PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.0.10
Tutor LMS – eLearning and online course solution v2.0.10
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 3 years ago Announcements.php 4 years ago Assets.php 3 years ago Backend_Page_Trait.php 4 years ago Course.php 3 years ago Course_Embed.php 3 years ago Course_Filter.php 4 years ago Course_List.php 3 years ago Course_Settings_Tabs.php 4 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 4 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 4 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 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 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 4 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 4 years ago WooCommerce.php 3 years ago
Options_V2.php
1562 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 Lessions, 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 'desc' => __('Any income has to remain this many days in the platform before it is available for withdrawal.', 'tutor'),
823 ),
824 array(
825 'key' => 'tutor_withdrawal_methods',
826 'type' => 'checkbox_horizontal',
827 'label' => __('Enable Withdraw Method', 'tutor'),
828 'default' => array('bank_transfer_withdraw'),
829 'options' => $methods_array,
830 'desc' => __('Set how you would like to withdraw money from the website.', 'tutor'),
831 ),
832 array(
833 'key' => 'tutor_bank_transfer_withdraw_instruction',
834 'type' => 'textarea',
835 'label' => __('Bank Instructions', 'tutor'),
836 'default' => __('Write the up to date bank informations of your instructor here.', 'tutor'),
837 'desc' => __('Write bank instructions for the instructors to conduct withdrawals.', 'tutor'),
838 ),
839 ),
840 ),
841 ),
842 ),
843 'design' => array(
844 'label' => __('Design', 'tutor'),
845 'slug' => 'design',
846 'desc' => __('Design Settings', 'tutor'),
847 'template' => 'design',
848 'icon' => 'tutor-icon-color-palette',
849 'blocks' => array(
850 'block_course' => array(
851 'label' => __('Course', 'tutor'),
852 'slug' => 'course',
853 'block_type' => 'uniform',
854 'fields' => array(
855 array(
856 'key' => 'courses_col_per_row',
857 'type' => 'radio_horizontal',
858 'label' => __('Column Per Row', 'tutor'),
859 'default' => '3',
860 'options' => array(
861 '1' => 'One',
862 '2' => 'Two',
863 '3' => 'Three',
864 '4' => 'Four',
865 ),
866 'desc' => __('Define how many columns you want to use to display courses.', 'tutor'),
867 ),
868 array(
869 'key' => 'course_archive_filter',
870 'type' => 'toggle_switch',
871 'label' => __('Course Filter', 'tutor'),
872 'label_title' => __('', 'tutor'),
873 'default' => 'off',
874 'desc' => __('Show sorting and filtering options on course archive page', 'tutor'),
875 ),
876 array(
877 'key' => 'courses_per_page',
878 'type' => 'number',
879 'label' => __('Courses Per Page', 'tutor'),
880 'default' => '12',
881 'desc' => __('Set the number of courses to display per page on the Course List page.', 'tutor'),
882 ),
883 array(
884 'key' => 'supported_course_filters',
885 'type' => 'checkbox_horizontal',
886 'label' => __('Preferred Course Filters', 'tutor'),
887 'default' => array('search', 'category'),
888 'options' => array(
889 'search' => __('Keyword Search', 'tutor'),
890 'category' => __('Category', 'tutor'),
891 'tag' => __('Tag', 'tutor'),
892 'difficulty_level' => __('Difficulty Level', 'tutor'),
893 'price_type' => __('Price Type', 'tutor'),
894 ),
895 'desc' => __('Choose preferred filter options you\'d like to show on the course archive page.', 'tutor'),
896 ),
897 array(
898 'key' => 'course_archive_filter_sorting',
899 'type' => 'toggle_switch',
900 'label' => __('Course Sorting', 'tutor'),
901 'label_title' => __('', 'tutor'),
902 'default' => 'on',
903 'desc' => __('If enabled, the courses will be sortable by Course Name or Creation Date in either Ascending or Descending order', 'tutor'),
904 ),
905 ),
906 ),
907 'layout' => array(
908 'label' => __('Layout', 'tutor'),
909 'slug' => 'layout',
910 'block_type' => 'uniform',
911 'fields' => array(
912 array(
913 'key' => 'instructor_list_layout',
914 'type' => 'group_radio',
915 'label' => __('Instructor List Layout', 'tutor'),
916 'desc' => __('Choose a layout for the list of instructors inside a course page. You can change this at any time.', 'tutor'),
917 'default' => 'portrait',
918 'group_options' => array(
919 'vertical' => array(
920 'default' => array(
921 'title' => 'Portrait',
922 'image' => 'instructor-layout/instructor-portrait.svg',
923 ),
924 'cover' => array(
925 'title' => 'Cover',
926 'image' => 'instructor-layout/instructor-cover.svg',
927 ),
928 'minimal' => array(
929 'title' => 'Minimal',
930 'image' => 'instructor-layout/instructor-minimal.svg',
931 ),
932 ),
933 'horizontal' => array(
934 'portrait-horizontal' => array(
935 'title' => 'Portrait Horizontal',
936 'image' => 'instructor-layout/instructor-horizontal-portrait.svg',
937 ),
938 'minimal-horizontal' => array(
939 'title' => 'Minimal Horizontal',
940 'image' => 'instructor-layout/instructor-horizontal-minimal.svg',
941 ),
942 ),
943 ),
944 ),
945 array(
946 'key' => 'public_profile_layout',
947 'type' => 'group_radio_full_3',
948 'label' => __('Instructor Public Profile Layout', 'tutor'),
949 'desc' => __('Choose a layout design for a instructor’s public profile', 'tutor'),
950 'default' => 'pp-rectangle',
951 'group_options' => array(
952 'private' => array(
953 'title' => 'Private',
954 'image' => 'profile-layout/profile-private.svg',
955 ),
956 'pp-circle' => array(
957 'title' => 'Modern',
958 'image' => 'profile-layout/profile-modern.svg',
959 ),
960 'no-cp' => array(
961 'title' => 'Minimal',
962 'image' => 'profile-layout/profile-minimal.svg',
963 ),
964 'pp-rectangle' => array(
965 'title' => 'Classic',
966 'image' => 'profile-layout/profile-classic.svg',
967 ),
968 ),
969 ),
970 array(
971 'key' => 'student_public_profile_layout',
972 'type' => 'group_radio_full_3',
973 'label' => __('Student Public Profile Layout', 'tutor'),
974 'desc' => __('Choose a layout design for a student’s public profile', 'tutor'),
975 'default' => 'pp-rectangle',
976 'group_options' => array(
977 'private' => array(
978 'title' => 'Private',
979 'image' => 'profile-layout/profile-private.svg',
980 ),
981 'pp-circle' => array(
982 'title' => 'Modern',
983 'image' => 'profile-layout/profile-modern.svg',
984 ),
985 'no-cp' => array(
986 'title' => 'Minimal',
987 'image' => 'profile-layout/profile-minimal.svg',
988 ),
989 'pp-rectangle' => array(
990 'title' => 'Classic',
991 'image' => 'profile-layout/profile-classic.svg',
992 ),
993 ),
994 ),
995 ),
996 ),
997 'course-details' => array(
998 'label' => __('Course Details', 'tutor'),
999 'slug' => 'course-details',
1000 'block_type' => 'isolate',
1001 'fields' => array(
1002 array(
1003 'key' => 'course_details_adjustments',
1004 'type' => 'checkgroup',
1005 'label' => __( 'Page Features', 'tutor' ),
1006 'desc' => __( 'You can keep the following features active or inactive as per the need of your business model', 'tutor' ),
1007 'group_options' => array(
1008 array(
1009 'key' => 'display_course_instructors',
1010 'type' => 'toggle_single',
1011 'label' => __('Instructor Info', 'tutor'),
1012 'default' => 'on',
1013 'desc' => __('Toggle to show instructor info', 'tutor'),
1014 ),
1015 array(
1016 'key' => 'enable_q_and_a_on_course',
1017 'type' => 'toggle_single',
1018 'label' => __('Q&A', 'tutor'),
1019 'default' => 'on',
1020 'desc' => __('Enable to add a Q&A section', 'tutor'),
1021 ),
1022 array(
1023 'key' => 'enable_course_author',
1024 'type' => 'toggle_single',
1025 'label' => __('Author', 'tutor'),
1026 'label_title' => __('Enable', 'tutor'),
1027 'default' => 'off',
1028 'desc' => __('Enable to remove course author name', 'tutor'),
1029 ),
1030 array(
1031 'key' => 'enable_course_level',
1032 'type' => 'toggle_single',
1033 'label' => __('Level', 'tutor'),
1034 'label_title' => __('Enable', 'tutor'),
1035 'default' => 'on',
1036 'desc' => __('Toggle to remove course level', 'tutor'),
1037 ),
1038 array(
1039 'key' => 'enable_course_share',
1040 'type' => 'toggle_single',
1041 'label' => __('Social Share', 'tutor'),
1042 'label_title' => __('Enable', 'tutor'),
1043 'default' => 'on',
1044 'desc' => __('Toggle to enable course social share', 'tutor'),
1045 ),
1046 array(
1047 'key' => 'enable_course_duration',
1048 'type' => 'toggle_single',
1049 'label' => __('Duration', 'tutor'),
1050 'label_title' => __('Disable', 'tutor'),
1051 'default' => 'on',
1052 'desc' => __('Enable to show course duration', 'tutor'),
1053 ),
1054 array(
1055 'key' => 'enable_course_total_enrolled',
1056 'type' => 'toggle_single',
1057 'label' => __('Total Enrolled', 'tutor'),
1058 'label_title' => __('Enable', 'tutor'),
1059 'default' => 'on',
1060 'desc' => __('Enable to show total enrolled students', 'tutor'),
1061 ),
1062 array(
1063 'key' => 'enable_course_update_date',
1064 'type' => 'toggle_single',
1065 'label' => __('Update Date', 'tutor'),
1066 'label_title' => __('Enable', 'tutor'),
1067 'default' => 'on',
1068 'desc' => __('Enable to show course update information', 'tutor'),
1069 ),
1070 array(
1071 'key' => 'enable_course_progress_bar',
1072 'type' => 'toggle_single',
1073 'label' => __('Progress Bar', 'tutor'),
1074 'label_title' => __('Enable', 'tutor'),
1075 'default' => 'on',
1076 'desc' => __('Enable to show course progress for Students', 'tutor'),
1077 ),
1078 array(
1079 'key' => 'enable_course_material',
1080 'type' => 'toggle_single',
1081 'label' => __('Material', 'tutor'),
1082 'label_title' => __('Enable', 'tutor'),
1083 'default' => 'on',
1084 'desc' => __('Enable to show course materials', 'tutor'),
1085 ),
1086 array(
1087 'key' => 'enable_course_about',
1088 'type' => 'toggle_single',
1089 'label' => __('About', 'tutor'),
1090 'label_title' => __('Enable', 'tutor'),
1091 'default' => 'on',
1092 'desc' => __('Enable to show course about section', 'tutor'),
1093 ),
1094 array(
1095 'key' => 'enable_course_description',
1096 'type' => 'toggle_single',
1097 'label' => __('Description', 'tutor'),
1098 'label_title' => __('Enable', 'tutor'),
1099 'default' => 'on',
1100 'desc' => __('Enable to show course description', 'tutor'),
1101 ),
1102 array(
1103 'key' => 'enable_course_benefits',
1104 'type' => 'toggle_single',
1105 'label' => __('Benefits', 'tutor'),
1106 'label_title' => __('Enable', 'tutor'),
1107 'default' => 'on',
1108 'desc' => __('Enable to show course benefits section', 'tutor'),
1109 ),
1110 array(
1111 'key' => 'enable_course_requirements',
1112 'type' => 'toggle_single',
1113 'label' => __('Requirements', 'tutor'),
1114 'label_title' => __('Enable', 'tutor'),
1115 'default' => 'on',
1116 'desc' => __('Enable to show courses requirements setion', 'tutor'),
1117 ),
1118 array(
1119 'key' => 'enable_course_target_audience',
1120 'type' => 'toggle_single',
1121 'label' => __('Target Audience', 'tutor'),
1122 'label_title' => __('Disable', 'tutor'),
1123 'default' => 'on',
1124 'desc' => __('Enable to show course target audience section', 'tutor'),
1125 ),
1126 array(
1127 'key' => 'enable_course_announcements',
1128 'type' => 'toggle_single',
1129 'label' => __('Announcements', 'tutor'),
1130 'label_title' => __('Enable', 'tutor'),
1131 'default' => 'on',
1132 'desc' => __('Enable to show course announcements section', 'tutor'),
1133 ),
1134 array(
1135 'key' => 'enable_course_review',
1136 'type' => 'toggle_single',
1137 'label' => __('Review', 'tutor'),
1138 'label_title' => __('Enable', 'tutor'),
1139 'default' => 'on',
1140 'desc' => __('Enable to show course review section', 'tutor'),
1141 ),
1142 ),
1143 ),
1144 ),
1145 ),
1146 'colors' => array(
1147 'label' => __('Colors', 'tutor'),
1148 'slug' => 'colors',
1149 'block_type' => 'color_picker',
1150 'fields_group' => array(
1151 array(
1152 'key' => 'color_preset_type',
1153 'type' => 'color_preset',
1154 'label' => __('Preset Colors', 'tutor'),
1155 'desc' => __('These colors will be used throughout your website. Choose between these presets or create your own custom palette.', 'tutor'),
1156 'default' => 'default',
1157 'fields' => array(
1158 /* First 4 preset_name should be same as color_fields */
1159 array(
1160 'key' => 'default',
1161 'label' => 'Default',
1162 'colors' => array(
1163 array(
1164 'slug' => 'tutor_primary_color',
1165 'preset_name' => 'primary',
1166 'value' => '#3E64DE',
1167 ),
1168 array(
1169 'slug' => 'tutor_primary_hover_color',
1170 'preset_name' => 'hover',
1171 'value' => '#395BCA',
1172 ),
1173 array(
1174 'slug' => 'tutor_text_color',
1175 'preset_name' => 'text',
1176 'value' => '#212327',
1177 ),
1178 array(
1179 'slug' => 'tutor_gray_color',
1180 'preset_name' => 'gray',
1181 'value' => '#E3E5EB',
1182 ),
1183 array(
1184 'slug' => 'tutor_border_color',
1185 'preset_name' => 'border',
1186 'value' => '#CDCFD5',
1187 ),
1188 ),
1189 ),
1190 array(
1191 'key' => 'landscape',
1192 'label' => 'Landscape',
1193 'colors' => array(
1194 array(
1195 'slug' => 'tutor_primary_color',
1196 'preset_name' => 'primary',
1197 'value' => '#239371',
1198 ),
1199 array(
1200 'slug' => 'tutor_primary_hover_color',
1201 'preset_name' => 'hover',
1202 'value' => '#117D5D',
1203 ),
1204 array(
1205 'slug' => 'tutor_text_color',
1206 'preset_name' => 'text',
1207 'value' => '#212327',
1208 ),
1209 array(
1210 'slug' => 'tutor_gray_color',
1211 'preset_name' => 'gray',
1212 'value' => '#E3E5EB',
1213 ),
1214 array(
1215 'slug' => 'tutor_border_color',
1216 'preset_name' => 'border',
1217 'value' => '#CDCFD5',
1218 ),
1219 ),
1220 ),
1221 array(
1222 'key' => 'ocean',
1223 'label' => 'Ocean',
1224 'colors' => array(
1225 array(
1226 'slug' => 'tutor_primary_color',
1227 'preset_name' => 'primary',
1228 'value' => '#5A18C2',
1229 ),
1230 array(
1231 'slug' => 'tutor_primary_hover_color',
1232 'preset_name' => 'hover',
1233 'value' => '#3F02A0',
1234 ),
1235 array(
1236 'slug' => 'tutor_text_color',
1237 'preset_name' => 'text',
1238 'value' => '#212327',
1239 ),
1240 array(
1241 'slug' => 'tutor_gray_color',
1242 'preset_name' => 'gray',
1243 'value' => '#E3E5EB',
1244 ),
1245 array(
1246 'slug' => 'tutor_border_color',
1247 'preset_name' => 'border',
1248 'value' => '#CDCFD5',
1249 ),
1250 ),
1251 ),
1252 array(
1253 'key' => 'custom',
1254 'label' => 'Custom',
1255 'colors' => array(
1256 array(
1257 'slug' => 'tutor_primary_color',
1258 'preset_name' => 'primary',
1259 'value' => '#3E64DE',
1260 ),
1261 array(
1262 'slug' => 'tutor_primary_hover_color',
1263 'preset_name' => 'hover',
1264 'value' => '#28408E',
1265 ),
1266 array(
1267 'slug' => 'tutor_text_color',
1268 'preset_name' => 'text',
1269 'value' => '#1A1B1E',
1270 ),
1271 array(
1272 'slug' => 'tutor_gray_color',
1273 'preset_name' => 'gray',
1274 'value' => '#E3E5EB',
1275 ),
1276 ),
1277 ),
1278 ),
1279 ),
1280 array(
1281 'key' => 'tutor_color_presets',
1282 'type' => 'color_fields',
1283 'label' => __('Preset Colors', 'tutor'),
1284 'fields' => array(
1285 array(
1286 'key' => 'tutor_primary_color',
1287 'type' => 'color_field',
1288 'preset_name' => 'primary',
1289 'preset_exist' => true,
1290 'label' => __('Primary Color', 'tutor'),
1291 'default' => '#3E64DE',
1292 'desc' => __('Choose a primary color', 'tutor'),
1293 ),
1294 array(
1295 'key' => 'tutor_primary_hover_color',
1296 'type' => 'color_field',
1297 'preset_name' => 'hover',
1298 'preset_exist' => true,
1299 'label' => __('Primary Hover Color', 'tutor'),
1300 'default' => '#395BCA',
1301 'desc' => __('Choose a primary hover color', 'tutor'),
1302 ),
1303 array(
1304 'key' => 'tutor_text_color',
1305 'type' => 'color_field',
1306 'preset_name' => 'text',
1307 'preset_exist' => true,
1308 'label' => __('Text Color', 'tutor'),
1309 'default' => '#212327',
1310 'desc' => __('Choose a text color for your website', 'tutor'),
1311 ),
1312 array(
1313 'key' => 'tutor_gray_color',
1314 'type' => 'color_field',
1315 'preset_name' => 'gray',
1316 'preset_exist' => false,
1317 'label' => __('Gray', 'tutor'),
1318 'default' => '#E3E5EB',
1319 'desc' => __('Choose a color for elements like table, card etc', 'tutor'),
1320 ),
1321 array(
1322 'key' => 'tutor_border_color',
1323 'type' => 'color_field',
1324 'preset_name' => 'border',
1325 'preset_exist' => false,
1326 'label' => __('Border', 'tutor'),
1327 'default' => '#CDCFD5',
1328 'desc' => __('Choose a border color for your website', 'tutor'),
1329 ),
1330 ),
1331 ),
1332 ),
1333 ),
1334 'video_player' => array(
1335 'label' => __('Video Player', 'tutor'),
1336 'slug' => 'video_player',
1337 'block_type' => 'uniform',
1338 'fields' => array(
1339 array(
1340 'key' => 'disable_default_player_youtube',
1341 'type' => 'toggle_switch',
1342 'label' => __('Use Tutor Player for YouTube', 'tutor'),
1343 'label_title' => __('', 'tutor'),
1344 'default' => 'off',
1345 'desc' => __('Enable this option to use Tutor LMS video player for YouTube.', 'tutor'),
1346 ),
1347 array(
1348 'key' => 'disable_default_player_vimeo',
1349 'type' => 'toggle_switch',
1350 'label' => __('Use Tutor Player for Vimeo', 'tutor'),
1351 'label_title' => __('', 'tutor'),
1352 'default' => 'off',
1353 'desc' => __('Enable this option to use Tutor LMS video player for Vimeo.', 'tutor'),
1354 ),
1355 ),
1356 ),
1357 ),
1358 ),
1359 'advanced' => array(
1360 'label' => __('Advanced', 'tutor'),
1361 'slug' => 'advanced',
1362 'desc' => __('Advanced Settings', 'tutor'),
1363 'template' => 'basic',
1364 'icon' => 'tutor-icon-filter',
1365 'blocks' => array(
1366 array(
1367 'label' => __('Course', 'tutor'),
1368 'slug' => 'options',
1369 'block_type' => 'uniform',
1370 'fields' => array(
1371 array(
1372 'key' => 'enable_gutenberg_course_edit',
1373 'type' => 'toggle_switch',
1374 'label' => __('Gutenberg Editor', 'tutor'),
1375 'default' => 'off',
1376 'desc' => __('Enable this to create courses using the Gutenberg Editor.', 'tutor'),
1377 ),
1378 array(
1379 'key' => 'hide_course_from_shop_page',
1380 'type' => 'toggle_switch',
1381 'label' => __('Hide Course Products on Shop Page', 'tutor'),
1382 'default' => 'off',
1383 'desc' => __('Enable to hide course products on shop page.', 'tutor'),
1384 ),
1385 array(
1386 'key' => 'course_archive_page',
1387 'type' => 'select',
1388 'label' => __('Course Archive Page', 'tutor'),
1389 'default' => $course_archive_page_id->ID ?? '0',
1390 'options' => $pages,
1391 'desc' => __('This page will be used to list all the published courses.', 'tutor'),
1392 ),
1393 array(
1394 'key' => 'instructor_register_page',
1395 'type' => 'select',
1396 'label' => __('Instructor Registration Page', 'tutor'),
1397 'default' => '0',
1398 'options' => $pages,
1399 'desc' => __('Choose the page for instructor registration.', 'tutor'),
1400 ),
1401 array(
1402 'key' => 'student_register_page',
1403 'type' => 'select',
1404 'label' => __('Student Registration Page', 'tutor'),
1405 'default' => '0',
1406 'options' => $pages,
1407 'desc' => __('Choose the page for student registration.', 'tutor'),
1408 ),
1409 // TODO
1410 // array(
1411 // 'key' => 'course_permalink_base',
1412 // 'type' => 'text',
1413 // 'label' => __('Course Permalink Base', 'tutor'),
1414 // 'default' => tutor()->course_post_type,
1415 // 'desc' => $course_url,
1416 // ),
1417 array(
1418 'key' => 'lesson_permalink_base',
1419 'type' => 'text',
1420 'label' => __('Lesson Permalink Base', 'tutor'),
1421 'default' => 'lessons',
1422 'desc' => $lesson_url,
1423 ),
1424 array(
1425 'key' => 'lesson_video_duration_youtube_api_key',
1426 'type' => 'text',
1427 'label' => __('Youtube API Key', 'tutor'),
1428 'default' => '',
1429 'desc' => __('Insert the YouTube API key to host live videos using YouTube.', 'tutor'),
1430 ),
1431 ),
1432 ),
1433 array(
1434 'label' => __('Options', 'tutor'),
1435 'slug' => 'options',
1436 'block_type' => 'uniform',
1437 'fields' => array(
1438 array(
1439 'key' => 'enable_profile_completion',
1440 'type' => 'toggle_switch',
1441 'label' => __('Profile Completion', 'tutor'),
1442 'label_title' => __('', 'tutor'),
1443 'default' => 'off',
1444 'desc' => __('Enabling this feature will show a notification bar to students and instructors to complete their profile information', 'tutor'),
1445 ),
1446 array(
1447 'key' => 'enable_tutor_native_login',
1448 'type' => 'toggle_switch',
1449 'label' => __('Enable Tutor Login', 'tutor'),
1450 'label_title' => __('', 'tutor'),
1451 'default' => 'on',
1452 'desc' => __('Enable to use the tutor login modal instead of the default WordPress login page', 'tutor'),
1453 ),
1454 array(
1455 'key' => 'delete_on_uninstall',
1456 'type' => 'toggle_switch',
1457 'label' => __('Erase upon uninstallation', 'tutor'),
1458 'label_title' => __('', 'tutor'),
1459 'default' => 'off',
1460 'desc' => __('Delete all data during uninstallation', 'tutor'),
1461 ),
1462 array(
1463 'key' => 'enable_tutor_maintenance_mode',
1464 'type' => 'toggle_switch',
1465 'label' => __('Maintenance Mode', 'tutor'),
1466 'label_title' => __('', 'tutor'),
1467 'default' => 'off',
1468 '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'),
1469 ),
1470 ),
1471 ),
1472 ),
1473 ),
1474 );
1475
1476 $attrs = apply_filters('tutor/options/extend/attr', apply_filters('tutor/options/attr', $attr));
1477
1478 // Get the active tab
1479 $tab_page = tutor_utils()->array_get('tab_page', $_REQUEST, 'general');
1480 $tab_data = null;
1481 $template = null;
1482
1483 foreach ($attrs as $key => $section) {
1484 if ($tab_page == $key) {
1485 if (isset($section['template_path']) && $section['template_path']) {
1486 $template = $section['template_path'];
1487 $tab_data = $section;
1488 }
1489 break;
1490 }
1491 }
1492
1493 // Store in runtime cache
1494 $this->setting_fields = array(
1495 'option_fields' => $attrs,
1496 'active_tab' => $tab_page,
1497 'active_tab_data' => $tab_data,
1498 'template_path' => $template,
1499 );
1500
1501 return $this->setting_fields;
1502 }
1503
1504 /**
1505 * @param array $field
1506 *
1507 * @return string
1508 *
1509 * Generate Option Field
1510 */
1511 public function generate_field($field = array())
1512 {
1513 ob_start();
1514 if (isset($field['type'])) {
1515 include tutor()->path . "views/options/field-types/{$field['type']}.php";
1516 }
1517 echo ob_get_clean();
1518 }
1519
1520 public function field_type($field = array())
1521 {
1522 ob_start();
1523 if (isset($field['type'])) {
1524 include tutor()->path . "views/options/field-types/{$field['type']}.php";
1525 }
1526 return ob_get_clean();
1527 }
1528
1529 public function blocks($blocks = array())
1530 {
1531 ob_start();
1532 include tutor()->path . 'views/options/option_blocks.php';
1533 return ob_get_clean();
1534 }
1535
1536 public function template($section = array())
1537 {
1538 ob_start();
1539 $blocks = $section['blocks'];
1540 if (isset($section['template'])) {
1541 include tutor()->path . "views/options/template/{$section['template']}.php";
1542 }
1543 return ob_get_clean();
1544 }
1545
1546 /**
1547 * Load template inside template dirctory
1548 *
1549 * @param mixed $template_slug
1550 * @param mixed $section
1551 * @return void
1552 */
1553 public function view_template($template_slug, $section = array())
1554 {
1555 ob_start();
1556 if (isset($template_slug)) {
1557 require tutor()->path . "views/options/template/{$template_slug}";
1558 }
1559 return ob_get_clean();
1560 }
1561 }
1562