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