PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.0.5
Tutor LMS – eLearning and online course solution v2.0.5
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 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 4 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
1529 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' => false,
434 'block_type' => 'uniform',
435 'slug' => 'general-page',
436 'fields' => array(
437 array(
438 'key' => 'tutor_toc_page_id',
439 'type' => 'select',
440 'label' => __('Terms and Conditions Page', 'tutor'),
441 'default' => '0',
442 'options' => $pages,
443 'desc' => __('This page will be used as the Terms and Conditions page', 'tutor'),
444 ),
445 ),
446 ),
447 array(
448 'label' => __('Others', 'tutor'),
449 'slug' => 'others',
450 'block_type' => 'isolate',
451 'fields' => array(
452 array(
453 'key' => 'enable_course_marketplace',
454 'type' => 'toggle_switch',
455 'label' => __('Enable Marketplace', 'tutor'),
456 'label_title' => __('', 'tutor'),
457 'default' => 'off',
458 'desc' => __('Allow multiple instructors to upload their courses.', 'tutor'),
459 ),
460 array(
461 'key' => 'pagination_per_page',
462 'type' => 'number',
463 'label' => __('Pagination', 'tutor'),
464 'default' => '20',
465 'desc' => __('Set the number of rows to be displayed per page', 'tutor'),
466 ),
467 ),
468 ),
469 array(
470 'label' => __('Instructor', 'tutor'),
471 'slug' => 'instructor',
472 'block_type' => 'uniform',
473 'fields' => array(
474 array(
475 'key' => 'instructor_can_publish_course',
476 'type' => 'toggle_switch',
477 'label' => __('Allow Instructors To Publish Courses', 'tutor'),
478 'label_title' => __('', 'tutor'),
479 'default' => 'off',
480 'desc' => __('Enable instructors to publish the course directly. If disabled, admins will be able to review course content before publishing.', 'tutor'),
481 ),
482 array(
483 'key' => 'enable_become_instructor_btn',
484 'type' => 'toggle_switch',
485 'label' => __('Become an Instructor Button', 'tutor'),
486 'label_title' => __('', 'tutor'),
487 'default' => 'off',
488 'desc' => __('Enable the option to display this button on the student dashboard.', 'tutor'),
489 ),
490 ),
491 ),
492 ),
493 ),
494 'course' => array(
495 'label' => __('Course', 'tutor'),
496 'slug' => 'course',
497 'desc' => __('Course Settings', 'tutor'),
498 'template' => 'basic',
499 'icon' => 'tutor-icon-book-open',
500 'blocks' => array(
501 'block_course' => array(
502 'label' => '',
503 'slug' => 'course',
504 'block_type' => 'uniform',
505 'fields' => array(
506 array(
507 'key' => 'student_must_login_to_view_course',
508 'type' => 'toggle_switch',
509 'label' => __( 'Course Visibility', 'tutor' ),
510 'label_title' => __( 'Logged Only', 'tutor' ),
511 'default' => 'off',
512 'desc' => __( 'Students must be logged in to view course', 'tutor' ),
513 ),
514 array(
515 'key' => 'course_content_access_for_ia',
516 'type' => 'toggle_switch',
517 'label' => __('Course Content Access', 'tutor'),
518 'default' => 'off',
519 'label_title' => __('', 'tutor'),
520 'desc' => __('Allow instructors and admins to view the course content without enrolling', 'tutor'),
521 ),
522 array(
523 'key' => 'course_content_summary',
524 'type' => 'toggle_switch',
525 'label' => __( 'Content Summary', 'tutor' ),
526 'default' => 'on',
527 'desc' => __( 'Enabling this feature will show a course content summary on the Course Details page.', 'tutor' ),
528 ),
529 array(
530 'key' => 'wc_automatic_order_complete_redirect_to_courses',
531 'type' => 'toggle_switch',
532 'label' => __('Auto redirect to courses', 'tutor'),
533 'default' => 'off',
534 'label_title' => __('', 'tutor'),
535 'desc' => __('When a user\'s WooCommerce order is auto-completed, they will be redirected to enrolled courses', 'tutor'),
536 ),
537 array(
538 'key' => 'enable_spotlight_mode',
539 'type' => 'toggle_switch',
540 'label' => __('Spotlight mode', 'tutor'),
541 'default' => 'off',
542 'label_title' => __('', 'tutor'),
543 'desc' => __('This will hide the header and the footer and enable spotlight (full screen) mode when students view lessons.', 'tutor'),
544 ),
545 array(
546 'key' => 'course_completion_process',
547 'type' => 'radio_vertical',
548 'label' => __('Course Completion Process', 'tutor'),
549 'default' => 'flexible',
550 'select_options' => false,
551 'options' => array(
552 'flexible' => __('Students can complete courses anytime in the Flexible mode', 'tutor'),
553 'strict' => __('Students have to complete, pass all the lessons and quizzes (if any) to mark a course as complete.', 'tutor'),
554 ),
555 'desc' => __('Choose when a user can click on the <strong>“Complete Course”</strong> button', 'tutor'),
556 ),
557 array(
558 'key' => 'course_retake_feature',
559 'type' => 'toggle_switch',
560 'label' => __('Course Retake', 'tutor'),
561 'default' => 'off',
562 'label_title' => __('', 'tutor'),
563 'desc' => __('Enabling this feature will allow students to reset course progress and start over.', 'tutor'),
564 ),
565 ),
566 ),
567 array(
568 'label' => __('Lesson', 'tutor'),
569 'slug' => 'lesson',
570 'block_type' => 'uniform',
571 'fields' => array(
572 array(
573 'key' => 'enable_lesson_classic_editor',
574 'type' => 'toggle_switch',
575 'label' => __('WP Editor for Lesson', 'tutor'),
576 'label_title' => __('', 'tutor'),
577 'default' => 'off',
578 'desc' => __('Enable classic editor to edit lesson.', 'tutor'),
579 ),
580 array(
581 'key' => 'autoload_next_course_content',
582 'type' => 'toggle_switch',
583 'label' => __('Automatically Load Next Course Content.', 'tutor'),
584 'label_title' => __('', 'tutor'),
585 'default' => 'off',
586 'desc' => __('Enable this feature to automatically load the next course content after the current one is finished.', 'tutor'),
587 ),
588 array(
589 'key' => 'enable_comment_for_lesson',
590 'type' => 'toggle_switch',
591 'label' => __('Enable Lesson Comment', 'tutor'),
592 'label_title' => __('', 'tutor'),
593 'default' => 'off',
594 'desc' => __('Enable this feature to allow students to post comments on lessons.', 'tutor'),
595 ),
596 ),
597 ),
598 'block_quiz' => array(
599 'label' => __('Quiz', 'tutor'),
600 'slug' => 'quiz',
601 'block_type' => 'uniform',
602 'fields' => array(
603 array(
604 'key' => 'quiz_when_time_expires',
605 'type' => 'radio_vertical',
606 'label' => __('When time expires', 'tutor'),
607 'default' => 'auto_abandon',
608 'select_options' => false,
609 'options' => array(
610 'auto_submit' => __('The current quiz answers are submitted automatically.', 'tutor'),
611 // 'grace_period' => __( 'The current quiz answers are submitted by students.', 'tutor' ),
612 'auto_abandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'),
613 ),
614 'desc' => __('Choose which action to follow when the quiz time expires.', 'tutor'),
615 ),
616 array(
617 'key' => 'quiz_attempts_allowed',
618 'type' => 'number',
619 'label' => __('Default Quiz Attempt limit (when Retry Mode is enabled)', 'tutor'),
620 'default' => '10',
621 'desc' => __('The highest number of attempts allowed for students to participate a quiz. 0 means unlimited. This will work as the default Quiz Attempt limit in case of Quiz Retry Mode.', 'tutor'),
622 ),
623 array(
624 'key' => 'quiz_previous_button_enabled',
625 'type' => 'toggle_switch',
626 'label' => __('Show Quiz Previous Button', 'tutor'),
627 'default' => 'on',
628 'desc' => __('Choose whether to show or hide the previous button for each question.', 'tutor'),
629 ),
630 array(
631 'key' => 'quiz_grade_method',
632 'type' => 'radio_horizontal_full',
633 'label' => __('Final Grade Calculation', 'tutor'),
634 'desc' => __('When multiple attempts are allowed, select which method should be used to calculate a student\'s final grade for the quiz.', 'tutor'),
635 'default' => 'highest_grade',
636 'options' => array(
637 'highest_grade' => __('Highest Grade', 'tutor'),
638 'average_grade' => __('Average Grade', 'tutor'),
639 'first_attempt' => __('First Attempt', 'tutor'),
640 'last_attempt' => __('Last Attempt', 'tutor'),
641 ),
642 ),
643 ),
644 ),
645 array(
646 'label' => __('Video', 'tutor'),
647 'slug' => 'video',
648 'block_type' => 'uniform',
649 'fields' => array(
650 array(
651 'key' => 'supported_video_sources',
652 'type' => 'checkbox_vertical',
653 'default' => array('youtube', 'vimeo'),
654 'label' => __('Preferred Video Source', 'tutor'),
655 'label_title' => __('Preferred Video Source', 'tutor'),
656 'options' => tutor_utils()->get_video_sources(true),
657 'desc' => __('Choose video sources you\'d like to support.', 'tutor'),
658 ),
659 ),
660 ),
661 ),
662 ),
663 'monetization' => array(
664 'label' => __('Monetization', 'tutor'),
665 'slug' => 'monetization',
666 'desc' => __('Monitization Settings', 'tutor'),
667 'template' => 'basic',
668 'icon' => 'tutor-icon-badge-discount',
669 'blocks' => array(
670 'block_options' => array(
671 'label' => __('Options', 'tutor'),
672 'slug' => 'options',
673 'block_type' => 'uniform',
674 'fields' => array(
675 array(
676 'key' => 'monetize_by',
677 'type' => 'select',
678 'label' => __('Select eCommerce Engine', 'tutor'),
679 'select_options' => true,
680 'options' => apply_filters(
681 'tutor_monetization_options',
682 array(
683 'free' => __('Disable Monetization', 'tutor'),
684 )
685 ),
686 'default' => 'free',
687 'desc' => __('Select a monetization option to generate revenue by selling courses. Supports: WooCommerce, Easy Digital Downloads, Paid Memberships Pro', 'tutor'),
688 ),
689 array(
690 'key' => 'tutor_woocommerce_order_auto_complete',
691 'type' => 'toggle_switch',
692 'label' => __( 'Automatically Complete WooCommerce Orders', 'tutor' ),
693 'label_title' => __( '', 'tutor' ),
694 'default' => 'off',
695 'desc' => __( 'If enabled, in the case of Courses, WooCommerce Orders will get the "Completed" status .', 'tutor' ),
696 ),
697 array(
698 'key' => 'enable_revenue_sharing',
699 'type' => 'toggle_switch',
700 'label' => __('Enable Revenue Sharing', 'tutor'),
701 'label_title' => __('', 'tutor'),
702 'default' => 'off',
703 'desc' => __('Allow revenue generated from selling courses to be shared with course creators.', 'tutor'),
704 ),
705 array(
706 'key' => 'sharing_percentage',
707 'type' => 'double_input',
708 'label' => __('Sharing Percentage', 'tutor'),
709 'label_title' => __('', 'tutor'),
710 'default' => '',
711 'fields' => array(
712 'earning_instructor_commission' => array(
713 'id' => 'revenue-instructor',
714 'type' => 'ratio',
715 'title' => 'Instructor Takes',
716 'default' => 20,
717 ),
718 'earning_admin_commission' => array(
719 'id' => 'revenue-admin',
720 'type' => 'ratio',
721 'title' => 'Admin Takes',
722 'default' => 80,
723 ),
724 ),
725 'desc' => __('Set how the sales revenue will be shared among admins and instructors.', 'tutor'),
726 ),
727 array(
728 'key' => 'statement_show_per_page',
729 'type' => 'number',
730 'label' => __('Show Statement Per Page', 'tutor'),
731 'default' => '20',
732
733 'desc' => __('Define the number of statements to show.', 'tutor'),
734 ),
735 ),
736 ),
737 array(
738 'label' => __('Fees', 'tutor'),
739 'slug' => 'fees',
740 'block_type' => 'uniform',
741 'fields' => array(
742 array(
743 'key' => 'enable_fees_deducting',
744 'type' => 'toggle_switch',
745 'label' => __('Deduct Fees', 'tutor'),
746 'label_title' => __('', 'tutor'),
747 'default' => 'off',
748 'desc' => __('Fees are charged from the entire sales amount. The remaining amount will be divided among admin and instructors.', 'tutor'),
749 ),
750 array(
751 'key' => 'fees_name',
752 'type' => 'textarea',
753 'label' => __('Fee Description', 'tutor'),
754 'placeholder' => __('Fee Description', 'tutor'),
755 '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'),
756 'default' => 'free',
757 ),
758 array(
759 'key' => 'fee_amount_type',
760 'type' => 'group_fields',
761 'label' => __('Fee Amount & Type', 'tutor'),
762 'desc' => __('Select the fee type and add fee amount/percentage', 'tutor'),
763 'group_fields' => array(
764 'fees_type' => array(
765 'type' => 'select',
766 'default' => 'fixed',
767 'options' => array(
768 'percent' => __('Percent', 'tutor'),
769 'fixed' => __('Fixed', 'tutor'),
770 ),
771 ),
772 'fees_amount' => array(
773 'type' => 'number',
774 'default' => '0',
775 ),
776 ),
777 ),
778 ),
779 ),
780 array(
781 'label' => __('Withdraw', 'tutor'),
782 'slug' => 'withdraw',
783 'block_type' => 'uniform',
784 'fields' => array(
785 array(
786 'key' => 'min_withdraw_amount',
787 'type' => 'number',
788 'label' => __('Minimum Withdrawal Amount', 'tutor'),
789 'default' => '80',
790 'desc' => __('Instructors should earn equal or above this amount to make a withdraw request.', 'tutor'),
791 ),
792 array(
793 'key' => 'minimum_days_for_balance_to_be_available',
794 'type' => 'number',
795 'label' => __('Minimum Days Before Balance is Available', 'tutor'),
796 'default' => '7',
797 'desc' => __('Any income has to remain this many days in the platform before it is available for withdrawal.', 'tutor'),
798 ),
799 array(
800 'key' => 'tutor_withdrawal_methods',
801 'type' => 'checkbox_horizontal',
802 'label' => __('Enable Withdraw Method', 'tutor'),
803 'default' => array('bank_transfer_withdraw'),
804 'options' => $methods_array,
805 'desc' => __('Set how you would like to withdraw money from the website.', 'tutor'),
806 ),
807 array(
808 'key' => 'tutor_bank_transfer_withdraw_instruction',
809 'type' => 'textarea',
810 'label' => __('Bank Instructions', 'tutor'),
811 'default' => __('Write the up to date bank informations of your instructor here.', 'tutor'),
812 'desc' => __('Write bank instructions for the instructors to conduct withdrawals.', 'tutor'),
813 ),
814 ),
815 ),
816 ),
817 ),
818 'design' => array(
819 'label' => __('Design', 'tutor'),
820 'slug' => 'design',
821 'desc' => __('Design Settings', 'tutor'),
822 'template' => 'design',
823 'icon' => 'tutor-icon-color-palette',
824 'blocks' => array(
825 'block_course' => array(
826 'label' => __('Course', 'tutor'),
827 'slug' => 'course',
828 'block_type' => 'uniform',
829 'fields' => array(
830 array(
831 'key' => 'courses_col_per_row',
832 'type' => 'radio_horizontal',
833 'label' => __('Column Per Row', 'tutor'),
834 'default' => '3',
835 'options' => array(
836 '1' => 'One',
837 '2' => 'Two',
838 '3' => 'Three',
839 '4' => 'Four',
840 ),
841 'desc' => __('Define how many columns you want to use to display courses.', 'tutor'),
842 ),
843 array(
844 'key' => 'course_archive_filter',
845 'type' => 'toggle_switch',
846 'label' => __('Course Filter', 'tutor'),
847 'label_title' => __('', 'tutor'),
848 'default' => 'off',
849 'desc' => __('Show sorting and filtering options on course archive page', 'tutor'),
850 ),
851 array(
852 'key' => 'courses_per_page',
853 'type' => 'number',
854 'label' => __('Courses Per Page', 'tutor'),
855 'default' => '12',
856 'desc' => __('Set the number of courses to display per page on the Course List page.', 'tutor'),
857 ),
858 array(
859 'key' => 'supported_course_filters',
860 'type' => 'checkbox_horizontal',
861 'label' => __('Preferred Course Filters', 'tutor'),
862 'default' => array('search', 'category'),
863 'options' => array(
864 'search' => __('Keyword Search', 'tutor'),
865 'category' => __('Category', 'tutor'),
866 'tag' => __('Tag', 'tutor'),
867 'difficulty_level' => __('Difficulty Level', 'tutor'),
868 'price_type' => __('Price Type', 'tutor'),
869 ),
870 'desc' => __('Choose preferred filter options you\'d like to show on the course archive page.', 'tutor'),
871 ),
872 ),
873 ),
874 'layout' => array(
875 'label' => __('Layout', 'tutor'),
876 'slug' => 'layout',
877 'block_type' => 'uniform',
878 'fields' => array(
879 array(
880 'key' => 'instructor_list_layout',
881 'type' => 'group_radio',
882 'label' => __('Instructor List Layout', 'tutor'),
883 'desc' => __('Choose a layout for the list of instructors inside a course page. You can change this at any time.', 'tutor'),
884 'default' => 'portrait',
885 'group_options' => array(
886 'vertical' => array(
887 'default' => array(
888 'title' => 'Portrait',
889 'image' => 'instructor-layout/instructor-portrait.svg',
890 ),
891 'cover' => array(
892 'title' => 'Cover',
893 'image' => 'instructor-layout/instructor-cover.svg',
894 ),
895 'minimal' => array(
896 'title' => 'Minimal',
897 'image' => 'instructor-layout/instructor-minimal.svg',
898 ),
899 ),
900 'horizontal' => array(
901 'portrait-horizontal' => array(
902 'title' => 'Portrait Horizontal',
903 'image' => 'instructor-layout/instructor-horizontal-portrait.svg',
904 ),
905 'minimal-horizontal' => array(
906 'title' => 'Minimal Horizontal',
907 'image' => 'instructor-layout/instructor-horizontal-minimal.svg',
908 ),
909 ),
910 ),
911 ),
912 array(
913 'key' => 'public_profile_layout',
914 'type' => 'group_radio_full_3',
915 'label' => __('Instructor Public Profile Layout', 'tutor'),
916 'desc' => __('Choose a layout design for a instructor’s public profile', 'tutor'),
917 'default' => 'pp-rectangle',
918 'group_options' => array(
919 'private' => array(
920 'title' => 'Private',
921 'image' => 'profile-layout/profile-private.svg',
922 ),
923 'pp-circle' => array(
924 'title' => 'Modern',
925 'image' => 'profile-layout/profile-modern.svg',
926 ),
927 'no-cp' => array(
928 'title' => 'Minimal',
929 'image' => 'profile-layout/profile-minimal.svg',
930 ),
931 'pp-rectangle' => array(
932 'title' => 'Classic',
933 'image' => 'profile-layout/profile-classic.svg',
934 ),
935 ),
936 ),
937 array(
938 'key' => 'student_public_profile_layout',
939 'type' => 'group_radio_full_3',
940 'label' => __('Student Public Profile Layout', 'tutor'),
941 'desc' => __('Choose a layout design for a student’s public profile', 'tutor'),
942 'default' => 'pp-rectangle',
943 'group_options' => array(
944 'private' => array(
945 'title' => 'Private',
946 'image' => 'profile-layout/profile-private.svg',
947 ),
948 'pp-circle' => array(
949 'title' => 'Modern',
950 'image' => 'profile-layout/profile-modern.svg',
951 ),
952 'no-cp' => array(
953 'title' => 'Minimal',
954 'image' => 'profile-layout/profile-minimal.svg',
955 ),
956 'pp-rectangle' => array(
957 'title' => 'Classic',
958 'image' => 'profile-layout/profile-classic.svg',
959 ),
960 ),
961 ),
962 ),
963 ),
964 'course-details' => array(
965 'label' => __('Course Details', 'tutor'),
966 'slug' => 'course-details',
967 'block_type' => 'isolate',
968 'fields' => array(
969 array(
970 'key' => 'course_details_adjustments',
971 'type' => 'checkgroup',
972 'label' => __('Course Details Adjustments', 'tutor'),
973 'group_options' => array(
974 array(
975 'key' => 'display_course_instructors',
976 'type' => 'toggle_single',
977 'label' => __('Instructor Info', 'tutor'),
978 'default' => 'on',
979 'desc' => __('Toggle to show instructor info', 'tutor'),
980 ),
981 array(
982 'key' => 'enable_q_and_a_on_course',
983 'type' => 'toggle_single',
984 'label' => __('Q&A', 'tutor'),
985 'default' => 'on',
986 'desc' => __('Enable to add a Q&A section', 'tutor'),
987 ),
988 array(
989 'key' => 'enable_course_author',
990 'type' => 'toggle_single',
991 'label' => __('Author', 'tutor'),
992 'label_title' => __('Enable', 'tutor'),
993 'default' => 'off',
994 'desc' => __('Enable to remove course author name', 'tutor'),
995 ),
996 array(
997 'key' => 'enable_course_level',
998 'type' => 'toggle_single',
999 'label' => __('Level', 'tutor'),
1000 'label_title' => __('Enable', 'tutor'),
1001 'default' => 'on',
1002 'desc' => __('Toggle to remove course level', 'tutor'),
1003 ),
1004 array(
1005 'key' => 'enable_course_share',
1006 'type' => 'toggle_single',
1007 'label' => __('Social Share', 'tutor'),
1008 'label_title' => __('Enable', 'tutor'),
1009 'default' => 'on',
1010 'desc' => __('Toggle to enable course social share', 'tutor'),
1011 ),
1012 array(
1013 'key' => 'enable_course_duration',
1014 'type' => 'toggle_single',
1015 'label' => __('Duration', 'tutor'),
1016 'label_title' => __('Disable', 'tutor'),
1017 'default' => 'on',
1018 'desc' => __('Enable to show course duration', 'tutor'),
1019 ),
1020 array(
1021 'key' => 'enable_course_total_enrolled',
1022 'type' => 'toggle_single',
1023 'label' => __('Total Enrolled', 'tutor'),
1024 'label_title' => __('Enable', 'tutor'),
1025 'default' => 'on',
1026 'desc' => __('Enable to show total enrolled students', 'tutor'),
1027 ),
1028 array(
1029 'key' => 'enable_course_update_date',
1030 'type' => 'toggle_single',
1031 'label' => __('Update Date', 'tutor'),
1032 'label_title' => __('Enable', 'tutor'),
1033 'default' => 'on',
1034 'desc' => __('Enable to show course update information', 'tutor'),
1035 ),
1036 array(
1037 'key' => 'enable_course_progress_bar',
1038 'type' => 'toggle_single',
1039 'label' => __('Progress Bar', 'tutor'),
1040 'label_title' => __('Enable', 'tutor'),
1041 'default' => 'on',
1042 'desc' => __('Enable to show course progress for Students', 'tutor'),
1043 ),
1044 array(
1045 'key' => 'enable_course_material',
1046 'type' => 'toggle_single',
1047 'label' => __('Material', 'tutor'),
1048 'label_title' => __('Enable', 'tutor'),
1049 'default' => 'on',
1050 'desc' => __('Enable to show course materials', 'tutor'),
1051 ),
1052 array(
1053 'key' => 'enable_course_about',
1054 'type' => 'toggle_single',
1055 'label' => __('About', 'tutor'),
1056 'label_title' => __('Enable', 'tutor'),
1057 'default' => 'on',
1058 'desc' => __('Enable to show course about section', 'tutor'),
1059 ),
1060 array(
1061 'key' => 'enable_course_description',
1062 'type' => 'toggle_single',
1063 'label' => __('Description', 'tutor'),
1064 'label_title' => __('Enable', 'tutor'),
1065 'default' => 'on',
1066 'desc' => __('Enable to show course description', 'tutor'),
1067 ),
1068 array(
1069 'key' => 'enable_course_benefits',
1070 'type' => 'toggle_single',
1071 'label' => __('Benefits', 'tutor'),
1072 'label_title' => __('Enable', 'tutor'),
1073 'default' => 'on',
1074 'desc' => __('Enable to show course benefits section', 'tutor'),
1075 ),
1076 array(
1077 'key' => 'enable_course_requirements',
1078 'type' => 'toggle_single',
1079 'label' => __('Requirements', 'tutor'),
1080 'label_title' => __('Enable', 'tutor'),
1081 'default' => 'on',
1082 'desc' => __('Enable to show courses requirements setion', 'tutor'),
1083 ),
1084 array(
1085 'key' => 'enable_course_target_audience',
1086 'type' => 'toggle_single',
1087 'label' => __('Target Audience', 'tutor'),
1088 'label_title' => __('Disable', 'tutor'),
1089 'default' => 'on',
1090 'desc' => __('Enable to show course target audience section', 'tutor'),
1091 ),
1092 array(
1093 'key' => 'enable_course_announcements',
1094 'type' => 'toggle_single',
1095 'label' => __('Announcements', 'tutor'),
1096 'label_title' => __('Enable', 'tutor'),
1097 'default' => 'on',
1098 'desc' => __('Enable to show course announcements section', 'tutor'),
1099 ),
1100 array(
1101 'key' => 'enable_course_review',
1102 'type' => 'toggle_single',
1103 'label' => __('Review', 'tutor'),
1104 'label_title' => __('Enable', 'tutor'),
1105 'default' => 'on',
1106 'desc' => __('Enable to show course review section', 'tutor'),
1107 ),
1108 ),
1109 'desc' => __('Content Needed Here...', 'tutor'),
1110 ),
1111 ),
1112 ),
1113 'colors' => array(
1114 'label' => __('Colors', 'tutor'),
1115 'slug' => 'colors',
1116 'block_type' => 'color_picker',
1117 'fields_group' => array(
1118 array(
1119 'key' => 'color_preset_type',
1120 'type' => 'color_preset',
1121 'label' => __('Preset Colors', 'tutor'),
1122 'desc' => __('These colors will be used throughout your website. Choose between these presets or create your own custom palette.', 'tutor'),
1123 'default' => 'default',
1124 'fields' => array(
1125 /* First 4 preset_name should be same as color_fields */
1126 array(
1127 'key' => 'default',
1128 'label' => 'Default',
1129 'colors' => array(
1130 array(
1131 'slug' => 'tutor_primary_color',
1132 'preset_name' => 'primary',
1133 'value' => '#3E64DE',
1134 ),
1135 array(
1136 'slug' => 'tutor_primary_hover_color',
1137 'preset_name' => 'hover',
1138 'value' => '#395BCA',
1139 ),
1140 array(
1141 'slug' => 'tutor_text_color',
1142 'preset_name' => 'text',
1143 'value' => '#212327',
1144 ),
1145 array(
1146 'slug' => 'tutor_gray_color',
1147 'preset_name' => 'gray',
1148 'value' => '#E3E5EB',
1149 ),
1150 array(
1151 'slug' => 'tutor_border_color',
1152 'preset_name' => 'border',
1153 'value' => '#CDCFD5',
1154 ),
1155 ),
1156 ),
1157 array(
1158 'key' => 'landscape',
1159 'label' => 'Landscape',
1160 'colors' => array(
1161 array(
1162 'slug' => 'tutor_primary_color',
1163 'preset_name' => 'primary',
1164 'value' => '#239371',
1165 ),
1166 array(
1167 'slug' => 'tutor_primary_hover_color',
1168 'preset_name' => 'hover',
1169 'value' => '#117D5D',
1170 ),
1171 array(
1172 'slug' => 'tutor_text_color',
1173 'preset_name' => 'text',
1174 'value' => '#212327',
1175 ),
1176 array(
1177 'slug' => 'tutor_gray_color',
1178 'preset_name' => 'gray',
1179 'value' => '#E3E5EB',
1180 ),
1181 array(
1182 'slug' => 'tutor_border_color',
1183 'preset_name' => 'border',
1184 'value' => '#CDCFD5',
1185 ),
1186 ),
1187 ),
1188 array(
1189 'key' => 'ocean',
1190 'label' => 'Ocean',
1191 'colors' => array(
1192 array(
1193 'slug' => 'tutor_primary_color',
1194 'preset_name' => 'primary',
1195 'value' => '#5A18C2',
1196 ),
1197 array(
1198 'slug' => 'tutor_primary_hover_color',
1199 'preset_name' => 'hover',
1200 'value' => '#3F02A0',
1201 ),
1202 array(
1203 'slug' => 'tutor_text_color',
1204 'preset_name' => 'text',
1205 'value' => '#212327',
1206 ),
1207 array(
1208 'slug' => 'tutor_gray_color',
1209 'preset_name' => 'gray',
1210 'value' => '#E3E5EB',
1211 ),
1212 array(
1213 'slug' => 'tutor_border_color',
1214 'preset_name' => 'border',
1215 'value' => '#CDCFD5',
1216 ),
1217 ),
1218 ),
1219 array(
1220 'key' => 'custom',
1221 'label' => 'Custom',
1222 'colors' => array(
1223 array(
1224 'slug' => 'tutor_primary_color',
1225 'preset_name' => 'primary',
1226 'value' => '#3E64DE',
1227 ),
1228 array(
1229 'slug' => 'tutor_primary_hover_color',
1230 'preset_name' => 'hover',
1231 'value' => '#28408E',
1232 ),
1233 array(
1234 'slug' => 'tutor_text_color',
1235 'preset_name' => 'text',
1236 'value' => '#1A1B1E',
1237 ),
1238 array(
1239 'slug' => 'tutor_gray_color',
1240 'preset_name' => 'gray',
1241 'value' => '#E3E5EB',
1242 ),
1243 ),
1244 ),
1245 ),
1246 ),
1247 array(
1248 'key' => 'tutor_color_presets',
1249 'type' => 'color_fields',
1250 'label' => __('Preset Colors', 'tutor'),
1251 'fields' => array(
1252 array(
1253 'key' => 'tutor_primary_color',
1254 'type' => 'color_field',
1255 'preset_name' => 'primary',
1256 'preset_exist' => true,
1257 'label' => __('Primary Color', 'tutor'),
1258 'default' => '#3E64DE',
1259 'desc' => __('Choose a primary color', 'tutor'),
1260 ),
1261 array(
1262 'key' => 'tutor_primary_hover_color',
1263 'type' => 'color_field',
1264 'preset_name' => 'hover',
1265 'preset_exist' => true,
1266 'label' => __('Primary Hover Color', 'tutor'),
1267 'default' => '#395BCA',
1268 'desc' => __('Choose a primary hover color', 'tutor'),
1269 ),
1270 array(
1271 'key' => 'tutor_text_color',
1272 'type' => 'color_field',
1273 'preset_name' => 'text',
1274 'preset_exist' => true,
1275 'label' => __('Text Color', 'tutor'),
1276 'default' => '#212327',
1277 'desc' => __('Choose a text color for your website', 'tutor'),
1278 ),
1279 array(
1280 'key' => 'tutor_gray_color',
1281 'type' => 'color_field',
1282 'preset_name' => 'gray',
1283 'preset_exist' => false,
1284 'label' => __('Gray', 'tutor'),
1285 'default' => '#E3E5EB',
1286 'desc' => __('Choose a color for elements like table, card etc', 'tutor'),
1287 ),
1288 array(
1289 'key' => 'tutor_border_color',
1290 'type' => 'color_field',
1291 'preset_name' => 'border',
1292 'preset_exist' => false,
1293 'label' => __('Border', 'tutor'),
1294 'default' => '#CDCFD5',
1295 'desc' => __('Choose a border color for your website', 'tutor'),
1296 ),
1297 ),
1298 ),
1299 ),
1300 ),
1301 'video_player' => array(
1302 'label' => __('Video Player', 'tutor'),
1303 'slug' => 'video_player',
1304 'block_type' => 'uniform',
1305 'fields' => array(
1306 array(
1307 'key' => 'disable_default_player_youtube',
1308 'type' => 'toggle_switch',
1309 'label' => __('Use Tutor Player for YouTube', 'tutor'),
1310 'label_title' => __('', 'tutor'),
1311 'default' => 'off',
1312 'desc' => __('Enable this option to use Tutor LMS video player for YouTube.', 'tutor'),
1313 ),
1314 array(
1315 'key' => 'disable_default_player_vimeo',
1316 'type' => 'toggle_switch',
1317 'label' => __('Use Tutor Player for Vimeo', 'tutor'),
1318 'label_title' => __('', 'tutor'),
1319 'default' => 'off',
1320 'desc' => __('Enable this option to use Tutor LMS video player for Vimeo.', 'tutor'),
1321 ),
1322 ),
1323 ),
1324 ),
1325 ),
1326 'advanced' => array(
1327 'label' => __('Advanced', 'tutor'),
1328 'slug' => 'advanced',
1329 'desc' => __('Advanced Settings', 'tutor'),
1330 'template' => 'basic',
1331 'icon' => 'tutor-icon-filter',
1332 'blocks' => array(
1333 array(
1334 'label' => __('Course', 'tutor'),
1335 'slug' => 'options',
1336 'block_type' => 'uniform',
1337 'fields' => array(
1338 array(
1339 'key' => 'enable_gutenberg_course_edit',
1340 'type' => 'toggle_switch',
1341 'label' => __('Gutenberg Editor', 'tutor'),
1342 'default' => 'off',
1343 'desc' => __('Enable this to create courses using the Gutenberg Editor.', 'tutor'),
1344 ),
1345 array(
1346 'key' => 'hide_course_from_shop_page',
1347 'type' => 'toggle_switch',
1348 'label' => __('Hide Course Products on Shop Page', 'tutor'),
1349 'default' => 'off',
1350 'desc' => __('Enable to hide course products on shop page.', 'tutor'),
1351 ),
1352 array(
1353 'key' => 'course_archive_page',
1354 'type' => 'select',
1355 'label' => __('Course Archive Page', 'tutor'),
1356 'default' => $course_archive_page_id->ID ?? '0',
1357 'options' => $pages,
1358 'desc' => __('This page will be used to list all the published courses.', 'tutor'),
1359 ),
1360 array(
1361 'key' => 'instructor_register_page',
1362 'type' => 'select',
1363 'label' => __('Instructor Registration Page', 'tutor'),
1364 'default' => '0',
1365 'options' => $pages,
1366 'desc' => __('Choose the page for instructor registration.', 'tutor'),
1367 ),
1368 array(
1369 'key' => 'student_register_page',
1370 'type' => 'select',
1371 'label' => __('Student Registration Page', 'tutor'),
1372 'default' => '0',
1373 'options' => $pages,
1374 'desc' => __('Choose the page for student registration.', 'tutor'),
1375 ),
1376 array(
1377 'key' => 'lesson_permalink_base',
1378 'type' => 'text',
1379 'label' => __('Lesson Permalink Base', 'tutor'),
1380 'default' => 'lessons',
1381 'desc' => $lesson_url,
1382 ),
1383 array(
1384 'key' => 'lesson_video_duration_youtube_api_key',
1385 'type' => 'text',
1386 'label' => __('Youtube API Key', 'tutor'),
1387 'default' => '',
1388 'desc' => __('Insert the YouTube API key to host live videos using YouTube.', 'tutor'),
1389 ),
1390 ),
1391 ),
1392 array(
1393 'label' => __('Options', 'tutor'),
1394 'slug' => 'options',
1395 'block_type' => 'uniform',
1396 'fields' => array(
1397 array(
1398 'key' => 'enable_profile_completion',
1399 'type' => 'toggle_switch',
1400 'label' => __('Profile Completion', 'tutor'),
1401 'label_title' => __('', 'tutor'),
1402 'default' => 'off',
1403 'desc' => __('Enabling this feature will show a notification bar to students and instructors to complete their profile information', 'tutor'),
1404 ),
1405 array(
1406 'key' => 'enable_tutor_native_login',
1407 'type' => 'toggle_switch',
1408 'label' => __('Enable Tutor Login', 'tutor'),
1409 'label_title' => __('', 'tutor'),
1410 'default' => 'on',
1411 'desc' => __('Enable to use the tutor login modal instead of the default WordPress login page', 'tutor'),
1412 ),
1413 array(
1414 'key' => 'hide_admin_bar_for_users',
1415 'type' => 'toggle_switch',
1416 'label' => __('Hide Admin Bar and Restrict Access to WP Admin for Instructors', 'tutor'),
1417 'label_title' => __('', 'tutor'),
1418 'default' => 'off',
1419 'desc' => __('Enable this to hide the WordPress Admin Bar from Frontend site, and restrict access to the WP Admin panel.', 'tutor'),
1420 ),
1421 array(
1422 'key' => 'delete_on_uninstall',
1423 'type' => 'toggle_switch',
1424 'label' => __('Erase upon uninstallation', 'tutor'),
1425 'label_title' => __('', 'tutor'),
1426 'default' => 'off',
1427 'desc' => __('Delete all data during uninstallation', 'tutor'),
1428 ),
1429 array(
1430 'key' => 'enable_tutor_maintenance_mode',
1431 'type' => 'toggle_switch',
1432 'label' => __('Maintenance Mode', 'tutor'),
1433 'label_title' => __('', 'tutor'),
1434 'default' => 'off',
1435 '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'),
1436 ),
1437 ),
1438 ),
1439 ),
1440 ),
1441 );
1442
1443 $attrs = apply_filters('tutor/options/extend/attr', apply_filters('tutor/options/attr', $attr));
1444
1445 // Get the active tab
1446 $tab_page = tutor_utils()->array_get('tab_page', $_REQUEST, 'general');
1447 $tab_data = null;
1448 $template = null;
1449
1450 foreach ($attrs as $key => $section) {
1451 if ($tab_page == $key) {
1452 if (isset($section['template_path']) && $section['template_path']) {
1453 $template = $section['template_path'];
1454 $tab_data = $section;
1455 }
1456 break;
1457 }
1458 }
1459
1460 // Store in runtime cache
1461 $this->setting_fields = array(
1462 'option_fields' => $attrs,
1463 'active_tab' => $tab_page,
1464 'active_tab_data' => $tab_data,
1465 'template_path' => $template,
1466 );
1467
1468 return $this->setting_fields;
1469 }
1470
1471 /**
1472 * @param array $field
1473 *
1474 * @return string
1475 *
1476 * Generate Option Field
1477 */
1478 public function generate_field($field = array())
1479 {
1480 ob_start();
1481 if (isset($field['type'])) {
1482 include tutor()->path . "views/options/field-types/{$field['type']}.php";
1483 }
1484 echo ob_get_clean();
1485 }
1486
1487 public function field_type($field = array())
1488 {
1489 ob_start();
1490 if (isset($field['type'])) {
1491 include tutor()->path . "views/options/field-types/{$field['type']}.php";
1492 }
1493 return ob_get_clean();
1494 }
1495
1496 public function blocks($blocks = array())
1497 {
1498 ob_start();
1499 include tutor()->path . 'views/options/option_blocks.php';
1500 return ob_get_clean();
1501 }
1502
1503 public function template($section = array())
1504 {
1505 ob_start();
1506 $blocks = $section['blocks'];
1507 if (isset($section['template'])) {
1508 include tutor()->path . "views/options/template/{$section['template']}.php";
1509 }
1510 return ob_get_clean();
1511 }
1512
1513 /**
1514 * Load template inside template dirctory
1515 *
1516 * @param mixed $template_slug
1517 * @param mixed $section
1518 * @return void
1519 */
1520 public function view_template($template_slug, $section = array())
1521 {
1522 ob_start();
1523 if (isset($template_slug)) {
1524 require tutor()->path . "views/options/template/{$template_slug}";
1525 }
1526 return ob_get_clean();
1527 }
1528 }
1529