PluginProbe
Tutor LMS – eLearning and online course solution / 2.2.1
Tutor LMS – eLearning and online course solution v2.2.1
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
← All changes | classes/Options_V2.php +469 -743 trunk2.2.1 View file →
@@ -9,14 +9,14 @@
9 9 */
10 10
11 11 namespace Tutor;
12 12
13 -defined( 'ABSPATH' ) || exit;
13 +use TUTOR\Admin;
14 +use TUTOR\Input;
14 15
15 -use TUTOR\Input;
16 -use Tutor\Traits\JsonResponse;
17 -use Tutor\Ecommerce\OptionKeys;
18 -use TUTOR\User;
16 +if ( ! defined( 'ABSPATH' ) ) {
17 + exit;
18 +}
19 19
20 20 /**
21 21 * Contains all the settings options
22 22 *
@@ -23,36 +23,9 @@
23 23 * @since 2.0.0
24 24 */
25 25 class Options_V2 {
26 26
27 - use JsonResponse;
28 -
29 27 /**
30 - * Learning modes.
31 - *
32 - * @since 4.0.0
33 - */
34 - const LEARNING_MODE_MODERN = 'modern';
35 - const LEARNING_MODE_KIDS = 'kids';
36 - const LEARNING_MODE_LEGACY = 'legacy';
37 -
38 - /**
39 - * Default theme.
40 - *
41 - * @since 4.0.0
42 - */
43 - const DEFAULT_THEME_LIGHT = 'light';
44 - const DEFAULT_THEME_DARK = 'dark';
45 - const DEFAULT_THEME_SYSTEM = 'system';
46 -
47 - /**
48 - * Brand color.
49 - *
50 - * @since 4.0.0
51 - */
52 - const DEFAULT_BRAND_COLOR = '#3e64de';
53 -
54 - /**
55 28 * Undocumented variable
56 29 *
57 30 * @since 2.0.0
58 31 *
@@ -83,9 +56,8 @@
83 56 return;
84 57 }
85 58
86 59 // Saving option.
87 - add_action( 'tutor_option_save_before', array( $this, 'validate_options' ) );
88 60 add_action( 'wp_ajax_tutor_option_save', array( $this, 'tutor_option_save' ) );
89 61 add_action( 'wp_ajax_tutor_option_default_save', array( $this, 'tutor_option_default_save' ) );
90 62 add_action( 'wp_ajax_tutor_option_search', array( $this, 'tutor_option_search' ) );
91 63 add_action( 'wp_ajax_tutor_export_settings', array( $this, 'tutor_export_settings' ) );
@@ -94,9 +66,8 @@
94 66 add_action( 'wp_ajax_tutor_import_settings', array( $this, 'tutor_import_settings' ) );
95 67 add_action( 'wp_ajax_tutor_apply_settings', array( $this, 'tutor_apply_settings' ) );
96 68 add_action( 'wp_ajax_load_saved_data', array( $this, 'load_saved_data' ) );
97 69 add_action( 'wp_ajax_reset_settings_data', array( $this, 'reset_settings_data' ) );
98 - add_action( 'tutor_option_monetize_by_changed', array( $this, 'handle_changed_monetization_option' ) );
99 70 }
100 71
101 72 /**
102 73 * Get settings value
@@ -147,41 +118,8 @@
147 118 return $default;
148 119 }
149 120
150 121 /**
151 - * Get only list of options.
152 - *
153 - * @since 3.0.0
154 - *
155 - * @param array $only only options.
156 - *
157 - * @return array
158 - */
159 - public static function get_only( $only = array() ) {
160 - $settings = get_option( 'tutor_option', array() );
161 - return array_intersect_key( $settings, array_flip( $only ) );
162 - }
163 -
164 - /**
165 - * Prepare settings search item.
166 - *
167 - * @since 3.0.0
168 - *
169 - * @param array $section section item.
170 - * @param array $block block item.
171 - * @param array $field field item.
172 - *
173 - * @return array prepared searchable field item.
174 - */
175 - private function prepare_search_item( $section, $block, $field ) {
176 - $field['section_label'] = isset( $section['label'] ) ? $section['label'] : '';
177 - $field['section_slug'] = isset( $section['slug'] ) ? $section['slug'] : '';
178 - $field['block_label'] = isset( $block['label'] ) ? $block['label'] : '';
179 -
180 - return $field;
181 - }
182 -
183 - /**
184 122 * Function to get all fields for search tutor_option_search
185 123 *
186 124 * @since 2.0.0
187 125 *
@@ -187,42 +125,24 @@
187 125 *
188 126 * @return void send wp_json response
189 127 */
190 128 public function tutor_option_search() {
191 - tutor_utils()->checking_nonce();
129 + tutor_utils()->checking_nonce();
192 130
193 - if ( ! User::is_admin() ) {
194 - wp_send_json_error( tutor_utils()->error_message() );
195 - }
196 -
197 131 $data_array = array();
198 132 foreach ( $this->get_setting_fields() as $sections ) {
199 133 if ( is_array( $sections ) && ! empty( $sections ) ) {
200 - foreach ( Input::sanitize_array( $sections ) as $section ) {
134 + foreach ( tutils()->sanitize_recursively( $sections ) as $section ) {
201 135 foreach ( $section['blocks'] as $blocks ) {
202 136 if ( isset( $blocks['fields'] ) && ! empty( $blocks['fields'] ) ) {
203 137 foreach ( $blocks['fields'] as $fields ) {
204 - $data_array['fields'][] = $this->prepare_search_item( $section, $blocks, $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;
205 142 }
206 143 }
207 144 }
208 -
209 - /**
210 - * Submenu item search.
211 - *
212 - * @since 3.0.0
213 - */
214 - if ( isset( $section['submenu'] ) && is_array( $section['submenu'] ) ) {
215 - foreach ( Input::sanitize_array( $section['submenu'] ) as $submenu_section ) {
216 - foreach ( $submenu_section['blocks'] as $block ) {
217 - if ( isset( $block['fields'] ) && ! empty( $block['fields'] ) ) {
218 - foreach ( $block['fields'] as $fields ) {
219 - $data_array['fields'][] = $this->prepare_search_item( $submenu_section, $block, $fields );
220 - }
221 - }
222 - }
223 - }
224 - }
225 145 }
226 146 }
227 147 }
228 148
@@ -236,38 +156,15 @@
236 156 *
237 157 * @return void send wp_json response
238 158 */
239 159 public function tutor_export_settings() {
240 - tutor_utils()->checking_nonce();
241 -
242 - if ( ! User::is_admin() ) {
160 + // Check if user is privileged.
161 + if ( ! current_user_can( 'administrator' ) ) {
243 162 wp_send_json_error( tutor_utils()->error_message() );
244 163 }
245 164
246 165 $tutor_option = get_option( 'tutor_option' );
247 - $data = maybe_unserialize( $tutor_option );
248 -
249 - $export_data = $this->get_export_json_schema();
250 -
251 - $prepare_data = array(
252 - 'content_type' => 'settings',
253 - 'data' => $data,
254 - );
255 -
256 - $export_data['data'][] = $prepare_data;
257 -
258 - $response = array(
259 - 'job_progress' => '100',
260 - 'exported_data' => $export_data,
261 - 'completed_contents' => array(
262 - 'settings' => true,
263 - ),
264 - );
265 -
266 - // Update settings log.
267 - $this->update_settings_log( $data, 'Exported' );
268 -
269 - $this->json_response( __( 'Settings exported successfully', 'tutor' ), $response );
166 + wp_send_json_success( maybe_unserialize( $tutor_option ) );
270 167 }
271 168
272 169 /**
273 170 * Export single settings
@@ -277,27 +174,16 @@
277 174 * @return void send wp_json response
278 175 */
279 176 public function tutor_export_single_settings() {
280 177
281 - tutor_utils()->checking_nonce();
282 -
283 178 // Check if user is privileged.
284 - if ( ! User::is_admin() ) {
179 + if ( ! current_user_can( 'administrator' ) ) {
285 180 wp_send_json_error( tutor_utils()->error_message() );
286 181 }
287 182
288 183 $tutor_settings_log = get_option( 'tutor_settings_log' );
289 184 $export_id = $this->get_request_data( 'export_id' );
290 -
291 - $export_data = $this->get_export_json_schema();
292 -
293 - $prepare_data = array(
294 - 'content_type' => 'settings',
295 - 'data' => $tutor_settings_log[ $export_id ]['dataset'],
296 - );
297 -
298 - $export_data['data'][] = $prepare_data;
299 - wp_send_json_success( $export_data );
185 + wp_send_json_success( $tutor_settings_log[ $export_id ] );
300 186 }
301 187
302 188 /**
303 189 * Apply settings
@@ -307,12 +193,10 @@
307 193 * @return void send wp_json response
308 194 */
309 195 public function tutor_apply_settings() {
310 196
311 - tutor_utils()->checking_nonce();
312 -
313 197 // Check if user is privileged.
314 - if ( ! User::is_admin() ) {
198 + if ( ! current_user_can( 'administrator' ) ) {
315 199 wp_send_json_error( tutor_utils()->error_message() );
316 200 }
317 201
318 202 $tutor_settings_log = get_option( 'tutor_settings_log' );
@@ -330,13 +214,10 @@
330 214 *
331 215 * @return void send wp_json response
332 216 */
333 217 public function tutor_delete_single_settings() {
334 -
335 - tutor_utils()->checking_nonce();
336 -
337 218 // Check if user is privileged.
338 - if ( ! User::is_admin() ) {
219 + if ( ! current_user_can( 'administrator' ) ) {
339 220 wp_send_json_error( tutor_utils()->error_message() );
340 221 }
341 222
342 223 $tutor_settings_log = get_option( 'tutor_settings_log' );
@@ -341,9 +222,9 @@
341 222
342 223 $tutor_settings_log = get_option( 'tutor_settings_log' );
343 224 $delete_id = $this->get_request_data( 'delete_id' );
344 225 unset( $tutor_settings_log[ $delete_id ] );
345 - update_option( 'tutor_settings_log', $tutor_settings_log, false );
226 + update_option( 'tutor_settings_log', $tutor_settings_log );
346 227
347 228 wp_send_json_success( $tutor_settings_log );
348 229 }
349 230
@@ -360,8 +241,37 @@
360 241 return isset( $_REQUEST[ $var ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $var ] ) ) : null;
361 242 }
362 243
363 244 /**
245 + * Tutor default settings update options
246 + * and send json response
247 + *
248 + * @since 2.0.0
249 + *
250 + * @return void send wp_json response
251 + */
252 + public function tutor_default_settings() {
253 + $attr = $this->get_setting_fields();
254 +
255 + foreach ( $attr as $sections ) {
256 +
257 + foreach ( $sections as $section ) {
258 + foreach ( $section['blocks'] as $blocks ) {
259 + foreach ( $blocks['fields'] as $field ) {
260 + if ( isset( $field['default'] ) ) {
261 + $attr_default[ $field['key'] ] = $field['default'];
262 + }
263 + }
264 + }
265 + }
266 + }
267 +
268 + update_option( 'tutor_option', $attr_default );
269 +
270 + wp_send_json_success( $attr_default );
271 + }
272 +
273 + /**
364 274 * Tutor settings log
365 275 *
366 276 * @since 2.0.0
367 277 *
@@ -370,9 +280,9 @@
370 280 public function load_saved_data() {
371 281 tutor_utils()->checking_nonce();
372 282
373 283 // Check if user is privileged.
374 - if ( ! User::is_admin() ) {
284 + if ( ! current_user_can( 'administrator' ) ) {
375 285 wp_send_json_error( tutor_utils()->error_message() );
376 286 }
377 287
378 288 wp_send_json_success( get_option( 'tutor_settings_log' ) );
@@ -388,13 +298,13 @@
388 298 public function reset_settings_data() {
389 299 tutor_utils()->checking_nonce();
390 300
391 301 // Check if user is privileged.
392 - if ( ! User::is_admin() ) {
302 + if ( ! current_user_can( 'administrator' ) ) {
393 303 wp_send_json_error( tutor_utils()->error_message() );
394 304 }
395 305
396 - $reset_fields = $return_fields = $return_fields_group = array(); //phpcs:ignore
306 + $reset_fields = $return_fields = $return_fields_group = array();
397 307 $reset_page = Input::post( 'reset_page' );
398 308 $setting_data = $this->get_setting_fields()['option_fields'][ $reset_page ]['blocks'];
399 309
400 310 foreach ( $setting_data as $blocks ) {
@@ -425,88 +335,57 @@
425 335 public function tutor_import_settings() {
426 336 tutor_utils()->checking_nonce();
427 337
428 338 // Check if user is privileged.
429 - if ( ! User::is_admin() ) {
339 + if ( ! current_user_can( 'administrator' ) ) {
430 340 wp_send_json_error( tutor_utils()->error_message() );
431 341 }
432 342
433 - //phpcs:ignore
434 - $data = $_FILES['data'];
343 + $request = $this->get_request_data( 'tutor_options' );
344 + $request = json_decode( stripslashes( $request ), true );
435 345
436 - if ( ! isset( $data['tmp_name'] ) ) {
437 - $this->response_bad_request( __( 'Invalid file', 'tutor' ) );
346 + $time = $this->get_request_data( 'time' );
347 +
348 + $save_import_data['datetime'] = (int) $time;
349 + $save_import_data['history_date'] = gmdate( 'j M, Y, g:i a', $time );
350 + $save_import_data['datatype'] = 'imported';
351 + $save_import_data['dataset'] = $request['data'];
352 + $import_data[ 'tutor-imported-' . $time ] = $save_import_data;
353 +
354 + $get_option_data = get_option( 'tutor_settings_log' );
355 + if ( empty( $get_option_data ) ) {
356 + $get_option_data = array();
438 357 }
358 + if ( ! empty( $get_option_data ) && null !== $save_import_data['dataset'] ) {
439 359
440 - $request = json_decode( file_get_contents( $data['tmp_name'] ), true );
360 + $update_option = array_merge( $import_data, $get_option_data );
441 361
442 - unlink( $data['tmp_name'] );
362 + $update_option = tutor_utils()->sanitize_recursively( $update_option );
443 363
444 - $settings_found = false;
364 + if ( ! empty( $update_option ) ) {
365 + update_option( 'tutor_settings_log', $update_option );
366 + }
445 367
446 - if ( json_last_error() ) {
447 - $this->response_bad_request( __( 'Invalid json file', 'tutor' ) );
448 - }
368 + if ( ! empty( $save_import_data ) ) {
369 + update_option( 'tutor_option', $save_import_data['dataset'] );
370 + }
449 371
450 - if ( ! isset( $request['data'] ) ) {
451 - $this->response_bad_request( __( 'Data not found or invalid', 'tutor' ) );
452 - }
372 + $get_final_data = get_option( 'tutor_settings_log' );
373 + } else {
374 + if ( ! empty( $import_data ) ) {
375 + update_option( 'tutor_settings_log', $import_data );
376 + }
453 377
454 - if ( is_array( $request['data'] ) && count( $request['data'] ) ) {
455 - foreach ( $request['data'] as $content ) {
456 - if ( isset( $content['content_type'] ) && 'settings' === $content['content_type'] ) {
457 - $settings_found = true;
458 - }
378 + if ( ! empty( $save_import_data ) ) {
379 + update_option( 'tutor_option', $save_import_data['dataset'] );
459 380 }
381 + $get_final_data = get_option( 'tutor_settings_log' );
460 382 }
461 383
462 - if ( ! $settings_found ) {
463 - $this->response_bad_request( __( 'Settings not found', 'tutor' ) );
464 - }
465 -
466 - $settings_data = is_array( $request ) && isset( $request['data'] ) ? $request['data'][0]['data'] : array();
467 - $update_settings = $this->update_settings_log( $settings_data, 'Imported' );
468 -
469 - $response = array(
470 - 'job_progress' => '100',
471 - 'exported_data' => $update_settings,
472 - );
473 -
474 - $this->json_response( __( 'Settings imported successfully!', 'tutor' ), $response );
384 + wp_send_json_success( $get_final_data );
475 385 }
476 386
477 - /**
478 - * Validate options before save.
479 - *
480 - * @since 2.8.0
481 - *
482 - * @param array $options option submitted to save.
483 - *
484 - * @return void
485 - */
486 - public function validate_options( $options ) {
487 - $success = true;
488 - $message = '';
489 387
490 - $enable_sharing = $options['enable_revenue_sharing'] ?? 'off';
491 - $admin_commission = (int) $options['earning_admin_commission'] ?? 0;
492 - $instructor_commission = (int) $options['earning_instructor_commission'] ?? 0;
493 -
494 - if ( 'on' === $enable_sharing && ( $admin_commission + $instructor_commission ) > 100 ) {
495 - $success = false;
496 - $message = __( 'Total share percentage must be 100% or less', 'tutor' );
497 - }
498 -
499 - if ( ! $success ) {
500 - wp_send_json(
501 - array(
502 - 'success' => $success,
503 - 'message' => $message,
504 - )
505 - );
506 - }
507 - }
508 -
509 388 /**
510 389 * Function tutor_option_save
511 390 *
512 391 * @since 2.0.0
@@ -513,39 +392,25 @@
513 392 *
514 393 * @return void send wp_json response
515 394 */
516 395 public function tutor_option_save() {
396 + global $wpdb;
517 397 tutor_utils()->checking_nonce();
518 398
519 - if ( ! User::is_admin() ) {
520 - wp_send_json_error( tutor_utils()->error_message() );
521 - }
399 + ! current_user_can( 'manage_options' ) ? wp_send_json_error() : 0;
522 400
523 - $data_before = get_option( 'tutor_option' );
524 - $login_page_id = 0;
401 + do_action( 'tutor_option_save_before' );
525 402
526 - if ( isset( $data_before['tutor_login_page'] ) ) {
527 - $login_page_id = $data_before['tutor_login_page'];
528 - }
403 + $option = (array) tutor_utils()->array_get( 'tutor_option', $_POST, array() );
529 404
530 - $option = (array) tutor_utils()->array_get( 'tutor_option', $_POST, array() ); //phpcs:ignore
405 + $option = tutor_utils()->sanitize_recursively( $option, array( 'email_footer_text' ) );
531 406
532 - do_action( 'tutor_option_save_before', $option );
407 + $old_dashboard_id = get_tutor_option( 'tutor_dashboard_page_id' );
408 + $dashboard_update_id = isset( $option['tutor_dashboard_page_id'] ) && null !== $option['tutor_dashboard_page_id'] ? $option['tutor_dashboard_page_id'] : null;
409 + $email_footer_text = json_encode( wp_unslash( $option['email_footer_text'] ) );
533 410
534 - if ( ! isset( $option['tutor_login_page'] ) ) {
535 - $option['tutor_login_page'] = $login_page_id ?? 0;
536 - }
411 + $option['email_footer_text'] = ! empty( $option['email_footer_text'] ) ? $email_footer_text : '';
537 412
538 - $option = Input::sanitize_array(
539 - $option,
540 - array(
541 - 'payment_settings' => 'wp_kses_post',
542 - 'tutor_bank_transfer_withdraw_instruction' => 'sanitize_textarea_field',
543 - 'certificate_showcase_desc' => 'sanitize_textarea_field',
544 - 'invoice_from_address' => 'sanitize_textarea_field',
545 - 'fees_name' => 'sanitize_textarea_field',
546 - )
547 - );
548 413 $option = apply_filters( 'tutor_option_input', $option );
549 414
550 415 $time = strtotime( 'now' ) + ( 6 * 60 * 60 );
551 416 $save_import_data['datetime'] = $time;
@@ -563,61 +428,18 @@
563 428 }
564 429
565 430 $update_option = array_slice( $update_option, 0, 10 );
566 431
567 - update_option( 'tutor_settings_log', $update_option, false );
432 + update_option( 'tutor_settings_log', $update_option );
568 433 update_option( 'tutor_option', $option );
569 434 update_option( 'tutor_option_update_time', gmdate( 'j M, Y, g:i a', $time ) );
570 435
571 - /**
572 - * Hook for each tutor settings option change detection.
573 - * Example: `tutor_option_{course_permalink_base}_changed`
574 - *
575 - * @since 2.6.0
576 - */
577 - $data_after = get_option( 'tutor_option' );
578 - if ( $data_before !== $data_after && is_array( $data_after ) ) {
579 - foreach ( $data_after as $key => $value ) {
580 - $from = $data_before[ $key ] ?? null;
581 - $to = $value;
582 - if ( $from !== $to ) {
583 - do_action( "tutor_option_{$key}_changed", $from, $to );
584 - }
585 - }
586 - }
587 -
588 436 do_action( 'tutor_option_save_after' );
589 437
590 - $data = apply_filters(
591 - 'tutor_option_saved_data',
592 - array(
593 - 'success' => true,
594 - 'message' => __( 'Settings Saved', 'tutor' ),
595 - 'options' => $option,
596 - )
597 - );
598 -
599 - wp_send_json( $data );
438 + wp_send_json_success( $option );
600 439 }
601 440
602 441 /**
603 - * Handle monetization option value change.
604 - *
605 - * @since 3.0.0
606 - *
607 - * @return void
608 - */
609 - public function handle_changed_monetization_option() {
610 - add_filter(
611 - 'tutor_option_saved_data',
612 - function ( $res ) {
613 - $res['reload_required'] = true;
614 - return $res;
615 - }
616 - );
617 - }
618 -
619 - /**
620 442 * Function tutor_option_save
621 443 *
622 444 * @since 2.0.0
623 445 *
@@ -625,29 +447,22 @@
625 447 */
626 448 public function tutor_option_default_save() {
627 449 tutor_utils()->checking_nonce();
628 450
629 - if ( ! User::is_admin() ) {
630 - wp_send_json_error( tutor_utils()->error_message() );
631 - }
632 -
451 + ! current_user_can( 'manage_options' ) ? wp_send_json_error() : 0;
633 452 $attr = $this->get_setting_fields();
634 453 $tutor_default_option = get_option( 'tutor_default_option' );
635 454 $tutor_saved_option = get_option( 'tutor_option' );
636 455
637 456 foreach ( $attr as $sections ) {
638 - if ( is_array( $sections ) && count( $sections ) ) {
639 - foreach ( $sections as $section ) {
640 - foreach ( $section['blocks'] as $blocks ) {
641 - if ( isset( $blocks['fields'] ) ) {
642 - foreach ( $blocks['fields'] as $field ) {
643 - if ( isset( $field['key'] ) ) {
644 - if ( isset( $tutor_default_option[ $field['key'] ] ) ) {
645 - $attr_default[ $field['key'] ] = $tutor_saved_option[ $field['key'] ];
646 - } else {
647 - $attr_default[ $field['key'] ] = $field['default'] ?? '';
648 - }
649 - }
457 + foreach ( $sections as $section ) {
458 + foreach ( $section['blocks'] as $blocks ) {
459 + foreach ( $blocks['fields'] as $field ) {
460 + if ( isset( $tutor_default_option[ $field['key'] ] ) ) {
461 + $attr_default[ $field['key'] ] = $tutor_saved_option[ $field['key'] ];
462 + } else {
463 + if ( null !== $field['key'] ) {
464 + $attr_default[ $field['key'] ] = $field['default'];
650 465 }
651 466 }
652 467 }
653 468 }
@@ -666,9 +481,9 @@
666 481 *
667 482 * @return void
668 483 */
669 484 public function load_settings_page() {
670 - extract( $this->get_setting_fields() ); //phpcs:ignore
485 + extract( $this->get_setting_fields() );
671 486
672 487 if ( ! $template_path ) {
673 488 $template_path = tutor()->path . '/views/options/settings.php';
674 489 }
@@ -689,18 +504,14 @@
689 504 }
690 505
691 506 $pages = tutor_utils()->get_pages();
692 507
693 - $site_url = site_url();
694 - $course_base = $this->get( 'course_permalink_base', 'courses' );
695 508 $lesson_key = $this->get( 'lesson_permalink_base', 'lessons' );
696 - $quiz_key = $this->get( 'quiz_permalink_base', 'quizzes' );
509 + $course_base = tutor_utils()->get_option( 'course_permalink_base', tutor()->course_post_type );
510 + $course_url = site_url() . '/<code>' . $course_base . '</code>/sample-course';
511 + $lesson_url = site_url() . '/' . $course_base . '/' . 'sample-course/<code>' . $lesson_key . '</code>/sample-lesson/';
512 + $student_url = tutor_utils()->profile_url( 0, false );
697 513
698 - $course_url = $site_url . '/<code>' . $course_base . '</code>/sample-course';
699 - $lesson_url = $site_url . '/' . $course_base . '/sample-course/<code>' . $lesson_key . '</code>/sample-lesson/';
700 - $quiz_url = $site_url . '/' . $course_base . '/sample-course/<code>' . $quiz_key . '</code>/sample-quiz/';
701 -
702 - $student_url = tutor_utils()->profile_url( 0, false );
703 514 $methods_array = array();
704 515 $withdrawl_methods = apply_filters( 'tutor_withdrawal_methods_all', array() );
705 516
706 517 foreach ( $withdrawl_methods as $key => $method ) {
@@ -717,9 +528,9 @@
717 528 $page_posts = get_posts( $page_args );
718 529 $course_archive_page_id = ( is_array( $page_posts ) && count( $page_posts ) ) ? $page_posts[0] : null;
719 530
720 531 $attr = array(
721 - 'general' => array(
532 + 'general' => array(
722 533 'label' => __( 'General', 'tutor' ),
723 534 'slug' => 'general',
724 535 'desc' => __( 'General Settings', 'tutor' ),
725 536 'template' => 'basic',
@@ -730,15 +541,14 @@
730 541 'block_type' => 'uniform',
731 542 'slug' => 'general-page',
732 543 'fields' => array(
733 544 array(
734 - 'key' => 'tutor_dashboard_page_id',
735 - 'type' => 'select',
736 - 'label' => __( 'Dashboard Page', 'tutor' ),
737 - 'default' => '0',
738 - 'options' => $pages,
739 - 'desc' => __( 'This page will be used for student and instructor dashboard', 'tutor' ),
740 - 'searchable' => true,
545 + 'key' => 'tutor_dashboard_page_id',
546 + 'type' => 'select',
547 + 'label' => __( 'Dashboard Page', 'tutor' ),
548 + 'default' => '0',
549 + 'options' => $pages,
550 + 'desc' => __( 'This page will be used for student and instructor dashboard', 'tutor' ),
741 551 ),
742 552 ),
743 553 ),
744 554 array(
@@ -746,25 +556,15 @@
746 556 'block_type' => 'uniform',
747 557 'slug' => 'general-page',
748 558 'fields' => array(
749 559 array(
750 - 'key' => 'tutor_toc_page_id',
751 - 'type' => 'select',
752 - 'label' => __( 'Terms and Conditions Page', 'tutor' ),
753 - 'default' => '0',
754 - 'options' => $pages,
755 - 'desc' => __( 'This page will be used as the Terms and Conditions page', 'tutor' ),
756 - 'searchable' => true,
560 + 'key' => 'tutor_toc_page_id',
561 + 'type' => 'select',
562 + 'label' => __( 'Terms and Conditions Page', 'tutor' ),
563 + 'default' => '0',
564 + 'options' => $pages,
565 + 'desc' => __( 'This page will be used as the Terms and Conditions page', 'tutor' ),
757 566 ),
758 - array(
759 - 'key' => OptionKeys::PRIVACY_POLICY,
760 - 'type' => 'select',
761 - 'label' => __( 'Privacy Policy', 'tutor' ),
762 - 'default' => 0,
763 - 'options' => $pages,
764 - 'desc' => __( 'Choose the page for privacy policy.', 'tutor' ),
765 - 'searchable' => true,
766 - ),
767 567 ),
768 568 ),
769 569 array(
770 570 'label' => __( 'Others', 'tutor' ),
@@ -776,17 +576,16 @@
776 576 'type' => 'toggle_switch',
777 577 'label' => __( 'Enable Marketplace', 'tutor' ),
778 578 'label_title' => '',
779 579 'default' => 'off',
780 - 'desc' => __( 'Allow multiple instructors to sell their courses.', 'tutor' ),
580 + 'desc' => __( 'Allow multiple instructors to upload their courses.', 'tutor' ),
781 581 ),
782 582 array(
783 - 'key' => 'pagination_per_page',
784 - 'type' => 'number',
785 - 'number_type' => 'integer',
786 - 'label' => __( 'Pagination', 'tutor' ),
787 - 'default' => '20',
788 - 'desc' => __( 'Set the number of rows to be displayed per page', 'tutor' ),
583 + 'key' => 'pagination_per_page',
584 + 'type' => 'number',
585 + 'label' => __( 'Pagination', 'tutor' ),
586 + 'default' => '20',
587 + 'desc' => __( 'Set the number of rows to be displayed per page', 'tutor' ),
789 588 ),
790 589 ),
791 590 ),
792 591 array(
@@ -794,36 +593,28 @@
794 593 'slug' => 'instructor',
795 594 'block_type' => 'uniform',
796 595 'fields' => array(
797 596 array(
798 - 'key' => 'enable_become_instructor_btn',
799 - 'type' => 'toggle_switch',
800 - 'label' => __( 'Become an Instructor Button', 'tutor' ),
801 - 'label_title' => '',
802 - 'default' => 'off',
803 - 'desc' => __( 'Enable the option to display this button on the student dashboard.', 'tutor' ),
804 - ),
805 - array(
806 597 'key' => 'instructor_can_publish_course',
807 598 'type' => 'toggle_switch',
808 - 'label' => __( 'Allow Instructors to Publish Courses', 'tutor' ),
599 + 'label' => __( 'Allow Instructors To Publish Courses', 'tutor' ),
809 600 'label_title' => '',
810 601 'default' => 'off',
811 602 'desc' => __( 'Enable instructors to publish the course directly. If disabled, admins will be able to review course content before publishing.', 'tutor' ),
812 603 ),
813 604 array(
814 - 'key' => 'instructor_can_delete_course',
605 + 'key' => 'enable_become_instructor_btn',
815 606 'type' => 'toggle_switch',
816 - 'label' => __( 'Allow Instructors to Trash Courses', 'tutor' ),
607 + 'label' => __( 'Become an Instructor Button', 'tutor' ),
817 608 'label_title' => '',
818 - 'default' => 'on',
819 - 'desc' => __( 'Enable this setting to allow instructors to delete courses.', 'tutor' ),
609 + 'default' => 'off',
610 + 'desc' => __( 'Enable the option to display this button on the student dashboard.', 'tutor' ),
820 611 ),
821 612 ),
822 613 ),
823 614 ),
824 615 ),
825 - 'course' => array(
616 + 'course' => array(
826 617 'label' => __( 'Course', 'tutor' ),
827 618 'slug' => 'course',
828 619 'desc' => __( 'Course Settings', 'tutor' ),
829 620 'template' => 'basic',
@@ -857,11 +648,19 @@
857 648 'default' => 'on',
858 649 'desc' => __( 'Enabling this feature will show a course content summary on the Course Details page.', 'tutor' ),
859 650 ),
860 651 array(
652 + 'key' => 'wc_automatic_order_complete_redirect_to_courses',
653 + 'type' => 'toggle_switch',
654 + 'label' => __( 'Auto redirect to courses', 'tutor' ),
655 + 'default' => 'off',
656 + 'label_title' => '',
657 + 'desc' => __( 'When a user\'s WooCommerce order is auto-completed, they will be redirected to enrolled courses', 'tutor' ),
658 + ),
659 + array(
861 660 'key' => 'enable_spotlight_mode',
862 661 'type' => 'toggle_switch',
863 - 'label' => __( 'Spotlight Mode', 'tutor' ),
662 + 'label' => __( 'Spotlight mode', 'tutor' ),
864 663 'default' => 'off',
865 664 'label_title' => '',
866 665 'desc' => __( 'This will hide the header and the footer and enable spotlight (full screen) mode when students view lessons.', 'tutor' ),
867 666 ),
@@ -867,9 +666,9 @@
867 666 ),
868 667 array(
869 668 'key' => 'auto_course_complete_on_all_lesson_completion',
870 669 'type' => 'toggle_switch',
871 - 'label' => __( 'Auto Complete Course on All Lesson Completion', 'tutor' ),
670 + 'label' => __( 'Auto Complete Course on all Lesson Completion', 'tutor' ),
872 671 'default' => 'off',
873 672 'label_title' => '',
874 673 'desc' => __( 'If enabled, an Enrolled Course will be automatically completed if all its Lessons, Quizzes, and Assignments are already completed by the Student', 'tutor' ),
875 674 ),
@@ -879,16 +678,10 @@
879 678 'label' => __( 'Course Completion Process', 'tutor' ),
880 679 'default' => 'flexible',
881 680 'select_options' => false,
882 681 'options' => array(
883 - 'flexible' => array(
884 - 'label' => __( 'Flexible', 'tutor' ),
885 - 'desc' => __( 'Students can complete courses anytime in the Flexible mode', 'tutor' ),
886 - ),
887 - 'strict' => array(
888 - 'label' => __( 'Strict', 'tutor' ),
889 - 'desc' => __( 'Students must complete all lessons, quizzes, and assignments to mark their courses as complete.', 'tutor' ),
890 - ),
682 + 'flexible' => __( 'Students can complete courses anytime in the Flexible mode', 'tutor' ),
683 + 'strict' => __( 'Students have to complete, pass all the lessons and quizzes (if any) to mark a course as complete.', 'tutor' ),
891 684 ),
892 685 'desc' => __( 'Choose when a user can click on the <strong>“Complete Course”</strong> button', 'tutor' ),
893 686 ),
894 687 array(
@@ -899,16 +692,8 @@
899 692 'label_title' => '',
900 693 'desc' => __( 'Enabling this feature will allow students to reset course progress and start over.', 'tutor' ),
901 694 ),
902 695 array(
903 - 'key' => 'course_reset_progress',
904 - 'type' => 'toggle_switch',
905 - 'label' => __( 'Course Reset Progress', 'tutor' ),
906 - 'default' => 'off',
907 - 'label_title' => '',
908 - 'desc' => __( 'Enabling this feature allows students to reset their progress and start over before completing the course.', 'tutor' ),
909 - ),
910 - array(
911 696 'key' => 'enable_course_review_moderation',
912 697 'type' => 'toggle_switch',
913 698 'label' => __( "Publish Course Review on Admin's Approval", 'tutor' ),
914 699 'default' => 'off',
@@ -916,9 +701,9 @@
916 701 'desc' => __( 'Enable to publish/re-publish Course Review after the approval of Site Admin', 'tutor' ),
917 702 ),
918 703 ),
919 704 ),
920 - 'block_lesson' => array(
705 + array(
921 706 'label' => __( 'Lesson', 'tutor' ),
922 707 'slug' => 'lesson',
923 708 'block_type' => 'uniform',
924 709 'fields' => array(
@@ -959,16 +744,11 @@
959 744 'label' => __( 'When time expires', 'tutor' ),
960 745 'default' => 'auto_abandon',
961 746 'select_options' => false,
962 747 'options' => array(
963 - 'auto_submit' => array(
964 - 'label' => __( 'Auto Submit', 'tutor' ),
965 - 'desc' => __( 'The current quiz answers are submitted automatically.', 'tutor' ),
966 - ),
967 - 'auto_abandon' => array(
968 - 'label' => __( 'Auto Abandon', 'tutor' ),
969 - 'desc' => __( 'Attempts must be submitted before time expires, otherwise they will not be counted.', 'tutor' ),
970 - ),
748 + 'auto_submit' => __( 'The current quiz answers are submitted automatically.', 'tutor' ),
749 + // 'grace_period' => __( 'The current quiz answers are submitted by students.', 'tutor' )
750 + 'auto_abandon' => __( 'Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor' ),
971 751 ),
972 752 'desc' => __( 'Choose which action to follow when the quiz time expires.', 'tutor' ),
973 753 ),
974 754 array(
@@ -973,13 +753,20 @@
973 753 ),
974 754 array(
975 755 'key' => 'quiz_answer_display_time',
976 756 'type' => 'number',
977 - 'label' => __( 'Correct Answer Display Time (When Reveal Mode is enabled)', 'tutor' ),
757 + 'label' => __( 'Correct Answer Display Time (when Reveal Mode is enabled)', 'tutor' ),
978 758 'default' => '2',
979 759 'desc' => __( 'Put the answer display time in seconds', 'tutor' ),
980 760 ),
981 761 array(
762 + 'key' => 'quiz_attempts_allowed',
763 + 'type' => 'number',
764 + 'label' => __( 'Default Quiz Attempt limit (when Retry Mode is enabled)', 'tutor' ),
765 + 'default' => '10',
766 + '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' ),
767 + ),
768 + array(
982 769 'key' => 'quiz_previous_button_enabled',
983 770 'type' => 'toggle_switch',
984 771 'label' => __( 'Show Quiz Previous Button', 'tutor' ),
985 772 'default' => 'on',
@@ -1011,38 +798,22 @@
1011 798 'default' => array( 'youtube', 'vimeo' ),
1012 799 'label' => __( 'Preferred Video Source', 'tutor' ),
1013 800 'label_title' => __( 'Preferred Video Source', 'tutor' ),
1014 801 'options' => tutor_utils()->get_video_sources( true ),
1015 - 'desc' => __( 'Select the video hosting platform(s) you want to enable.', 'tutor' ),
802 + 'desc' => __( 'Choose video sources you\'d like to support.', 'tutor' ),
1016 803 ),
1017 - array(
1018 - 'key' => 'disable_default_player_youtube',
1019 - 'type' => 'toggle_switch',
1020 - 'label' => __( 'Use Tutor Player for YouTube', 'tutor' ),
1021 - 'label_title' => '',
1022 - 'default' => 'off',
1023 - 'desc' => __( 'Enable this option to use Tutor LMS video player for YouTube.', 'tutor' ),
1024 - ),
1025 - array(
1026 - 'key' => 'disable_default_player_vimeo',
1027 - 'type' => 'toggle_switch',
1028 - 'label' => __( 'Use Tutor Player for Vimeo', 'tutor' ),
1029 - 'label_title' => '',
1030 - 'default' => 'off',
1031 - 'desc' => __( 'Enable this option to use Tutor LMS video player for Vimeo.', 'tutor' ),
1032 - ),
1033 804 ),
1034 805 ),
1035 806 ),
1036 807 ),
1037 - 'monetization' => array(
808 + 'monetization' => array(
1038 809 'label' => __( 'Monetization', 'tutor' ),
1039 810 'slug' => 'monetization',
1040 - 'desc' => __( 'Monetization Settings', 'tutor' ),
811 + 'desc' => __( 'Monitization Settings', 'tutor' ),
1041 812 'template' => 'basic',
1042 813 'icon' => 'tutor-icon-badge-discount',
1043 814 'blocks' => array(
1044 - 'block_options' => array(
815 + 'block_options' => array(
1045 816 'label' => __( 'Options', 'tutor' ),
1046 817 'slug' => 'options',
1047 818 'block_type' => 'uniform',
1048 819 'fields' => array(
@@ -1049,9 +820,9 @@
1049 820 array(
1050 821 'key' => 'monetize_by',
1051 822 'type' => 'select',
1052 823 'label' => __( 'Select eCommerce Engine', 'tutor' ),
1053 - 'select_options' => false,
824 + 'select_options' => true,
1054 825 'options' => apply_filters(
1055 826 'tutor_monetization_options',
1056 827 array(
1057 828 'free' => __( 'Disable Monetization', 'tutor' ),
@@ -1057,17 +828,10 @@
1057 828 'free' => __( 'Disable Monetization', 'tutor' ),
1058 829 )
1059 830 ),
1060 831 'default' => 'free',
1061 - 'desc' => __( 'Select a monetization option to generate revenue by selling courses.', 'tutor' ),
832 + 'desc' => __( 'Select a monetization option to generate revenue by selling courses. Supports: WooCommerce, Easy Digital Downloads, Paid Memberships Pro', 'tutor' ),
1062 833 ),
1063 - ),
1064 - ),
1065 - 'block_woocommerce' => array(
1066 - 'label' => __( 'WooCommerce', 'tutor' ),
1067 - 'slug' => 'woocommerce',
1068 - 'block_type' => 'uniform',
1069 - 'fields' => array(
1070 834 array(
1071 835 'key' => 'tutor_woocommerce_order_auto_complete',
1072 836 'type' => 'toggle_switch',
1073 837 'label' => __( 'Automatically Complete WooCommerce Orders', 'tutor' ),
@@ -1075,31 +839,8 @@
1075 839 'default' => 'off',
1076 840 'desc' => __( 'If enabled, in the case of Courses, WooCommerce Orders will get the "Completed" status .', 'tutor' ),
1077 841 ),
1078 842 array(
1079 - 'key' => 'wc_automatic_order_complete_redirect_to_courses',
1080 - 'type' => 'toggle_switch',
1081 - 'label' => __( 'Auto Redirect to Courses', 'tutor' ),
1082 - 'default' => 'off',
1083 - 'label_title' => '',
1084 - 'desc' => __( 'When a user\'s WooCommerce order is auto-completed, they will be redirected to enrolled courses', 'tutor' ),
1085 - ),
1086 - array(
1087 - 'key' => 'enable_guest_course_cart',
1088 - 'type' => 'toggle_switch',
1089 - 'label' => __( 'Enable Guest Mode', 'tutor' ),
1090 - 'label_title' => '',
1091 - 'default' => 'off',
1092 - 'desc' => __( 'Allow customers to place orders without an account.', 'tutor' ),
1093 - ),
1094 - ),
1095 - ),
1096 - 'block_revenue_sharing' => array(
1097 - 'label' => __( 'Revenue Sharing', 'tutor' ),
1098 - 'slug' => 'revenue_sharing',
1099 - 'block_type' => 'uniform',
1100 - 'fields' => array(
1101 - array(
1102 843 'key' => 'enable_revenue_sharing',
1103 844 'type' => 'toggle_switch',
1104 845 'label' => __( 'Enable Revenue Sharing', 'tutor' ),
1105 846 'label_title' => '',
@@ -1105,9 +846,8 @@
1105 846 'label_title' => '',
1106 847 'default' => 'off',
1107 848 'desc' => __( 'Allow revenue generated from selling courses to be shared with course creators.', 'tutor' ),
1108 849 'toggle_fields' => 'sharing_percentage',
1109 - 'toggle_blocks' => 'fees,withdraw',
1110 850 ),
1111 851 array(
1112 852 'key' => 'sharing_percentage',
1113 853 'type' => 'double_input',
@@ -1117,23 +857,31 @@
1117 857 'fields' => array(
1118 858 'earning_instructor_commission' => array(
1119 859 'id' => 'revenue-instructor',
1120 860 'type' => 'ratio',
1121 - 'title' => __( 'Instructor Takes', 'tutor' ),
861 + 'title' => 'Instructor Takes',
1122 862 'default' => 20,
1123 863 ),
1124 864 'earning_admin_commission' => array(
1125 865 'id' => 'revenue-admin',
1126 866 'type' => 'ratio',
1127 - 'title' => __( 'Admin Takes', 'tutor' ),
867 + 'title' => 'Admin Takes',
1128 868 'default' => 80,
1129 869 ),
1130 870 ),
1131 871 'desc' => __( 'Set how the sales revenue will be shared among admins and instructors.', 'tutor' ),
1132 872 ),
873 + array(
874 + 'key' => 'statement_show_per_page',
875 + 'type' => 'number',
876 + 'label' => __( 'Show Statement Per Page', 'tutor' ),
877 + 'default' => '20',
878 +
879 + 'desc' => __( 'Define the number of statements to show.', 'tutor' ),
880 + ),
1133 881 ),
1134 882 ),
1135 - 'block_fees' => array(
883 + array(
1136 884 'label' => __( 'Fees', 'tutor' ),
1137 885 'slug' => 'fees',
1138 886 'block_type' => 'uniform',
1139 887 'fields' => array(
@@ -1150,12 +898,10 @@
1150 898 'key' => 'fees_name',
1151 899 'type' => 'textarea',
1152 900 'label' => __( 'Fee Description', 'tutor' ),
1153 901 'placeholder' => __( 'Fee Description', 'tutor' ),
1154 - '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' ),
1155 - 'maxlength' => 200,
1156 - 'rows' => 5,
1157 - 'default' => 'Maintenance Fees',
902 + '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' ),
903 + 'default' => 'free',
1158 904 ),
1159 905 array(
1160 906 'key' => 'fee_amount_type',
1161 907 'type' => 'group_fields',
@@ -1162,12 +908,11 @@
1162 908 'label' => __( 'Fee Amount & Type', 'tutor' ),
1163 909 'desc' => __( 'Select the fee type and add fee amount/percentage', 'tutor' ),
1164 910 'group_fields' => array(
1165 911 'fees_type' => array(
1166 - 'type' => 'select',
1167 - 'default' => 'fixed',
1168 - 'select_options' => false,
1169 - 'options' => array(
912 + 'type' => 'select',
913 + 'default' => 'fixed',
914 + 'options' => array(
1170 915 'percent' => __( 'Percent', 'tutor' ),
1171 916 'fixed' => __( 'Fixed', 'tutor' ),
1172 917 ),
1173 918 ),
@@ -1178,9 +923,9 @@
1178 923 ),
1179 924 ),
1180 925 ),
1181 926 ),
1182 - 'block_withdraw' => array(
927 + array(
1183 928 'label' => __( 'Withdraw', 'tutor' ),
1184 929 'slug' => 'withdraw',
1185 930 'block_type' => 'uniform',
1186 931 'fields' => array(
@@ -1191,15 +936,14 @@
1191 936 'default' => '80',
1192 937 'desc' => __( 'Instructors should earn equal or above this amount to make a withdraw request.', 'tutor' ),
1193 938 ),
1194 939 array(
1195 - 'key' => 'minimum_days_for_balance_to_be_available',
1196 - 'type' => 'number',
1197 - 'number_type' => 'integer',
1198 - 'label' => __( 'Minimum Days Before Balance is Available', 'tutor' ),
1199 - 'default' => '7',
1200 - 'min' => 1,
1201 - 'desc' => __( 'Any income has to remain this many days in the platform before it is available for withdrawal.', 'tutor' ),
940 + 'key' => 'minimum_days_for_balance_to_be_available',
941 + 'type' => 'number',
942 + 'label' => __( 'Minimum Days Before Balance is Available', 'tutor' ),
943 + 'default' => '7',
944 + 'min' => 1,
945 + 'desc' => __( 'Any income has to remain this many days in the platform before it is available for withdrawal.', 'tutor' ),
1202 946 ),
1203 947 array(
1204 948 'key' => 'tutor_withdrawal_methods',
1205 949 'type' => 'checkbox_horizontal',
@@ -1218,9 +962,9 @@
1218 962 ),
1219 963 ),
1220 964 ),
1221 965 ),
1222 - 'design' => array(
966 + 'design' => array(
1223 967 'label' => __( 'Design', 'tutor' ),
1224 968 'slug' => 'design',
1225 969 'desc' => __( 'Design Settings', 'tutor' ),
1226 970 'template' => 'design',
@@ -1225,68 +969,9 @@
1225 969 'desc' => __( 'Design Settings', 'tutor' ),
1226 970 'template' => 'design',
1227 971 'icon' => 'tutor-icon-color-palette',
1228 972 'blocks' => array(
1229 - // Experimental.
1230 - 'block_appearance' => array(
1231 - 'label' => __( 'Appearance', 'tutor' ),
1232 - 'slug' => 'appearance',
1233 - 'block_type' => 'uniform',
1234 - 'fields' => array(
1235 - array(
1236 - 'key' => 'learning_mode',
1237 - 'type' => 'radio_horizontal_image',
1238 - 'label' => __( 'Learning Mode', 'tutor' ),
1239 - 'desc' => __( 'Decide how students will experience the courses you create.', 'tutor' ),
1240 - 'default' => self::LEARNING_MODE_MODERN,
1241 - 'options' => array(
1242 - self::LEARNING_MODE_MODERN => array(
1243 - 'title' => __( 'Modern', 'tutor' ),
1244 - 'image' => 'learning-mode/modern.svg',
1245 - ),
1246 - self::LEARNING_MODE_KIDS => array(
1247 - 'title' => __( 'Kids', 'tutor' ),
1248 - 'image' => 'learning-mode/kids.svg',
1249 - ),
1250 - self::LEARNING_MODE_LEGACY => array(
1251 - 'title' => __( 'Legacy', 'tutor' ),
1252 - 'image' => 'learning-mode/legacy.svg',
1253 - ),
1254 - ),
1255 - ),
1256 - array(
1257 - 'key' => 'default_theme',
1258 - 'type' => 'radio_horizontal_image',
1259 - 'label' => __( 'Default Theme', 'tutor' ),
1260 - 'desc' => __( 'Set the default appearance for learners across your platform. Learners can switch between dark and light mode if enabled.', 'tutor' ),
1261 - 'default' => self::DEFAULT_THEME_SYSTEM,
1262 - 'options' => array(
1263 - self::DEFAULT_THEME_LIGHT => array(
1264 - 'title' => __( 'Light', 'tutor' ),
1265 - 'image' => 'default-theme/light.webp',
1266 - ),
1267 - self::DEFAULT_THEME_DARK => array(
1268 - 'title' => __( 'Dark', 'tutor' ),
1269 - 'image' => 'default-theme/dark.webp',
1270 - ),
1271 - self::DEFAULT_THEME_SYSTEM => array(
1272 - 'title' => __( 'Auto', 'tutor' ),
1273 - 'image' => 'default-theme/auto.webp',
1274 - ),
1275 - ),
1276 - ),
1277 - array(
1278 - 'key' => 'brand_color',
1279 - 'preset_name' => 'brand_color',
1280 - 'type' => 'color_field',
1281 - 'label' => __( 'Brand Color', 'tutor' ),
1282 - 'desc' => __( 'Customize the primary accent color used across your learning platform to match your brand identity.', 'tutor' ),
1283 - 'class' => 'color-picker-wrapper',
1284 - 'default' => tutor_utils()->get_default_brand_color(),
1285 - ),
1286 - ),
1287 - ),
1288 - 'block_course' => array(
973 + 'block_course' => array(
1289 974 'label' => __( 'Course', 'tutor' ),
1290 975 'slug' => 'course',
1291 976 'block_type' => 'uniform',
1292 977 'fields' => array(
@@ -1295,31 +980,29 @@
1295 980 'type' => 'radio_horizontal',
1296 981 'label' => __( 'Column Per Row', 'tutor' ),
1297 982 'default' => '3',
1298 983 'options' => array(
1299 - '1' => __( 'One', 'tutor' ),
1300 - '2' => __( 'Two', 'tutor' ),
1301 - '3' => __( 'Three', 'tutor' ),
1302 - '4' => __( 'Four', 'tutor' ),
984 + '1' => 'One',
985 + '2' => 'Two',
986 + '3' => 'Three',
987 + '4' => 'Four',
1303 988 ),
1304 989 'desc' => __( 'Define how many columns you want to use to display courses.', 'tutor' ),
1305 990 ),
1306 991 array(
1307 - 'key' => 'courses_per_page',
1308 - 'type' => 'number',
1309 - 'number_type' => 'integer',
1310 - 'label' => __( 'Courses Per Page', 'tutor' ),
1311 - 'default' => '12',
1312 - 'desc' => __( 'Set the number of courses to display per page on the Course List page.', 'tutor' ),
992 + 'key' => 'course_archive_filter',
993 + 'type' => 'toggle_switch',
994 + 'label' => __( 'Course Filter', 'tutor' ),
995 + 'label_title' => '',
996 + 'default' => 'off',
997 + 'desc' => __( 'Show sorting and filtering options on course archive page', 'tutor' ),
1313 998 ),
1314 999 array(
1315 - 'key' => 'course_archive_filter',
1316 - 'type' => 'toggle_switch',
1317 - 'label' => __( 'Course Filter', 'tutor' ),
1318 - 'label_title' => '',
1319 - 'default' => 'off',
1320 - 'desc' => __( 'Show sorting and filtering options on course archive page', 'tutor' ),
1321 - 'toggle_fields' => 'supported_course_filters',
1000 + 'key' => 'courses_per_page',
1001 + 'type' => 'number',
1002 + 'label' => __( 'Courses Per Page', 'tutor' ),
1003 + 'default' => '12',
1004 + 'desc' => __( 'Set the number of courses to display per page on the Course List page.', 'tutor' ),
1322 1005 ),
1323 1006 array(
1324 1007 'key' => 'supported_course_filters',
1325 1008 'type' => 'checkbox_horizontal',
@@ -1343,9 +1026,9 @@
1343 1026 'desc' => __( 'If enabled, the courses will be sortable by Course Name or Creation Date in either Ascending or Descending order', 'tutor' ),
1344 1027 ),
1345 1028 ),
1346 1029 ),
1347 - 'layout' => array(
1030 + 'layout' => array(
1348 1031 'label' => __( 'Layout', 'tutor' ),
1349 1032 'slug' => 'layout',
1350 1033 'block_type' => 'uniform',
1351 1034 'fields' => array(
@@ -1357,27 +1040,27 @@
1357 1040 'default' => 'portrait',
1358 1041 'group_options' => array(
1359 1042 'vertical' => array(
1360 1043 'default' => array(
1361 - 'title' => __( 'Portrait', 'tutor' ),
1044 + 'title' => 'Portrait',
1362 1045 'image' => 'instructor-layout/instructor-portrait.svg',
1363 1046 ),
1364 1047 'cover' => array(
1365 - 'title' => __( 'Cover', 'tutor' ),
1048 + 'title' => 'Cover',
1366 1049 'image' => 'instructor-layout/instructor-cover.svg',
1367 1050 ),
1368 1051 'minimal' => array(
1369 - 'title' => __( 'Minimal', 'tutor' ),
1052 + 'title' => 'Minimal',
1370 1053 'image' => 'instructor-layout/instructor-minimal.svg',
1371 1054 ),
1372 1055 ),
1373 1056 'horizontal' => array(
1374 1057 'portrait-horizontal' => array(
1375 - 'title' => __( 'Portrait Horizontal', 'tutor' ),
1058 + 'title' => 'Portrait Horizontal',
1376 1059 'image' => 'instructor-layout/instructor-horizontal-portrait.svg',
1377 1060 ),
1378 1061 'minimal-horizontal' => array(
1379 - 'title' => __( 'Minimal Horizontal', 'tutor' ),
1062 + 'title' => 'Minimal Horizontal',
1380 1063 'image' => 'instructor-layout/instructor-horizontal-minimal.svg',
1381 1064 ),
1382 1065 ),
1383 1066 ),
@@ -1389,21 +1072,21 @@
1389 1072 'desc' => __( 'Choose a layout design for a instructor’s public profile', 'tutor' ),
1390 1073 'default' => 'pp-rectangle',
1391 1074 'group_options' => array(
1392 1075 'private' => array(
1393 - 'title' => __( 'Private', 'tutor' ),
1076 + 'title' => 'Private',
1394 1077 'image' => 'profile-layout/profile-private.svg',
1395 1078 ),
1396 1079 'pp-circle' => array(
1397 - 'title' => __( 'Modern', 'tutor' ),
1080 + 'title' => 'Modern',
1398 1081 'image' => 'profile-layout/profile-modern.svg',
1399 1082 ),
1400 1083 'no-cp' => array(
1401 - 'title' => __( 'Minimal', 'tutor' ),
1084 + 'title' => 'Minimal',
1402 1085 'image' => 'profile-layout/profile-minimal.svg',
1403 1086 ),
1404 1087 'pp-rectangle' => array(
1405 - 'title' => __( 'Classic', 'tutor' ),
1088 + 'title' => 'Classic',
1406 1089 'image' => 'profile-layout/profile-classic.svg',
1407 1090 ),
1408 1091 ),
1409 1092 ),
@@ -1414,21 +1097,21 @@
1414 1097 'desc' => __( 'Choose a layout design for a student’s public profile', 'tutor' ),
1415 1098 'default' => 'pp-rectangle',
1416 1099 'group_options' => array(
1417 1100 'private' => array(
1418 - 'title' => __( 'Private', 'tutor' ),
1101 + 'title' => 'Private',
1419 1102 'image' => 'profile-layout/profile-private.svg',
1420 1103 ),
1421 1104 'pp-circle' => array(
1422 - 'title' => __( 'Modern', 'tutor' ),
1105 + 'title' => 'Modern',
1423 1106 'image' => 'profile-layout/profile-modern.svg',
1424 1107 ),
1425 1108 'no-cp' => array(
1426 - 'title' => __( 'Minimal', 'tutor' ),
1109 + 'title' => 'Minimal',
1427 1110 'image' => 'profile-layout/profile-minimal.svg',
1428 1111 ),
1429 1112 'pp-rectangle' => array(
1430 - 'title' => __( 'Classic', 'tutor' ),
1113 + 'title' => 'Classic',
1431 1114 'image' => 'profile-layout/profile-classic.svg',
1432 1115 ),
1433 1116 ),
1434 1117 ),
@@ -1433,9 +1116,9 @@
1433 1116 ),
1434 1117 ),
1435 1118 ),
1436 1119 ),
1437 - 'course-details' => array(
1120 + 'course-details' => array(
1438 1121 'label' => __( 'Course Details', 'tutor' ),
1439 1122 'slug' => 'course-details',
1440 1123 'block_type' => 'isolate',
1441 1124 'fields' => array(
@@ -1452,15 +1135,8 @@
1452 1135 'default' => 'on',
1453 1136 'desc' => __( 'Toggle to show instructor info', 'tutor' ),
1454 1137 ),
1455 1138 array(
1456 - 'key' => 'enable_wishlist',
1457 - 'type' => 'toggle_single',
1458 - 'label' => __( 'Wishlist', 'tutor' ),
1459 - 'default' => 'on',
1460 - 'desc' => __( 'Toggle to disable/enable wishlist', 'tutor' ),
1461 - ),
1462 - array(
1463 1139 'key' => 'enable_q_and_a_on_course',
1464 1140 'type' => 'toggle_single',
1465 1141 'label' => __( 'Q&A', 'tutor' ),
1466 1142 'default' => 'on',
@@ -1559,9 +1235,9 @@
1559 1235 'type' => 'toggle_single',
1560 1236 'label' => __( 'Requirements', 'tutor' ),
1561 1237 'label_title' => __( 'Enable', 'tutor' ),
1562 1238 'default' => 'on',
1563 - 'desc' => __( 'Enable to show courses requirements section', 'tutor' ),
1239 + 'desc' => __( 'Enable to show courses requirements setion', 'tutor' ),
1564 1240 ),
1565 1241 array(
1566 1242 'key' => 'enable_course_target_audience',
1567 1243 'type' => 'toggle_single',
@@ -1589,11 +1265,222 @@
1589 1265 ),
1590 1266 ),
1591 1267 ),
1592 1268 ),
1269 + 'colors' => array(
1270 + 'label' => __( 'Colors', 'tutor' ),
1271 + 'slug' => 'colors',
1272 + 'block_type' => 'color_picker',
1273 + 'fields_group' => array(
1274 + array(
1275 + 'key' => 'color_preset_type',
1276 + 'type' => 'color_preset',
1277 + 'label' => __( 'Preset Colors', 'tutor' ),
1278 + 'desc' => __( 'These colors will be used throughout your website. Choose between these presets or create your own custom palette.', 'tutor' ),
1279 + 'default' => 'default',
1280 + 'fields' => array(
1281 + /* First 4 preset_name should be same as color_fields */
1282 + array(
1283 + 'key' => 'default',
1284 + 'label' => 'Default',
1285 + 'colors' => array(
1286 + array(
1287 + 'slug' => 'tutor_primary_color',
1288 + 'preset_name' => 'primary',
1289 + 'value' => '#3E64DE',
1290 + ),
1291 + array(
1292 + 'slug' => 'tutor_primary_hover_color',
1293 + 'preset_name' => 'hover',
1294 + 'value' => '#395BCA',
1295 + ),
1296 + array(
1297 + 'slug' => 'tutor_text_color',
1298 + 'preset_name' => 'text',
1299 + 'value' => '#212327',
1300 + ),
1301 + array(
1302 + 'slug' => 'tutor_gray_color',
1303 + 'preset_name' => 'gray',
1304 + 'value' => '#E3E5EB',
1305 + ),
1306 + array(
1307 + 'slug' => 'tutor_border_color',
1308 + 'preset_name' => 'border',
1309 + 'value' => '#CDCFD5',
1310 + ),
1311 + ),
1312 + ),
1313 + array(
1314 + 'key' => 'landscape',
1315 + 'label' => 'Landscape',
1316 + 'colors' => array(
1317 + array(
1318 + 'slug' => 'tutor_primary_color',
1319 + 'preset_name' => 'primary',
1320 + 'value' => '#239371',
1321 + ),
1322 + array(
1323 + 'slug' => 'tutor_primary_hover_color',
1324 + 'preset_name' => 'hover',
1325 + 'value' => '#117D5D',
1326 + ),
1327 + array(
1328 + 'slug' => 'tutor_text_color',
1329 + 'preset_name' => 'text',
1330 + 'value' => '#212327',
1331 + ),
1332 + array(
1333 + 'slug' => 'tutor_gray_color',
1334 + 'preset_name' => 'gray',
1335 + 'value' => '#E3E5EB',
1336 + ),
1337 + array(
1338 + 'slug' => 'tutor_border_color',
1339 + 'preset_name' => 'border',
1340 + 'value' => '#CDCFD5',
1341 + ),
1342 + ),
1343 + ),
1344 + array(
1345 + 'key' => 'ocean',
1346 + 'label' => 'Ocean',
1347 + 'colors' => array(
1348 + array(
1349 + 'slug' => 'tutor_primary_color',
1350 + 'preset_name' => 'primary',
1351 + 'value' => '#5A18C2',
1352 + ),
1353 + array(
1354 + 'slug' => 'tutor_primary_hover_color',
1355 + 'preset_name' => 'hover',
1356 + 'value' => '#3F02A0',
1357 + ),
1358 + array(
1359 + 'slug' => 'tutor_text_color',
1360 + 'preset_name' => 'text',
1361 + 'value' => '#212327',
1362 + ),
1363 + array(
1364 + 'slug' => 'tutor_gray_color',
1365 + 'preset_name' => 'gray',
1366 + 'value' => '#E3E5EB',
1367 + ),
1368 + array(
1369 + 'slug' => 'tutor_border_color',
1370 + 'preset_name' => 'border',
1371 + 'value' => '#CDCFD5',
1372 + ),
1373 + ),
1374 + ),
1375 + array(
1376 + 'key' => 'custom',
1377 + 'label' => 'Custom',
1378 + 'colors' => array(
1379 + array(
1380 + 'slug' => 'tutor_primary_color',
1381 + 'preset_name' => 'primary',
1382 + 'value' => '#3E64DE',
1383 + ),
1384 + array(
1385 + 'slug' => 'tutor_primary_hover_color',
1386 + 'preset_name' => 'hover',
1387 + 'value' => '#28408E',
1388 + ),
1389 + array(
1390 + 'slug' => 'tutor_text_color',
1391 + 'preset_name' => 'text',
1392 + 'value' => '#1A1B1E',
1393 + ),
1394 + array(
1395 + 'slug' => 'tutor_gray_color',
1396 + 'preset_name' => 'gray',
1397 + 'value' => '#E3E5EB',
1398 + ),
1399 + ),
1400 + ),
1401 + ),
1402 + ),
1403 + array(
1404 + 'key' => 'tutor_color_presets',
1405 + 'type' => 'color_fields',
1406 + 'label' => __( 'Preset Colors', 'tutor' ),
1407 + 'fields' => array(
1408 + array(
1409 + 'key' => 'tutor_primary_color',
1410 + 'type' => 'color_field',
1411 + 'preset_name' => 'primary',
1412 + 'preset_exist' => true,
1413 + 'label' => __( 'Primary Color', 'tutor' ),
1414 + 'default' => '#3E64DE',
1415 + 'desc' => __( 'Choose a primary color', 'tutor' ),
1416 + ),
1417 + array(
1418 + 'key' => 'tutor_primary_hover_color',
1419 + 'type' => 'color_field',
1420 + 'preset_name' => 'hover',
1421 + 'preset_exist' => true,
1422 + 'label' => __( 'Primary Hover Color', 'tutor' ),
1423 + 'default' => '#395BCA',
1424 + 'desc' => __( 'Choose a primary hover color', 'tutor' ),
1425 + ),
1426 + array(
1427 + 'key' => 'tutor_text_color',
1428 + 'type' => 'color_field',
1429 + 'preset_name' => 'text',
1430 + 'preset_exist' => true,
1431 + 'label' => __( 'Text Color', 'tutor' ),
1432 + 'default' => '#212327',
1433 + 'desc' => __( 'Choose a text color for your website', 'tutor' ),
1434 + ),
1435 + array(
1436 + 'key' => 'tutor_gray_color',
1437 + 'type' => 'color_field',
1438 + 'preset_name' => 'gray',
1439 + 'preset_exist' => false,
1440 + 'label' => __( 'Gray', 'tutor' ),
1441 + 'default' => '#E3E5EB',
1442 + 'desc' => __( 'Choose a color for elements like table, card etc', 'tutor' ),
1443 + ),
1444 + array(
1445 + 'key' => 'tutor_border_color',
1446 + 'type' => 'color_field',
1447 + 'preset_name' => 'border',
1448 + 'preset_exist' => false,
1449 + 'label' => __( 'Border', 'tutor' ),
1450 + 'default' => '#CDCFD5',
1451 + 'desc' => __( 'Choose a border color for your website', 'tutor' ),
1452 + ),
1453 + ),
1454 + ),
1455 + ),
1456 + ),
1457 + 'video_player' => array(
1458 + 'label' => __( 'Video Player', 'tutor' ),
1459 + 'slug' => 'video_player',
1460 + 'block_type' => 'uniform',
1461 + 'fields' => array(
1462 + array(
1463 + 'key' => 'disable_default_player_youtube',
1464 + 'type' => 'toggle_switch',
1465 + 'label' => __( 'Use Tutor Player for YouTube', 'tutor' ),
1466 + 'label_title' => '',
1467 + 'default' => 'off',
1468 + 'desc' => __( 'Enable this option to use Tutor LMS video player for YouTube.', 'tutor' ),
1469 + ),
1470 + array(
1471 + 'key' => 'disable_default_player_vimeo',
1472 + 'type' => 'toggle_switch',
1473 + 'label' => __( 'Use Tutor Player for Vimeo', 'tutor' ),
1474 + 'label_title' => '',
1475 + 'default' => 'off',
1476 + 'desc' => __( 'Enable this option to use Tutor LMS video player for Vimeo.', 'tutor' ),
1477 + ),
1478 + ),
1479 + ),
1593 1480 ),
1594 1481 ),
1595 - 'advanced' => array(
1482 + 'advanced' => array(
1596 1483 'label' => __( 'Advanced', 'tutor' ),
1597 1484 'slug' => 'advanced',
1598 1485 'desc' => __( 'Advanced Settings', 'tutor' ),
1599 1486 'template' => 'basic',
@@ -1618,72 +1505,52 @@
1618 1505 'default' => 'off',
1619 1506 'desc' => __( 'Enable to hide course products on shop page.', 'tutor' ),
1620 1507 ),
1621 1508 array(
1622 - 'key' => 'course_archive_page',
1623 - 'type' => 'select',
1624 - 'label' => __( 'Course Archive Page', 'tutor' ),
1625 - 'default' => $course_archive_page_id->ID ?? '0',
1626 - 'options' => $pages,
1627 - 'desc' => __( 'This page will be used to list all the published courses.', 'tutor' ),
1628 - 'searchable' => true,
1509 + 'key' => 'course_archive_page',
1510 + 'type' => 'select',
1511 + 'label' => __( 'Course Archive Page', 'tutor' ),
1512 + 'default' => $course_archive_page_id->ID ?? '0',
1513 + 'options' => $pages,
1514 + 'desc' => __( 'This page will be used to list all the published courses.', 'tutor' ),
1629 1515 ),
1630 1516 array(
1631 - 'key' => 'instructor_register_page',
1632 - 'type' => 'select',
1633 - 'label' => __( 'Instructor Registration Page', 'tutor' ),
1634 - 'default' => '0',
1635 - 'options' => $pages,
1636 - 'desc' => __( 'Choose the page for instructor registration.', 'tutor' ),
1637 - 'searchable' => true,
1517 + 'key' => 'instructor_register_page',
1518 + 'type' => 'select',
1519 + 'label' => __( 'Instructor Registration Page', 'tutor' ),
1520 + 'default' => '0',
1521 + 'options' => $pages,
1522 + 'desc' => __( 'Choose the page for instructor registration.', 'tutor' ),
1638 1523 ),
1639 1524 array(
1640 - 'key' => 'student_register_page',
1641 - 'type' => 'select',
1642 - 'label' => __( 'Student Registration Page', 'tutor' ),
1643 - 'default' => '0',
1644 - 'options' => $pages,
1645 - 'desc' => __( 'Choose the page for student registration.', 'tutor' ),
1646 - 'searchable' => true,
1525 + 'key' => 'student_register_page',
1526 + 'type' => 'select',
1527 + 'label' => __( 'Student Registration Page', 'tutor' ),
1528 + 'default' => '0',
1529 + 'options' => $pages,
1530 + 'desc' => __( 'Choose the page for student registration.', 'tutor' ),
1647 1531 ),
1532 + // TODO
1533 + // array(
1534 + // 'key' => 'course_permalink_base',
1535 + // 'type' => 'text',
1536 + // 'label' => __('Course Permalink Base', 'tutor'),
1537 + // 'default' => tutor()->course_post_type,
1538 + // 'desc' => $course_url,
1539 + // ),
1648 1540 array(
1649 - 'key' => 'lesson_video_duration_youtube_api_key',
1650 - 'type' => 'text',
1651 - 'label' => __( 'YouTube API Key', 'tutor' ),
1652 - 'default' => '',
1653 - 'desc' => __(
1654 - 'To host live videos on your platform using YouTube, enter your YouTube API key.',
1655 - 'tutor'
1656 - ),
1657 - 'placeholder' => __( 'Insert API key here', 'tutor' ),
1658 - ),
1659 - ),
1660 - ),
1661 - array(
1662 - 'label' => __( 'Base Permalink', 'tutor' ),
1663 - 'slug' => 'base_permalink',
1664 - 'block_type' => 'uniform',
1665 - 'fields' => array(
1666 - array(
1667 - 'key' => 'course_permalink_base',
1668 - 'type' => 'text',
1669 - 'label' => __( 'Course Permalink', 'tutor' ),
1670 - 'default' => 'courses',
1671 - 'desc' => $course_url,
1672 - ),
1673 - array(
1674 1541 'key' => 'lesson_permalink_base',
1675 1542 'type' => 'text',
1676 - 'label' => __( 'Lesson Permalink', 'tutor' ),
1543 + 'label' => __( 'Lesson Permalink Base', 'tutor' ),
1677 1544 'default' => 'lessons',
1678 1545 'desc' => $lesson_url,
1679 1546 ),
1680 1547 array(
1681 - 'key' => 'quiz_permalink_base',
1548 + 'key' => 'lesson_video_duration_youtube_api_key',
1682 1549 'type' => 'text',
1683 - 'label' => __( 'Quiz Permalink', 'tutor' ),
1684 - 'default' => 'quizzes',
1685 - 'desc' => $quiz_url,
1550 + 'label' => __( 'Youtube API Key', 'tutor' ),
1551 + 'default' => '',
1552 + 'desc' => __( 'Insert the YouTube API key to host live videos using YouTube.', 'tutor' ),
1686 1553 ),
1687 1554 ),
1688 1555 ),
1689 1556 array(
@@ -1701,12 +1568,12 @@
1701 1568 ),
1702 1569 array(
1703 1570 'key' => 'enable_tutor_native_login',
1704 1571 'type' => 'toggle_switch',
1705 - 'label' => __( 'Enable Tutor LMS Login', 'tutor' ),
1572 + 'label' => __( 'Enable Tutor Login', 'tutor' ),
1706 1573 'label_title' => '',
1707 1574 'default' => 'on',
1708 - 'desc' => __( 'Enable to use the Tutor LMS native login system instead of the WordPress login page', 'tutor' ),
1575 + 'desc' => __( 'Enable to use the tutor login modal instead of the default WordPress login page', 'tutor' ),
1709 1576 ),
1710 1577 array(
1711 1578 'key' => 'delete_on_uninstall',
1712 1579 'type' => 'toggle_switch',
@@ -1720,36 +1587,14 @@
1720 1587 'type' => 'toggle_switch',
1721 1588 'label' => __( 'Maintenance Mode', 'tutor' ),
1722 1589 'label_title' => '',
1723 1590 'default' => 'off',
1724 - 'desc' => __( 'Enabling maintenance mode will display a custom message on the frontend. During maintenance mode, visitors cannot access site content, but the wp-admin dashboard remains accessible.', 'tutor' ),
1591 + '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' ),
1725 1592 ),
1726 1593 ),
1727 1594 ),
1728 1595 ),
1729 1596 ),
1730 - 'legal_consents' => array(
1731 - 'label' => __( 'Legal Consents', 'tutor' ),
1732 - 'slug' => 'legal_consents',
1733 - 'desc' => __( 'Legal Consents', 'tutor' ),
1734 - 'template' => 'legal_consents',
1735 - 'icon' => 'tutor-icon-lesson',
1736 - 'blocks' => array(
1737 - array(
1738 - 'label' => __( 'Legal Consents', 'tutor' ),
1739 - 'slug' => 'legal_consents',
1740 - 'block_type' => 'uniform',
1741 - 'fields' => array(
1742 - array(
1743 - 'key' => 'legal_consents',
1744 - 'type' => 'text',
1745 - 'label' => __( 'Legal Consents', 'tutor' ),
1746 - 'default' => array(),
1747 - ),
1748 - ),
1749 - ),
1750 - ),
1751 - ),
1752 1597 );
1753 1598
1754 1599 $attrs = apply_filters( 'tutor/options/extend/attr', apply_filters( 'tutor/options/attr', $attr ) );
1755 1600
@@ -1784,15 +1629,14 @@
1784 1629 *
1785 1630 * @since 2.0.0
1786 1631 *
1787 1632 * @param array $field field array.
1788 - * @param array $blocks blocks array.
1789 1633 *
1790 1634 * @return void
1791 1635 *
1792 1636 * Generate Option Field
1793 1637 */
1794 - public function generate_field( $field = array(), $blocks = array() ) {
1638 + public function generate_field( $field = array() ) {
1795 1639 ob_start();
1796 1640 if ( isset( $field['type'] ) ) {
1797 1641 include tutor()->path . "views/options/field-types/{$field['type']}.php";
1798 1642 }
@@ -1828,9 +1672,9 @@
1828 1672 * @return string
1829 1673 */
1830 1674 public function blocks( $blocks = array() ) {
1831 1675 ob_start();
1832 - include apply_filters( 'tutor_settings_block_template_path', tutor()->path . 'views/options/option_blocks.php', $blocks );
1676 + include tutor()->path . 'views/options/option_blocks.php';
1833 1677 return ob_get_clean();
1834 1678 }
1835 1679
1836 1680 /**
@@ -1846,16 +1690,15 @@
1846 1690 public function template( $section = array() ) {
1847 1691 ob_start();
1848 1692 $blocks = $section['blocks'];
1849 1693 if ( isset( $section['template'] ) ) {
1850 - include apply_filters( 'tutor_option_template_path', tutor()->path . "views/options/template/{$section['template']}.php", $section['template'] );
1694 + include tutor()->path . "views/options/template/{$section['template']}.php";
1851 1695 }
1852 1696 return ob_get_clean();
1853 1697 }
1854 1698
1855 -
1856 1699 /**
1857 - * Load template inside template directory
1700 + * Load template inside template dirctory
1858 1701 *
1859 1702 * @since 2.0.0
1860 1703 *
1861 1704 * @param mixed $template_slug template slug.
@@ -1868,123 +1711,6 @@
1868 1711 if ( isset( $template_slug ) ) {
1869 1712 require tutor()->path . "views/options/template/{$template_slug}";
1870 1713 }
1871 1714 return ob_get_clean();
1872 - }
1873 -
1874 - /**
1875 - * Get field name
1876 - *
1877 - * It's useful when a field has event key like course.lessons
1878 - *
1879 - * @since 3.5.0
1880 - *
1881 - * @param array $field Option field array.
1882 - *
1883 - * @return string
1884 - */
1885 - public function get_field_name( array $field ) {
1886 - $events = $field['event'] ?? null;
1887 - $field_name = 'tutor_option';
1888 - if ( $events ) {
1889 - $events = explode( '.', $events );
1890 - foreach ( $events as $event ) {
1891 - $field_name .= '[' . $event . ']';
1892 - }
1893 - $field_name .= '[' . $field['key'] . ']';
1894 - } else {
1895 - $field_name .= '[' . $field['key'] . ']';
1896 - }
1897 -
1898 - return $field_name;
1899 - }
1900 -
1901 - /**
1902 - * Json schema data
1903 - *
1904 - * @since 1.0.0
1905 - *
1906 - * @return array
1907 - */
1908 - public function get_export_json_schema() {
1909 - $export_data = array(
1910 - 'schema_version' => '1.0.0',
1911 - 'exported_at' => current_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ),
1912 - 'keep_media_files' => false,
1913 - 'keep_user_data' => false,
1914 - 'data' => array(),
1915 - );
1916 -
1917 - return $export_data;
1918 - }
1919 -
1920 - /**
1921 - * Update settings log based on the new data
1922 - *
1923 - * @since 3.6.0
1924 - *
1925 - * @param array $new_settings_data New exported/import settings data.
1926 - * @param string $action_type Action type Imported/Exported.
1927 - *
1928 - * @return array Settings log data
1929 - */
1930 - public function update_settings_log( $new_settings_data, $action_type ) {
1931 - $get_final_data = array();
1932 -
1933 - $action = strtolower( $action_type );
1934 -
1935 - $time = tutor_time();
1936 -
1937 - $save_import_data['datetime'] = $time;
1938 - $save_import_data['history_date'] = gmdate( 'j M, Y, g:i a', $time );
1939 - $save_import_data['datatype'] = $action_type;
1940 - $save_import_data['dataset'] = $new_settings_data;
1941 - $import_data[ 'tutor-imported-' . $time ] = $save_import_data;
1942 -
1943 - $get_option_data = get_option( 'tutor_settings_log' );
1944 - if ( empty( $get_option_data ) ) {
1945 - $get_option_data = array();
1946 - }
1947 - if ( ! empty( $get_option_data ) && null !== $save_import_data['dataset'] ) {
1948 -
1949 - $update_option = array_merge( $import_data, $get_option_data );
1950 -
1951 - $update_option = Input::sanitize_array(
1952 - $update_option,
1953 - array(
1954 - 'payment_settings' => 'wp_kses_post',
1955 - 'tutor_bank_transfer_withdraw_instruction' => 'sanitize_textarea_field',
1956 - 'certificate_showcase_desc' => 'sanitize_textarea_field',
1957 - 'invoice_from_address' => 'sanitize_textarea_field',
1958 - 'fees_name' => 'sanitize_textarea_field',
1959 - )
1960 - );
1961 -
1962 - if ( ! empty( $update_option ) ) {
1963 - update_option( 'tutor_settings_log', $update_option );
1964 - }
1965 -
1966 - if ( 'imported' === $action ) {
1967 - if ( ! empty( $save_import_data ) ) {
1968 - update_option( 'tutor_option', $save_import_data['dataset'] );
1969 - }
1970 - }
1971 -
1972 - $get_final_data = get_option( 'tutor_settings_log' );
1973 -
1974 - } else {
1975 - if ( ! empty( $import_data ) ) {
1976 - update_option( 'tutor_settings_log', $import_data );
1977 - }
1978 -
1979 - if ( 'imported' === $action ) {
1980 - if ( ! empty( $save_import_data ) ) {
1981 - update_option( 'tutor_option', $save_import_data['dataset'] );
1982 - }
1983 - }
1984 -
1985 - $get_final_data = get_option( 'tutor_settings_log' );
1986 - }
1987 -
1988 - return $get_final_data;
1989 1715 }
1990 1716 }