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