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