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