PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.0.4
Tutor LMS – eLearning and online course solution v2.0.4
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 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.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_V2.php
tutor / classes Last commit date
Addons.php 4 years ago Admin.php 4 years ago Ajax.php 4 years ago Announcements.php 4 years ago Assets.php 4 years ago Backend_Page_Trait.php 4 years ago Course.php 4 years ago Course_Filter.php 4 years ago Course_List.php 4 years ago Course_Settings_Tabs.php 4 years ago Course_Widget.php 4 years ago Custom_Validation.php 5 years ago Dashboard.php 4 years ago FormHandler.php 4 years ago Frontend.php 4 years ago Gutenberg.php 4 years ago Input.php 4 years ago Instructor.php 4 years ago Instructors_List.php 4 years ago Lesson.php 4 years ago Options_V2.php 4 years ago Post_types.php 4 years ago Private_Course_Access.php 4 years ago Q_and_A.php 4 years ago Question_Answers_List.php 4 years ago Quiz.php 4 years ago Quiz_Attempts_List.php 4 years ago RestAPI.php 4 years ago Reviews.php 4 years ago Rewrite_Rules.php 4 years ago Shortcode.php 4 years ago Student.php 4 years ago Students_List.php 4 years ago Taxonomies.php 4 years ago Template.php 4 years ago Theme_Compatibility.php 5 years ago Tools.php 4 years ago Tools_V2.php 4 years ago Tutor.php 4 years ago TutorEDD.php 4 years ago Tutor_Base.php 5 years ago Tutor_List_Table.php 4 years ago Tutor_Setup.php 4 years ago Upgrader.php 4 years ago User.php 4 years ago Utils.php 4 years ago Video_Stream.php 4 years ago Withdraw.php 4 years ago Withdraw_Requests_List.php 4 years ago WooCommerce.php 4 years ago
Options_V2.php
1514 lines
1 <?php
2
3 /**
4 * Options for TutorLMS
5 *
6 * @since v.2.0
7 *
8 * @author Themeum
9 * @url https://themeum.com
10 *
11 * @package TutorLMS/Certificate
12 * @version 2.0
13 */
14
15 namespace Tutor;
16
17 use TUTOR\Admin;
18
19 if (!defined('ABSPATH')) {
20 exit;
21 }
22
23 class Options_V2
24 {
25 private $options;
26 private $setting_fields;
27
28 public function __construct($register_hook = true)
29 {
30 if (!$register_hook) {
31 return;
32 }
33
34 // Saving option.
35 add_action('wp_ajax_tutor_option_save', array($this, 'tutor_option_save'));
36 add_action('wp_ajax_tutor_option_default_save', array($this, 'tutor_option_default_save'));
37 add_action('wp_ajax_tutor_option_search', array($this, 'tutor_option_search'));
38 add_action('wp_ajax_tutor_export_settings', array($this, 'tutor_export_settings'));
39 add_action('wp_ajax_tutor_export_single_settings', array($this, 'tutor_export_single_settings'));
40 add_action('wp_ajax_tutor_delete_single_settings', array($this, 'tutor_delete_single_settings'));
41 add_action('wp_ajax_tutor_import_settings', array($this, 'tutor_import_settings'));
42 add_action('wp_ajax_tutor_apply_settings', array($this, 'tutor_apply_settings'));
43 add_action('wp_ajax_load_saved_data', array($this, 'load_saved_data'));
44 add_action('wp_ajax_reset_settings_data', array($this, 'reset_settings_data'));
45 }
46
47 private function get($key = null, $default = false)
48 {
49
50 if (!$this->options) {
51 // Get if already not prepared
52 $this->options = (array) maybe_unserialize(get_option('tutor_option'));
53 }
54
55 $option = $this->options;
56
57 if (empty($option) || !is_array($option)) {
58 return $default;
59 }
60
61 if (!$key) {
62 return $option;
63 }
64
65 if (array_key_exists($key, $option)) {
66 return apply_filters($key, $option[$key]);
67 }
68
69 // Access array value via dot notation, such as option->get('value.subvalue').
70 if (strpos($key, '.')) {
71 $option_key_array = explode('.', $key);
72 $new_option = $option;
73 foreach ($option_key_array as $dotKey) {
74 if (isset($new_option[$dotKey])) {
75 $new_option = $new_option[$dotKey];
76 } else {
77 return $default;
78 }
79 }
80
81 return apply_filters($key, $new_option);
82 }
83
84 return $default;
85 }
86
87 /**
88 * Function to get all fields for search tutor_option_search
89 *
90 * @return array
91 */
92 public function tutor_option_search()
93 {
94 tutor_utils()->checking_nonce();
95
96 $data_array = array();
97 foreach ($this->get_setting_fields() as $sections) {
98 if (is_array($sections) && !empty($sections)) {
99 foreach (tutils()->sanitize_recursively($sections) as $section) {
100 foreach ($section['blocks'] as $blocks) {
101 if (isset($blocks['fields']) && !empty($blocks['fields'])) {
102 foreach ($blocks['fields'] as $fields) {
103 $fields['section_label'] = isset($section['label']) ? $section['label'] : '';
104 $fields['section_slug'] = isset($section['slug']) ? $section['slug'] : '';
105 $fields['block_label'] = isset($blocks['label']) ? $blocks['label'] : '';
106 $data_array['fields'][] = $fields;
107 }
108 }
109 }
110 }
111 }
112 }
113
114 wp_send_json_success($data_array);
115 }
116
117 /**
118 * Export settings
119 */
120 public function tutor_export_settings()
121 {
122 $tutor_option = get_option('tutor_option');
123 // pr($tutor_option);die;
124 wp_send_json_success(maybe_unserialize($tutor_option));
125 }
126
127 /**
128 * Export single settings
129 */
130 public function tutor_export_single_settings()
131 {
132 $tutor_settings_log = get_option('tutor_settings_log');
133 $export_id = $this->get_request_data('export_id');
134 wp_send_json_success($tutor_settings_log[$export_id]);
135 }
136
137 /**
138 * Apply settings
139 */
140 public function tutor_apply_settings()
141 {
142 $tutor_settings_log = get_option('tutor_settings_log');
143 $apply_id = $this->get_request_data('apply_id');
144
145 update_option('tutor_option', $tutor_settings_log[$apply_id]['dataset']);
146
147 wp_send_json_success($tutor_settings_log[$apply_id]);
148 }
149
150 /**
151 * Delete single setting
152 */
153 public function tutor_delete_single_settings()
154 {
155 $tutor_settings_log = get_option('tutor_settings_log');
156 $delete_id = $this->get_request_data('delete_id');
157 unset($tutor_settings_log[$delete_id]);
158 update_option('tutor_settings_log', $tutor_settings_log);
159
160 wp_send_json_success($tutor_settings_log);
161 }
162
163 /**
164 * Get request data
165 *
166 * @return mixed
167 */
168 public function get_request_data($var)
169 {
170 return isset($_REQUEST[$var]) ? $_REQUEST[$var] : null;
171 }
172
173 /**
174 * tutor_default_settings
175 *
176 * @return JSON
177 */
178 public function tutor_default_settings()
179 {
180 $attr = $this->get_setting_fields();
181
182 foreach ($attr as $sections) {
183
184 foreach ($sections as $section) {
185 foreach ($section['blocks'] as $blocks) {
186 foreach ($blocks['fields'] as $field) {
187 if (isset($field['default'])) {
188 $attr_default[$field['key']] = $field['default'];
189 }
190 }
191 }
192 }
193 }
194
195 update_option('tutor_option', $attr_default);
196
197 wp_send_json_success($attr_default);
198 }
199
200 public function load_saved_data()
201 {
202 tutor_utils()->checking_nonce();
203 wp_send_json_success(get_option('tutor_settings_log'));
204 }
205
206 public function reset_settings_data()
207 {
208 tutor_utils()->checking_nonce();
209 $reset_fields = $return_fields = $return_fields_group = array();
210 $reset_page = isset($_POST['reset_page']) ? sanitize_key($_POST['reset_page']) : null;
211 $setting_data = $this->get_setting_fields()['option_fields'][$reset_page]['blocks'];
212
213 foreach ($setting_data as $blocks) {
214
215 $block_fields = isset($blocks['fields']) ? $blocks['fields'] : array();
216 foreach ($block_fields as $fields) {
217 $return_fields[] = $fields;
218 }
219
220 $block_fields_group = isset($blocks['fields_group']) ? $blocks['fields_group'] : array();
221 foreach ($block_fields_group as $fields) {
222 $return_fields_group[] = $fields;
223 }
224 }
225
226 $reset_fields = array_merge($return_fields, $return_fields_group);
227
228 wp_send_json_success($reset_fields);
229 }
230
231 public function tutor_import_settings()
232 {
233 tutor_utils()->checking_nonce();
234 // pr($_REQUEST);die;
235 $request = $this->get_request_data('tutor_options');
236 $request = json_decode(stripslashes($request), true);
237
238 $time = $this->get_request_data('time');
239 //pr(json_decode(stripslashes($request), true));die;
240
241 $save_import_data['datetime'] = (int) $time;
242 $save_import_data['history_date'] = gmdate('j M, Y, g:i a', $time);
243 $save_import_data['datatype'] = 'imported';
244 $save_import_data['dataset'] = $request['data'];
245 $import_data['tutor-imported-' . $time] = $save_import_data;
246
247 // update_option( 'tutor_settings_log', array() );
248 $get_option_data = get_option('tutor_settings_log');
249 if (empty($get_option_data)) {
250 $get_option_data = array();
251 }
252 if (!empty($get_option_data) && null !== $save_import_data['dataset']) {
253
254 $update_option = array_merge($import_data, $get_option_data);
255
256 $update_option = tutor_utils()->sanitize_recursively($update_option);
257
258 if (!empty($update_option)) {
259 update_option('tutor_settings_log', $update_option);
260 }
261
262 if (!empty($save_import_data)) {
263 update_option('tutor_option', $save_import_data['dataset']);
264 }
265
266 $get_final_data = get_option('tutor_settings_log');
267 } else {
268 if (!empty($import_data)) {
269
270 // echo count($import_data);
271
272
273 update_option('tutor_settings_log', $import_data);
274 }
275
276 if (!empty($save_import_data)) {
277 update_option('tutor_option', $save_import_data['dataset']);
278 }
279 $get_final_data = get_option('tutor_settings_log');
280 }
281
282 wp_send_json_success($get_final_data);
283 }
284
285
286 /**
287 * Function tutor_option_save
288 *
289 * @return JSON
290 */
291 public function tutor_option_save()
292 {
293 global $wpdb;
294 tutor_utils()->checking_nonce();
295
296 !current_user_can('manage_options') ? wp_send_json_error() : 0;
297
298 do_action('tutor_option_save_before');
299
300 $option = (array) tutor_utils()->array_get('tutor_option', $_POST, array());
301
302 $option = tutor_utils()->sanitize_recursively($option, array('email_footer_text'));
303
304 $old_dashboard_id = get_tutor_option('tutor_dashboard_page_id');
305 $dashboard_update_id = isset($option['tutor_dashboard_page_id']) && null !== $option['tutor_dashboard_page_id'] ? $option['tutor_dashboard_page_id'] : null;
306 $email_footer_text = json_encode(wp_unslash( $option['email_footer_text'] ));
307
308 $option['email_footer_text'] = !empty($option['email_footer_text']) ? $email_footer_text : '';
309
310 $option = apply_filters('tutor_option_input', $option);
311
312 // $request = $this->get_request_data( 'tutor_options' );
313 $time = strtotime('now') + (6 * 60 * 60);
314 $save_import_data['datetime'] = $time;
315 $save_import_data['history_date'] = date('j M, Y, g:i a', $time);
316 $save_import_data['datatype'] = 'saved';
317 $save_import_data['dataset'] = $option;
318 $import_data['tutor-saved-' . $time] = $save_import_data;
319 $update_option = array();
320 $get_option_data = get_option('tutor_settings_log', array());
321
322 if (!empty($get_option_data)) {
323 $update_option = array_merge($import_data, $get_option_data);
324 } else {
325 $update_option = array_merge($update_option, $import_data);
326 }
327
328 $update_option = array_slice($update_option, 0, 10);
329 // pr(array_keys($update_option));die;
330
331 update_option('tutor_settings_log', $update_option);
332 update_option('tutor_option', $option);
333 update_option('tutor_option_update_time', date('j M, Y, g:i a', $time));
334
335 do_action('tutor_option_save_after');
336
337 wp_send_json_success($option);
338 }
339
340 /**
341 * Function tutor_option_save
342 *
343 * @return JSON
344 */
345 public function tutor_option_default_save()
346 {
347 tutor_utils()->checking_nonce();
348
349 !current_user_can('manage_options') ? wp_send_json_error() : 0;
350 $attr = $this->get_setting_fields();
351 $tutor_default_option = get_option('tutor_default_option');
352 $tutor_saved_option = get_option('tutor_option');
353
354 // pr($tutor_saved_option);die;
355 foreach ($attr as $sections) {
356
357 foreach ($sections as $section) {
358 foreach ($section['blocks'] as $blocks) {
359 foreach ($blocks['fields'] as $field) {
360 if (isset($tutor_default_option[$field['key']])) {
361 $attr_default[$field['key']] = $tutor_saved_option[$field['key']];
362 } else {
363 if (null !== $field['key']) {
364 $attr_default[$field['key']] = $field['default'];
365 }
366 }
367 }
368 }
369 }
370 }
371
372 update_option('tutor_option', $attr_default);
373
374 wp_send_json_success($attr_default);
375 }
376
377 public function load_settings_page()
378 {
379 extract($this->get_setting_fields());
380
381 if (!$template_path) {
382 $template_path = tutor()->path . '/views/options/settings.php';
383 }
384
385 include $template_path;
386 }
387
388 public function get_setting_fields()
389 {
390
391 if ($this->setting_fields) {
392 // Return from property if already prepared
393 return $this->setting_fields;
394 }
395
396 $pages = tutor_utils()->get_pages();
397
398 $lesson_key = $this->get('lesson_permalink_base', 'lessons');
399 $lesson_url = site_url() . '/course/' . 'sample-course/<code>' . $lesson_key . '</code>/sample-lesson/';
400 $student_url = tutor_utils()->profile_url(0, false);
401
402 $methods_array = array();
403 $withdrawl_methods = apply_filters('tutor_withdrawal_methods_all', array());
404
405 foreach ($withdrawl_methods as $key => $method) {
406 $methods_array[$key] = $method['method_name'];
407 }
408 $course_archive_page_id = get_page_by_title('Courses');
409 $attr = array(
410 'general' => array(
411 'label' => __('General', 'tutor'),
412 'slug' => 'general',
413 'desc' => __('General Settings', 'tutor'),
414 'template' => 'basic',
415 'icon' => 'tutor-icon-earth',
416 'blocks' => array(
417 array(
418 'label' => false,
419 'block_type' => 'uniform',
420 'slug' => 'general-page',
421 'fields' => array(
422 array(
423 'key' => 'tutor_dashboard_page_id',
424 'type' => 'select',
425 'label' => __('Dashboard Page', 'tutor'),
426 'default' => '0',
427 'options' => $pages,
428 'desc' => __('This page will be used for student and instructor dashboard', 'tutor'),
429 ),
430 ),
431 ),
432 array(
433 'label' => __('Others', 'tutor'),
434 'slug' => 'others',
435 'block_type' => 'isolate',
436 'fields' => array(
437 array(
438 'key' => 'enable_course_marketplace',
439 'type' => 'toggle_switch',
440 'label' => __('Enable Marketplace', 'tutor'),
441 'label_title' => __('', 'tutor'),
442 'default' => 'off',
443 'desc' => __('Allow multiple instructors to upload their courses.', 'tutor'),
444 ),
445 array(
446 'key' => 'pagination_per_page',
447 'type' => 'number',
448 'label' => __('Pagination', 'tutor'),
449 'default' => '20',
450 'desc' => __('Set the number of rows to be displayed per page', 'tutor'),
451 ),
452 ),
453 ),
454 array(
455 'label' => __('Instructor', 'tutor'),
456 'slug' => 'instructor',
457 'block_type' => 'uniform',
458 'fields' => array(
459 array(
460 'key' => 'instructor_can_publish_course',
461 'type' => 'toggle_switch',
462 'label' => __('Allow Instructors To Publish Courses', 'tutor'),
463 'label_title' => __('', 'tutor'),
464 'default' => 'off',
465 'desc' => __('Enable instructors to publish the course directly. If disabled, admins will be able to review course content before publishing.', 'tutor'),
466 ),
467 array(
468 'key' => 'enable_become_instructor_btn',
469 'type' => 'toggle_switch',
470 'label' => __('Become an Instructor Button', 'tutor'),
471 'label_title' => __('', 'tutor'),
472 'default' => 'off',
473 'desc' => __('Enable the option to display this button on the student dashboard.', 'tutor'),
474 ),
475 ),
476 ),
477 ),
478 ),
479 'course' => array(
480 'label' => __('Course', 'tutor'),
481 'slug' => 'course',
482 'desc' => __('Course Settings', 'tutor'),
483 'template' => 'basic',
484 'icon' => 'tutor-icon-book-open',
485 'blocks' => array(
486 'block_course' => array(
487 'label' => '',
488 'slug' => 'course',
489 'block_type' => 'uniform',
490 'fields' => array(
491 /**
492 * TODO
493 *
494 * This option will be implemented on future
495 * release
496 *
497 * @since v2.0.0
498 */
499 // array(
500 // 'key' => 'student_must_login_to_view_course',
501 // 'type' => 'toggle_switch',
502 // 'label' => __( 'Course Visibility', 'tutor' ),
503 // 'label_title' => __( 'Logged Only', 'tutor' ),
504 // 'default' => 'off',
505 // 'desc' => __( 'Students must be logged in to view course', 'tutor' ),
506 // ),
507 array(
508 'key' => 'course_content_access_for_ia',
509 'type' => 'toggle_switch',
510 'label' => __('Course Content Access', 'tutor'),
511 'default' => 'off',
512 'label_title' => __('', 'tutor'),
513 'desc' => __('Allow instructors and admins to view the course content without enrolling', 'tutor'),
514 ),
515 array(
516 'key' => 'course_content_summary',
517 'type' => 'toggle_switch',
518 'label' => __( 'Content Summary', 'tutor' ),
519 'default' => 'on',
520 'desc' => __( 'Enabling this feature will show a course content summary on the Course Details page.', 'tutor' ),
521 ),
522 array(
523 'key' => 'wc_automatic_order_complete_redirect_to_courses',
524 'type' => 'toggle_switch',
525 'label' => __('Auto redirect to courses', 'tutor'),
526 'default' => 'off',
527 'label_title' => __('', 'tutor'),
528 'desc' => __('When a user\'s WooCommerce order is auto-completed, they will be redirected to enrolled courses', 'tutor'),
529 ),
530 array(
531 'key' => 'enable_spotlight_mode',
532 'type' => 'toggle_switch',
533 'label' => __('Spotlight mode', 'tutor'),
534 'default' => 'off',
535 'label_title' => __('', 'tutor'),
536 'desc' => __('This will hide the header and the footer and enable spotlight (full screen) mode when students view lessons.', 'tutor'),
537 ),
538 array(
539 'key' => 'course_completion_process',
540 'type' => 'radio_vertical',
541 'label' => __('Course Completion Process', 'tutor'),
542 'default' => 'flexible',
543 'select_options' => false,
544 'options' => array(
545 'flexible' => __('Students can complete courses anytime in the Flexible mode', 'tutor'),
546 'strict' => __('Students have to complete, pass all the lessons and quizzes (if any) to mark a course as complete.', 'tutor'),
547 ),
548 'desc' => __('Choose when a user can click on the <strong>“Complete Course”</strong> button', 'tutor'),
549 ),
550 array(
551 'key' => 'course_retake_feature',
552 'type' => 'toggle_switch',
553 'label' => __('Course Retake', 'tutor'),
554 'default' => 'off',
555 'label_title' => __('', 'tutor'),
556 'desc' => __('Enabling this feature will allow students to reset course progress and start over.', 'tutor'),
557 ),
558 ),
559 ),
560 array(
561 'label' => __('Lesson', 'tutor'),
562 'slug' => 'lesson',
563 'block_type' => 'uniform',
564 'fields' => array(
565 array(
566 'key' => 'enable_lesson_classic_editor',
567 'type' => 'toggle_switch',
568 'label' => __('WP Editor for Lesson', 'tutor'),
569 'label_title' => __('', 'tutor'),
570 'default' => 'off',
571 'desc' => __('Enable classic editor to edit lesson.', 'tutor'),
572 ),
573 array(
574 'key' => 'autoload_next_course_content',
575 'type' => 'toggle_switch',
576 'label' => __('Automatically Load Next Course Content.', 'tutor'),
577 'label_title' => __('', 'tutor'),
578 'default' => 'off',
579 'desc' => __('Enable this feature to automatically load the next course content after the current one is finished.', 'tutor'),
580 ),
581 array(
582 'key' => 'enable_comment_for_lesson',
583 'type' => 'toggle_switch',
584 'label' => __('Enable Lesson Comment', 'tutor'),
585 'label_title' => __('', 'tutor'),
586 'default' => 'off',
587 'desc' => __('Enable this feature to allow students to post comments on lessons.', 'tutor'),
588 ),
589 ),
590 ),
591 'block_quiz' => array(
592 'label' => __('Quiz', 'tutor'),
593 'slug' => 'quiz',
594 'block_type' => 'uniform',
595 'fields' => array(
596 array(
597 'key' => 'quiz_when_time_expires',
598 'type' => 'radio_vertical',
599 'label' => __('When time expires', 'tutor'),
600 'default' => 'auto_abandon',
601 'select_options' => false,
602 'options' => array(
603 'auto_submit' => __('The current quiz answers are submitted automatically.', 'tutor'),
604 // 'grace_period' => __( 'The current quiz answers are submitted by students.', 'tutor' ),
605 'auto_abandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'),
606 ),
607 'desc' => __('Choose which action to follow when the quiz time expires.', 'tutor'),
608 ),
609 array(
610 'key' => 'quiz_attempts_allowed',
611 'type' => 'number',
612 'label' => __('Quiz Attempts allowed', 'tutor'),
613 'default' => '10',
614 'desc' => __('The highest number of attempts students are allowed to take for a quiz. 0 means unlimited attempts.', 'tutor'),
615 ),
616 array(
617 'key' => 'quiz_previous_button_enabled',
618 'type' => 'toggle_switch',
619 'label' => __('Show Quiz Previous Button', 'tutor'),
620 'default' => 'on',
621 'desc' => __('Choose whether to show or hide the previous button for each question.', 'tutor'),
622 ),
623 array(
624 'key' => 'quiz_grade_method',
625 'type' => 'radio_horizontal_full',
626 'label' => __('Final Grade Calculation', 'tutor'),
627 'desc' => __('When multiple attempts are allowed, select which method should be used to calculate a student\'s final grade for the quiz.', 'tutor'),
628 'default' => 'highest_grade',
629 'options' => array(
630 'highest_grade' => __('Highest Grade', 'tutor'),
631 'average_grade' => __('Average Grade', 'tutor'),
632 'first_attempt' => __('First Attempt', 'tutor'),
633 'last_attempt' => __('Last Attempt', 'tutor'),
634 ),
635 ),
636 ),
637 ),
638 array(
639 'label' => __('Video', 'tutor'),
640 'slug' => 'video',
641 'block_type' => 'uniform',
642 'fields' => array(
643 array(
644 'key' => 'supported_video_sources',
645 'type' => 'checkbox_vertical',
646 'default' => array('youtube', 'vimeo'),
647 'label' => __('Preferred Video Source', 'tutor'),
648 'label_title' => __('Preferred Video Source', 'tutor'),
649 'options' => tutor_utils()->get_video_sources(true),
650 'desc' => __('Choose video sources you\'d like to support.', 'tutor'),
651 ),
652 ),
653 ),
654 ),
655 ),
656 'monetization' => array(
657 'label' => __('Monetization', 'tutor'),
658 'slug' => 'monetization',
659 'desc' => __('Monitization Settings', 'tutor'),
660 'template' => 'basic',
661 'icon' => 'tutor-icon-badge-discount',
662 'blocks' => array(
663 'block_options' => array(
664 'label' => __('Options', 'tutor'),
665 'slug' => 'options',
666 'block_type' => 'uniform',
667 'fields' => array(
668 array(
669 'key' => 'monetize_by',
670 'type' => 'select',
671 'label' => __('Select eCommerce Engine', 'tutor'),
672 'select_options' => true,
673 'options' => apply_filters(
674 'tutor_monetization_options',
675 array(
676 'free' => __('Disable Monetization', 'tutor'),
677 )
678 ),
679 'default' => 'free',
680 'desc' => __('Select a monetization option to generate revenue by selling courses. Supports: WooCommerce, Easy Digital Downloads, Paid Memberships Pro', 'tutor'),
681 ),
682 array(
683 'key' => 'enable_revenue_sharing',
684 'type' => 'toggle_switch',
685 'label' => __('Enable Revenue Sharing', 'tutor'),
686 'label_title' => __('', 'tutor'),
687 'default' => 'off',
688 'desc' => __('Allow revenue generated from selling courses to be shared with course creators.', 'tutor'),
689 ),
690 array(
691 'key' => 'sharing_percentage',
692 'type' => 'double_input',
693 'label' => __('Sharing Percentage', 'tutor'),
694 'label_title' => __('', 'tutor'),
695 'default' => '',
696 'fields' => array(
697 'earning_instructor_commission' => array(
698 'id' => 'revenue-instructor',
699 'type' => 'ratio',
700 'title' => 'Instructor Takes',
701 'default' => 20,
702 ),
703 'earning_admin_commission' => array(
704 'id' => 'revenue-admin',
705 'type' => 'ratio',
706 'title' => 'Admin Takes',
707 'default' => 80,
708 ),
709 ),
710 'desc' => __('Set how the sales revenue will be shared among admins and instructors.', 'tutor'),
711 ),
712 array(
713 'key' => 'statement_show_per_page',
714 'type' => 'number',
715 'label' => __('Show Statement Per Page', 'tutor'),
716 'default' => '20',
717
718 'desc' => __('Define the number of statements to show.', 'tutor'),
719 ),
720 ),
721 ),
722 array(
723 'label' => __('Fees', 'tutor'),
724 'slug' => 'fees',
725 'block_type' => 'uniform',
726 'fields' => array(
727 array(
728 'key' => 'enable_fees_deducting',
729 'type' => 'toggle_switch',
730 'label' => __('Deduct Fees', 'tutor'),
731 'label_title' => __('', 'tutor'),
732 'default' => 'off',
733 'desc' => __('Fees are charged from the entire sales amount. The remaining amount will be divided among admin and instructors.', 'tutor'),
734 ),
735 array(
736 'key' => 'fees_name',
737 'type' => 'textarea',
738 'label' => __('Fee Description', 'tutor'),
739 'placeholder' => __('Fee Description', 'tutor'),
740 'desc' => __('Set a description for the fee that you are deducting. Make sure to give a reasonable explanation to maintain transparency with your site’s instructors', 'tutor'),
741 'default' => 'free',
742 ),
743 array(
744 'key' => 'fee_amount_type',
745 'type' => 'group_fields',
746 'label' => __('Fee Amount & Type', 'tutor'),
747 'desc' => __('Select the fee type and add fee amount/percentage', 'tutor'),
748 'group_fields' => array(
749 'fees_type' => array(
750 'type' => 'select',
751 'default' => 'fixed',
752 'options' => array(
753 'percent' => __('Percent', 'tutor'),
754 'fixed' => __('Fixed', 'tutor'),
755 ),
756 ),
757 'fees_amount' => array(
758 'type' => 'number',
759 'default' => '0',
760 ),
761 ),
762 ),
763 ),
764 ),
765 array(
766 'label' => __('Withdraw', 'tutor'),
767 'slug' => 'withdraw',
768 'block_type' => 'uniform',
769 'fields' => array(
770 array(
771 'key' => 'min_withdraw_amount',
772 'type' => 'number',
773 'label' => __('Minimum Withdrawal Amount', 'tutor'),
774 'default' => '80',
775 'desc' => __('Instructors should earn equal or above this amount to make a withdraw request.', 'tutor'),
776 ),
777 array(
778 'key' => 'minimum_days_for_balance_to_be_available',
779 'type' => 'number',
780 'label' => __('Minimum Days Before Balance is Available', 'tutor'),
781 'default' => '7',
782 'desc' => __('Any income has to remain this many days in the platform before it is available for withdrawal.', 'tutor'),
783 ),
784 array(
785 'key' => 'tutor_withdrawal_methods',
786 'type' => 'checkbox_horizontal',
787 'label' => __('Enable Withdraw Method', 'tutor'),
788 'default' => array('bank_transfer_withdraw'),
789 'options' => $methods_array,
790 'desc' => __('Set how you would like to withdraw money from the website.', 'tutor'),
791 ),
792 array(
793 'key' => 'tutor_bank_transfer_withdraw_instruction',
794 'type' => 'textarea',
795 'label' => __('Bank Instructions', 'tutor'),
796 'default' => __('Write the up to date bank informations of your instructor here.', 'tutor'),
797 'desc' => __('Write bank instructions for the instructors to conduct withdrawals.', 'tutor'),
798 ),
799 ),
800 ),
801 ),
802 ),
803 'design' => array(
804 'label' => __('Design', 'tutor'),
805 'slug' => 'design',
806 'desc' => __('Design Settings', 'tutor'),
807 'template' => 'design',
808 'icon' => 'tutor-icon-color-palette',
809 'blocks' => array(
810 'block_course' => array(
811 'label' => __('Course', 'tutor'),
812 'slug' => 'course',
813 'block_type' => 'uniform',
814 'fields' => array(
815 array(
816 'key' => 'courses_col_per_row',
817 'type' => 'radio_horizontal',
818 'label' => __('Column Per Row', 'tutor'),
819 'default' => '3',
820 'options' => array(
821 '1' => 'One',
822 '2' => 'Two',
823 '3' => 'Three',
824 '4' => 'Four',
825 ),
826 'desc' => __('Define how many columns you want to use to display courses.', 'tutor'),
827 ),
828 array(
829 'key' => 'course_archive_filter',
830 'type' => 'toggle_switch',
831 'label' => __('Course Filter', 'tutor'),
832 'label_title' => __('', 'tutor'),
833 'default' => 'off',
834 'desc' => __('Show sorting and filtering options on course archive page', 'tutor'),
835 ),
836 array(
837 'key' => 'courses_per_page',
838 'type' => 'number',
839 'label' => __('Courses Per Page', 'tutor'),
840 'default' => '12',
841 'desc' => __('Set the number of courses to display per page on the Course List page.', 'tutor'),
842 ),
843 array(
844 'key' => 'supported_course_filters',
845 'type' => 'checkbox_horizontal',
846 'label' => __('Preferred Course Filters', 'tutor'),
847 'default' => array('search', 'category'),
848 'options' => array(
849 'search' => __('Keyword Search', 'tutor'),
850 'category' => __('Category', 'tutor'),
851 'tag' => __('Tag', 'tutor'),
852 'difficulty_level' => __('Difficulty Level', 'tutor'),
853 'price_type' => __('Price Type', 'tutor'),
854 ),
855 'desc' => __('Choose preferred filter options you\'d like to show on the course archive page.', 'tutor'),
856 ),
857 ),
858 ),
859 'layout' => array(
860 'label' => __('Layout', 'tutor'),
861 'slug' => 'layout',
862 'block_type' => 'uniform',
863 'fields' => array(
864 array(
865 'key' => 'instructor_list_layout',
866 'type' => 'group_radio',
867 'label' => __('Instructor List Layout', 'tutor'),
868 'desc' => __('Choose a layout for the list of instructors inside a course page. You can change this at any time.', 'tutor'),
869 'default' => 'portrait',
870 'group_options' => array(
871 'vertical' => array(
872 'default' => array(
873 'title' => 'Portrait',
874 'image' => 'instructor-layout/instructor-portrait.svg',
875 ),
876 'cover' => array(
877 'title' => 'Cover',
878 'image' => 'instructor-layout/instructor-cover.svg',
879 ),
880 'minimal' => array(
881 'title' => 'Minimal',
882 'image' => 'instructor-layout/instructor-minimal.svg',
883 ),
884 ),
885 'horizontal' => array(
886 'portrait-horizontal' => array(
887 'title' => 'Portrait Horizontal',
888 'image' => 'instructor-layout/instructor-horizontal-portrait.svg',
889 ),
890 'minimal-horizontal' => array(
891 'title' => 'Minimal Horizontal',
892 'image' => 'instructor-layout/instructor-horizontal-minimal.svg',
893 ),
894 ),
895 ),
896 ),
897 array(
898 'key' => 'public_profile_layout',
899 'type' => 'group_radio_full_3',
900 'label' => __('Instructor Public Profile Layout', 'tutor'),
901 'desc' => __('Choose a layout design for a instructor’s public profile', 'tutor'),
902 'default' => 'pp-rectangle',
903 'group_options' => array(
904 'private' => array(
905 'title' => 'Private',
906 'image' => 'profile-layout/profile-private.svg',
907 ),
908 'pp-circle' => array(
909 'title' => 'Modern',
910 'image' => 'profile-layout/profile-modern.svg',
911 ),
912 'no-cp' => array(
913 'title' => 'Minimal',
914 'image' => 'profile-layout/profile-minimal.svg',
915 ),
916 'pp-rectangle' => array(
917 'title' => 'Classic',
918 'image' => 'profile-layout/profile-classic.svg',
919 ),
920 ),
921 ),
922 array(
923 'key' => 'student_public_profile_layout',
924 'type' => 'group_radio_full_3',
925 'label' => __('Student Public Profile Layout', 'tutor'),
926 'desc' => __('Choose a layout design for a student’s public profile', 'tutor'),
927 'default' => 'pp-rectangle',
928 'group_options' => array(
929 'private' => array(
930 'title' => 'Private',
931 'image' => 'profile-layout/profile-private.svg',
932 ),
933 'pp-circle' => array(
934 'title' => 'Modern',
935 'image' => 'profile-layout/profile-modern.svg',
936 ),
937 'no-cp' => array(
938 'title' => 'Minimal',
939 'image' => 'profile-layout/profile-minimal.svg',
940 ),
941 'pp-rectangle' => array(
942 'title' => 'Classic',
943 'image' => 'profile-layout/profile-classic.svg',
944 ),
945 ),
946 ),
947 ),
948 ),
949 'course-details' => array(
950 'label' => __('Course Details', 'tutor'),
951 'slug' => 'course-details',
952 'block_type' => 'isolate',
953 'fields' => array(
954 array(
955 'key' => 'course_details_adjustments',
956 'type' => 'checkgroup',
957 'label' => __('Course Details Adjustments', 'tutor'),
958 'group_options' => array(
959 array(
960 'key' => 'display_course_instructors',
961 'type' => 'toggle_single',
962 'label' => __('Instructor Info', 'tutor'),
963 'default' => 'on',
964 'desc' => __('Toggle to show instructor info', 'tutor'),
965 ),
966 array(
967 'key' => 'enable_q_and_a_on_course',
968 'type' => 'toggle_single',
969 'label' => __('Q&A', 'tutor'),
970 'default' => 'on',
971 'desc' => __('Enable to add a Q&A section', 'tutor'),
972 ),
973 array(
974 'key' => 'enable_course_author',
975 'type' => 'toggle_single',
976 'label' => __('Author', 'tutor'),
977 'label_title' => __('Enable', 'tutor'),
978 'default' => 'off',
979 'desc' => __('Enable to remove course author name', 'tutor'),
980 ),
981 array(
982 'key' => 'enable_course_level',
983 'type' => 'toggle_single',
984 'label' => __('Level', 'tutor'),
985 'label_title' => __('Enable', 'tutor'),
986 'default' => 'on',
987 'desc' => __('Toggle to remove course level', 'tutor'),
988 ),
989 array(
990 'key' => 'enable_course_share',
991 'type' => 'toggle_single',
992 'label' => __('Social Share', 'tutor'),
993 'label_title' => __('Enable', 'tutor'),
994 'default' => 'on',
995 'desc' => __('Toggle to enable course social share', 'tutor'),
996 ),
997 array(
998 'key' => 'enable_course_duration',
999 'type' => 'toggle_single',
1000 'label' => __('Duration', 'tutor'),
1001 'label_title' => __('Disable', 'tutor'),
1002 'default' => 'on',
1003 'desc' => __('Enable to show course duration', 'tutor'),
1004 ),
1005 array(
1006 'key' => 'enable_course_total_enrolled',
1007 'type' => 'toggle_single',
1008 'label' => __('Total Enrolled', 'tutor'),
1009 'label_title' => __('Enable', 'tutor'),
1010 'default' => 'on',
1011 'desc' => __('Enable to show total enrolled students', 'tutor'),
1012 ),
1013 array(
1014 'key' => 'enable_course_update_date',
1015 'type' => 'toggle_single',
1016 'label' => __('Update Date', 'tutor'),
1017 'label_title' => __('Enable', 'tutor'),
1018 'default' => 'on',
1019 'desc' => __('Enable to show course update information', 'tutor'),
1020 ),
1021 array(
1022 'key' => 'enable_course_progress_bar',
1023 'type' => 'toggle_single',
1024 'label' => __('Progress Bar', 'tutor'),
1025 'label_title' => __('Enable', 'tutor'),
1026 'default' => 'on',
1027 'desc' => __('Enable to show course progress for Students', 'tutor'),
1028 ),
1029 array(
1030 'key' => 'enable_course_material',
1031 'type' => 'toggle_single',
1032 'label' => __('Material', 'tutor'),
1033 'label_title' => __('Enable', 'tutor'),
1034 'default' => 'on',
1035 'desc' => __('Enable to show course materials', 'tutor'),
1036 ),
1037 array(
1038 'key' => 'enable_course_about',
1039 'type' => 'toggle_single',
1040 'label' => __('About', 'tutor'),
1041 'label_title' => __('Enable', 'tutor'),
1042 'default' => 'on',
1043 'desc' => __('Enable to show course about section', 'tutor'),
1044 ),
1045 array(
1046 'key' => 'enable_course_description',
1047 'type' => 'toggle_single',
1048 'label' => __('Description', 'tutor'),
1049 'label_title' => __('Enable', 'tutor'),
1050 'default' => 'on',
1051 'desc' => __('Enable to show course description', 'tutor'),
1052 ),
1053 array(
1054 'key' => 'enable_course_benefits',
1055 'type' => 'toggle_single',
1056 'label' => __('Benefits', 'tutor'),
1057 'label_title' => __('Enable', 'tutor'),
1058 'default' => 'on',
1059 'desc' => __('Enable to show course benefits section', 'tutor'),
1060 ),
1061 array(
1062 'key' => 'enable_course_requirements',
1063 'type' => 'toggle_single',
1064 'label' => __('Requirements', 'tutor'),
1065 'label_title' => __('Enable', 'tutor'),
1066 'default' => 'on',
1067 'desc' => __('Enable to show courses requirements setion', 'tutor'),
1068 ),
1069 array(
1070 'key' => 'enable_course_target_audience',
1071 'type' => 'toggle_single',
1072 'label' => __('Target Audience', 'tutor'),
1073 'label_title' => __('Disable', 'tutor'),
1074 'default' => 'on',
1075 'desc' => __('Enable to show course target audience section', 'tutor'),
1076 ),
1077 array(
1078 'key' => 'enable_course_announcements',
1079 'type' => 'toggle_single',
1080 'label' => __('Announcements', 'tutor'),
1081 'label_title' => __('Enable', 'tutor'),
1082 'default' => 'on',
1083 'desc' => __('Enable to show course announcements section', 'tutor'),
1084 ),
1085 array(
1086 'key' => 'enable_course_review',
1087 'type' => 'toggle_single',
1088 'label' => __('Review', 'tutor'),
1089 'label_title' => __('Enable', 'tutor'),
1090 'default' => 'on',
1091 'desc' => __('Enable to show course review section', 'tutor'),
1092 ),
1093 ),
1094 'desc' => __('Content Needed Here...', 'tutor'),
1095 ),
1096 ),
1097 ),
1098 'colors' => array(
1099 'label' => __('Colors', 'tutor'),
1100 'slug' => 'colors',
1101 'block_type' => 'color_picker',
1102 'fields_group' => array(
1103 array(
1104 'key' => 'color_preset_type',
1105 'type' => 'color_preset',
1106 'label' => __('Preset Colors', 'tutor'),
1107 'desc' => __('These colors will be used throughout your website. Choose between these presets or create your own custom palette.', 'tutor'),
1108 'default' => 'default',
1109 'fields' => array(
1110 /* First 4 preset_name should be same as color_fields */
1111 array(
1112 'key' => 'default',
1113 'label' => 'Default',
1114 'colors' => array(
1115 array(
1116 'slug' => 'tutor_primary_color',
1117 'preset_name' => 'primary',
1118 'value' => '#3E64DE',
1119 ),
1120 array(
1121 'slug' => 'tutor_primary_hover_color',
1122 'preset_name' => 'hover',
1123 'value' => '#395BCA',
1124 ),
1125 array(
1126 'slug' => 'tutor_text_color',
1127 'preset_name' => 'text',
1128 'value' => '#212327',
1129 ),
1130 array(
1131 'slug' => 'tutor_gray_color',
1132 'preset_name' => 'gray',
1133 'value' => '#E3E5EB',
1134 ),
1135 array(
1136 'slug' => 'tutor_border_color',
1137 'preset_name' => 'border',
1138 'value' => '#CDCFD5',
1139 ),
1140 ),
1141 ),
1142 array(
1143 'key' => 'landscape',
1144 'label' => 'Landscape',
1145 'colors' => array(
1146 array(
1147 'slug' => 'tutor_primary_color',
1148 'preset_name' => 'primary',
1149 'value' => '#239371',
1150 ),
1151 array(
1152 'slug' => 'tutor_primary_hover_color',
1153 'preset_name' => 'hover',
1154 'value' => '#117D5D',
1155 ),
1156 array(
1157 'slug' => 'tutor_text_color',
1158 'preset_name' => 'text',
1159 'value' => '#212327',
1160 ),
1161 array(
1162 'slug' => 'tutor_gray_color',
1163 'preset_name' => 'gray',
1164 'value' => '#E3E5EB',
1165 ),
1166 array(
1167 'slug' => 'tutor_border_color',
1168 'preset_name' => 'border',
1169 'value' => '#CDCFD5',
1170 ),
1171 ),
1172 ),
1173 array(
1174 'key' => 'ocean',
1175 'label' => 'Ocean',
1176 'colors' => array(
1177 array(
1178 'slug' => 'tutor_primary_color',
1179 'preset_name' => 'primary',
1180 'value' => '#5A18C2',
1181 ),
1182 array(
1183 'slug' => 'tutor_primary_hover_color',
1184 'preset_name' => 'hover',
1185 'value' => '#3F02A0',
1186 ),
1187 array(
1188 'slug' => 'tutor_text_color',
1189 'preset_name' => 'text',
1190 'value' => '#212327',
1191 ),
1192 array(
1193 'slug' => 'tutor_gray_color',
1194 'preset_name' => 'gray',
1195 'value' => '#E3E5EB',
1196 ),
1197 array(
1198 'slug' => 'tutor_border_color',
1199 'preset_name' => 'border',
1200 'value' => '#CDCFD5',
1201 ),
1202 ),
1203 ),
1204 array(
1205 'key' => 'custom',
1206 'label' => 'Custom',
1207 'colors' => array(
1208 array(
1209 'slug' => 'tutor_primary_color',
1210 'preset_name' => 'primary',
1211 'value' => '#3E64DE',
1212 ),
1213 array(
1214 'slug' => 'tutor_primary_hover_color',
1215 'preset_name' => 'hover',
1216 'value' => '#28408E',
1217 ),
1218 array(
1219 'slug' => 'tutor_text_color',
1220 'preset_name' => 'text',
1221 'value' => '#1A1B1E',
1222 ),
1223 array(
1224 'slug' => 'tutor_gray_color',
1225 'preset_name' => 'gray',
1226 'value' => '#E3E5EB',
1227 ),
1228 ),
1229 ),
1230 ),
1231 ),
1232 array(
1233 'key' => 'tutor_color_presets',
1234 'type' => 'color_fields',
1235 'label' => __('Preset Colors', 'tutor'),
1236 'fields' => array(
1237 array(
1238 'key' => 'tutor_primary_color',
1239 'type' => 'color_field',
1240 'preset_name' => 'primary',
1241 'preset_exist' => true,
1242 'label' => __('Primary Color', 'tutor'),
1243 'default' => '#3E64DE',
1244 'desc' => __('Choose a primary color', 'tutor'),
1245 ),
1246 array(
1247 'key' => 'tutor_primary_hover_color',
1248 'type' => 'color_field',
1249 'preset_name' => 'hover',
1250 'preset_exist' => true,
1251 'label' => __('Primary Hover Color', 'tutor'),
1252 'default' => '#395BCA',
1253 'desc' => __('Choose a primary hover color', 'tutor'),
1254 ),
1255 array(
1256 'key' => 'tutor_text_color',
1257 'type' => 'color_field',
1258 'preset_name' => 'text',
1259 'preset_exist' => true,
1260 'label' => __('Text Color', 'tutor'),
1261 'default' => '#212327',
1262 'desc' => __('Choose a text color for your website', 'tutor'),
1263 ),
1264 array(
1265 'key' => 'tutor_gray_color',
1266 'type' => 'color_field',
1267 'preset_name' => 'gray',
1268 'preset_exist' => false,
1269 'label' => __('Gray', 'tutor'),
1270 'default' => '#E3E5EB',
1271 'desc' => __('Choose a color for elements like table, card etc', 'tutor'),
1272 ),
1273 array(
1274 'key' => 'tutor_border_color',
1275 'type' => 'color_field',
1276 'preset_name' => 'border',
1277 'preset_exist' => false,
1278 'label' => __('Border', 'tutor'),
1279 'default' => '#CDCFD5',
1280 'desc' => __('Choose a border color for your website', 'tutor'),
1281 ),
1282 ),
1283 ),
1284 ),
1285 ),
1286 'video_player' => array(
1287 'label' => __('Video Player', 'tutor'),
1288 'slug' => 'video_player',
1289 'block_type' => 'uniform',
1290 'fields' => array(
1291 array(
1292 'key' => 'disable_default_player_youtube',
1293 'type' => 'toggle_switch',
1294 'label' => __('Use Tutor Player for YouTube', 'tutor'),
1295 'label_title' => __('', 'tutor'),
1296 'default' => 'off',
1297 'desc' => __('Enable this option to use Tutor LMS video player for YouTube.', 'tutor'),
1298 ),
1299 array(
1300 'key' => 'disable_default_player_vimeo',
1301 'type' => 'toggle_switch',
1302 'label' => __('Use Tutor Player for Vimeo', 'tutor'),
1303 'label_title' => __('', 'tutor'),
1304 'default' => 'off',
1305 'desc' => __('Enable this option to use Tutor LMS video player for Vimeo.', 'tutor'),
1306 ),
1307 ),
1308 ),
1309 ),
1310 ),
1311 'advanced' => array(
1312 'label' => __('Advanced', 'tutor'),
1313 'slug' => 'advanced',
1314 'desc' => __('Advanced Settings', 'tutor'),
1315 'template' => 'basic',
1316 'icon' => 'tutor-icon-filter',
1317 'blocks' => array(
1318 array(
1319 'label' => __('Course', 'tutor'),
1320 'slug' => 'options',
1321 'block_type' => 'uniform',
1322 'fields' => array(
1323 array(
1324 'key' => 'enable_gutenberg_course_edit',
1325 'type' => 'toggle_switch',
1326 'label' => __('Gutenberg Editor', 'tutor'),
1327 'default' => 'off',
1328 'desc' => __('Enable this to create courses using the Gutenberg Editor.', 'tutor'),
1329 ),
1330 array(
1331 'key' => 'hide_course_from_shop_page',
1332 'type' => 'toggle_switch',
1333 'label' => __('Hide Course Products on Shop Page', 'tutor'),
1334 'default' => 'off',
1335 'desc' => __('Enable to hide course products on shop page.', 'tutor'),
1336 ),
1337 array(
1338 'key' => 'course_archive_page',
1339 'type' => 'select',
1340 'label' => __('Course Archive Page', 'tutor'),
1341 'default' => $course_archive_page_id->ID ?? '0',
1342 'options' => $pages,
1343 'desc' => __('This page will be used to list all the published courses.', 'tutor'),
1344 ),
1345 array(
1346 'key' => 'instructor_register_page',
1347 'type' => 'select',
1348 'label' => __('Instructor Registration Page', 'tutor'),
1349 'default' => '0',
1350 'options' => $pages,
1351 'desc' => __('Choose the page for instructor registration.', 'tutor'),
1352 ),
1353 array(
1354 'key' => 'student_register_page',
1355 'type' => 'select',
1356 'label' => __('Student Registration Page', 'tutor'),
1357 'default' => '0',
1358 'options' => $pages,
1359 'desc' => __('Choose the page for student registration.', 'tutor'),
1360 ),
1361 array(
1362 'key' => 'lesson_permalink_base',
1363 'type' => 'text',
1364 'label' => __('Lesson Permalink Base', 'tutor'),
1365 'default' => 'lessons',
1366 'desc' => $lesson_url,
1367 ),
1368 array(
1369 'key' => 'lesson_video_duration_youtube_api_key',
1370 'type' => 'text',
1371 'label' => __('Youtube API Key', 'tutor'),
1372 'default' => '',
1373 'desc' => __('Insert the YouTube API key to host live videos using YouTube.', 'tutor'),
1374 ),
1375 ),
1376 ),
1377 array(
1378 'label' => __('Options', 'tutor'),
1379 'slug' => 'options',
1380 'block_type' => 'uniform',
1381 'fields' => array(
1382 array(
1383 'key' => 'enable_profile_completion',
1384 'type' => 'toggle_switch',
1385 'label' => __('Profile Completion', 'tutor'),
1386 'label_title' => __('', 'tutor'),
1387 'default' => 'off',
1388 'desc' => __('Enabling this feature will show a notification bar to students and instructors to complete their profile information', 'tutor'),
1389 ),
1390 array(
1391 'key' => 'enable_tutor_native_login',
1392 'type' => 'toggle_switch',
1393 'label' => __('Enable Tutor Login', 'tutor'),
1394 'label_title' => __('', 'tutor'),
1395 'default' => 'on',
1396 'desc' => __('Enable to use the tutor login modal instead of the default WordPress login page', 'tutor'),
1397 ),
1398 array(
1399 'key' => 'hide_admin_bar_for_users',
1400 'type' => 'toggle_switch',
1401 'label' => __('Hide Frontend Admin Bar', 'tutor'),
1402 'label_title' => __('', 'tutor'),
1403 'default' => 'off',
1404 'desc' => __('Enable this to hide the WordPress admin bar from the frontend. It will still be visible to admins.', 'tutor'),
1405 ),
1406 array(
1407 'key' => 'delete_on_uninstall',
1408 'type' => 'toggle_switch',
1409 'label' => __('Erase upon uninstallation', 'tutor'),
1410 'label_title' => __('', 'tutor'),
1411 'default' => 'off',
1412 'desc' => __('Delete all data during uninstallation', 'tutor'),
1413 ),
1414 array(
1415 'key' => 'enable_tutor_maintenance_mode',
1416 'type' => 'toggle_switch',
1417 'label' => __('Maintenance Mode', 'tutor'),
1418 'label_title' => __('', 'tutor'),
1419 'default' => 'off',
1420 'desc' => __('Enabling the maintenance mode allows you to display a custom message on the frontend. During this time, visitors can not access the site content. But the wp-admin dashboard will remain accessible.', 'tutor'),
1421 ),
1422 ),
1423 ),
1424 ),
1425 ),
1426 );
1427
1428 $attrs = apply_filters('tutor/options/extend/attr', apply_filters('tutor/options/attr', $attr));
1429
1430 // Get the active tab
1431 $tab_page = tutor_utils()->array_get('tab_page', $_REQUEST, 'general');
1432 $tab_data = null;
1433 $template = null;
1434
1435 foreach ($attrs as $key => $section) {
1436 if ($tab_page == $key) {
1437 if (isset($section['template_path']) && $section['template_path']) {
1438 $template = $section['template_path'];
1439 $tab_data = $section;
1440 }
1441 break;
1442 }
1443 }
1444
1445 // Store in runtime cache
1446 $this->setting_fields = array(
1447 'option_fields' => $attrs,
1448 'active_tab' => $tab_page,
1449 'active_tab_data' => $tab_data,
1450 'template_path' => $template,
1451 );
1452
1453 return $this->setting_fields;
1454 }
1455
1456 /**
1457 * @param array $field
1458 *
1459 * @return string
1460 *
1461 * Generate Option Field
1462 */
1463 public function generate_field($field = array())
1464 {
1465 ob_start();
1466 if (isset($field['type'])) {
1467 include tutor()->path . "views/options/field-types/{$field['type']}.php";
1468 }
1469 echo ob_get_clean();
1470 }
1471
1472 public function field_type($field = array())
1473 {
1474 ob_start();
1475 if (isset($field['type'])) {
1476 include tutor()->path . "views/options/field-types/{$field['type']}.php";
1477 }
1478 return ob_get_clean();
1479 }
1480
1481 public function blocks($blocks = array())
1482 {
1483 ob_start();
1484 include tutor()->path . 'views/options/option_blocks.php';
1485 return ob_get_clean();
1486 }
1487
1488 public function template($section = array())
1489 {
1490 ob_start();
1491 $blocks = $section['blocks'];
1492 if (isset($section['template'])) {
1493 include tutor()->path . "views/options/template/{$section['template']}.php";
1494 }
1495 return ob_get_clean();
1496 }
1497
1498 /**
1499 * Load template inside template dirctory
1500 *
1501 * @param mixed $template_slug
1502 * @param mixed $section
1503 * @return void
1504 */
1505 public function view_template($template_slug, $section = array())
1506 {
1507 ob_start();
1508 if (isset($template_slug)) {
1509 require tutor()->path . "views/options/template/{$template_slug}";
1510 }
1511 return ob_get_clean();
1512 }
1513 }
1514