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