Quiz And Survey Master (Formerly Quiz Master Next) - Version 7.3.10

Version Description

(January 28, 2022) = * Checked compatibility with WordPress 5.9 * Bug: Fixed UI issues in QSM dashboard banner * Bug: Fixed CURRENT_DATE template variable with certificate addon * Bug: Fixed CATEGORY_SCORE_X template variable * Bug: Fixed incorrectly marked answers in survey & simple form * Bug: Fixed translation issues * Bug: Fixed issues with global default settings * Bug: Fixed issues with multiple response question type

Download this release

Release Info

Developer expresstech
Plugin Icon 128x128 Quiz And Survey Master (Formerly Quiz Master Next)
Version 7.3.10
Comparing to
See all releases

Code changes from version 7.3.9 to 7.3.10

css/admin-dashboard.css CHANGED
@@ -1055,6 +1055,48 @@ h2.hndle.ui-sortable-handle {
1055
  box-shadow: 0 0 3px rgba(10, 10, 10, 0.2);
1056
  }
1057
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  @media screen and (min-width: 1200px) {
1059
  #quiz_settings_wrapper tr td fieldset>br {
1060
  display: none;
1055
  box-shadow: 0 0 3px rgba(10, 10, 10, 0.2);
1056
  }
1057
 
1058
+ .qsm_dashboard_page .welcome-panel-column{
1059
+ display: block;
1060
+ }
1061
+
1062
+ .qsm_dashboard_page.welcome-panel h2 {
1063
+ margin: 0;
1064
+ font-size: 21px;
1065
+ font-weight: 400;
1066
+ color: #1d2327;
1067
+ line-height: 1.2;
1068
+ }
1069
+
1070
+ .qsm_dashboard_page.welcome-panel::before{
1071
+ content: none;
1072
+ }
1073
+
1074
+ .qsm_dashboard_page.postbox {
1075
+ padding: 23px 10px 0;
1076
+ }
1077
+
1078
+ .qsm_dashboard_page .welcome-panel-content {
1079
+ margin-left: 13px;
1080
+ min-height: auto;
1081
+ display: block;
1082
+ }
1083
+
1084
+ .qsm_dashboard_page .welcome-panel-column-container {
1085
+ padding: 0 !important;
1086
+ margin: 1.33em 0 0 !important;
1087
+ }
1088
+
1089
+ .qsm_dashboard_page p.about-description {
1090
+ margin: 0;
1091
+ font-size: 16px;
1092
+ line-height: 1.5;
1093
+ color: #646970;
1094
+ }
1095
+
1096
+ .qsm_dashboard_page .welcome-panel h3 {
1097
+ margin: 1.33em 0 0;
1098
+ }
1099
+
1100
  @media screen and (min-width: 1200px) {
1101
  #quiz_settings_wrapper tr td fieldset>br {
1102
  display: none;
js/qsm-admin.js CHANGED
@@ -2321,6 +2321,7 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
2321
  if (confirm('Are you sure?')) {
2322
  $(this).parents('.page').remove();
2323
  $('.save-page-button').trigger('click');
 
2324
  }
2325
  });
2326
  $(document).on('click', '#answers .delete-answer-button', function (event) {
2321
  if (confirm('Are you sure?')) {
2322
  $(this).parents('.page').remove();
2323
  $('.save-page-button').trigger('click');
2324
+ QSMQuestion.countTotal();
2325
  }
2326
  });
2327
  $(document).on('click', '#answers .delete-answer-button', function (event) {
js/qsm-quiz.js CHANGED
@@ -201,7 +201,7 @@ var QSMPageTimer;
201
  $(".mlw_answer_number").attr('readonly', true);
202
 
203
  $quizForm.closest('.qmn_quiz_container').addClass('qsm_timer_ended');
204
- $quizForm.closest('.qmn_quiz_container').prepend('<p class="qmn_error_message" style="color: red;">Quiz time is over</p>');
205
  if (qmn_quiz_data[quizID].enable_result_after_timer_end == 1) {
206
  $quizForm.closest('.qmn_quiz_container').find('.qsm-submit-btn').trigger('click');
207
  } else {
201
  $(".mlw_answer_number").attr('readonly', true);
202
 
203
  $quizForm.closest('.qmn_quiz_container').addClass('qsm_timer_ended');
204
+ $quizForm.closest('.qmn_quiz_container').prepend('<p class="qmn_error_message" style="color: red;">' + qmn_ajax_object.quiz_time_over + '</p>');
205
  if (qmn_quiz_data[quizID].enable_result_after_timer_end == 1) {
206
  $quizForm.closest('.qmn_quiz_container').find('.qsm-submit-btn').trigger('click');
207
  } else {
mlw_quizmaster2.php CHANGED
@@ -2,14 +2,14 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 7.3.9
6
  * Author: ExpressTech
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://expresstech.io/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
- * @version 7.3.9
13
  * @package QSM
14
  */
15
 
@@ -44,7 +44,7 @@ class MLWQuizMasterNext {
44
  * @var string
45
  * @since 4.0.0
46
  */
47
- public $version = '7.3.9';
48
 
49
  /**
50
  * QSM Alert Manager Object
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 7.3.10
6
  * Author: ExpressTech
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://expresstech.io/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
+ * @version 7.3.10
13
  * @package QSM
14
  */
15
 
44
  * @var string
45
  * @since 4.0.0
46
  */
47
+ public $version = '7.3.10';
48
 
49
  /**
50
  * QSM Alert Manager Object
php/admin/admin-dashboard.php CHANGED
@@ -109,7 +109,7 @@ function qsm_generate_dashboard_page() {
109
  ?>
110
  <div class="wrap">
111
  <h1><?php esc_html_e( 'QSM Dashboard', 'quiz-master-next' ); ?></h1>
112
- <div id="welcome_panel" class="postbox welcome-panel <?php qsm_check_close_hidden_box( 'welcome_panel' ); ?>">
113
  <div class="qsm-welcome-panel-close">
114
  <img src="<?php echo esc_url( QSM_PLUGIN_URL . '/assets/icon-128x128.png' ); ?>" alt="Welcome Logo">
115
  <p class="current_version"><?php echo esc_attr( $mlwQuizMasterNext->version ); ?></p>
@@ -298,7 +298,7 @@ function qsm_wizard_template_quiz_options() {
298
  QSM_Fields::generate_field( $field, $single_setting['value'] );
299
  }
300
  } else {
301
- echo esc_html__( 'No settings are found!', 'quiz-master-next' );
302
  }
303
  echo '=====';
304
  if ( $addons ) {
@@ -412,7 +412,7 @@ function qsm_dashboard_recent_taken_quiz( $widget_id ) {
412
  $user_name = 'None' === $single_result_arr['name'] ? $actual_user->data->display_name : $single_result_arr['name'];
413
  echo '<a href="' . esc_url( $edit_link ) . '">' . esc_html( $user_name ) . '</a>';
414
  } else {
415
- echo esc_html__( 'Guest', 'quiz-master-next' );
416
  }
417
  esc_html_e( ' took quiz ', 'quiz-master-next' );
418
  echo '<a href="admin.php?page=mlw_quiz_options&quiz_id=' . esc_attr( $single_result_arr['quiz_id'] ) . '">' . esc_html( $single_result_arr['quiz_name'] ) . '</a>';
@@ -620,6 +620,8 @@ function qsm_create_new_quiz_from_wizard() {
620
  'require_log_in' => isset( $_POST['require_log_in'] ) ? sanitize_text_field( wp_unslash( $_POST['require_log_in'] ) ) : '',
621
  'disable_scroll_next_previous_click' => isset( $_POST['disable_scroll_next_previous_click'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_scroll_next_previous_click'] ) ) : '',
622
  );
 
 
623
  $quiz_options = apply_filters( 'qsm_quiz_wizard_settings_option_save', $quiz_options );
624
  $mlwQuizMasterNext->quizCreator->create_quiz( $quiz_name, $theme_id, array( 'quiz_options' => $quiz_options ) );
625
  }
109
  ?>
110
  <div class="wrap">
111
  <h1><?php esc_html_e( 'QSM Dashboard', 'quiz-master-next' ); ?></h1>
112
+ <div id="welcome_panel" class="qsm_dashboard_page postbox welcome-panel <?php qsm_check_close_hidden_box( 'welcome_panel' ); ?>">
113
  <div class="qsm-welcome-panel-close">
114
  <img src="<?php echo esc_url( QSM_PLUGIN_URL . '/assets/icon-128x128.png' ); ?>" alt="Welcome Logo">
115
  <p class="current_version"><?php echo esc_attr( $mlwQuizMasterNext->version ); ?></p>
298
  QSM_Fields::generate_field( $field, $single_setting['value'] );
299
  }
300
  } else {
301
+ esc_html_e( 'No settings are found!', 'quiz-master-next' );
302
  }
303
  echo '=====';
304
  if ( $addons ) {
412
  $user_name = 'None' === $single_result_arr['name'] ? $actual_user->data->display_name : $single_result_arr['name'];
413
  echo '<a href="' . esc_url( $edit_link ) . '">' . esc_html( $user_name ) . '</a>';
414
  } else {
415
+ esc_html_e( 'Guest', 'quiz-master-next' );
416
  }
417
  esc_html_e( ' took quiz ', 'quiz-master-next' );
418
  echo '<a href="admin.php?page=mlw_quiz_options&quiz_id=' . esc_attr( $single_result_arr['quiz_id'] ) . '">' . esc_html( $single_result_arr['quiz_name'] ) . '</a>';
620
  'require_log_in' => isset( $_POST['require_log_in'] ) ? sanitize_text_field( wp_unslash( $_POST['require_log_in'] ) ) : '',
621
  'disable_scroll_next_previous_click' => isset( $_POST['disable_scroll_next_previous_click'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_scroll_next_previous_click'] ) ) : '',
622
  );
623
+ $get_saved_value = get_option( 'qsm-quiz-settings' );
624
+ $quiz_options = array_replace( $get_saved_value, $quiz_options );
625
  $quiz_options = apply_filters( 'qsm_quiz_wizard_settings_option_save', $quiz_options );
626
  $mlwQuizMasterNext->quizCreator->create_quiz( $quiz_name, $theme_id, array( 'quiz_options' => $quiz_options ) );
627
  }
php/admin/functions.php CHANGED
@@ -533,46 +533,47 @@ function qsm_create_new_quiz_wizard() {
533
  </span>
534
  </div>
535
  <?php
536
- $all_settings = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_options' );
537
- $quiz_setting_option = array(
 
538
  'form_type' => array(
539
  'option_name' => __( 'Form Type', 'quiz-master-next' ),
540
- 'value' => 0,
541
  ),
542
  'system' => array(
543
  'option_name' => __( 'Grading System', 'quiz-master-next' ),
544
- 'value' => 0,
545
  ),
546
  'pagination' => array(
547
  'option_name' => __( 'Questions Per Page', 'quiz-master-next' ),
548
- 'value' => 0,
549
  ),
550
  'progress_bar' => array(
551
  'option_name' => __( 'Show Progress Bar', 'quiz-master-next' ),
552
- 'value' => 0,
553
  ),
554
  'timer_limit' => array(
555
  'option_name' => __( 'Time Limit (in Minute)', 'quiz-master-next' ),
556
- 'value' => 0,
557
  ),
558
  'enable_pagination_quiz' => array(
559
  'option_name' => __( 'Show current page number', 'quiz-master-next' ),
560
- 'value' => 0,
561
  ),
562
  'require_log_in' => array(
563
  'option_name' => __( 'Require User Login', 'quiz-master-next' ),
564
- 'value' => 0,
565
  ),
566
  'disable_scroll_next_previous_click' => array(
567
  'option_name' => __( 'Disable scroll on next and previous button click?', 'quiz-master-next' ),
568
- 'value' => 0,
569
  ),
570
  'disable_first_page' => array(
571
  'option_name' => __( 'Disable first page on quiz', 'quiz-master-next' ),
572
- 'value' => 0,
573
  ),
574
  );
575
- $quiz_setting_option = apply_filters( 'qsm_quiz_wizard_settings_option', $quiz_setting_option );
576
  if ( $quiz_setting_option ) {
577
  foreach ( $quiz_setting_option as $key => $single_setting ) {
578
  $key = array_search( $key, array_column( $all_settings, 'id' ), true );
533
  </span>
534
  </div>
535
  <?php
536
+ $all_settings = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_options' );
537
+ global $globalQuizsetting;
538
+ $quiz_setting_option = array(
539
  'form_type' => array(
540
  'option_name' => __( 'Form Type', 'quiz-master-next' ),
541
+ 'value' => $globalQuizsetting['form_type'],
542
  ),
543
  'system' => array(
544
  'option_name' => __( 'Grading System', 'quiz-master-next' ),
545
+ 'value' => $globalQuizsetting['system'],
546
  ),
547
  'pagination' => array(
548
  'option_name' => __( 'Questions Per Page', 'quiz-master-next' ),
549
+ 'value' => $globalQuizsetting['pagination'],
550
  ),
551
  'progress_bar' => array(
552
  'option_name' => __( 'Show Progress Bar', 'quiz-master-next' ),
553
+ 'value' => $globalQuizsetting['progress_bar'],
554
  ),
555
  'timer_limit' => array(
556
  'option_name' => __( 'Time Limit (in Minute)', 'quiz-master-next' ),
557
+ 'value' => $globalQuizsetting['timer_limit'],
558
  ),
559
  'enable_pagination_quiz' => array(
560
  'option_name' => __( 'Show current page number', 'quiz-master-next' ),
561
+ 'value' => $globalQuizsetting['enable_pagination_quiz'],
562
  ),
563
  'require_log_in' => array(
564
  'option_name' => __( 'Require User Login', 'quiz-master-next' ),
565
+ 'value' => $globalQuizsetting['require_log_in'],
566
  ),
567
  'disable_scroll_next_previous_click' => array(
568
  'option_name' => __( 'Disable scroll on next and previous button click?', 'quiz-master-next' ),
569
+ 'value' => $globalQuizsetting['disable_scroll_next_previous_click'],
570
  ),
571
  'disable_first_page' => array(
572
  'option_name' => __( 'Disable first page on quiz', 'quiz-master-next' ),
573
+ 'value' => $globalQuizsetting['disable_first_page'],
574
  ),
575
  );
576
+ $quiz_setting_option = apply_filters( 'qsm_quiz_wizard_settings_option', $quiz_setting_option );
577
  if ( $quiz_setting_option ) {
578
  foreach ( $quiz_setting_option as $key => $single_setting ) {
579
  $key = array_search( $key, array_column( $all_settings, 'id' ), true );
php/admin/settings-page.php CHANGED
@@ -36,10 +36,15 @@ class QMNGlobalSettingsPage {
36
  private function add_hooks() {
37
  add_action( 'admin_init', array( $this, 'init' ) );
38
  add_action( 'admin_init', array( $this, 'quiz_default_global_option_init' ) );
39
- add_filter( 'pre_update_option_qmn-settings', function( $new_value ) {
40
- $new_value['cpt_slug'] = sanitize_title( $new_value['cpt_slug'] ) ;
41
- return $new_value;
42
- }, 10, 2 );
 
 
 
 
 
43
  add_action( 'admin_enqueue_scripts', array( $this, 'qsm_admin_enqueue_scripts_settings_page' ), 20 );
44
  }
45
 
@@ -53,8 +58,8 @@ class QMNGlobalSettingsPage {
53
  return;
54
  }
55
  global $mlwQuizMasterNext;
56
- wp_enqueue_script( 'qmn_datetime_js', QSM_PLUGIN_JS_URL.'/jquery.datetimepicker.full.min.js',array(), $mlwQuizMasterNext->version, false);
57
- wp_enqueue_style( 'qsm_datetime_style', QSM_PLUGIN_CSS_URL.'/jquery.datetimepicker.css', array(), $mlwQuizMasterNext->version );
58
  }
59
 
60
  /**
@@ -82,7 +87,57 @@ class QMNGlobalSettingsPage {
82
  add_settings_field( 'results-details', __( 'Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'results_details_template' ), 'qmn_global_settings', 'qmn-global-section' );
83
  }
84
 
85
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  * Prepares Settings Fields of global quiz default option
87
  *
88
  * @since 4.1.0
@@ -130,9 +185,10 @@ class QMNGlobalSettingsPage {
130
  add_settings_field( 'logo-url', __( 'Logo URL', 'quiz-master-next' ), array( $this, 'qsm_global_logo_url' ), 'qsm_default_global_option', 'qmn-global-section' );
131
  add_settings_field( 'preferred_date_format', __( 'Preferred Date Format', 'quiz-master-next' ), array( $this, 'preferred_date_format' ), 'qsm_default_global_option', 'qmn-global-section' );
132
  global $globalQuizsetting;
133
- $globalQuizsetting = get_option( 'qsm-quiz-settings' );
134
-
135
- }
 
136
  /**
137
  * Generates Section Text
138
  *
@@ -154,19 +210,21 @@ class QMNGlobalSettingsPage {
154
  ?>
155
  <div class="notice notice-info multiple-category-notice">
156
  <h3>
157
- <?php esc_html_e( 'Database update required', 'quiz-master-next' ); ?>
158
  </h3>
159
  <p>
160
- <?php esc_html_e( 'QSM has been updated!', 'quiz-master-next' ); ?><br/>
161
- <?php esc_html_e( 'We need to upgrade your database so that you can enjoy the latest features.', 'quiz-master-next' ); ?><br/>
162
- <?php /* translators: %s: HTML tag */
163
- echo sprintf( esc_html__( 'Please note that this action %1$s can not be %2$s rolled back. We recommend you to take a backup of your current site before proceeding.', 'quiz-master-next' ), '<b>', '</b>'); ?>
 
 
164
  </p>
165
  <p class="category-action">
166
  <a href="#" class="button button-primary enable-multiple-category"><?php esc_html_e( 'Update Database', 'quiz-master-next' ); ?></a>
167
  </p>
168
  </div>
169
- <?php
170
  }
171
  }
172
 
@@ -185,7 +243,7 @@ class QMNGlobalSettingsPage {
185
  ?>
186
  <input type='email' name='qmn-settings[from_email]' id='qmn-settings[from_email]'
187
  value='<?php echo esc_attr( $from_email ); ?>' />
188
- <?php
189
  }
190
 
191
  /**
@@ -203,7 +261,7 @@ class QMNGlobalSettingsPage {
203
  ?>
204
  <input type='number' name='qmn-settings[items_per_page_question_bank]' id='qmn-settings[items_per_page_question_bank]'
205
  value='<?php echo esc_attr( $items_per_page_question_bank ); ?>' />
206
- <?php
207
  }
208
 
209
  /**
@@ -221,7 +279,7 @@ class QMNGlobalSettingsPage {
221
  ?>
222
  <input type='text' name='qmn-settings[from_name]' id='qmn-settings[from_name]'
223
  value='<?php echo esc_attr( $from_name ); ?>' />
224
- <?php
225
  }
226
 
227
  /**
@@ -320,7 +378,7 @@ class QMNGlobalSettingsPage {
320
  * @return void
321
  */
322
  public function qsm_delete_data() {
323
- $settings = (array) get_option( 'qmn-settings' );
324
  $cpt_archive = '0';
325
  if ( isset( $settings['delete_qsm_data'] ) ) {
326
  $cpt_archive = esc_attr( $settings['delete_qsm_data'] );
@@ -350,12 +408,12 @@ class QMNGlobalSettingsPage {
350
 
351
  echo '<label style="margin-bottom: 10px;display: inline-block;">';
352
  echo "<input type='radio' name='qmn-settings[background_quiz_email_process]' class='background_quiz_email_process' value='1' " . checked( $background_quiz_email_process, '1', false ) . '/>';
353
- echo esc_html__( 'Yes', 'quiz-master-next' );
354
  echo '</label>';
355
  echo '<br/>';
356
  echo '<label>';
357
  echo "<input type='radio' name='qmn-settings[background_quiz_email_process]' class='background_quiz_email_process' value='0' " . checked( $background_quiz_email_process, '0', false ) . '/>';
358
- echo esc_html__( 'No', 'quiz-master-next' );
359
  echo '</label>';
360
  }
361
 
@@ -393,7 +451,7 @@ class QMNGlobalSettingsPage {
393
  * @return void
394
  */
395
  public function usage_tracker_field() {
396
- $settings = (array) get_option( 'qmn-settings' );
397
  $tracking_allowed = '0';
398
  if ( isset( $settings['tracking_allowed'] ) ) {
399
  $tracking_allowed = esc_attr( $settings['tracking_allowed'] );
@@ -428,7 +486,7 @@ class QMNGlobalSettingsPage {
428
  echo '<label class="switch">';
429
  echo '<input type="checkbox" name="qmn-settings[ip_collection]" id="qmn-settings[ip_collection]" value="1"' . esc_attr( $checked ) . '/>';
430
  echo '<span class="slider round"></span></label>';
431
- echo "<span class='global-sub-text' for='qmn-settings[ip_collection]'>". esc_html__( 'You must not restrict number of quiz attempts when this option is enabled.', 'quiz-master-next' ) . '</span>';
432
  }
433
 
434
  /**
@@ -439,12 +497,12 @@ class QMNGlobalSettingsPage {
439
  */
440
  public static function display_page() {
441
  global $mlwQuizMasterNext;
442
- $active_tab = "qmn_global_settings";
443
- if ( isset( $_GET["tab"] ) ) {
444
- if ( sanitize_text_field( wp_unslash( $_GET["tab"] ) ) == "qmn_global_settings" ) {
445
- $active_tab = "qmn_global_settings";
446
  } else {
447
- $active_tab = "quiz-default-qptions";
448
  }
449
  }
450
  $g_class = $d_class = '';
@@ -455,26 +513,30 @@ class QMNGlobalSettingsPage {
455
  $d_class = 'nav-tab-active';
456
  }
457
  ?>
458
- <div class="wrap">
459
- <h2><?php esc_html_e( 'Global Settings', 'quiz-master-next' ); ?></h2>
460
- <h2 class="nav-tab-wrapper">
461
- <!-- when tab buttons are clicked we jump back to the same page but with a new parameter that represents the clicked tab. accordingly we make it active -->
462
- <a href="?page=qmn_global_settings&tab=qmn_global_settings" class="nav-tab <?php echo esc_attr( $g_class ); ?> "><?php esc_html_e('Main Settings', 'quiz-master-next'); ?></a>
463
- <a href="?page=qmn_global_settings&tab=quiz-default-qptions" class="nav-tab <?php echo esc_attr( $d_class ); ?>"><?php esc_html_e('Quiz Default Options', 'quiz-master-next'); ?></a>
464
- </h2>
465
- <form action="options.php" method="POST" class="qsm_global_settings">
466
- <?php if ( 'qmn_global_settings' === $active_tab ) {
467
- settings_fields( 'qmn-settings-group' );
468
- do_settings_sections( 'qmn_global_settings' );
469
- } ?>
470
- <?php if ( 'quiz-default-qptions' === $active_tab ) {
471
- settings_fields( 'qsm-quiz-settings-group' );
472
- do_settings_sections( 'qsm_default_global_option' );
473
- } ?>
474
- <?php submit_button(); ?>
475
- </form>
476
- </div>
477
- <?php
 
 
 
 
478
  }
479
 
480
  /**
@@ -491,12 +553,12 @@ class QMNGlobalSettingsPage {
491
  }
492
  echo '<label style="margin-bottom: 10px;display: inline-block;">';
493
  echo "<input type='radio' name='qmn-settings[new_template_result_detail]' class='new_template_result_detail' value='1' " . checked( $new_template_result_detail, '1', false ) . '/>';
494
- echo esc_html__( 'New Template', 'quiz-master-next' );
495
  echo '</label>';
496
  echo '<br/>';
497
  echo '<label>';
498
  echo "<input type='radio' name='qmn-settings[new_template_result_detail]' class='new_template_result_detail' value='0' " . checked( $new_template_result_detail, '0', false ) . '/>';
499
- echo esc_html__( 'Old Template', 'quiz-master-next' );
500
  echo '</label>';
501
  }
502
 
@@ -508,11 +570,11 @@ class QMNGlobalSettingsPage {
508
  */
509
  public function qsm_global_quiz_type() {
510
  global $globalQuizsetting;
511
- $qsm_form_type = (isset($globalQuizsetting['form_type']) && '' !== $globalQuizsetting['form_type'] ? $globalQuizsetting['form_type'] : "");
512
  echo '<div class="global_form_type_settiong"><select name ="qsm-quiz-settings[form_type]">
513
- <option value="0" '.(0 === intval( $qsm_form_type ) ? "Selected" : "").'>Quiz</option>
514
- <option value="1" '.(1 === intval( $qsm_form_type ) ? "Selected" : "").' >Survey</option>
515
- <option value="2" '.(2 === intval( $qsm_form_type ) ? "Selected" : "").'>Simple Form</option>
516
  </select></div>';
517
  }
518
 
@@ -524,13 +586,13 @@ class QMNGlobalSettingsPage {
524
  */
525
  public function qsm_global_grading_system() {
526
  global $globalQuizsetting;
527
- $qsm_system = (isset($globalQuizsetting['system']) && '' !== $globalQuizsetting['system'] ? $globalQuizsetting['system'] : "");
528
  echo '<fieldset class="buttonset buttonset-hide global_setting_system" >
529
- <input type="radio" id="system-0" name="qsm-quiz-settings[system]" value="0" '. checked( $qsm_system, '0', false ) .'>
530
  <label for="system-0">Correct/Incorrect</label><br>
531
- <input type="radio" id="system-1" name="qsm-quiz-settings[system]" value="1" '. checked( $qsm_system, '1', false ) .'>
532
  <label for="system-1">Points</label><br>
533
- <input type="radio" id="system-3" name="qsm-quiz-settings[system]" value="3" '. checked( $qsm_system, '3', false ) .'>
534
  <label for="system-3">Both</label><br>
535
  </fieldset>
536
  <span class="qsm-opt-desc">Select the system for grading the quiz.</span>';
@@ -544,9 +606,9 @@ class QMNGlobalSettingsPage {
544
  */
545
  public function qsm_global_score_roundoff() {
546
  global $globalQuizsetting;
547
- $qsm_score_roundoff = (isset($globalQuizsetting['score_roundoff']) && '' !== $globalQuizsetting['score_roundoff'] ? $globalQuizsetting['score_roundoff'] : "");
548
  echo '<fieldset class="buttonset buttonset-hide global_setting_score_roundoff" >
549
- <input type="checkbox" id="score_roundoff-1" name="qsm-quiz-settings[score_roundoff]" value="1" '. checked( $qsm_score_roundoff, '1', false ) .'>
550
  </fieldset>';
551
  }
552
 
@@ -558,11 +620,11 @@ class QMNGlobalSettingsPage {
558
  */
559
  public function qsm_global_show_progress_bar() {
560
  global $globalQuizsetting;
561
- $qsm_progress_bar = (isset($globalQuizsetting['progress_bar']) && '' !== $globalQuizsetting['progress_bar'] ? $globalQuizsetting['progress_bar'] : "0");
562
  echo '<fieldset class="buttonset buttonset-hide qsm_tab_content" >
563
- <input type="radio" id="progress_bar-1" name="qsm-quiz-settings[progress_bar]" value="1" '. checked( $qsm_progress_bar, '1', false ) .' >
564
  <label for="progress_bar-1">Yes</label><br>
565
- <input type="radio" id="progress_bar-0" name="qsm-quiz-settings[progress_bar]" value="0" '. checked( $qsm_progress_bar, '0', false ) .'>
566
  <label for="progress_bar-0">No</label><br>
567
  </fieldset>';
568
  }
@@ -576,11 +638,11 @@ class QMNGlobalSettingsPage {
576
  public function qsm_global_require_user_login() {
577
  global $globalQuizsetting;
578
 
579
- $qsm_require_log_in = (isset($globalQuizsetting['require_log_in']) && '' !== $globalQuizsetting['require_log_in'] ? $globalQuizsetting['require_log_in'] : "0");
580
  echo '<fieldset class="buttonset buttonset-hide" >
581
- <input type="radio" id="require_log_in-1" name="qsm-quiz-settings[require_log_in]" value="1" '. checked( $qsm_require_log_in, '1', false ) .'>
582
  <label for="require_log_in-1">Yes</label><br>
583
- <input type="radio" id="require_log_in-0" name="qsm-quiz-settings[require_log_in]" value="0" '. checked( $qsm_require_log_in, '0', false ) .'>
584
  <label for="require_log_in-0">No</label><br>
585
  </fieldset>
586
  <span class="qsm-opt-desc">Enabling this allows only logged in users to take the quiz</span>';
@@ -594,7 +656,7 @@ class QMNGlobalSettingsPage {
594
  */
595
  public function qsm_global_questions_per_page() {
596
  global $globalQuizsetting;
597
- $qsm_pagination = isset( $globalQuizsetting['pagination'] ) && '' !== $globalQuizsetting['pagination'] ? $globalQuizsetting['pagination'] : "0";
598
  echo '<input type="number" step="1" min="0" id="pagination" name="qsm-quiz-settings[pagination]" value="' . esc_attr( $qsm_pagination ) . '">
599
  <span class="qsm-opt-desc">Override the default pagination created on questions tab</span>';
600
  }
@@ -607,8 +669,8 @@ class QMNGlobalSettingsPage {
607
  */
608
  public function qsm_global_time_limit_in_minutes() {
609
  global $globalQuizsetting;
610
- $qsm_timer_limit = (isset($globalQuizsetting['timer_limit']) && '' !== $globalQuizsetting['timer_limit'] ? $globalQuizsetting['timer_limit'] : "0");
611
- echo '<input type="number" step="1" min="0" id="timer_limit" name="qsm-quiz-settings[timer_limit]" value="'.esc_attr($qsm_timer_limit).'">
612
  <span class="qsm-opt-desc">Leave 0 for no time limit</span>';
613
  }
614
 
@@ -620,11 +682,11 @@ class QMNGlobalSettingsPage {
620
  */
621
  public function qsm_global_force_submit_after_timer_expiry() {
622
  global $globalQuizsetting;
623
- $qsm_enable_result_after_timer_end = (isset($globalQuizsetting['enable_result_after_timer_end']) && '' !== $globalQuizsetting['enable_result_after_timer_end'] ? $globalQuizsetting['enable_result_after_timer_end'] : "0");
624
  echo '<fieldset class="buttonset buttonset-hide" >
625
- <input type="radio" id="enable_result_after_timer_end-1" name="qsm-quiz-settings[enable_result_after_timer_end]" value="1" '. checked( $qsm_enable_result_after_timer_end, '1', false ) .'>
626
  <label for="enable_result_after_timer_end-1">Yes</label><br>
627
- <input type="radio" id="enable_result_after_timer_end-0" name="qsm-quiz-settings[enable_result_after_timer_end]" value="0" '. checked( $qsm_enable_result_after_timer_end, '0', false ) .'>
628
  <label for="enable_result_after_timer_end-0">No</label><br>
629
  </fieldset>';
630
  }
@@ -636,11 +698,11 @@ class QMNGlobalSettingsPage {
636
  */
637
  public function qsm_global_skip_validations_when_time_expire() {
638
  global $globalQuizsetting;
639
- $qsm_skip_validation_time_expire = (isset($globalQuizsetting['skip_validation_time_expire']) && '' !== $globalQuizsetting['skip_validation_time_expire'] ? $globalQuizsetting['skip_validation_time_expire'] : "0");
640
  echo '<fieldset class="buttonset buttonset-hide" >
641
- <input type="radio" id="skip_validation_time_expire-1" name="qsm-quiz-settings[skip_validation_time_expire]" value="1" '. checked( $qsm_skip_validation_time_expire, '1', false ) .'>
642
  <label for="skip_validation_time_expire-1">Yes</label><br>
643
- <input type="radio" id="skip_validation_time_expire-0" name="qsm-quiz-settings[skip_validation_time_expire]" value="0" '. checked( $qsm_skip_validation_time_expire, '0', false ) .'>
644
  <label for="skip_validation_time_expire-0">No</label><br>
645
  </fieldset>';
646
  }
@@ -653,8 +715,8 @@ class QMNGlobalSettingsPage {
653
  */
654
  public function qsm_global_limit_attempts() {
655
  global $globalQuizsetting;
656
- $qsm_total_user_tries = (isset($globalQuizsetting['total_user_tries']) && '' !== $globalQuizsetting['total_user_tries'] ? $globalQuizsetting['total_user_tries'] : "0");
657
- echo '<input type="number" step="1" min="0" id="total_user_tries" name="qsm-quiz-settings[total_user_tries]" value="'.esc_attr($qsm_total_user_tries).'">
658
  <span class="qsm-opt-desc">Leave 0 for unlimited attempts</span>';
659
  }
660
 
@@ -667,8 +729,8 @@ class QMNGlobalSettingsPage {
667
  */
668
  public function qsm_global_limit_entries() {
669
  global $globalQuizsetting;
670
- $qsm_limit_total_entries = (isset($globalQuizsetting['limit_total_entries']) && '' !== $globalQuizsetting['limit_total_entries'] ? $globalQuizsetting['limit_total_entries'] : "0");
671
- echo '<input type="number" step="1" min="0" id="limit_total_entries" name="qsm-quiz-settings[limit_total_entries]" value="'.esc_attr($qsm_limit_total_entries).'">
672
  <span class="qsm-opt-desc">Leave 0 for unlimited entries</span>';
673
 
674
  }
@@ -681,8 +743,8 @@ class QMNGlobalSettingsPage {
681
  */
682
  public function qsm_global_limit_number_of_questions() {
683
  global $globalQuizsetting;
684
- $qsm_question_from_total = (isset($globalQuizsetting['question_from_total']) && '' !== $globalQuizsetting['question_from_total'] ? $globalQuizsetting['question_from_total'] : "0");
685
- echo '<input type="number" step="1" min="0" id="question_from_total" name="qsm-quiz-settings[question_from_total]" value="'.esc_attr($qsm_question_from_total).'">
686
  <span class="qsm-opt-desc">Leave 0 to load all questions</span>';
687
  }
688
 
@@ -696,8 +758,8 @@ class QMNGlobalSettingsPage {
696
  */
697
  public function qsm_global_limit_number_of_questions_per_category() {
698
  global $globalQuizsetting;
699
- $qsm_question_per_category = (isset($globalQuizsetting['question_per_category']) && '' !== $globalQuizsetting['question_per_category'] ? $globalQuizsetting['question_per_category'] : "0");
700
- echo '<input type="number" step="1" min="0" id="question_per_category" name="qsm-quiz-settings[question_per_category]" value="'.esc_attr($qsm_question_per_category).'">
701
  <span class="qsm-opt-desc">Leave 0 to load all questions. You also need to set Limit Number of questions, as well as select Question Categories</span>';
702
  }
703
 
@@ -710,11 +772,11 @@ class QMNGlobalSettingsPage {
710
  */
711
  public function qsm_global_contact_form_position() {
712
  global $globalQuizsetting;
713
- $qsm_contact_info_location = (isset($globalQuizsetting['contact_info_location']) && '' !== $globalQuizsetting['contact_info_location'] ? $globalQuizsetting['contact_info_location'] : "0");
714
  echo '<fieldset class="buttonset buttonset-hide" >
715
- <input type="radio" id="contact_info_location-0" name="qsm-quiz-settings[contact_info_location]" value="0" '. checked( $qsm_contact_info_location, '0', false ) .'>
716
  <label for="contact_info_location-0">Show before quiz begins</label><br>
717
- <input type="radio" id="contact_info_location-1" name="qsm-quiz-settings[contact_info_location]" value="1" '. checked( $qsm_contact_info_location, '1', false ) .'>
718
  <label for="contact_info_location-1">Show after the quiz ends</label><br>
719
  </fieldset>
720
  <span class="qsm-opt-desc">Select when to display the contact form</span>';
@@ -728,11 +790,11 @@ class QMNGlobalSettingsPage {
728
  */
729
  public function qsm_global_show_contact_form_to_logged_in_users() {
730
  global $globalQuizsetting;
731
- $qsm_loggedin_user_contact = (isset($globalQuizsetting['loggedin_user_contact']) && '' !== $globalQuizsetting['loggedin_user_contact'] ? $globalQuizsetting['loggedin_user_contact'] : "0");
732
  echo '<fieldset class="buttonset buttonset-hide" >
733
- <input type="radio" id="loggedin_user_contact-0" name="qsm-quiz-settings[loggedin_user_contact]" value="0" '. checked( $qsm_loggedin_user_contact, '0', false ) .'>
734
  <label for="loggedin_user_contact-0">Yes</label><br>
735
- <input type="radio" id="loggedin_user_contact-1" name="qsm-quiz-settings[loggedin_user_contact]" value="1" '. checked( $qsm_loggedin_user_contact, '1', false ) .'>
736
  <label for="loggedin_user_contact-1">No</label><br>
737
  </fieldset>
738
  <span class="qsm-opt-desc">Logged in users can edit their contact information</span>';
@@ -746,11 +808,11 @@ class QMNGlobalSettingsPage {
746
  */
747
  public function qsm_global_enable_comments() {
748
  global $globalQuizsetting;
749
- $qsm_comment_section = (isset($globalQuizsetting['comment_section']) && '' !== $globalQuizsetting['comment_section'] ? $globalQuizsetting['comment_section'] : "0");
750
  echo '<fieldset class="buttonset buttonset-hide" >
751
- <input type="radio" id="comment_section-0" name="qsm-quiz-settings[comment_section]" value="0" '. checked( $qsm_comment_section, '0', false ) .'>
752
  <label for="comment_section-0">Yes</label><br>
753
- <input type="radio" id="comment_section-1" name="qsm-quiz-settings[comment_section]" value="1" '. checked( $qsm_comment_section, '1', false ) .'>
754
  <label for="comment_section-1">No</label><br>
755
  </fieldset>
756
  <span class="qsm-opt-desc">Allow users to enter their comments after the quiz</span>';
@@ -764,11 +826,11 @@ class QMNGlobalSettingsPage {
764
  */
765
  public function qsm_global_show_question_numbers() {
766
  global $globalQuizsetting;
767
- $qsm_question_numbering = (isset($globalQuizsetting['question_numbering']) && '' !== $globalQuizsetting['question_numbering'] ? $globalQuizsetting['question_numbering'] : "0");
768
  echo '<fieldset class="buttonset buttonset-hide" >
769
- <input type="radio" id="question_numbering-1" name="qsm-quiz-settings[question_numbering]" value="1" '. checked( $qsm_question_numbering, '1', false ) .'>
770
  <label for="question_numbering-1">Yes</label><br>
771
- <input type="radio" id="question_numbering-0" name="qsm-quiz-settings[question_numbering]" value="0" '. checked( $qsm_question_numbering, '0', false ) .'>
772
  <label for="question_numbering-0">No</label><br>
773
  </fieldset>';
774
  }
@@ -781,11 +843,11 @@ class QMNGlobalSettingsPage {
781
  */
782
  public function qsm_global_save_responses() {
783
  global $globalQuizsetting;
784
- $qsm_store_responses = (isset($globalQuizsetting['store_responses']) && '' !== $globalQuizsetting['store_responses'] ? $globalQuizsetting['store_responses'] : "0");
785
  echo '<fieldset class="buttonset buttonset-hide" >
786
- <input type="radio" id="store_responses-1" name="qsm-quiz-settings[store_responses]" value="1" '. checked( $qsm_store_responses, '1', false ) .'>
787
  <label for="store_responses-1">Yes</label><br>
788
- <input type="radio" id="store_responses-0" name="qsm-quiz-settings[store_responses]" value="0" '. checked( $qsm_store_responses, '0', false ) .'>
789
  <label for="store_responses-0">No</label><br>
790
  </fieldset>
791
  <span class="qsm-opt-desc">The results will be permanently stored in a database</span>';
@@ -799,11 +861,11 @@ class QMNGlobalSettingsPage {
799
  */
800
  public function qsm_global_disable_change_of_answers() {
801
  global $globalQuizsetting;
802
- $qsm_disable_answer_onselect = (isset($globalQuizsetting['disable_answer_onselect']) && '' !== $globalQuizsetting['disable_answer_onselect'] ? $globalQuizsetting['disable_answer_onselect'] : "0");
803
  echo '<fieldset class="buttonset buttonset-hide" >
804
- <input type="radio" id="disable_answer_onselect-1" name="qsm-quiz-settings[disable_answer_onselect]" value="1" '. checked( $qsm_disable_answer_onselect, '1', false ) .'>
805
  <label for="disable_answer_onselect-1">Yes</label><br>
806
- <input type="radio" id="disable_answer_onselect-0" name="qsm-quiz-settings[disable_answer_onselect]" value="0" '. checked( $qsm_disable_answer_onselect, '0', false ) .'>
807
  <label for="disable_answer_onselect-0">No</label><br>
808
  </fieldset>
809
  <span class="qsm-opt-desc">Works with multiple choice questions only</span>';
@@ -817,11 +879,11 @@ class QMNGlobalSettingsPage {
817
  */
818
  public function qsm_global_add_class_for_correct_incorrect_answers() {
819
  global $globalQuizsetting;
820
- $qsm_ajax_show_correct = (isset($globalQuizsetting['ajax_show_correct']) && '' !== $globalQuizsetting['ajax_show_correct'] ? $globalQuizsetting['ajax_show_correct'] : "0");
821
  echo '<fieldset class="buttonset buttonset-hide" >
822
- <input type="radio" id="ajax_show_correct-1" name="qsm-quiz-settings[ajax_show_correct]" value="1" '. checked( $qsm_ajax_show_correct, '1', false ) .'>
823
  <label for="ajax_show_correct-1">Yes</label><br>
824
- <input type="radio" id="ajax_show_correct-0" name="qsm-quiz-settings[ajax_show_correct]"value="0" '. checked( $qsm_ajax_show_correct, '0', false ) .'>
825
  <label for="ajax_show_correct-0">No</label><br>
826
  </fieldset>
827
  <span class="qsm-opt-desc">Works with multiple choice questions only</span>';
@@ -835,11 +897,11 @@ class QMNGlobalSettingsPage {
835
  */
836
  public function qsm_global_disable_auto_fill_for_contact_input() {
837
  global $globalQuizsetting;
838
- $qsm_contact_disable_autofill = (isset($globalQuizsetting['contact_disable_autofill']) && '' !== $globalQuizsetting['contact_disable_autofill'] ? $globalQuizsetting['contact_disable_autofill'] : "0");
839
  echo '<fieldset class="buttonset buttonset-hide" >
840
- <input type="radio" id="contact_disable_autofill-1" name="qsm-quiz-settings[contact_disable_autofill]" value="1" '. checked( $qsm_contact_disable_autofill, '1', false ) .'>
841
  <label for="contact_disable_autofill-1">Yes</label><br>
842
- <input type="radio" id="contact_disable_autofill-0" name="qsm-quiz-settings[contact_disable_autofill]" value="0" '. checked( $qsm_contact_disable_autofill, '0', false ) .'>
843
  <label for="contact_disable_autofill-0">No</label><br>
844
  </fieldset>';
845
  }
@@ -852,11 +914,11 @@ class QMNGlobalSettingsPage {
852
  */
853
  public function qsm_global_disable_auto_fill_for_quiz_input() {
854
  global $globalQuizsetting;
855
- $qsm_form_disable_autofill = (isset($globalQuizsetting['form_disable_autofill']) && '' !== $globalQuizsetting['form_disable_autofill'] ? $globalQuizsetting['form_disable_autofill'] : "0");
856
  echo '<fieldset class="buttonset buttonset-hide" >
857
- <input type="radio" id="form_disable_autofill-1" name="qsm-quiz-settings[form_disable_autofill]" value="1" '. checked( $qsm_form_disable_autofill, '1', false ) .'>
858
  <label for="form_disable_autofill-1">Yes</label><br>
859
- <input type="radio" id="form_disable_autofill-0" name="qsm-quiz-settings[form_disable_autofill]" value="0" '. checked( $qsm_form_disable_autofill, '0', false ) .'>
860
  <label for="form_disable_autofill-0">No</label><br>
861
  </fieldset>';
862
  }
@@ -869,11 +931,11 @@ class QMNGlobalSettingsPage {
869
  */
870
  public function qsm_global_display_category_name_on_front_end() {
871
  global $globalQuizsetting;
872
- $qsm_show_category_on_front = (isset($globalQuizsetting['show_category_on_front']) && '' !== $globalQuizsetting['show_category_on_front'] ? $globalQuizsetting['show_category_on_front'] : "0");
873
  echo '<fieldset class="buttonset buttonset-hide" >
874
- <input type="radio" id="show_category_on_front-1" name="qsm-quiz-settings[show_category_on_front]" value="1" '. checked( $qsm_show_category_on_front, '1', false ) .' >
875
  <label for="show_category_on_front-1">Yes</label><br>
876
- <input type="radio" id="show_category_on_front-0" name="qsm-quiz-settings[show_category_on_front]" value="0" '. checked( $qsm_show_category_on_front, '0', false ) .'>
877
  <label for="show_category_on_front-0">No</label><br>
878
  </fieldset>';
879
  }
@@ -886,11 +948,11 @@ class QMNGlobalSettingsPage {
886
  */
887
  public function qsm_global_show_results_inline() {
888
  global $globalQuizsetting;
889
- $qsm_enable_quick_result_mc = (isset($globalQuizsetting['enable_quick_result_mc']) && '' !== $globalQuizsetting['enable_quick_result_mc'] ? $globalQuizsetting['enable_quick_result_mc'] : "0");
890
  echo '<fieldset class="buttonset buttonset-hide" >
891
- <input type="radio" id="enable_quick_result_mc-1" name="qsm-quiz-settings[enable_quick_result_mc]" value="1" '. checked( $qsm_enable_quick_result_mc, '1', false ) .'>
892
  <label for="enable_quick_result_mc-1">Yes</label><br>
893
- <input type="radio" id="enable_quick_result_mc-0" name="qsm-quiz-settings[enable_quick_result_mc]" value="0" '. checked( $qsm_enable_quick_result_mc, '0', false ) .'>
894
  <label for="enable_quick_result_mc-0">No</label><br>
895
  </fieldset>
896
  <span class="qsm-opt-desc">Instantly displays the result for each question</span>';
@@ -904,11 +966,11 @@ class QMNGlobalSettingsPage {
904
  */
905
  public function qsm_global_end_quiz_if_there_is_wrong_answer() {
906
  global $globalQuizsetting;
907
- $qsm_end_quiz_if_wrong = (isset($globalQuizsetting['end_quiz_if_wrong']) && '' !== $globalQuizsetting['end_quiz_if_wrong'] ? $globalQuizsetting['end_quiz_if_wrong'] : "0");
908
  echo '<fieldset class="buttonset buttonset-hide" >
909
- <input type="radio" id="end_quiz_if_wrong-1" name="qsm-quiz-settings[end_quiz_if_wrong]" value="1" '. checked( $qsm_end_quiz_if_wrong, '1', false ) .' >
910
  <label for="end_quiz_if_wrong-1">Yes</label><br>
911
- <input type="radio" id="end_quiz_if_wrong-0" name="qsm-quiz-settings[end_quiz_if_wrong]" value="0" '. checked( $qsm_end_quiz_if_wrong, '0', false ) .'>
912
  <label for="end_quiz_if_wrong-0">No</label><br>
913
  </fieldset>
914
  <span class="qsm-opt-desc">This option works with vertical Multiple Choice , horizontal Multiple Choice , drop down , multiple response and horizontal multiple response question types</span>';
@@ -922,13 +984,13 @@ class QMNGlobalSettingsPage {
922
  */
923
  public function qsm_global_show_correct_answer_inline() {
924
  global $globalQuizsetting;
925
- $qsm_enable_quick_correct_answer_info = (isset($globalQuizsetting['enable_quick_correct_answer_info']) && '' !== $globalQuizsetting['enable_quick_correct_answer_info'] ? $globalQuizsetting['enable_quick_correct_answer_info'] : "0");
926
  echo '<fieldset class="buttonset buttonset-hide" >
927
- <input type="radio" id="enable_quick_correct_answer_info-1" name="qsm-quiz-settings[enable_quick_correct_answer_info]" value="1" '. checked( $qsm_enable_quick_correct_answer_info, '1', false ) .'>
928
  <label for="enable_quick_correct_answer_info-1">Yes When answer is correct</label><br>
929
- <input type="radio" id="enable_quick_correct_answer_info-2" name="qsm-quiz-settings[enable_quick_correct_answer_info]" value="2" '. checked( $qsm_enable_quick_correct_answer_info, '2', false ) .'>
930
  <label for="enable_quick_correct_answer_info-2">Yes Independent of correct/incorrect</label><br>
931
- <input type="radio" id="enable_quick_correct_answer_info-0" name="qsm-quiz-settings[enable_quick_correct_answer_info]" value="0" '. checked( $qsm_enable_quick_correct_answer_info, '0', false ) .'>
932
  <label for="enable_quick_correct_answer_info-0">No</label><br>
933
  </fieldset>
934
  <span class="qsm-opt-desc">Show correct user info when inline result is enabled.</span>';
@@ -942,11 +1004,11 @@ class QMNGlobalSettingsPage {
942
  */
943
  public function qsm_global_retake_quiz() {
944
  global $globalQuizsetting;
945
- $qsm_enable_retake_quiz_button = (isset($globalQuizsetting['enable_retake_quiz_button']) && '' !== $globalQuizsetting['enable_retake_quiz_button'] ? $globalQuizsetting['enable_retake_quiz_button'] : "0");
946
  echo '<fieldset class="buttonset buttonset-hide" >
947
- <input type="radio" id="enable_retake_quiz_button-1" name="qsm-quiz-settings[enable_retake_quiz_button]" value="1" '. checked( $qsm_enable_retake_quiz_button, '1', false ) .'>
948
  <label for="enable_retake_quiz_button-1">Yes</label><br>
949
- <input type="radio" id="enable_retake_quiz_button-0" name="qsm-quiz-settings[enable_retake_quiz_button]" value="0" '. checked( $qsm_enable_retake_quiz_button, '0', false ) .'>
950
  <label for="enable_retake_quiz_button-0">No</label><br>
951
  </fieldset>
952
  <span class="qsm-opt-desc">Show a button on result page to retake the quiz</span>';
@@ -961,11 +1023,11 @@ class QMNGlobalSettingsPage {
961
  */
962
  public function qsm_global_show_current_page_number() {
963
  global $globalQuizsetting;
964
- $qsm_enable_pagination_quiz = (isset($globalQuizsetting['enable_pagination_quiz']) && '' !== $globalQuizsetting['enable_pagination_quiz'] ? $globalQuizsetting['enable_pagination_quiz'] : "0");
965
  echo '<fieldset class="buttonset buttonset-hide" >
966
- <input type="radio" id="enable_pagination_quiz-1" name="qsm-quiz-settings[enable_pagination_quiz]" value="1" '. checked( $qsm_enable_pagination_quiz, '1', false ) .'>
967
  <label for="enable_pagination_quiz-1">Yes</label><br>
968
- <input type="radio" id="enable_pagination_quiz-0" name="qsm-quiz-settings[enable_pagination_quiz]" value="0" '. checked( $qsm_enable_pagination_quiz, '0', false ) .'>
969
  <label for="enable_pagination_quiz-0">No</label><br>
970
  </fieldset>';
971
  }
@@ -978,11 +1040,11 @@ class QMNGlobalSettingsPage {
978
  */
979
  public function qsm_global_deselect_answer() {
980
  global $globalQuizsetting;
981
- $qsm_enable_deselect_option = (isset($globalQuizsetting['enable_deselect_option']) && '' !== $globalQuizsetting['enable_deselect_option'] ? $globalQuizsetting['enable_deselect_option'] : "0");
982
  echo '<fieldset class="buttonset buttonset-hide" >
983
- <input type="radio" id="enable_deselect_option-1" name="qsm-quiz-settings[enable_deselect_option]" value="1" '. checked( $qsm_enable_deselect_option, '1', false ) .'>
984
  <label for="enable_deselect_option-1">Yes</label><br>
985
- <input type="radio" id="enable_deselect_option-0" name="qsm-quiz-settings[enable_deselect_option]" value="0" '. checked( $qsm_enable_deselect_option, '0', false ) .'>
986
  <label for="enable_deselect_option-0">No</label><br>
987
  </fieldset>
988
  <span class="qsm-opt-desc">Users are able deselect an answer and leave it blank. Works with Multiple Choice and Horizintal Multiple Choice questions only</span>';
@@ -995,11 +1057,11 @@ class QMNGlobalSettingsPage {
995
  */
996
  public function qsm_global_disable_description_on_quiz_result_page() {
997
  global $globalQuizsetting;
998
- $qsm_disable_description_on_result = (isset($globalQuizsetting['disable_description_on_result']) && '' !== $globalQuizsetting['disable_description_on_result'] ? $globalQuizsetting['disable_description_on_result'] : "0");
999
  echo '<fieldset class="buttonset buttonset-hide" >
1000
- <input type="radio" id="disable_description_on_result-1" name="qsm-quiz-settings[disable_description_on_result]" value="1" '. checked( $qsm_disable_description_on_result, '1', false ) .' >
1001
  <label for="disable_description_on_result-1">Yes</label><br>
1002
- <input type="radio" id="disable_description_on_result-0" name="qsm-quiz-settings[disable_description_on_result]" value="0" '. checked( $qsm_disable_description_on_result, '0', false ) .'>
1003
  <label for="disable_description_on_result-0">No</label><br>
1004
  </fieldset>';
1005
  }
@@ -1011,11 +1073,11 @@ class QMNGlobalSettingsPage {
1011
  */
1012
  public function qsm_global_disable_scroll_on_next_and_previous_button_click() {
1013
  global $globalQuizsetting;
1014
- $qsm_disable_scroll_next_previous_click = (isset($globalQuizsetting['disable_scroll_next_previous_click']) && '' !== $globalQuizsetting['disable_scroll_next_previous_click'] ? $globalQuizsetting['disable_scroll_next_previous_click'] : "0");
1015
  echo '<fieldset class="buttonset buttonset-hide" >
1016
- <input type="radio" id="disable_scroll_next_previous_click-1" name="qsm-quiz-settings[disable_scroll_next_previous_click]" value="1" '. checked( $qsm_disable_scroll_next_previous_click, '1', false ) .'>
1017
  <label for="disable_scroll_next_previous_click-1">Yes</label><br>
1018
- <input type="radio" id="disable_scroll_next_previous_click-0" name="qsm-quiz-settings[disable_scroll_next_previous_click]" value="0" '. checked( $qsm_disable_scroll_next_previous_click, '0', false ) .'>
1019
  <label for="disable_scroll_next_previous_click-0">No</label><br>
1020
  </fieldset>';
1021
  }
@@ -1028,17 +1090,17 @@ class QMNGlobalSettingsPage {
1028
  */
1029
  public function qsm_global_disable_first_page() {
1030
  global $globalQuizsetting;
1031
- $qsm_disable_first_page = (isset($globalQuizsetting['disable_first_page']) && '' !== $globalQuizsetting['disable_first_page'] ? $globalQuizsetting['disable_first_page'] : "0");
1032
  echo '<fieldset class="buttonset buttonset-hide" >
1033
- <input type="radio" id="disable_first_page-1" name="qsm-quiz-settings[disable_first_page]" value="1" '. checked( $qsm_disable_first_page, '1', false ) .'>
1034
  <label for="disable_first_page-1">Yes</label><br>
1035
- <input type="radio" id="disable_first_page-0" name="qsm-quiz-settings[disable_first_page]" value="0" '. checked( $qsm_disable_first_page, '0', false ) .'>
1036
  <label for="disable_first_page-0">No</label><br>
1037
  </fieldset>';
1038
  }
1039
 
1040
 
1041
- /**
1042
  * Generates Quiz Global Field For Quiz Animation
1043
  *
1044
  * @since 4.1.0
@@ -1047,17 +1109,17 @@ class QMNGlobalSettingsPage {
1047
  public function qsm_global_quiz_animation() {
1048
  global $globalQuizsetting;
1049
  global $mlwQuizMasterNext;
1050
- $qsm_quiz_animation = (isset( $globalQuizsetting['quiz_animation'] ) && '' !== $globalQuizsetting['quiz_animation'] ? $globalQuizsetting['quiz_animation'] : "");
1051
- $options = $mlwQuizMasterNext->pluginHelper->quiz_animation_effect();
1052
 
1053
  echo '<select name="qsm-quiz-settings[quiz_animation]">';
1054
  foreach ( $options as $value ) {
1055
- echo '<option value="' . esc_attr( $value['value'] ) . '" ' . (isset( $qsm_quiz_animation ) && $qsm_quiz_animation == $value['value'] ? "Selected" : "") . ' >' . esc_html( $value['label'] ) . '</option>';
1056
  }
1057
  echo '</select>';
1058
  }
1059
 
1060
- /**
1061
  * Generates Quiz Global Field For Logo URL
1062
  *
1063
  * @since 4.1.0
@@ -1065,8 +1127,8 @@ class QMNGlobalSettingsPage {
1065
  */
1066
  public function qsm_global_logo_url() {
1067
  global $globalQuizsetting;
1068
- $qsm_result_page_fb_image = (isset($globalQuizsetting['result_page_fb_image']) && '' !== $globalQuizsetting['result_page_fb_image'] ? $globalQuizsetting['result_page_fb_image'] : QSM_PLUGIN_URL . 'assets/icon-200x200.png');
1069
- echo '<input type="url" id="result_page_fb_image" name="qsm-quiz-settings[result_page_fb_image]" value="'.esc_url($qsm_result_page_fb_image).'">
1070
  <span class="qsm-opt-desc">If left blank, this will default to QSM logo</span>';
1071
  }
1072
 
@@ -1078,8 +1140,8 @@ class QMNGlobalSettingsPage {
1078
  */
1079
  public function qsm_global_random_questions() {
1080
  global $globalQuizsetting;
1081
- $qsm_randomness_order = (isset($globalQuizsetting['randomness_order']) && '' !== $globalQuizsetting['randomness_order'] ? $globalQuizsetting['randomness_order'] : "");
1082
- $options = array(
1083
  array(
1084
  'label' => __( 'Random Questions', 'quiz-master-next' ),
1085
  'value' => 1,
@@ -1099,7 +1161,7 @@ class QMNGlobalSettingsPage {
1099
  );
1100
  echo '<select name="qsm-quiz-settings[randomness_order]">';
1101
  foreach ( $options as $value ) {
1102
- echo '<option value="' . esc_attr( $value['value'] ) . '" ' . (isset( $qsm_randomness_order ) && $qsm_randomness_order == $value['value'] ? "Selected" : "") . ' >' . esc_html( $value['label'] ) . '</option>';
1103
  }
1104
  echo '</select>';
1105
  }
@@ -1111,21 +1173,21 @@ class QMNGlobalSettingsPage {
1111
  */
1112
  public function qsm_global_quiz_dates() {
1113
  global $globalQuizsetting;
1114
- $qsm_scheduled_time_start = (isset($globalQuizsetting['scheduled_time_start']) && '' !== $globalQuizsetting['scheduled_time_start'] ? $globalQuizsetting['scheduled_time_start'] : "");
1115
- $qsm_scheduled_time_end = (isset($globalQuizsetting['scheduled_time_end']) && '' !== $globalQuizsetting['scheduled_time_end'] ? $globalQuizsetting['scheduled_time_end'] : "");
1116
  echo '<div>
1117
  <span class="qsm-ph_text">Start Date</span>
1118
- <input autocomplete="off" type="text" id="scheduled_time_start" name="qsm-quiz-settings[scheduled_time_start]" value="'.esc_attr($qsm_scheduled_time_start).'">
1119
  <span class="qsm-opt-desc">If set, Quiz will be accessible only after this date</span>
1120
  </div>';
1121
  echo '<div>
1122
  <span class="qsm-ph_text">End Date</span>
1123
- <input autocomplete="off" type="text" id="scheduled_time_end" name="qsm-quiz-settings[scheduled_time_end]" value="'.esc_attr($qsm_scheduled_time_end).'">
1124
  <span class="qsm-opt-desc"> If set, Quiz will not be accessible after this date</span>
1125
  </div>';
1126
- wp_add_inline_script( 'qsm_admin_js', 'jQuery(function(){jQuery("#scheduled_time_start,#scheduled_time_end").datetimepicker({format: "m/d/Y H:i",step: 1});});');
1127
  }
1128
- /**
1129
  * Generates Quiz Global Field For Do not allow quiz submission after the end date/time
1130
  *
1131
  * @since 4.1.0
@@ -1133,9 +1195,9 @@ class QMNGlobalSettingsPage {
1133
  */
1134
  public function qsm_global_do_not_allow_quiz_submission_after_the_end_datetime() {
1135
  global $globalQuizsetting;
1136
- $qsm_not_allow_after_expired_time = (isset($globalQuizsetting['not_allow_after_expired_time']) && '' !== $globalQuizsetting['not_allow_after_expired_time'] ? $globalQuizsetting['not_allow_after_expired_time'] : "");
1137
  echo '<fieldset class="buttonset buttonset-hide" >
1138
- <input type="checkbox" id="not_allow_after_expired_time-1" name="qsm-quiz-settings[not_allow_after_expired_time]" value="1" '. checked( $qsm_not_allow_after_expired_time, '1', false ) .'>
1139
  <br>
1140
  </fieldset>';
1141
  }
@@ -1149,8 +1211,8 @@ class QMNGlobalSettingsPage {
1149
  public function preferred_date_format() {
1150
 
1151
  global $globalQuizsetting;
1152
- $preferred_date_format = (isset($globalQuizsetting['preferred_date_format']) ? $globalQuizsetting['preferred_date_format'] : get_option( 'date_format' ));
1153
- echo '<input type="text" id="preferred_date_format" name="qsm-quiz-settings[preferred_date_format]" value="'.esc_attr($preferred_date_format).'">';
1154
  echo '<span class="qsm-opt-desc">Set your preferred date format.</span>';
1155
  }
1156
 
36
  private function add_hooks() {
37
  add_action( 'admin_init', array( $this, 'init' ) );
38
  add_action( 'admin_init', array( $this, 'quiz_default_global_option_init' ) );
39
+ add_filter(
40
+ 'pre_update_option_qmn-settings',
41
+ function( $new_value ) {
42
+ $new_value['cpt_slug'] = sanitize_title( $new_value['cpt_slug'] );
43
+ return $new_value;
44
+ },
45
+ 10,
46
+ 2
47
+ );
48
  add_action( 'admin_enqueue_scripts', array( $this, 'qsm_admin_enqueue_scripts_settings_page' ), 20 );
49
  }
50
 
58
  return;
59
  }
60
  global $mlwQuizMasterNext;
61
+ wp_enqueue_script( 'qmn_datetime_js', QSM_PLUGIN_JS_URL . '/jquery.datetimepicker.full.min.js', array(), $mlwQuizMasterNext->version, false );
62
+ wp_enqueue_style( 'qsm_datetime_style', QSM_PLUGIN_CSS_URL . '/jquery.datetimepicker.css', array(), $mlwQuizMasterNext->version );
63
  }
64
 
65
  /**
87
  add_settings_field( 'results-details', __( 'Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'results_details_template' ), 'qmn_global_settings', 'qmn-global-section' );
88
  }
89
 
90
+ /**
91
+ * Default settings value
92
+ *
93
+ * @since 7.3.10
94
+ * @return array
95
+ */
96
+ public function default_settings() {
97
+ return array(
98
+ 'form_type' => 0,
99
+ 'system' => 3,
100
+ 'score_roundoff' => 0,
101
+ 'progress_bar' => 0,
102
+ 'require_log_in' => 0,
103
+ 'pagination' => 0,
104
+ 'timer_limit' => 0,
105
+ 'enable_result_after_timer_end' => 0,
106
+ 'skip_validation_time_expire' => 0,
107
+ 'total_user_tries' => 0,
108
+ 'limit_total_entries' => 0,
109
+ 'question_from_total' => 0,
110
+ 'question_per_category' => 0,
111
+ 'contact_info_location' => 0,
112
+ 'loggedin_user_contact' => 0,
113
+ 'comment_section' => 0,
114
+ 'question_numbering' => 0,
115
+ 'store_responses' => 1,
116
+ 'disable_answer_onselect' => 0,
117
+ 'ajax_show_correct' => 0,
118
+ 'contact_disable_autofill' => 0,
119
+ 'form_disable_autofill' => 0,
120
+ 'show_category_on_front' => 0,
121
+ 'enable_quick_result_mc' => 0,
122
+ 'end_quiz_if_wrong' => 0,
123
+ 'enable_quick_correct_answer_info' => 0,
124
+ 'enable_retake_quiz_button' => 1,
125
+ 'enable_pagination_quiz' => 0,
126
+ 'enable_deselect_option' => 0,
127
+ 'disable_description_on_result' => 0,
128
+ 'disable_scroll_next_previous_click' => 0,
129
+ 'disable_first_page' => 0,
130
+ 'quiz_animation' => '',
131
+ 'result_page_fb_image' => QSM_PLUGIN_URL . 'assets/icon-200x200.png',
132
+ 'randomness_order' => 0,
133
+ 'scheduled_time_start' => '',
134
+ 'scheduled_time_end' => '',
135
+ 'not_allow_after_expired_time' => 0,
136
+ 'preferred_date_format' => 'F j, Y',
137
+ );
138
+ }
139
+
140
+ /**
141
  * Prepares Settings Fields of global quiz default option
142
  *
143
  * @since 4.1.0
185
  add_settings_field( 'logo-url', __( 'Logo URL', 'quiz-master-next' ), array( $this, 'qsm_global_logo_url' ), 'qsm_default_global_option', 'qmn-global-section' );
186
  add_settings_field( 'preferred_date_format', __( 'Preferred Date Format', 'quiz-master-next' ), array( $this, 'preferred_date_format' ), 'qsm_default_global_option', 'qmn-global-section' );
187
  global $globalQuizsetting;
188
+ $get_default_value = $this->default_settings();
189
+ $get_saved_value = get_option( 'qsm-quiz-settings' );
190
+ $globalQuizsetting = wp_parse_args( $get_saved_value, $get_default_value );
191
+ }
192
  /**
193
  * Generates Section Text
194
  *
210
  ?>
211
  <div class="notice notice-info multiple-category-notice">
212
  <h3>
213
+ <?php esc_html_e( 'Database update required', 'quiz-master-next' ); ?>
214
  </h3>
215
  <p>
216
+ <?php esc_html_e( 'QSM has been updated!', 'quiz-master-next' ); ?><br/>
217
+ <?php esc_html_e( 'We need to upgrade your database so that you can enjoy the latest features.', 'quiz-master-next' ); ?><br/>
218
+ <?php
219
+ /* translators: %s: HTML tag */
220
+ echo sprintf( esc_html__( 'Please note that this action %1$s can not be %2$s rolled back. We recommend you to take a backup of your current site before proceeding.', 'quiz-master-next' ), '<b>', '</b>' );
221
+ ?>
222
  </p>
223
  <p class="category-action">
224
  <a href="#" class="button button-primary enable-multiple-category"><?php esc_html_e( 'Update Database', 'quiz-master-next' ); ?></a>
225
  </p>
226
  </div>
227
+ <?php
228
  }
229
  }
230
 
243
  ?>
244
  <input type='email' name='qmn-settings[from_email]' id='qmn-settings[from_email]'
245
  value='<?php echo esc_attr( $from_email ); ?>' />
246
+ <?php
247
  }
248
 
249
  /**
261
  ?>
262
  <input type='number' name='qmn-settings[items_per_page_question_bank]' id='qmn-settings[items_per_page_question_bank]'
263
  value='<?php echo esc_attr( $items_per_page_question_bank ); ?>' />
264
+ <?php
265
  }
266
 
267
  /**
279
  ?>
280
  <input type='text' name='qmn-settings[from_name]' id='qmn-settings[from_name]'
281
  value='<?php echo esc_attr( $from_name ); ?>' />
282
+ <?php
283
  }
284
 
285
  /**
378
  * @return void
379
  */
380
  public function qsm_delete_data() {
381
+ $settings = (array) get_option( 'qmn-settings' );
382
  $cpt_archive = '0';
383
  if ( isset( $settings['delete_qsm_data'] ) ) {
384
  $cpt_archive = esc_attr( $settings['delete_qsm_data'] );
408
 
409
  echo '<label style="margin-bottom: 10px;display: inline-block;">';
410
  echo "<input type='radio' name='qmn-settings[background_quiz_email_process]' class='background_quiz_email_process' value='1' " . checked( $background_quiz_email_process, '1', false ) . '/>';
411
+ esc_html_e( 'Yes', 'quiz-master-next' );
412
  echo '</label>';
413
  echo '<br/>';
414
  echo '<label>';
415
  echo "<input type='radio' name='qmn-settings[background_quiz_email_process]' class='background_quiz_email_process' value='0' " . checked( $background_quiz_email_process, '0', false ) . '/>';
416
+ esc_html_e( 'No', 'quiz-master-next' );
417
  echo '</label>';
418
  }
419
 
451
  * @return void
452
  */
453
  public function usage_tracker_field() {
454
+ $settings = (array) get_option( 'qmn-settings' );
455
  $tracking_allowed = '0';
456
  if ( isset( $settings['tracking_allowed'] ) ) {
457
  $tracking_allowed = esc_attr( $settings['tracking_allowed'] );
486
  echo '<label class="switch">';
487
  echo '<input type="checkbox" name="qmn-settings[ip_collection]" id="qmn-settings[ip_collection]" value="1"' . esc_attr( $checked ) . '/>';
488
  echo '<span class="slider round"></span></label>';
489
+ echo "<span class='global-sub-text' for='qmn-settings[ip_collection]'>" . esc_html__( 'You must not restrict number of quiz attempts when this option is enabled.', 'quiz-master-next' ) . '</span>';
490
  }
491
 
492
  /**
497
  */
498
  public static function display_page() {
499
  global $mlwQuizMasterNext;
500
+ $active_tab = 'qmn_global_settings';
501
+ if ( isset( $_GET['tab'] ) ) {
502
+ if ( sanitize_text_field( wp_unslash( $_GET['tab'] ) ) == 'qmn_global_settings' ) {
503
+ $active_tab = 'qmn_global_settings';
504
  } else {
505
+ $active_tab = 'quiz-default-qptions';
506
  }
507
  }
508
  $g_class = $d_class = '';
513
  $d_class = 'nav-tab-active';
514
  }
515
  ?>
516
+ <div class="wrap">
517
+ <h2><?php esc_html_e( 'Global Settings', 'quiz-master-next' ); ?></h2>
518
+ <h2 class="nav-tab-wrapper">
519
+ <!-- when tab buttons are clicked we jump back to the same page but with a new parameter that represents the clicked tab. accordingly we make it active -->
520
+ <a href="?page=qmn_global_settings&tab=qmn_global_settings" class="nav-tab <?php echo esc_attr( $g_class ); ?> "><?php esc_html_e( 'Main Settings', 'quiz-master-next' ); ?></a>
521
+ <a href="?page=qmn_global_settings&tab=quiz-default-qptions" class="nav-tab <?php echo esc_attr( $d_class ); ?>"><?php esc_html_e( 'Quiz Default Options', 'quiz-master-next' ); ?></a>
522
+ </h2>
523
+ <form action="options.php" method="POST" class="qsm_global_settings">
524
+ <?php
525
+ if ( 'qmn_global_settings' === $active_tab ) {
526
+ settings_fields( 'qmn-settings-group' );
527
+ do_settings_sections( 'qmn_global_settings' );
528
+ }
529
+ ?>
530
+ <?php
531
+ if ( 'quiz-default-qptions' === $active_tab ) {
532
+ settings_fields( 'qsm-quiz-settings-group' );
533
+ do_settings_sections( 'qsm_default_global_option' );
534
+ }
535
+ ?>
536
+ <?php submit_button(); ?>
537
+ </form>
538
+ </div>
539
+ <?php
540
  }
541
 
542
  /**
553
  }
554
  echo '<label style="margin-bottom: 10px;display: inline-block;">';
555
  echo "<input type='radio' name='qmn-settings[new_template_result_detail]' class='new_template_result_detail' value='1' " . checked( $new_template_result_detail, '1', false ) . '/>';
556
+ esc_html_e( 'New Template', 'quiz-master-next' );
557
  echo '</label>';
558
  echo '<br/>';
559
  echo '<label>';
560
  echo "<input type='radio' name='qmn-settings[new_template_result_detail]' class='new_template_result_detail' value='0' " . checked( $new_template_result_detail, '0', false ) . '/>';
561
+ esc_html_e( 'Old Template', 'quiz-master-next' );
562
  echo '</label>';
563
  }
564
 
570
  */
571
  public function qsm_global_quiz_type() {
572
  global $globalQuizsetting;
573
+ $qsm_form_type = ( isset( $globalQuizsetting['form_type'] ) && '' !== $globalQuizsetting['form_type'] ? $globalQuizsetting['form_type'] : '' );
574
  echo '<div class="global_form_type_settiong"><select name ="qsm-quiz-settings[form_type]">
575
+ <option value="0" ' . ( 0 === intval( $qsm_form_type ) ? 'Selected' : '' ) . '>Quiz</option>
576
+ <option value="1" ' . ( 1 === intval( $qsm_form_type ) ? 'Selected' : '' ) . ' >Survey</option>
577
+ <option value="2" ' . ( 2 === intval( $qsm_form_type ) ? 'Selected' : '' ) . '>Simple Form</option>
578
  </select></div>';
579
  }
580
 
586
  */
587
  public function qsm_global_grading_system() {
588
  global $globalQuizsetting;
589
+ $qsm_system = ( isset( $globalQuizsetting['system'] ) && '' !== $globalQuizsetting['system'] ? $globalQuizsetting['system'] : '' );
590
  echo '<fieldset class="buttonset buttonset-hide global_setting_system" >
591
+ <input type="radio" id="system-0" name="qsm-quiz-settings[system]" value="0" ' . checked( $qsm_system, '0', false ) . '>
592
  <label for="system-0">Correct/Incorrect</label><br>
593
+ <input type="radio" id="system-1" name="qsm-quiz-settings[system]" value="1" ' . checked( $qsm_system, '1', false ) . '>
594
  <label for="system-1">Points</label><br>
595
+ <input type="radio" id="system-3" name="qsm-quiz-settings[system]" value="3" ' . checked( $qsm_system, '3', false ) . '>
596
  <label for="system-3">Both</label><br>
597
  </fieldset>
598
  <span class="qsm-opt-desc">Select the system for grading the quiz.</span>';
606
  */
607
  public function qsm_global_score_roundoff() {
608
  global $globalQuizsetting;
609
+ $qsm_score_roundoff = ( isset( $globalQuizsetting['score_roundoff'] ) && '' !== $globalQuizsetting['score_roundoff'] ? $globalQuizsetting['score_roundoff'] : '' );
610
  echo '<fieldset class="buttonset buttonset-hide global_setting_score_roundoff" >
611
+ <input type="checkbox" id="score_roundoff-1" name="qsm-quiz-settings[score_roundoff]" value="1" ' . checked( $qsm_score_roundoff, '1', false ) . '>
612
  </fieldset>';
613
  }
614
 
620
  */
621
  public function qsm_global_show_progress_bar() {
622
  global $globalQuizsetting;
623
+ $qsm_progress_bar = ( isset( $globalQuizsetting['progress_bar'] ) && '' !== $globalQuizsetting['progress_bar'] ? $globalQuizsetting['progress_bar'] : '0' );
624
  echo '<fieldset class="buttonset buttonset-hide qsm_tab_content" >
625
+ <input type="radio" id="progress_bar-1" name="qsm-quiz-settings[progress_bar]" value="1" ' . checked( $qsm_progress_bar, '1', false ) . ' >
626
  <label for="progress_bar-1">Yes</label><br>
627
+ <input type="radio" id="progress_bar-0" name="qsm-quiz-settings[progress_bar]" value="0" ' . checked( $qsm_progress_bar, '0', false ) . '>
628
  <label for="progress_bar-0">No</label><br>
629
  </fieldset>';
630
  }
638
  public function qsm_global_require_user_login() {
639
  global $globalQuizsetting;
640
 
641
+ $qsm_require_log_in = ( isset( $globalQuizsetting['require_log_in'] ) && '' !== $globalQuizsetting['require_log_in'] ? $globalQuizsetting['require_log_in'] : '0' );
642
  echo '<fieldset class="buttonset buttonset-hide" >
643
+ <input type="radio" id="require_log_in-1" name="qsm-quiz-settings[require_log_in]" value="1" ' . checked( $qsm_require_log_in, '1', false ) . '>
644
  <label for="require_log_in-1">Yes</label><br>
645
+ <input type="radio" id="require_log_in-0" name="qsm-quiz-settings[require_log_in]" value="0" ' . checked( $qsm_require_log_in, '0', false ) . '>
646
  <label for="require_log_in-0">No</label><br>
647
  </fieldset>
648
  <span class="qsm-opt-desc">Enabling this allows only logged in users to take the quiz</span>';
656
  */
657
  public function qsm_global_questions_per_page() {
658
  global $globalQuizsetting;
659
+ $qsm_pagination = isset( $globalQuizsetting['pagination'] ) && '' !== $globalQuizsetting['pagination'] ? $globalQuizsetting['pagination'] : '0';
660
  echo '<input type="number" step="1" min="0" id="pagination" name="qsm-quiz-settings[pagination]" value="' . esc_attr( $qsm_pagination ) . '">
661
  <span class="qsm-opt-desc">Override the default pagination created on questions tab</span>';
662
  }
669
  */
670
  public function qsm_global_time_limit_in_minutes() {
671
  global $globalQuizsetting;
672
+ $qsm_timer_limit = ( isset( $globalQuizsetting['timer_limit'] ) && '' !== $globalQuizsetting['timer_limit'] ? $globalQuizsetting['timer_limit'] : '0' );
673
+ echo '<input type="number" step="1" min="0" id="timer_limit" name="qsm-quiz-settings[timer_limit]" value="' . esc_attr( $qsm_timer_limit ) . '">
674
  <span class="qsm-opt-desc">Leave 0 for no time limit</span>';
675
  }
676
 
682
  */
683
  public function qsm_global_force_submit_after_timer_expiry() {
684
  global $globalQuizsetting;
685
+ $qsm_enable_result_after_timer_end = ( isset( $globalQuizsetting['enable_result_after_timer_end'] ) && '' !== $globalQuizsetting['enable_result_after_timer_end'] ? $globalQuizsetting['enable_result_after_timer_end'] : '0' );
686
  echo '<fieldset class="buttonset buttonset-hide" >
687
+ <input type="radio" id="enable_result_after_timer_end-1" name="qsm-quiz-settings[enable_result_after_timer_end]" value="1" ' . checked( $qsm_enable_result_after_timer_end, '1', false ) . '>
688
  <label for="enable_result_after_timer_end-1">Yes</label><br>
689
+ <input type="radio" id="enable_result_after_timer_end-0" name="qsm-quiz-settings[enable_result_after_timer_end]" value="0" ' . checked( $qsm_enable_result_after_timer_end, '0', false ) . '>
690
  <label for="enable_result_after_timer_end-0">No</label><br>
691
  </fieldset>';
692
  }
698
  */
699
  public function qsm_global_skip_validations_when_time_expire() {
700
  global $globalQuizsetting;
701
+ $qsm_skip_validation_time_expire = ( isset( $globalQuizsetting['skip_validation_time_expire'] ) && '' !== $globalQuizsetting['skip_validation_time_expire'] ? $globalQuizsetting['skip_validation_time_expire'] : '0' );
702
  echo '<fieldset class="buttonset buttonset-hide" >
703
+ <input type="radio" id="skip_validation_time_expire-1" name="qsm-quiz-settings[skip_validation_time_expire]" value="1" ' . checked( $qsm_skip_validation_time_expire, '1', false ) . '>
704
  <label for="skip_validation_time_expire-1">Yes</label><br>
705
+ <input type="radio" id="skip_validation_time_expire-0" name="qsm-quiz-settings[skip_validation_time_expire]" value="0" ' . checked( $qsm_skip_validation_time_expire, '0', false ) . '>
706
  <label for="skip_validation_time_expire-0">No</label><br>
707
  </fieldset>';
708
  }
715
  */
716
  public function qsm_global_limit_attempts() {
717
  global $globalQuizsetting;
718
+ $qsm_total_user_tries = ( isset( $globalQuizsetting['total_user_tries'] ) && '' !== $globalQuizsetting['total_user_tries'] ? $globalQuizsetting['total_user_tries'] : '0' );
719
+ echo '<input type="number" step="1" min="0" id="total_user_tries" name="qsm-quiz-settings[total_user_tries]" value="' . esc_attr( $qsm_total_user_tries ) . '">
720
  <span class="qsm-opt-desc">Leave 0 for unlimited attempts</span>';
721
  }
722
 
729
  */
730
  public function qsm_global_limit_entries() {
731
  global $globalQuizsetting;
732
+ $qsm_limit_total_entries = ( isset( $globalQuizsetting['limit_total_entries'] ) && '' !== $globalQuizsetting['limit_total_entries'] ? $globalQuizsetting['limit_total_entries'] : '0' );
733
+ echo '<input type="number" step="1" min="0" id="limit_total_entries" name="qsm-quiz-settings[limit_total_entries]" value="' . esc_attr( $qsm_limit_total_entries ) . '">
734
  <span class="qsm-opt-desc">Leave 0 for unlimited entries</span>';
735
 
736
  }
743
  */
744
  public function qsm_global_limit_number_of_questions() {
745
  global $globalQuizsetting;
746
+ $qsm_question_from_total = ( isset( $globalQuizsetting['question_from_total'] ) && '' !== $globalQuizsetting['question_from_total'] ? $globalQuizsetting['question_from_total'] : '0' );
747
+ echo '<input type="number" step="1" min="0" id="question_from_total" name="qsm-quiz-settings[question_from_total]" value="' . esc_attr( $qsm_question_from_total ) . '">
748
  <span class="qsm-opt-desc">Leave 0 to load all questions</span>';
749
  }
750
 
758
  */
759
  public function qsm_global_limit_number_of_questions_per_category() {
760
  global $globalQuizsetting;
761
+ $qsm_question_per_category = ( isset( $globalQuizsetting['question_per_category'] ) && '' !== $globalQuizsetting['question_per_category'] ? $globalQuizsetting['question_per_category'] : '0' );
762
+ echo '<input type="number" step="1" min="0" id="question_per_category" name="qsm-quiz-settings[question_per_category]" value="' . esc_attr( $qsm_question_per_category ) . '">
763
  <span class="qsm-opt-desc">Leave 0 to load all questions. You also need to set Limit Number of questions, as well as select Question Categories</span>';
764
  }
765
 
772
  */
773
  public function qsm_global_contact_form_position() {
774
  global $globalQuizsetting;
775
+ $qsm_contact_info_location = ( isset( $globalQuizsetting['contact_info_location'] ) && '' !== $globalQuizsetting['contact_info_location'] ? $globalQuizsetting['contact_info_location'] : '0' );
776
  echo '<fieldset class="buttonset buttonset-hide" >
777
+ <input type="radio" id="contact_info_location-0" name="qsm-quiz-settings[contact_info_location]" value="0" ' . checked( $qsm_contact_info_location, '0', false ) . '>
778
  <label for="contact_info_location-0">Show before quiz begins</label><br>
779
+ <input type="radio" id="contact_info_location-1" name="qsm-quiz-settings[contact_info_location]" value="1" ' . checked( $qsm_contact_info_location, '1', false ) . '>
780
  <label for="contact_info_location-1">Show after the quiz ends</label><br>
781
  </fieldset>
782
  <span class="qsm-opt-desc">Select when to display the contact form</span>';
790
  */
791
  public function qsm_global_show_contact_form_to_logged_in_users() {
792
  global $globalQuizsetting;
793
+ $qsm_loggedin_user_contact = ( isset( $globalQuizsetting['loggedin_user_contact'] ) && '' !== $globalQuizsetting['loggedin_user_contact'] ? $globalQuizsetting['loggedin_user_contact'] : '0' );
794
  echo '<fieldset class="buttonset buttonset-hide" >
795
+ <input type="radio" id="loggedin_user_contact-0" name="qsm-quiz-settings[loggedin_user_contact]" value="0" ' . checked( $qsm_loggedin_user_contact, '0', false ) . '>
796
  <label for="loggedin_user_contact-0">Yes</label><br>
797
+ <input type="radio" id="loggedin_user_contact-1" name="qsm-quiz-settings[loggedin_user_contact]" value="1" ' . checked( $qsm_loggedin_user_contact, '1', false ) . '>
798
  <label for="loggedin_user_contact-1">No</label><br>
799
  </fieldset>
800
  <span class="qsm-opt-desc">Logged in users can edit their contact information</span>';
808
  */
809
  public function qsm_global_enable_comments() {
810
  global $globalQuizsetting;
811
+ $qsm_comment_section = ( isset( $globalQuizsetting['comment_section'] ) && '' !== $globalQuizsetting['comment_section'] ? $globalQuizsetting['comment_section'] : '0' );
812
  echo '<fieldset class="buttonset buttonset-hide" >
813
+ <input type="radio" id="comment_section-0" name="qsm-quiz-settings[comment_section]" value="0" ' . checked( $qsm_comment_section, '0', false ) . '>
814
  <label for="comment_section-0">Yes</label><br>
815
+ <input type="radio" id="comment_section-1" name="qsm-quiz-settings[comment_section]" value="1" ' . checked( $qsm_comment_section, '1', false ) . '>
816
  <label for="comment_section-1">No</label><br>
817
  </fieldset>
818
  <span class="qsm-opt-desc">Allow users to enter their comments after the quiz</span>';
826
  */
827
  public function qsm_global_show_question_numbers() {
828
  global $globalQuizsetting;
829
+ $qsm_question_numbering = ( isset( $globalQuizsetting['question_numbering'] ) && '' !== $globalQuizsetting['question_numbering'] ? $globalQuizsetting['question_numbering'] : '0' );
830
  echo '<fieldset class="buttonset buttonset-hide" >
831
+ <input type="radio" id="question_numbering-1" name="qsm-quiz-settings[question_numbering]" value="1" ' . checked( $qsm_question_numbering, '1', false ) . '>
832
  <label for="question_numbering-1">Yes</label><br>
833
+ <input type="radio" id="question_numbering-0" name="qsm-quiz-settings[question_numbering]" value="0" ' . checked( $qsm_question_numbering, '0', false ) . '>
834
  <label for="question_numbering-0">No</label><br>
835
  </fieldset>';
836
  }
843
  */
844
  public function qsm_global_save_responses() {
845
  global $globalQuizsetting;
846
+ $qsm_store_responses = ( isset( $globalQuizsetting['store_responses'] ) && '' !== $globalQuizsetting['store_responses'] ? $globalQuizsetting['store_responses'] : '0' );
847
  echo '<fieldset class="buttonset buttonset-hide" >
848
+ <input type="radio" id="store_responses-1" name="qsm-quiz-settings[store_responses]" value="1" ' . checked( $qsm_store_responses, '1', false ) . '>
849
  <label for="store_responses-1">Yes</label><br>
850
+ <input type="radio" id="store_responses-0" name="qsm-quiz-settings[store_responses]" value="0" ' . checked( $qsm_store_responses, '0', false ) . '>
851
  <label for="store_responses-0">No</label><br>
852
  </fieldset>
853
  <span class="qsm-opt-desc">The results will be permanently stored in a database</span>';
861
  */
862
  public function qsm_global_disable_change_of_answers() {
863
  global $globalQuizsetting;
864
+ $qsm_disable_answer_onselect = ( isset( $globalQuizsetting['disable_answer_onselect'] ) && '' !== $globalQuizsetting['disable_answer_onselect'] ? $globalQuizsetting['disable_answer_onselect'] : '0' );
865
  echo '<fieldset class="buttonset buttonset-hide" >
866
+ <input type="radio" id="disable_answer_onselect-1" name="qsm-quiz-settings[disable_answer_onselect]" value="1" ' . checked( $qsm_disable_answer_onselect, '1', false ) . '>
867
  <label for="disable_answer_onselect-1">Yes</label><br>
868
+ <input type="radio" id="disable_answer_onselect-0" name="qsm-quiz-settings[disable_answer_onselect]" value="0" ' . checked( $qsm_disable_answer_onselect, '0', false ) . '>
869
  <label for="disable_answer_onselect-0">No</label><br>
870
  </fieldset>
871
  <span class="qsm-opt-desc">Works with multiple choice questions only</span>';
879
  */
880
  public function qsm_global_add_class_for_correct_incorrect_answers() {
881
  global $globalQuizsetting;
882
+ $qsm_ajax_show_correct = ( isset( $globalQuizsetting['ajax_show_correct'] ) && '' !== $globalQuizsetting['ajax_show_correct'] ? $globalQuizsetting['ajax_show_correct'] : '0' );
883
  echo '<fieldset class="buttonset buttonset-hide" >
884
+ <input type="radio" id="ajax_show_correct-1" name="qsm-quiz-settings[ajax_show_correct]" value="1" ' . checked( $qsm_ajax_show_correct, '1', false ) . '>
885
  <label for="ajax_show_correct-1">Yes</label><br>
886
+ <input type="radio" id="ajax_show_correct-0" name="qsm-quiz-settings[ajax_show_correct]"value="0" ' . checked( $qsm_ajax_show_correct, '0', false ) . '>
887
  <label for="ajax_show_correct-0">No</label><br>
888
  </fieldset>
889
  <span class="qsm-opt-desc">Works with multiple choice questions only</span>';
897
  */
898
  public function qsm_global_disable_auto_fill_for_contact_input() {
899
  global $globalQuizsetting;
900
+ $qsm_contact_disable_autofill = ( isset( $globalQuizsetting['contact_disable_autofill'] ) && '' !== $globalQuizsetting['contact_disable_autofill'] ? $globalQuizsetting['contact_disable_autofill'] : '0' );
901
  echo '<fieldset class="buttonset buttonset-hide" >
902
+ <input type="radio" id="contact_disable_autofill-1" name="qsm-quiz-settings[contact_disable_autofill]" value="1" ' . checked( $qsm_contact_disable_autofill, '1', false ) . '>
903
  <label for="contact_disable_autofill-1">Yes</label><br>
904
+ <input type="radio" id="contact_disable_autofill-0" name="qsm-quiz-settings[contact_disable_autofill]" value="0" ' . checked( $qsm_contact_disable_autofill, '0', false ) . '>
905
  <label for="contact_disable_autofill-0">No</label><br>
906
  </fieldset>';
907
  }
914
  */
915
  public function qsm_global_disable_auto_fill_for_quiz_input() {
916
  global $globalQuizsetting;
917
+ $qsm_form_disable_autofill = ( isset( $globalQuizsetting['form_disable_autofill'] ) && '' !== $globalQuizsetting['form_disable_autofill'] ? $globalQuizsetting['form_disable_autofill'] : '0' );
918
  echo '<fieldset class="buttonset buttonset-hide" >
919
+ <input type="radio" id="form_disable_autofill-1" name="qsm-quiz-settings[form_disable_autofill]" value="1" ' . checked( $qsm_form_disable_autofill, '1', false ) . '>
920
  <label for="form_disable_autofill-1">Yes</label><br>
921
+ <input type="radio" id="form_disable_autofill-0" name="qsm-quiz-settings[form_disable_autofill]" value="0" ' . checked( $qsm_form_disable_autofill, '0', false ) . '>
922
  <label for="form_disable_autofill-0">No</label><br>
923
  </fieldset>';
924
  }
931
  */
932
  public function qsm_global_display_category_name_on_front_end() {
933
  global $globalQuizsetting;
934
+ $qsm_show_category_on_front = ( isset( $globalQuizsetting['show_category_on_front'] ) && '' !== $globalQuizsetting['show_category_on_front'] ? $globalQuizsetting['show_category_on_front'] : '0' );
935
  echo '<fieldset class="buttonset buttonset-hide" >
936
+ <input type="radio" id="show_category_on_front-1" name="qsm-quiz-settings[show_category_on_front]" value="1" ' . checked( $qsm_show_category_on_front, '1', false ) . ' >
937
  <label for="show_category_on_front-1">Yes</label><br>
938
+ <input type="radio" id="show_category_on_front-0" name="qsm-quiz-settings[show_category_on_front]" value="0" ' . checked( $qsm_show_category_on_front, '0', false ) . '>
939
  <label for="show_category_on_front-0">No</label><br>
940
  </fieldset>';
941
  }
948
  */
949
  public function qsm_global_show_results_inline() {
950
  global $globalQuizsetting;
951
+ $qsm_enable_quick_result_mc = ( isset( $globalQuizsetting['enable_quick_result_mc'] ) && '' !== $globalQuizsetting['enable_quick_result_mc'] ? $globalQuizsetting['enable_quick_result_mc'] : '0' );
952
  echo '<fieldset class="buttonset buttonset-hide" >
953
+ <input type="radio" id="enable_quick_result_mc-1" name="qsm-quiz-settings[enable_quick_result_mc]" value="1" ' . checked( $qsm_enable_quick_result_mc, '1', false ) . '>
954
  <label for="enable_quick_result_mc-1">Yes</label><br>
955
+ <input type="radio" id="enable_quick_result_mc-0" name="qsm-quiz-settings[enable_quick_result_mc]" value="0" ' . checked( $qsm_enable_quick_result_mc, '0', false ) . '>
956
  <label for="enable_quick_result_mc-0">No</label><br>
957
  </fieldset>
958
  <span class="qsm-opt-desc">Instantly displays the result for each question</span>';
966
  */
967
  public function qsm_global_end_quiz_if_there_is_wrong_answer() {
968
  global $globalQuizsetting;
969
+ $qsm_end_quiz_if_wrong = ( isset( $globalQuizsetting['end_quiz_if_wrong'] ) && '' !== $globalQuizsetting['end_quiz_if_wrong'] ? $globalQuizsetting['end_quiz_if_wrong'] : '0' );
970
  echo '<fieldset class="buttonset buttonset-hide" >
971
+ <input type="radio" id="end_quiz_if_wrong-1" name="qsm-quiz-settings[end_quiz_if_wrong]" value="1" ' . checked( $qsm_end_quiz_if_wrong, '1', false ) . ' >
972
  <label for="end_quiz_if_wrong-1">Yes</label><br>
973
+ <input type="radio" id="end_quiz_if_wrong-0" name="qsm-quiz-settings[end_quiz_if_wrong]" value="0" ' . checked( $qsm_end_quiz_if_wrong, '0', false ) . '>
974
  <label for="end_quiz_if_wrong-0">No</label><br>
975
  </fieldset>
976
  <span class="qsm-opt-desc">This option works with vertical Multiple Choice , horizontal Multiple Choice , drop down , multiple response and horizontal multiple response question types</span>';
984
  */
985
  public function qsm_global_show_correct_answer_inline() {
986
  global $globalQuizsetting;
987
+ $qsm_enable_quick_correct_answer_info = ( isset( $globalQuizsetting['enable_quick_correct_answer_info'] ) && '' !== $globalQuizsetting['enable_quick_correct_answer_info'] ? $globalQuizsetting['enable_quick_correct_answer_info'] : '0' );
988
  echo '<fieldset class="buttonset buttonset-hide" >
989
+ <input type="radio" id="enable_quick_correct_answer_info-1" name="qsm-quiz-settings[enable_quick_correct_answer_info]" value="1" ' . checked( $qsm_enable_quick_correct_answer_info, '1', false ) . '>
990
  <label for="enable_quick_correct_answer_info-1">Yes When answer is correct</label><br>
991
+ <input type="radio" id="enable_quick_correct_answer_info-2" name="qsm-quiz-settings[enable_quick_correct_answer_info]" value="2" ' . checked( $qsm_enable_quick_correct_answer_info, '2', false ) . '>
992
  <label for="enable_quick_correct_answer_info-2">Yes Independent of correct/incorrect</label><br>
993
+ <input type="radio" id="enable_quick_correct_answer_info-0" name="qsm-quiz-settings[enable_quick_correct_answer_info]" value="0" ' . checked( $qsm_enable_quick_correct_answer_info, '0', false ) . '>
994
  <label for="enable_quick_correct_answer_info-0">No</label><br>
995
  </fieldset>
996
  <span class="qsm-opt-desc">Show correct user info when inline result is enabled.</span>';
1004
  */
1005
  public function qsm_global_retake_quiz() {
1006
  global $globalQuizsetting;
1007
+ $qsm_enable_retake_quiz_button = ( isset( $globalQuizsetting['enable_retake_quiz_button'] ) && '' !== $globalQuizsetting['enable_retake_quiz_button'] ? $globalQuizsetting['enable_retake_quiz_button'] : '0' );
1008
  echo '<fieldset class="buttonset buttonset-hide" >
1009
+ <input type="radio" id="enable_retake_quiz_button-1" name="qsm-quiz-settings[enable_retake_quiz_button]" value="1" ' . checked( $qsm_enable_retake_quiz_button, '1', false ) . '>
1010
  <label for="enable_retake_quiz_button-1">Yes</label><br>
1011
+ <input type="radio" id="enable_retake_quiz_button-0" name="qsm-quiz-settings[enable_retake_quiz_button]" value="0" ' . checked( $qsm_enable_retake_quiz_button, '0', false ) . '>
1012
  <label for="enable_retake_quiz_button-0">No</label><br>
1013
  </fieldset>
1014
  <span class="qsm-opt-desc">Show a button on result page to retake the quiz</span>';
1023
  */
1024
  public function qsm_global_show_current_page_number() {
1025
  global $globalQuizsetting;
1026
+ $qsm_enable_pagination_quiz = ( isset( $globalQuizsetting['enable_pagination_quiz'] ) && '' !== $globalQuizsetting['enable_pagination_quiz'] ? $globalQuizsetting['enable_pagination_quiz'] : '0' );
1027
  echo '<fieldset class="buttonset buttonset-hide" >
1028
+ <input type="radio" id="enable_pagination_quiz-1" name="qsm-quiz-settings[enable_pagination_quiz]" value="1" ' . checked( $qsm_enable_pagination_quiz, '1', false ) . '>
1029
  <label for="enable_pagination_quiz-1">Yes</label><br>
1030
+ <input type="radio" id="enable_pagination_quiz-0" name="qsm-quiz-settings[enable_pagination_quiz]" value="0" ' . checked( $qsm_enable_pagination_quiz, '0', false ) . '>
1031
  <label for="enable_pagination_quiz-0">No</label><br>
1032
  </fieldset>';
1033
  }
1040
  */
1041
  public function qsm_global_deselect_answer() {
1042
  global $globalQuizsetting;
1043
+ $qsm_enable_deselect_option = ( isset( $globalQuizsetting['enable_deselect_option'] ) && '' !== $globalQuizsetting['enable_deselect_option'] ? $globalQuizsetting['enable_deselect_option'] : '0' );
1044
  echo '<fieldset class="buttonset buttonset-hide" >
1045
+ <input type="radio" id="enable_deselect_option-1" name="qsm-quiz-settings[enable_deselect_option]" value="1" ' . checked( $qsm_enable_deselect_option, '1', false ) . '>
1046
  <label for="enable_deselect_option-1">Yes</label><br>
1047
+ <input type="radio" id="enable_deselect_option-0" name="qsm-quiz-settings[enable_deselect_option]" value="0" ' . checked( $qsm_enable_deselect_option, '0', false ) . '>
1048
  <label for="enable_deselect_option-0">No</label><br>
1049
  </fieldset>
1050
  <span class="qsm-opt-desc">Users are able deselect an answer and leave it blank. Works with Multiple Choice and Horizintal Multiple Choice questions only</span>';
1057
  */
1058
  public function qsm_global_disable_description_on_quiz_result_page() {
1059
  global $globalQuizsetting;
1060
+ $qsm_disable_description_on_result = ( isset( $globalQuizsetting['disable_description_on_result'] ) && '' !== $globalQuizsetting['disable_description_on_result'] ? $globalQuizsetting['disable_description_on_result'] : '0' );
1061
  echo '<fieldset class="buttonset buttonset-hide" >
1062
+ <input type="radio" id="disable_description_on_result-1" name="qsm-quiz-settings[disable_description_on_result]" value="1" ' . checked( $qsm_disable_description_on_result, '1', false ) . ' >
1063
  <label for="disable_description_on_result-1">Yes</label><br>
1064
+ <input type="radio" id="disable_description_on_result-0" name="qsm-quiz-settings[disable_description_on_result]" value="0" ' . checked( $qsm_disable_description_on_result, '0', false ) . '>
1065
  <label for="disable_description_on_result-0">No</label><br>
1066
  </fieldset>';
1067
  }
1073
  */
1074
  public function qsm_global_disable_scroll_on_next_and_previous_button_click() {
1075
  global $globalQuizsetting;
1076
+ $qsm_disable_scroll_next_previous_click = ( isset( $globalQuizsetting['disable_scroll_next_previous_click'] ) && '' !== $globalQuizsetting['disable_scroll_next_previous_click'] ? $globalQuizsetting['disable_scroll_next_previous_click'] : '0' );
1077
  echo '<fieldset class="buttonset buttonset-hide" >
1078
+ <input type="radio" id="disable_scroll_next_previous_click-1" name="qsm-quiz-settings[disable_scroll_next_previous_click]" value="1" ' . checked( $qsm_disable_scroll_next_previous_click, '1', false ) . '>
1079
  <label for="disable_scroll_next_previous_click-1">Yes</label><br>
1080
+ <input type="radio" id="disable_scroll_next_previous_click-0" name="qsm-quiz-settings[disable_scroll_next_previous_click]" value="0" ' . checked( $qsm_disable_scroll_next_previous_click, '0', false ) . '>
1081
  <label for="disable_scroll_next_previous_click-0">No</label><br>
1082
  </fieldset>';
1083
  }
1090
  */
1091
  public function qsm_global_disable_first_page() {
1092
  global $globalQuizsetting;
1093
+ $qsm_disable_first_page = ( isset( $globalQuizsetting['disable_first_page'] ) && '' !== $globalQuizsetting['disable_first_page'] ? $globalQuizsetting['disable_first_page'] : '0' );
1094
  echo '<fieldset class="buttonset buttonset-hide" >
1095
+ <input type="radio" id="disable_first_page-1" name="qsm-quiz-settings[disable_first_page]" value="1" ' . checked( $qsm_disable_first_page, '1', false ) . '>
1096
  <label for="disable_first_page-1">Yes</label><br>
1097
+ <input type="radio" id="disable_first_page-0" name="qsm-quiz-settings[disable_first_page]" value="0" ' . checked( $qsm_disable_first_page, '0', false ) . '>
1098
  <label for="disable_first_page-0">No</label><br>
1099
  </fieldset>';
1100
  }
1101
 
1102
 
1103
+ /**
1104
  * Generates Quiz Global Field For Quiz Animation
1105
  *
1106
  * @since 4.1.0
1109
  public function qsm_global_quiz_animation() {
1110
  global $globalQuizsetting;
1111
  global $mlwQuizMasterNext;
1112
+ $qsm_quiz_animation = ( isset( $globalQuizsetting['quiz_animation'] ) && '' !== $globalQuizsetting['quiz_animation'] ? $globalQuizsetting['quiz_animation'] : '' );
1113
+ $options = $mlwQuizMasterNext->pluginHelper->quiz_animation_effect();
1114
 
1115
  echo '<select name="qsm-quiz-settings[quiz_animation]">';
1116
  foreach ( $options as $value ) {
1117
+ echo '<option value="' . esc_attr( $value['value'] ) . '" ' . ( isset( $qsm_quiz_animation ) && $qsm_quiz_animation == $value['value'] ? 'Selected' : '' ) . ' >' . esc_html( $value['label'] ) . '</option>';
1118
  }
1119
  echo '</select>';
1120
  }
1121
 
1122
+ /**
1123
  * Generates Quiz Global Field For Logo URL
1124
  *
1125
  * @since 4.1.0
1127
  */
1128
  public function qsm_global_logo_url() {
1129
  global $globalQuizsetting;
1130
+ $qsm_result_page_fb_image = ( isset( $globalQuizsetting['result_page_fb_image'] ) && '' !== $globalQuizsetting['result_page_fb_image'] ? $globalQuizsetting['result_page_fb_image'] : QSM_PLUGIN_URL . 'assets/icon-200x200.png' );
1131
+ echo '<input type="url" id="result_page_fb_image" name="qsm-quiz-settings[result_page_fb_image]" value="' . esc_url( $qsm_result_page_fb_image ) . '">
1132
  <span class="qsm-opt-desc">If left blank, this will default to QSM logo</span>';
1133
  }
1134
 
1140
  */
1141
  public function qsm_global_random_questions() {
1142
  global $globalQuizsetting;
1143
+ $qsm_randomness_order = ( isset( $globalQuizsetting['randomness_order'] ) && '' !== $globalQuizsetting['randomness_order'] ? $globalQuizsetting['randomness_order'] : '' );
1144
+ $options = array(
1145
  array(
1146
  'label' => __( 'Random Questions', 'quiz-master-next' ),
1147
  'value' => 1,
1161
  );
1162
  echo '<select name="qsm-quiz-settings[randomness_order]">';
1163
  foreach ( $options as $value ) {
1164
+ echo '<option value="' . esc_attr( $value['value'] ) . '" ' . ( isset( $qsm_randomness_order ) && $qsm_randomness_order == $value['value'] ? 'Selected' : '' ) . ' >' . esc_html( $value['label'] ) . '</option>';
1165
  }
1166
  echo '</select>';
1167
  }
1173
  */
1174
  public function qsm_global_quiz_dates() {
1175
  global $globalQuizsetting;
1176
+ $qsm_scheduled_time_start = ( isset( $globalQuizsetting['scheduled_time_start'] ) && '' !== $globalQuizsetting['scheduled_time_start'] ? $globalQuizsetting['scheduled_time_start'] : '' );
1177
+ $qsm_scheduled_time_end = ( isset( $globalQuizsetting['scheduled_time_end'] ) && '' !== $globalQuizsetting['scheduled_time_end'] ? $globalQuizsetting['scheduled_time_end'] : '' );
1178
  echo '<div>
1179
  <span class="qsm-ph_text">Start Date</span>
1180
+ <input autocomplete="off" type="text" id="scheduled_time_start" name="qsm-quiz-settings[scheduled_time_start]" value="' . esc_attr( $qsm_scheduled_time_start ) . '">
1181
  <span class="qsm-opt-desc">If set, Quiz will be accessible only after this date</span>
1182
  </div>';
1183
  echo '<div>
1184
  <span class="qsm-ph_text">End Date</span>
1185
+ <input autocomplete="off" type="text" id="scheduled_time_end" name="qsm-quiz-settings[scheduled_time_end]" value="' . esc_attr( $qsm_scheduled_time_end ) . '">
1186
  <span class="qsm-opt-desc"> If set, Quiz will not be accessible after this date</span>
1187
  </div>';
1188
+ wp_add_inline_script( 'qsm_admin_js', 'jQuery(function(){jQuery("#scheduled_time_start,#scheduled_time_end").datetimepicker({format: "m/d/Y H:i",step: 1});});' );
1189
  }
1190
+ /**
1191
  * Generates Quiz Global Field For Do not allow quiz submission after the end date/time
1192
  *
1193
  * @since 4.1.0
1195
  */
1196
  public function qsm_global_do_not_allow_quiz_submission_after_the_end_datetime() {
1197
  global $globalQuizsetting;
1198
+ $qsm_not_allow_after_expired_time = ( isset( $globalQuizsetting['not_allow_after_expired_time'] ) && '' !== $globalQuizsetting['not_allow_after_expired_time'] ? $globalQuizsetting['not_allow_after_expired_time'] : '' );
1199
  echo '<fieldset class="buttonset buttonset-hide" >
1200
+ <input type="checkbox" id="not_allow_after_expired_time-1" name="qsm-quiz-settings[not_allow_after_expired_time]" value="1" ' . checked( $qsm_not_allow_after_expired_time, '1', false ) . '>
1201
  <br>
1202
  </fieldset>';
1203
  }
1211
  public function preferred_date_format() {
1212
 
1213
  global $globalQuizsetting;
1214
+ $preferred_date_format = ( isset( $globalQuizsetting['preferred_date_format'] ) ? $globalQuizsetting['preferred_date_format'] : get_option( 'date_format' ) );
1215
+ echo '<input type="text" id="preferred_date_format" name="qsm-quiz-settings[preferred_date_format]" value="' . esc_attr( $preferred_date_format ) . '">';
1216
  echo '<span class="qsm-opt-desc">Set your preferred date format.</span>';
1217
  }
1218
 
php/classes/class-qmn-quiz-manager.php CHANGED
@@ -22,7 +22,7 @@ class QMNQuizManager {
22
  * @var string
23
  * @since 7.3.5
24
  */
25
- public $common_css = QSM_PLUGIN_CSS_URL . '/common.css';
26
  /*
27
  * Default MathJax inline scripts.
28
  */
@@ -35,8 +35,8 @@ class QMNQuizManager {
35
  ignoreHtmlClass: 'tex2jax_ignore|editor-rich-text'
36
  }
37
  };";
38
- public $mathjax_url = QSM_PLUGIN_JS_URL . '/mathjax/tex-mml-chtml.js';
39
- public $mathjax_version = '3.2.0';
40
 
41
  protected $qsm_background_email;
42
  /**
@@ -225,7 +225,7 @@ class QMNQuizManager {
225
  $correct_answer = false;
226
  if ( $answer_array && false === $got_ans ) {
227
  foreach ( $answer_array as $key => $value ) {
228
- if ( intval( $answer) === $key && 1 === intval( $value[2] ) ) {
229
  $got_ans = true;
230
  $correct_answer = true;
231
  break;
@@ -328,7 +328,7 @@ class QMNQuizManager {
328
  wp_enqueue_script( 'qsm_quiz', QSM_PLUGIN_JS_URL . '/qsm-quiz.js', array( 'wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip' ), $mlwQuizMasterNext->version, false );
329
  wp_enqueue_script( 'qsm_common', QSM_PLUGIN_JS_URL . '/qsm-common.js', array(), $mlwQuizMasterNext->version, true );
330
  wp_enqueue_script( 'math_jax', $this->mathjax_url, false, $this->mathjax_version, true );
331
- wp_add_inline_script( 'math_jax', self::$default_MathJax_script, 'before' );
332
  $result_unique_id = sanitize_text_field( wp_unslash( $_GET['result_id'] ) );
333
  $query = $wpdb->prepare( "SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE unique_id = %s", $result_unique_id );
334
  $result = $wpdb->get_row( $query, ARRAY_A );
@@ -490,7 +490,7 @@ class QMNQuizManager {
490
  wp_enqueue_style( 'dashicons' );
491
  wp_enqueue_style( 'qsm_primary_css', plugins_url( '../../templates/qmn_primary.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
492
  wp_enqueue_script( 'math_jax', $this->mathjax_url, false, $this->mathjax_version, true );
493
- wp_add_inline_script( 'math_jax', self::$default_MathJax_script, 'before' );
494
  $quiz_result = maybe_unserialize( $result_data['quiz_results'] );
495
  $response_data = array(
496
  'quiz_id' => $result_data['quiz_id'],
@@ -781,14 +781,12 @@ class QMNQuizManager {
781
  array(
782
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
783
  'multicheckbox_limit_reach' => __( 'Limit of choice is reached.', 'quiz-master-next' ),
784
- 'out_of_text' => __(
785
- ' out of ',
786
- 'quiz-master-next'
787
- ),
788
  )
789
  );
790
  wp_enqueue_script( 'math_jax', $this->mathjax_url, array(), $this->mathjax_version, true );
791
- wp_add_inline_script( 'math_jax', self::$default_MathJax_script, 'before' );
792
  global $qmn_total_questions;
793
  $qmn_total_questions = 0;
794
  global $mlw_qmn_section_count;
@@ -1819,7 +1817,7 @@ class QMNQuizManager {
1819
  $question_text = $results_array['question_text'];
1820
  }
1821
 
1822
- $user_answer_array = isset( $results_array['user_answer'] ) ? $results_array['user_answer'] : array() ;
1823
  $correct_answer_array = isset( $results_array['correct_answer'] ) ? $results_array['correct_answer'] : array();
1824
 
1825
  // Save question data into new array in our array
@@ -1903,7 +1901,7 @@ class QMNQuizManager {
1903
  if ( isset( $results_array['question_text'] ) ) {
1904
  $question_text = $results_array['question_text'];
1905
  }
1906
- $user_answer_array = is_array( $results_array['user_answer'] ) ? $results_array['user_answer'] : array() ;
1907
  $correct_answer_array = is_array( $results_array['correct_answer'] ) ? $results_array['correct_answer'] : array();
1908
 
1909
  // Save question data into new array in our array
22
  * @var string
23
  * @since 7.3.5
24
  */
25
+ public $common_css = QSM_PLUGIN_CSS_URL . '/common.css';
26
  /*
27
  * Default MathJax inline scripts.
28
  */
35
  ignoreHtmlClass: 'tex2jax_ignore|editor-rich-text'
36
  }
37
  };";
38
+ public $mathjax_url = QSM_PLUGIN_JS_URL . '/mathjax/tex-mml-chtml.js';
39
+ public $mathjax_version = '3.2.0';
40
 
41
  protected $qsm_background_email;
42
  /**
225
  $correct_answer = false;
226
  if ( $answer_array && false === $got_ans ) {
227
  foreach ( $answer_array as $key => $value ) {
228
+ if ( intval( $answer ) === $key && 1 === intval( $value[2] ) ) {
229
  $got_ans = true;
230
  $correct_answer = true;
231
  break;
328
  wp_enqueue_script( 'qsm_quiz', QSM_PLUGIN_JS_URL . '/qsm-quiz.js', array( 'wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip' ), $mlwQuizMasterNext->version, false );
329
  wp_enqueue_script( 'qsm_common', QSM_PLUGIN_JS_URL . '/qsm-common.js', array(), $mlwQuizMasterNext->version, true );
330
  wp_enqueue_script( 'math_jax', $this->mathjax_url, false, $this->mathjax_version, true );
331
+ wp_add_inline_script( 'math_jax', self::$default_MathJax_script, 'before' );
332
  $result_unique_id = sanitize_text_field( wp_unslash( $_GET['result_id'] ) );
333
  $query = $wpdb->prepare( "SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE unique_id = %s", $result_unique_id );
334
  $result = $wpdb->get_row( $query, ARRAY_A );
490
  wp_enqueue_style( 'dashicons' );
491
  wp_enqueue_style( 'qsm_primary_css', plugins_url( '../../templates/qmn_primary.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
492
  wp_enqueue_script( 'math_jax', $this->mathjax_url, false, $this->mathjax_version, true );
493
+ wp_add_inline_script( 'math_jax', self::$default_MathJax_script, 'before' );
494
  $quiz_result = maybe_unserialize( $result_data['quiz_results'] );
495
  $response_data = array(
496
  'quiz_id' => $result_data['quiz_id'],
781
  array(
782
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
783
  'multicheckbox_limit_reach' => __( 'Limit of choice is reached.', 'quiz-master-next' ),
784
+ 'out_of_text' => __( 'out of', 'quiz-master-next' ),
785
+ 'quiz_time_over' => __( 'Quiz time is over.', 'quiz-master-next' ),
 
 
786
  )
787
  );
788
  wp_enqueue_script( 'math_jax', $this->mathjax_url, array(), $this->mathjax_version, true );
789
+ wp_add_inline_script( 'math_jax', self::$default_MathJax_script, 'before' );
790
  global $qmn_total_questions;
791
  $qmn_total_questions = 0;
792
  global $mlw_qmn_section_count;
1817
  $question_text = $results_array['question_text'];
1818
  }
1819
 
1820
+ $user_answer_array = isset( $results_array['user_answer'] ) ? $results_array['user_answer'] : array();
1821
  $correct_answer_array = isset( $results_array['correct_answer'] ) ? $results_array['correct_answer'] : array();
1822
 
1823
  // Save question data into new array in our array
1901
  if ( isset( $results_array['question_text'] ) ) {
1902
  $question_text = $results_array['question_text'];
1903
  }
1904
+ $user_answer_array = is_array( $results_array['user_answer'] ) ? $results_array['user_answer'] : array();
1905
  $correct_answer_array = is_array( $results_array['correct_answer'] ) ? $results_array['correct_answer'] : array();
1906
 
1907
  // Save question data into new array in our array
php/classes/class-qsm-install.php CHANGED
@@ -707,7 +707,7 @@ class QSM_Install {
707
  'default' => 0,
708
  );
709
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
710
-
711
  // Setting for animation
712
  $field_array = array(
713
  'id' => 'quiz_animation',
707
  'default' => 0,
708
  );
709
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
710
+
711
  // Setting for animation
712
  $field_array = array(
713
  'id' => 'quiz_animation',
php/classes/class-qsm-settings.php CHANGED
@@ -1,260 +1,261 @@
1
  <?php
2
 
3
- if ( ! defined( 'ABSPATH' ) ) exit;
 
 
4
 
5
  /**
6
  * This handles all of the settings data for each individual quiz.
7
  *
8
  * @since 5.0.0
9
  */
10
- class QSM_Quiz_Settings
11
- {
12
-
13
- /**
14
- * ID of the quiz
15
- *
16
- * @var int
17
- * @since 5.0.0
18
- */
19
- private $quiz_id;
20
-
21
- /**
22
- * The settings for the quiz
23
- *
24
- * @var array
25
- * @since 5.0.0
26
- */
27
- private $settings;
28
-
29
- /**
30
- * The fields that have been registered
31
- *
32
- * @var array
33
- * @since 5.0.0
34
- */
35
- private $registered_fields;
36
-
37
- /**
38
- * Prepares the settings for the supplied quiz
39
- *
40
- * @since 5.0.0
41
- * @param int $quiz_id the ID of the quiz that we are handling the settings data for
42
- */
43
- public function prepare_quiz( $quiz_id ) {
44
- $this->quiz_id = intval($quiz_id);
45
- $this->load_settings();
46
- }
47
-
48
-
49
- /**
50
- * Registers a setting be shown on the Options or Text tab
51
- *
52
- * @since 5.0.0
53
- * @param array $field_array An array of the components for the settings field
54
- */
55
- public function register_setting( $field_array, $section = 'quiz_options' ) {
56
- // Adds field to registered fields
57
- $this->registered_fields[ $section ][] = $field_array;
58
- }
59
-
60
- /**
61
- * Retrieves the registered setting fields
62
- *
63
- * @since 5.0.0
64
- * @param string $section The section whose fields that are being retrieved
65
- * @return array All the fields registered the the section provided
66
- */
67
- public function load_setting_fields( $section = 'quiz_options' ) {
68
- // Checks if section exists in registered fields and returns it if it does
69
- if ( isset($this->registered_fields[ $section ]) ) {
70
- return $this->registered_fields[ $section ];
71
- } else {
72
- return false;
73
- }
74
- }
75
-
76
- /**
77
- * Retrieves a setting value from a section based on name of section and setting
78
- *
79
- * @since 5.0.0
80
- * @param string $section The name of the section the setting is registered in
81
- * @param string $setting The name of the setting whose value we need to retrieve
82
- * @param mixed $default What we need to return if no setting exists with given $setting
83
- * @return $mixed Value set for $setting or $default if setting does not exist
84
- */
85
- public function get_section_setting( $section, $setting, $default = false ) {
86
- // Return if section or setting is empty
87
- if ( empty( $section ) || empty( $setting ) ) {
88
- return $default;
89
- }
90
-
91
- // Get settings in section
92
- $section_settings = $this->get_setting( $section );
93
-
94
- // Return default if section not found
95
- if ( ! $section_settings ) {
96
- return $default;
97
- }
98
-
99
- // Maybe unserailize
100
- $section_settings = maybe_unserialize( $section_settings );
101
-
102
- // Check if setting exists
103
- if ( isset( $section_settings[ $setting ] ) ) {
104
- // Try to unserialize it and then return it
105
- return maybe_unserialize( $section_settings[ $setting ] );
106
- } else {
107
- // Return the default if no setting exists
108
- return $default;
109
- }
110
- }
111
-
112
- /**
113
- * Retrieves setting value based on name of setting
114
- *
115
- * @since 5.0.0
116
- * @param string $setting The name of the setting whose value we need to retrieve
117
- * @param mixed $default What we need to return if no setting exists with given $setting
118
- * @return $mixed Value set for $setting or $default if setting does not exist
119
- */
120
- public function get_setting( $setting, $default = false ) {
121
- global $mlwQuizMasterNext;
122
-
123
- // Return if empty
124
- if ( empty($setting) ) {
125
- return false;
126
- }
127
-
128
- // Check if ID is not set, for backwards compatibility
129
- if ( ! $this->quiz_id ) {
130
- $quiz_id = $mlwQuizMasterNext->quizCreator->get_id();
131
- // If get_id doesn't work, return false
132
- if ( ! $quiz_id ) {
133
- return false;
134
- } else {
135
- $this->prepare_quiz($quiz_id);
136
- }
137
- }
138
-
139
- // Check if setting exists
140
- if ( isset($this->settings[ $setting ]) ) {
141
- // Try to unserialize it and then return it
142
- return maybe_unserialize($this->settings[ $setting ]);
143
- } else {
144
- // Return the default if no setting exists
145
- return $default;
146
- }
147
- }
148
-
149
- /**
150
- * Updates a settings value, adding it if it didn't already exist
151
- *
152
- * @since 5.0.0
153
- * @param string $setting The name of the setting whose value we need to retrieve.
154
- * @param mixed $value The value that needs to be stored for the setting.
155
- * @return bool True if successful or false if fails
156
- */
157
- public function update_setting( $setting, $value ) {
158
- global $mlwQuizMasterNext;
159
-
160
- // Return if empty.
161
- if ( empty( $setting ) ) {
162
- $mlwQuizMasterNext->log_manager->add('Error when updating setting', 'Setting was empty with value equal to ' . wp_json_encode( $value ), 0, 'error');
163
- return false;
164
- }
165
-
166
- // Check if ID is not set, for backwards compatibility.
167
- if ( ! $this->quiz_id ) {
168
- $quiz_id = $mlwQuizMasterNext->quizCreator->get_id();
169
-
170
- // If get_id doesn't work, return false.
171
- if ( ! $quiz_id ) {
172
- $mlwQuizMasterNext->log_manager->add('Error when updating setting', 'Quiz ID was not found', 0, 'error');
173
- return false;
174
- } else {
175
- $this->prepare_quiz($quiz_id);
176
- }
177
- }
178
-
179
-
180
- $old_value = $this->get_setting($setting);
181
- if ( isset($_POST['global_setting']) ) {
182
- $setDefaultvalue = $old_value;
183
- $getdefaultvalue = (array) get_option('qsm-quiz-settings');
184
- $setDefaultvalue['form_type'] = $getdefaultvalue['form_type'];
185
- $setDefaultvalue['system'] = $getdefaultvalue['system'];
186
- $setDefaultvalue['score_roundoff'] = $getdefaultvalue['score_roundoff'];
187
- $setDefaultvalue['progress_bar'] = $getdefaultvalue['progress_bar'];
188
- $setDefaultvalue['require_log_in'] = $getdefaultvalue['require_log_in'];
189
- $setDefaultvalue['pagination'] = $getdefaultvalue['pagination'];
190
- $setDefaultvalue['timer_limit'] = $getdefaultvalue['timer_limit'];
191
- $setDefaultvalue['enable_result_after_timer_end'] = $getdefaultvalue['enable_result_after_timer_end'];
192
- $setDefaultvalue['skip_validation_time_expire'] = $getdefaultvalue['skip_validation_time_expire'];
193
- $setDefaultvalue['total_user_tries'] = $getdefaultvalue['total_user_tries'];
194
- $setDefaultvalue['limit_total_entries'] = $getdefaultvalue['limit_total_entries'];
195
- $setDefaultvalue['question_from_total'] = $getdefaultvalue['question_from_total'];
196
- $setDefaultvalue['question_per_category'] = $getdefaultvalue['question_per_category'];
197
- $setDefaultvalue['contact_info_location'] = $getdefaultvalue['contact_info_location'];
198
- $setDefaultvalue['loggedin_user_contact'] = $getdefaultvalue['loggedin_user_contact'];
199
- $setDefaultvalue['comment_section'] = $getdefaultvalue['comment_section'];
200
- $setDefaultvalue['question_numbering'] = $getdefaultvalue['question_numbering'];
201
- $setDefaultvalue['store_responses'] = $getdefaultvalue['store_responses'];
202
- $setDefaultvalue['disable_answer_onselect'] = $getdefaultvalue['disable_answer_onselect'];
203
- $setDefaultvalue['ajax_show_correct'] = $getdefaultvalue['ajax_show_correct'];
204
- $setDefaultvalue['contact_disable_autofill'] = $getdefaultvalue['contact_disable_autofill'];
205
- $setDefaultvalue['form_disable_autofill'] = $getdefaultvalue['form_disable_autofill'];
206
- $setDefaultvalue['show_category_on_front'] = $getdefaultvalue['show_category_on_front'];
207
- $setDefaultvalue['enable_quick_result_mc'] = $getdefaultvalue['enable_quick_result_mc'];
208
- $setDefaultvalue['end_quiz_if_wrong'] = $getdefaultvalue['end_quiz_if_wrong'];
209
- $setDefaultvalue['enable_quick_correct_answer_info'] = $getdefaultvalue['enable_quick_correct_answer_info'];
210
- $setDefaultvalue['enable_retake_quiz_button'] = $getdefaultvalue['enable_retake_quiz_button'];
211
- $setDefaultvalue['enable_pagination_quiz'] = $getdefaultvalue['enable_pagination_quiz'];
212
- $setDefaultvalue['enable_deselect_option'] = $getdefaultvalue['enable_deselect_option'];
213
- $setDefaultvalue['disable_description_on_result'] = $getdefaultvalue['disable_description_on_result'];
214
- $setDefaultvalue['disable_scroll_next_previous_click'] = $getdefaultvalue['disable_scroll_next_previous_click'];
215
- $setDefaultvalue['disable_first_page'] = $getdefaultvalue['disable_first_page'];
216
- $setDefaultvalue['quiz_animation'] = $getdefaultvalue['quiz_animation'];
217
- $setDefaultvalue['result_page_fb_image'] = $getdefaultvalue['result_page_fb_image'];
218
- $setDefaultvalue['randomness_order'] = $getdefaultvalue['randomness_order'];
219
- $setDefaultvalue['scheduled_time_start'] = $getdefaultvalue['scheduled_time_start'];
220
- $setDefaultvalue['scheduled_time_end'] = $getdefaultvalue['scheduled_time_end'];
221
- $setDefaultvalue['not_allow_after_expired_time'] = $getdefaultvalue['not_allow_after_expired_time'];
222
- $setDefaultvalue['preferred_date_format'] = $getdefaultvalue['preferred_date_format'];
223
- // Try to serialize the value.
224
- return $this->save_quiz_settings($setting,$setDefaultvalue);
225
- }
226
- // If the old value and new value are the same, return false.
227
- if ( $value === $old_value ) {
228
- return true;
229
- }
230
- // Try to serialize the value.
231
- return $this->save_quiz_settings($setting,$value);
232
- }
233
- /**
234
- * Update setting option fdor Quiz
235
- *
236
- * @since 5.0.0
237
- */
238
- private function save_quiz_settings( $setting,$settingArray ) {
239
- global $mlwQuizMasterNext;
240
- $serialized_value = maybe_serialize( $settingArray );
241
- // Set the new value.
242
- $this->settings[ $setting ] = $serialized_value;
243
- // Update the database.
244
- global $wpdb;
245
- $results = $wpdb->update(
246
- $wpdb->prefix . 'mlw_quizzes',
247
- array( 'quiz_settings' => maybe_serialize( $this->settings ) ),
248
- array( 'quiz_id' => $this->quiz_id ),
249
- array( '%s' ),
250
- array( '%d' )
251
- );
252
- if ( false === $results ) {
253
- $mlwQuizMasterNext->log_manager->add( 'Error when updating setting', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
254
- return false;
255
- } else {
256
- return true;
257
- }
258
 
259
  }
260
 
@@ -278,16 +279,16 @@ class QSM_Quiz_Settings
278
  }
279
 
280
  // If some options are missing
281
- if ( ! isset( $settings_array['quiz_options'] ) || ! isset( $settings_array["quiz_text"] ) || ! isset( $settings_array["quiz_leaderboards"] ) ) {
282
  // Load the old options system
283
  $quiz_options = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $this->quiz_id ) );
284
  // If no leadboard is present
285
- if ( ! isset( $settings_array["quiz_leaderboards"] ) ) {
286
- $settings_array["quiz_leaderboards"] = maybe_serialize( array( 'template' => $quiz_options->leaderboard_template ) );
287
  }
288
  // If no options are present
289
  if ( ! isset( $settings_array['quiz_options'] ) ) {
290
- $scheduled_timeframe = maybe_unserialize( $quiz_options->scheduled_timeframe );
291
 
292
  // Sets up older scheduled timeframe settings
293
  if ( ! is_array( $scheduled_timeframe ) ) {
@@ -297,36 +298,38 @@ class QSM_Quiz_Settings
297
  );
298
  }
299
  // Prepares new quiz_options section's settings
300
- $settings_array['quiz_options'] = maybe_serialize( array(
301
- 'system' => $quiz_options->quiz_system,
302
- 'loggedin_user_contact' => $quiz_options->loggedin_user_contact,
303
- 'contact_info_location' => $quiz_options->contact_info_location,
304
- 'user_name' => $quiz_options->user_name,
305
- 'user_comp' => $quiz_options->user_comp,
306
- 'user_email' => $quiz_options->user_email,
307
- 'user_phone' => $quiz_options->user_phone,
308
- 'comment_section' => $quiz_options->comment_section,
309
- 'randomness_order' => $quiz_options->randomness_order,
310
- 'question_from_total' => $quiz_options->question_from_total,
311
- 'question_per_category' => $quiz_options->question_per_category,
312
- 'total_user_tries' => $quiz_options->total_user_tries,
313
- 'social_media' => $quiz_options->social_media,
314
- 'pagination' => $quiz_options->pagination,
315
- 'timer_limit' => $quiz_options->timer_limit,
316
- 'question_numbering' => $quiz_options->question_numbering,
317
- 'require_log_in' => $quiz_options->require_log_in,
318
- 'limit_total_entries' => $quiz_options->limit_total_entries,
319
- 'scheduled_time_start' => $scheduled_timeframe["start"],
320
- 'scheduled_time_end' => $scheduled_timeframe["end"],
321
- 'disable_answer_onselect' => $quiz_options->disable_answer_onselect,
322
- 'ajax_show_correct' => $quiz_options->ajax_show_correct,
323
- 'preferred_date_format' => $quiz_options->preferred_date_format,
324
- ) );
 
 
325
  }
326
 
327
  // If no text is present
328
- if ( ! isset( $settings_array["quiz_text"] ) ) {
329
- $pagination_text = maybe_unserialize( $quiz_options->pagination_text );
330
  // Sets up older pagination text
331
  if ( ! is_array( $pagination_text ) ) {
332
  $pagination_text = array(
@@ -335,7 +338,7 @@ class QSM_Quiz_Settings
335
  );
336
  }
337
 
338
- $social_media_text = maybe_unserialize( $quiz_options->social_media_text );
339
  // Sets up older social sharing text
340
  if ( ! is_array( $social_media_text ) ) {
341
  $social_media_text = array(
@@ -344,30 +347,36 @@ class QSM_Quiz_Settings
344
  );
345
  }
346
  // Prepares new quiz_text section's settings
347
- $settings_array["quiz_text"] = maybe_serialize( array(
348
- 'message_before' => $quiz_options->message_before,
349
- 'message_comment' => $quiz_options->message_comment,
350
- 'message_end_template' => $quiz_options->message_end_template,
351
- 'comment_field_text' => $quiz_options->comment_field_text,
352
- 'question_answer_template' => $quiz_options->question_answer_template,
353
- 'submit_button_text' => $quiz_options->submit_button_text,
354
- 'name_field_text' => $quiz_options->name_field_text,
355
- 'business_field_text' => $quiz_options->business_field_text,
356
- 'email_field_text' => $quiz_options->email_field_text,
357
- 'phone_field_text' => $quiz_options->phone_field_text,
358
- 'total_user_tries_text' => $quiz_options->total_user_tries_text,
359
- 'twitter_sharing_text' => $social_media_text["twitter"],
360
- 'facebook_sharing_text' => $social_media_text["facebook"],
361
- 'previous_button_text' => $pagination_text[0],
362
- 'next_button_text' => $pagination_text[1],
363
- 'require_log_in_text' => $quiz_options->require_log_in_text,
364
- 'limit_total_entries_text' => $quiz_options->limit_total_entries_text,
365
- 'scheduled_timeframe_text' => $quiz_options->scheduled_timeframe_text,
366
- ) );
 
 
367
  }
368
  // Update new settings system
369
- $results = $wpdb->update(
370
- $wpdb->prefix . "mlw_quizzes", array( 'quiz_settings' => maybe_serialize( $settings_array ) ), array( 'quiz_id' => $this->quiz_id ), array( '%s' ), array( '%d' )
 
 
 
 
371
  );
372
  }
373
  // Cycle through registered settings
@@ -381,8 +390,8 @@ class QSM_Quiz_Settings
381
  // Cycle through each setting in section
382
  foreach ( $fields as $field ) {
383
  // Check if setting exists in section settings and, if not, set it to the default
384
- if ( ! isset( $unserialized_section[ $field["id"] ] ) ) {
385
- $unserialized_section[ $field["id"] ] = $field["default"];
386
  }
387
  }
388
  $settings_array[ $section ] = maybe_serialize( $unserialized_section );
@@ -411,7 +420,7 @@ class QSM_Quiz_Settings
411
 
412
  $options = $this->get_setting( 'quiz_options' );
413
  if ( is_array( $options ) ) {
414
- unset( $options['quiz_name'] );
415
  $quiz_options = array_merge( $quiz_options, $options );
416
  }
417
 
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
 
7
  /**
8
  * This handles all of the settings data for each individual quiz.
9
  *
10
  * @since 5.0.0
11
  */
12
+ class QSM_Quiz_Settings {
13
+
14
+
15
+ /**
16
+ * ID of the quiz
17
+ *
18
+ * @var int
19
+ * @since 5.0.0
20
+ */
21
+ private $quiz_id;
22
+
23
+ /**
24
+ * The settings for the quiz
25
+ *
26
+ * @var array
27
+ * @since 5.0.0
28
+ */
29
+ private $settings;
30
+
31
+ /**
32
+ * The fields that have been registered
33
+ *
34
+ * @var array
35
+ * @since 5.0.0
36
+ */
37
+ private $registered_fields;
38
+
39
+ /**
40
+ * Prepares the settings for the supplied quiz
41
+ *
42
+ * @since 5.0.0
43
+ * @param int $quiz_id the ID of the quiz that we are handling the settings data for
44
+ */
45
+ public function prepare_quiz( $quiz_id ) {
46
+ $this->quiz_id = intval( $quiz_id );
47
+ $this->load_settings();
48
+ }
49
+
50
+
51
+ /**
52
+ * Registers a setting be shown on the Options or Text tab
53
+ *
54
+ * @since 5.0.0
55
+ * @param array $field_array An array of the components for the settings field
56
+ */
57
+ public function register_setting( $field_array, $section = 'quiz_options' ) {
58
+ // Adds field to registered fields
59
+ $this->registered_fields[ $section ][] = $field_array;
60
+ }
61
+
62
+ /**
63
+ * Retrieves the registered setting fields
64
+ *
65
+ * @since 5.0.0
66
+ * @param string $section The section whose fields that are being retrieved
67
+ * @return array All the fields registered the the section provided
68
+ */
69
+ public function load_setting_fields( $section = 'quiz_options' ) {
70
+ // Checks if section exists in registered fields and returns it if it does
71
+ if ( isset( $this->registered_fields[ $section ] ) ) {
72
+ return $this->registered_fields[ $section ];
73
+ } else {
74
+ return false;
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Retrieves a setting value from a section based on name of section and setting
80
+ *
81
+ * @since 5.0.0
82
+ * @param string $section The name of the section the setting is registered in
83
+ * @param string $setting The name of the setting whose value we need to retrieve
84
+ * @param mixed $default What we need to return if no setting exists with given $setting
85
+ * @return $mixed Value set for $setting or $default if setting does not exist
86
+ */
87
+ public function get_section_setting( $section, $setting, $default = false ) {
88
+ // Return if section or setting is empty
89
+ if ( empty( $section ) || empty( $setting ) ) {
90
+ return $default;
91
+ }
92
+
93
+ // Get settings in section
94
+ $section_settings = $this->get_setting( $section );
95
+
96
+ // Return default if section not found
97
+ if ( ! $section_settings ) {
98
+ return $default;
99
+ }
100
+
101
+ // Maybe unserailize
102
+ $section_settings = maybe_unserialize( $section_settings );
103
+
104
+ // Check if setting exists
105
+ if ( isset( $section_settings[ $setting ] ) ) {
106
+ // Try to unserialize it and then return it
107
+ return maybe_unserialize( $section_settings[ $setting ] );
108
+ } else {
109
+ // Return the default if no setting exists
110
+ return $default;
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Retrieves setting value based on name of setting
116
+ *
117
+ * @since 5.0.0
118
+ * @param string $setting The name of the setting whose value we need to retrieve
119
+ * @param mixed $default What we need to return if no setting exists with given $setting
120
+ * @return $mixed Value set for $setting or $default if setting does not exist
121
+ */
122
+ public function get_setting( $setting, $default = false ) {
123
+ global $mlwQuizMasterNext;
124
+
125
+ // Return if empty
126
+ if ( empty( $setting ) ) {
127
+ return false;
128
+ }
129
+
130
+ // Check if ID is not set, for backwards compatibility
131
+ if ( ! $this->quiz_id ) {
132
+ $quiz_id = $mlwQuizMasterNext->quizCreator->get_id();
133
+ // If get_id doesn't work, return false
134
+ if ( ! $quiz_id ) {
135
+ return false;
136
+ } else {
137
+ $this->prepare_quiz( $quiz_id );
138
+ }
139
+ }
140
+
141
+ // Check if setting exists
142
+ if ( isset( $this->settings[ $setting ] ) ) {
143
+ // Try to unserialize it and then return it
144
+ return maybe_unserialize( $this->settings[ $setting ] );
145
+ } else {
146
+ // Return the default if no setting exists
147
+ return $default;
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Updates a settings value, adding it if it didn't already exist
153
+ *
154
+ * @since 5.0.0
155
+ * @param string $setting The name of the setting whose value we need to retrieve.
156
+ * @param mixed $value The value that needs to be stored for the setting.
157
+ * @return bool True if successful or false if fails
158
+ */
159
+ public function update_setting( $setting, $value ) {
160
+ global $mlwQuizMasterNext;
161
+
162
+ // Return if empty.
163
+ if ( empty( $setting ) ) {
164
+ $mlwQuizMasterNext->log_manager->add( 'Error when updating setting', 'Setting was empty with value equal to ' . wp_json_encode( $value ), 0, 'error' );
165
+ return false;
166
+ }
167
+
168
+ // Check if ID is not set, for backwards compatibility.
169
+ if ( ! $this->quiz_id ) {
170
+ $quiz_id = $mlwQuizMasterNext->quizCreator->get_id();
171
+
172
+ // If get_id doesn't work, return false.
173
+ if ( ! $quiz_id ) {
174
+ $mlwQuizMasterNext->log_manager->add( 'Error when updating setting', 'Quiz ID was not found', 0, 'error' );
175
+ return false;
176
+ } else {
177
+ $this->prepare_quiz( $quiz_id );
178
+ }
179
+ }
180
+
181
+ $old_value = $this->get_setting( $setting );
182
+ if ( isset( $_POST['global_setting'] ) ) {
183
+ global $globalQuizsetting;
184
+ $setDefaultvalue = $old_value;
185
+ $setDefaultvalue['form_type'] = $globalQuizsetting['form_type'];
186
+ $setDefaultvalue['system'] = $globalQuizsetting['system'];
187
+ $setDefaultvalue['score_roundoff'] = $globalQuizsetting['score_roundoff'];
188
+ $setDefaultvalue['progress_bar'] = $globalQuizsetting['progress_bar'];
189
+ $setDefaultvalue['require_log_in'] = $globalQuizsetting['require_log_in'];
190
+ $setDefaultvalue['pagination'] = $globalQuizsetting['pagination'];
191
+ $setDefaultvalue['timer_limit'] = $globalQuizsetting['timer_limit'];
192
+ $setDefaultvalue['enable_result_after_timer_end'] = $globalQuizsetting['enable_result_after_timer_end'];
193
+ $setDefaultvalue['skip_validation_time_expire'] = $globalQuizsetting['skip_validation_time_expire'];
194
+ $setDefaultvalue['total_user_tries'] = $globalQuizsetting['total_user_tries'];
195
+ $setDefaultvalue['limit_total_entries'] = $globalQuizsetting['limit_total_entries'];
196
+ $setDefaultvalue['question_from_total'] = $globalQuizsetting['question_from_total'];
197
+ $setDefaultvalue['question_per_category'] = $globalQuizsetting['question_per_category'];
198
+ $setDefaultvalue['contact_info_location'] = $globalQuizsetting['contact_info_location'];
199
+ $setDefaultvalue['loggedin_user_contact'] = $globalQuizsetting['loggedin_user_contact'];
200
+ $setDefaultvalue['comment_section'] = $globalQuizsetting['comment_section'];
201
+ $setDefaultvalue['question_numbering'] = $globalQuizsetting['question_numbering'];
202
+ $setDefaultvalue['store_responses'] = $globalQuizsetting['store_responses'];
203
+ $setDefaultvalue['disable_answer_onselect'] = $globalQuizsetting['disable_answer_onselect'];
204
+ $setDefaultvalue['ajax_show_correct'] = $globalQuizsetting['ajax_show_correct'];
205
+ $setDefaultvalue['contact_disable_autofill'] = $globalQuizsetting['contact_disable_autofill'];
206
+ $setDefaultvalue['form_disable_autofill'] = $globalQuizsetting['form_disable_autofill'];
207
+ $setDefaultvalue['show_category_on_front'] = $globalQuizsetting['show_category_on_front'];
208
+ $setDefaultvalue['enable_quick_result_mc'] = $globalQuizsetting['enable_quick_result_mc'];
209
+ $setDefaultvalue['end_quiz_if_wrong'] = $globalQuizsetting['end_quiz_if_wrong'];
210
+ $setDefaultvalue['enable_quick_correct_answer_info'] = $globalQuizsetting['enable_quick_correct_answer_info'];
211
+ $setDefaultvalue['enable_retake_quiz_button'] = $globalQuizsetting['enable_retake_quiz_button'];
212
+ $setDefaultvalue['enable_pagination_quiz'] = $globalQuizsetting['enable_pagination_quiz'];
213
+ $setDefaultvalue['enable_deselect_option'] = $globalQuizsetting['enable_deselect_option'];
214
+ $setDefaultvalue['disable_description_on_result'] = $globalQuizsetting['disable_description_on_result'];
215
+ $setDefaultvalue['disable_scroll_next_previous_click'] = $globalQuizsetting['disable_scroll_next_previous_click'];
216
+ $setDefaultvalue['disable_first_page'] = $globalQuizsetting['disable_first_page'];
217
+ $setDefaultvalue['quiz_animation'] = $globalQuizsetting['quiz_animation'];
218
+ $setDefaultvalue['result_page_fb_image'] = $globalQuizsetting['result_page_fb_image'];
219
+ $setDefaultvalue['randomness_order'] = $globalQuizsetting['randomness_order'];
220
+ $setDefaultvalue['scheduled_time_start'] = $globalQuizsetting['scheduled_time_start'];
221
+ $setDefaultvalue['scheduled_time_end'] = $globalQuizsetting['scheduled_time_end'];
222
+ $setDefaultvalue['not_allow_after_expired_time'] = $globalQuizsetting['not_allow_after_expired_time'];
223
+ $setDefaultvalue['preferred_date_format'] = $globalQuizsetting['preferred_date_format'];
224
+ // Try to serialize the value.
225
+ return $this->save_quiz_settings( $setting, $setDefaultvalue );
226
+ }
227
+ // If the old value and new value are the same, return false.
228
+ if ( $value === $old_value ) {
229
+ return true;
230
+ }
231
+ // Try to serialize the value.
232
+ return $this->save_quiz_settings( $setting, $value );
233
+ }
234
+ /**
235
+ * Update setting option fdor Quiz
236
+ *
237
+ * @since 5.0.0
238
+ */
239
+ private function save_quiz_settings( $setting, $settingArray ) {
240
+ global $mlwQuizMasterNext;
241
+ $serialized_value = maybe_serialize( $settingArray );
242
+ // Set the new value.
243
+ $this->settings[ $setting ] = $serialized_value;
244
+ // Update the database.
245
+ global $wpdb;
246
+ $results = $wpdb->update(
247
+ $wpdb->prefix . 'mlw_quizzes',
248
+ array( 'quiz_settings' => maybe_serialize( $this->settings ) ),
249
+ array( 'quiz_id' => $this->quiz_id ),
250
+ array( '%s' ),
251
+ array( '%d' )
252
+ );
253
+ if ( false === $results ) {
254
+ $mlwQuizMasterNext->log_manager->add( 'Error when updating setting', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
255
+ return false;
256
+ } else {
257
+ return true;
258
+ }
 
259
 
260
  }
261
 
279
  }
280
 
281
  // If some options are missing
282
+ if ( ! isset( $settings_array['quiz_options'] ) || ! isset( $settings_array['quiz_text'] ) || ! isset( $settings_array['quiz_leaderboards'] ) ) {
283
  // Load the old options system
284
  $quiz_options = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $this->quiz_id ) );
285
  // If no leadboard is present
286
+ if ( ! isset( $settings_array['quiz_leaderboards'] ) ) {
287
+ $settings_array['quiz_leaderboards'] = maybe_serialize( array( 'template' => $quiz_options->leaderboard_template ) );
288
  }
289
  // If no options are present
290
  if ( ! isset( $settings_array['quiz_options'] ) ) {
291
+ $scheduled_timeframe = maybe_unserialize( $quiz_options->scheduled_timeframe );
292
 
293
  // Sets up older scheduled timeframe settings
294
  if ( ! is_array( $scheduled_timeframe ) ) {
298
  );
299
  }
300
  // Prepares new quiz_options section's settings
301
+ $settings_array['quiz_options'] = maybe_serialize(
302
+ array(
303
+ 'system' => $quiz_options->quiz_system,
304
+ 'loggedin_user_contact' => $quiz_options->loggedin_user_contact,
305
+ 'contact_info_location' => $quiz_options->contact_info_location,
306
+ 'user_name' => $quiz_options->user_name,
307
+ 'user_comp' => $quiz_options->user_comp,
308
+ 'user_email' => $quiz_options->user_email,
309
+ 'user_phone' => $quiz_options->user_phone,
310
+ 'comment_section' => $quiz_options->comment_section,
311
+ 'randomness_order' => $quiz_options->randomness_order,
312
+ 'question_from_total' => $quiz_options->question_from_total,
313
+ 'question_per_category' => $quiz_options->question_per_category,
314
+ 'total_user_tries' => $quiz_options->total_user_tries,
315
+ 'social_media' => $quiz_options->social_media,
316
+ 'pagination' => $quiz_options->pagination,
317
+ 'timer_limit' => $quiz_options->timer_limit,
318
+ 'question_numbering' => $quiz_options->question_numbering,
319
+ 'require_log_in' => $quiz_options->require_log_in,
320
+ 'limit_total_entries' => $quiz_options->limit_total_entries,
321
+ 'scheduled_time_start' => $scheduled_timeframe['start'],
322
+ 'scheduled_time_end' => $scheduled_timeframe['end'],
323
+ 'disable_answer_onselect' => $quiz_options->disable_answer_onselect,
324
+ 'ajax_show_correct' => $quiz_options->ajax_show_correct,
325
+ 'preferred_date_format' => $quiz_options->preferred_date_format,
326
+ )
327
+ );
328
  }
329
 
330
  // If no text is present
331
+ if ( ! isset( $settings_array['quiz_text'] ) ) {
332
+ $pagination_text = maybe_unserialize( $quiz_options->pagination_text );
333
  // Sets up older pagination text
334
  if ( ! is_array( $pagination_text ) ) {
335
  $pagination_text = array(
338
  );
339
  }
340
 
341
+ $social_media_text = maybe_unserialize( $quiz_options->social_media_text );
342
  // Sets up older social sharing text
343
  if ( ! is_array( $social_media_text ) ) {
344
  $social_media_text = array(
347
  );
348
  }
349
  // Prepares new quiz_text section's settings
350
+ $settings_array['quiz_text'] = maybe_serialize(
351
+ array(
352
+ 'message_before' => $quiz_options->message_before,
353
+ 'message_comment' => $quiz_options->message_comment,
354
+ 'message_end_template' => $quiz_options->message_end_template,
355
+ 'comment_field_text' => $quiz_options->comment_field_text,
356
+ 'question_answer_template' => $quiz_options->question_answer_template,
357
+ 'submit_button_text' => $quiz_options->submit_button_text,
358
+ 'name_field_text' => $quiz_options->name_field_text,
359
+ 'business_field_text' => $quiz_options->business_field_text,
360
+ 'email_field_text' => $quiz_options->email_field_text,
361
+ 'phone_field_text' => $quiz_options->phone_field_text,
362
+ 'total_user_tries_text' => $quiz_options->total_user_tries_text,
363
+ 'twitter_sharing_text' => $social_media_text['twitter'],
364
+ 'facebook_sharing_text' => $social_media_text['facebook'],
365
+ 'previous_button_text' => $pagination_text[0],
366
+ 'next_button_text' => $pagination_text[1],
367
+ 'require_log_in_text' => $quiz_options->require_log_in_text,
368
+ 'limit_total_entries_text' => $quiz_options->limit_total_entries_text,
369
+ 'scheduled_timeframe_text' => $quiz_options->scheduled_timeframe_text,
370
+ )
371
+ );
372
  }
373
  // Update new settings system
374
+ $results = $wpdb->update(
375
+ $wpdb->prefix . 'mlw_quizzes',
376
+ array( 'quiz_settings' => maybe_serialize( $settings_array ) ),
377
+ array( 'quiz_id' => $this->quiz_id ),
378
+ array( '%s' ),
379
+ array( '%d' )
380
  );
381
  }
382
  // Cycle through registered settings
390
  // Cycle through each setting in section
391
  foreach ( $fields as $field ) {
392
  // Check if setting exists in section settings and, if not, set it to the default
393
+ if ( ! isset( $unserialized_section[ $field['id'] ] ) ) {
394
+ $unserialized_section[ $field['id'] ] = $field['default'];
395
  }
396
  }
397
  $settings_array[ $section ] = maybe_serialize( $unserialized_section );
420
 
421
  $options = $this->get_setting( 'quiz_options' );
422
  if ( is_array( $options ) ) {
423
+ unset( $options['quiz_name'] );
424
  $quiz_options = array_merge( $quiz_options, $options );
425
  }
426
 
php/classes/question-types/class-question-review-choice.php CHANGED
@@ -27,11 +27,23 @@ class QSM_Question_Review_Choice extends QSM_Question_Review {
27
  }
28
 
29
  public function set_answer_status() {
 
 
30
  foreach ( $this->user_answer as $user_answer_key => $user_answer_value ) {
31
  if ( in_array( $user_answer_key, array_keys( $this->correct_answer ), true ) ) {
32
- $this->answer_status = 'correct';
33
- $this->points += $this->answer_array[ $user_answer_key ][1];
 
34
  }
 
 
 
 
 
 
 
 
 
35
  }
36
  }
37
  }
27
  }
28
 
29
  public function set_answer_status() {
30
+ $user_correct_ans = 0;
31
+ $total_correct_ans = 0;
32
  foreach ( $this->user_answer as $user_answer_key => $user_answer_value ) {
33
  if ( in_array( $user_answer_key, array_keys( $this->correct_answer ), true ) ) {
34
+ $user_correct_ans += 1;
35
+ } else {
36
+ $user_correct_ans = -1;
37
  }
38
+ $this->points += $this->answer_array[ $user_answer_key ][1];
39
+ $check_correct_answer_key = $this->answer_array[ $user_answer_key ][2];
40
+
41
+ if ( 1 == $check_correct_answer_key ) {
42
+ $total_correct_ans++;
43
+ }
44
+ }
45
+ if ( $user_correct_ans == $total_correct_ans ) {
46
+ $this->answer_status = 'correct';
47
  }
48
  }
49
  }
php/question-types.php CHANGED
@@ -6,12 +6,12 @@ if ( ! defined( 'ABSPATH' ) ) {
6
  include 'question-types/qsm-question-type-multiple-choice.php';
7
  add_action( 'plugins_loaded', 'qmn_question_type_multiple_choice' );
8
  //
9
- include 'question-types/qsm-question-type-multiple-choice-horizontal.php';
10
- add_action( 'plugins_loaded', 'qmn_question_type_horizontal_multiple_choice' );
11
- //
12
  include 'question-types/qsm-question-type-multiple-response.php';
13
  add_action( 'plugins_loaded', 'qmn_question_type_multiple_response' );
14
  //
 
 
 
15
  include 'question-types/qsm-question-type-multiple-response-horizontal.php';
16
  add_action( 'plugins_loaded', 'qmn_question_type_horizontal_multiple_response' );
17
  //
@@ -67,7 +67,7 @@ include 'classes/question-types/class-question-review-text.php';
67
  */
68
  function qmn_question_type_multiple_choice() {
69
  global $mlwQuizMasterNext;
70
- $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Vertical Multiple Choice', 'quiz-master-next' ), 'qmn_multiple_choice_display', true, 'qmn_multiple_choice_review', null, null, 0 );
71
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 0, 'input_field', 'radio' );
72
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 0, 'category', 'Choice' );
73
  }
@@ -103,7 +103,7 @@ function qmn_question_type_date() {
103
  */
104
  function qmn_question_type_horizontal_multiple_choice() {
105
  global $mlwQuizMasterNext;
106
- $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Horizontal Multiple Choice', 'quiz-master-next' ), 'qmn_horizontal_multiple_choice_display', true, 'qmn_horizontal_multiple_choice_review', null, null, 1 );
107
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 1, 'input_field', 'radio' );
108
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 1, 'category', 'Choice' );
109
  }
@@ -238,7 +238,7 @@ function qmn_question_type_captcha() {
238
  */
239
  function qmn_question_type_horizontal_multiple_response() {
240
  global $mlwQuizMasterNext;
241
- $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Horizontal Multiple Response', 'quiz-master-next' ), 'qmn_horizontal_multiple_response_display', true, 'qmn_horizontal_multiple_response_review', null, null, 10 );
242
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 10, 'input_field', 'checkbox' );
243
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 10, 'category', 'Choice' );
244
  }
6
  include 'question-types/qsm-question-type-multiple-choice.php';
7
  add_action( 'plugins_loaded', 'qmn_question_type_multiple_choice' );
8
  //
 
 
 
9
  include 'question-types/qsm-question-type-multiple-response.php';
10
  add_action( 'plugins_loaded', 'qmn_question_type_multiple_response' );
11
  //
12
+ include 'question-types/qsm-question-type-multiple-choice-horizontal.php';
13
+ add_action( 'plugins_loaded', 'qmn_question_type_horizontal_multiple_choice' );
14
+ //
15
  include 'question-types/qsm-question-type-multiple-response-horizontal.php';
16
  add_action( 'plugins_loaded', 'qmn_question_type_horizontal_multiple_response' );
17
  //
67
  */
68
  function qmn_question_type_multiple_choice() {
69
  global $mlwQuizMasterNext;
70
+ $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Multiple Choice', 'quiz-master-next' ), 'qmn_multiple_choice_display', true, 'qmn_multiple_choice_review', null, null, 0 );
71
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 0, 'input_field', 'radio' );
72
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 0, 'category', 'Choice' );
73
  }
103
  */
104
  function qmn_question_type_horizontal_multiple_choice() {
105
  global $mlwQuizMasterNext;
106
+ $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Multiple Choice (Horizontal)', 'quiz-master-next' ), 'qmn_horizontal_multiple_choice_display', true, 'qmn_horizontal_multiple_choice_review', null, null, 1 );
107
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 1, 'input_field', 'radio' );
108
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 1, 'category', 'Choice' );
109
  }
238
  */
239
  function qmn_question_type_horizontal_multiple_response() {
240
  global $mlwQuizMasterNext;
241
+ $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Multiple Response (Horizontal)', 'quiz-master-next' ), 'qmn_horizontal_multiple_response_display', true, 'qmn_horizontal_multiple_response_review', null, null, 10 );
242
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 10, 'input_field', 'checkbox' );
243
  $mlwQuizMasterNext->pluginHelper->set_question_type_meta( 10, 'category', 'Choice' );
244
  }
php/template-variables.php CHANGED
@@ -520,8 +520,7 @@ function mlw_qmn_variable_timer_seconds( $content, $mlw_quiz_array ) {
520
  * @return string Returns the contents for the results page
521
  */
522
  function mlw_qmn_variable_date( $content, $results ) {
523
- global $mlw_quiz_array;
524
- $date = isset( $mlw_quiz_array['time_taken'] ) ? date_i18n( get_option( 'date_format' ), strtotime( $mlw_quiz_array['time_taken'] ) ) : '';
525
  $content = str_replace( '%CURRENT_DATE%', $date, $content );
526
  return $content;
527
  }
@@ -668,6 +667,7 @@ function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
668
  * @return string Returns the contents for the results page
669
  */
670
  function qmn_variable_category_score( $content, $mlw_quiz_array ) {
 
671
  $return_score = 0;
672
  $total_questions = 0;
673
  $amount_correct = 0;
@@ -684,17 +684,32 @@ function qmn_variable_category_score( $content, $mlw_quiz_array ) {
684
 
685
  }
686
 
 
 
687
  foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
688
- if ( is_array( $answer['multicategories'] ) ) {
689
- foreach ( $answer['multicategories'] as $category ) {
690
- $category_name_object = get_term_by( 'ID', $category, 'qsm_category' );
691
- if ( $category_name_object->name == $category_name && '11' !== $answer['question_type'] ) {
692
- $total_questions += 1;
693
- $amount_correct += $answer['points'];
 
 
 
 
 
 
 
 
 
 
 
 
694
  }
695
  }
696
  }
697
  }
 
698
  if ( 0 != $total_questions ) {
699
  if ( qsm_is_allow_score_roundoff() ) {
700
  $return_score = round( ( ( $amount_correct / $total_questions ) * 100 ) );
@@ -905,29 +920,29 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
905
  if ( isset( $mlw_quiz_array['form_type'] ) && 0 == $mlw_quiz_array['form_type'] ) {
906
  if ( 0 == $mlw_quiz_array['quiz_system'] || 3 == $mlw_quiz_array['quiz_system'] ) {
907
  if ( 'correct' === $answer['correct'] ) {
908
- $user_answer_class = 'qmn_user_correct_answer';
909
  $question_answer_class = 'qmn_question_answer_correct';
910
  } else {
911
- $user_answer_class = 'qmn_user_incorrect_answer';
912
  $question_answer_class = 'qmn_question_answer_incorrect';
913
  }
914
  }
915
  }
916
  } else {
917
- if ( isset( $mlw_quiz_array['form_type'] ) && '1' === $mlw_quiz_array['form_type'] ) {
918
- $user_answer_class = 'qmn_user_correct_answer';
919
  $question_answer_class = 'qmn_question_answer_correct';
920
  } else {
921
  if ( 'correct' === $answer['correct'] ) {
922
- $user_answer_class = 'qmn_user_correct_answer qsm-text-correct-option qsm-text-user-correct-answer';
923
  $question_answer_class = 'qmn_question_answer_correct';
924
  } else {
925
- $user_answer_class = 'qmn_user_incorrect_answer';
926
  $question_answer_class = 'qmn_question_answer_incorrect';
927
  }
928
  }
929
  }
930
- $open_span_tag = '<span class="' . $user_answer_class . '">';
931
  $mlw_question_answer_display = htmlspecialchars_decode( $qmn_question_answer_template, ENT_QUOTES );
932
  $disable_description_on_result = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'disable_description_on_result' );
933
  // Get question setting
@@ -1084,7 +1099,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
1084
  if ( 0 == $form_type && ( 0 == $quiz_system || 3 == $quiz_system ) ) {
1085
  if ( isset( $answer['question_type'] ) && ( 4 == $answer['question_type'] || 10 == $answer['question_type'] ) ) {
1086
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1087
- $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings );
1088
  } else {
1089
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_multi_choice_correct( $total_answers, $answer, $question_settings );
1090
  }
@@ -1096,7 +1111,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
1096
  $question_with_answer_text .= apply_filters( 'qsm_result_page_custom_default_template', $total_answers, $questions, $answer );
1097
  } else {
1098
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1099
- $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings );
1100
  } else {
1101
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_single_choice_correct( $total_answers, $answer, $question_settings );
1102
  }
@@ -1105,7 +1120,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
1105
  } else {
1106
  if ( isset( $answer['question_type'] ) && ( 4 == $answer['question_type'] || 10 == $answer['question_type'] ) ) {
1107
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1108
- $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings );
1109
  } else {
1110
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_multi_choice_points( $total_answers, $answer, $question_settings );
1111
  }
@@ -1119,7 +1134,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
1119
  $question_with_answer_text .= apply_filters( 'qsm_result_page_custom_default_template', $total_answers, $questions, $answer );
1120
  } else {
1121
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1122
- $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings );
1123
  } else {
1124
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_single_choice_points( $total_answers, $answer, $question_settings );
1125
  }
520
  * @return string Returns the contents for the results page
521
  */
522
  function mlw_qmn_variable_date( $content, $results ) {
523
+ $date = date_i18n( get_option( 'date_format' ), wp_timezone_string() );
 
524
  $content = str_replace( '%CURRENT_DATE%', $date, $content );
525
  return $content;
526
  }
667
  * @return string Returns the contents for the results page
668
  */
669
  function qmn_variable_category_score( $content, $mlw_quiz_array ) {
670
+ global $mlwQuizMasterNext;
671
  $return_score = 0;
672
  $total_questions = 0;
673
  $amount_correct = 0;
684
 
685
  }
686
 
687
+ $category_data = $mlwQuizMasterNext->migrationHelper->get_category_data( $category_name );
688
+
689
  foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
690
+ if ( $category_data['migrated'] ) {
691
+ $length = 0;
692
+ foreach ( $category_data['ids'] as $id ) {
693
+ if ( in_array( $id, $answer['multicategories'], true ) ) {
694
+ $length++;
695
+ }
696
+ }
697
+ if ( sizeof( $category_data['ids'] ) == $length ) {
698
+ $total_questions += 1;
699
+ if ( 'correct' == $answer['correct'] ) {
700
+ $amount_correct += 1;
701
+ }
702
+ }
703
+ } else {
704
+ if ( $answer['category'] == $category_name ) {
705
+ $total_questions += 1;
706
+ if ( 'correct' == $answer['correct'] ) {
707
+ $amount_correct += 1;
708
  }
709
  }
710
  }
711
  }
712
+
713
  if ( 0 != $total_questions ) {
714
  if ( qsm_is_allow_score_roundoff() ) {
715
  $return_score = round( ( ( $amount_correct / $total_questions ) * 100 ) );
920
  if ( isset( $mlw_quiz_array['form_type'] ) && 0 == $mlw_quiz_array['form_type'] ) {
921
  if ( 0 == $mlw_quiz_array['quiz_system'] || 3 == $mlw_quiz_array['quiz_system'] ) {
922
  if ( 'correct' === $answer['correct'] ) {
923
+ $user_answer_class = 'qmn_user_correct_answer';
924
  $question_answer_class = 'qmn_question_answer_correct';
925
  } else {
926
+ $user_answer_class = 'qmn_user_incorrect_answer';
927
  $question_answer_class = 'qmn_question_answer_incorrect';
928
  }
929
  }
930
  }
931
  } else {
932
+ if ( isset( $mlw_quiz_array['form_type'] ) && '1' === $mlw_quiz_array['form_type'] || '2' === $mlw_quiz_array['form_type'] ) {
933
+ $user_answer_class = 'qmn_user_correct_answer';
934
  $question_answer_class = 'qmn_question_answer_correct';
935
  } else {
936
  if ( 'correct' === $answer['correct'] ) {
937
+ $user_answer_class = 'qmn_user_correct_answer qsm-text-correct-option qsm-text-user-correct-answer';
938
  $question_answer_class = 'qmn_question_answer_correct';
939
  } else {
940
+ $user_answer_class = 'qmn_user_incorrect_answer';
941
  $question_answer_class = 'qmn_question_answer_incorrect';
942
  }
943
  }
944
  }
945
+ $open_span_tag = '<span class="' . $user_answer_class . '">';
946
  $mlw_question_answer_display = htmlspecialchars_decode( $qmn_question_answer_template, ENT_QUOTES );
947
  $disable_description_on_result = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'disable_description_on_result' );
948
  // Get question setting
1099
  if ( 0 == $form_type && ( 0 == $quiz_system || 3 == $quiz_system ) ) {
1100
  if ( isset( $answer['question_type'] ) && ( 4 == $answer['question_type'] || 10 == $answer['question_type'] ) ) {
1101
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1102
+ $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings, $form_type );
1103
  } else {
1104
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_multi_choice_correct( $total_answers, $answer, $question_settings );
1105
  }
1111
  $question_with_answer_text .= apply_filters( 'qsm_result_page_custom_default_template', $total_answers, $questions, $answer );
1112
  } else {
1113
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1114
+ $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings, $form_type );
1115
  } else {
1116
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_single_choice_correct( $total_answers, $answer, $question_settings );
1117
  }
1120
  } else {
1121
  if ( isset( $answer['question_type'] ) && ( 4 == $answer['question_type'] || 10 == $answer['question_type'] ) ) {
1122
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1123
+ $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings, $form_type );
1124
  } else {
1125
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_multi_choice_points( $total_answers, $answer, $question_settings );
1126
  }
1134
  $question_with_answer_text .= apply_filters( 'qsm_result_page_custom_default_template', $total_answers, $questions, $answer );
1135
  } else {
1136
  if ( isset( $answer['user_answer'] ) && isset( $answer['correct_answer'] ) ) {
1137
+ $question_with_answer_text .= qsm_tempvar_qa_text_qt_choice( $total_answers, $answer, $quiz_system, $question_settings, $form_type );
1138
  } else {
1139
  $question_with_answer_text .= qsm_bckcmp_tempvar_qa_text_qt_single_choice_points( $total_answers, $answer, $question_settings );
1140
  }
php/template-variables/qsm-tempvar-question-answers.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function qsm_tempvar_qa_text_qt_choice( $answers_from_db, $answers_from_response, $grading_system, $question_settings ) {
4
  $question_with_answer_text = '';
5
  foreach ( $answers_from_db as $single_answer_key => $single_answer ) {
6
  $current_answer_key = $single_answer_key;
@@ -24,7 +24,7 @@ function qsm_tempvar_qa_text_qt_choice( $answers_from_db, $answers_from_response
24
  $show_user_answer = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
25
  $image_class = '';
26
  }
27
- if ( 0 === intval( $grading_system ) || 3 === intval( $grading_system ) ) {
28
  if ( $is_user_answer && $is_answer_correct ) {
29
  $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer ' . $image_class . '">' . $show_user_answer . '</span>';
30
  } elseif ( ! $is_user_answer && $is_answer_correct ) {
@@ -43,4 +43,4 @@ function qsm_tempvar_qa_text_qt_choice( $answers_from_db, $answers_from_response
43
  }
44
  }
45
  return $question_with_answer_text;
46
- }
1
  <?php
2
 
3
+ function qsm_tempvar_qa_text_qt_choice( $answers_from_db, $answers_from_response, $grading_system, $question_settings, $form_type = 0 ) {
4
  $question_with_answer_text = '';
5
  foreach ( $answers_from_db as $single_answer_key => $single_answer ) {
6
  $current_answer_key = $single_answer_key;
24
  $show_user_answer = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
25
  $image_class = '';
26
  }
27
+ if ( 0 == $form_type && ( 0 === intval( $grading_system ) || 3 === intval( $grading_system ) ) ) {
28
  if ( $is_user_answer && $is_answer_correct ) {
29
  $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer ' . $image_class . '">' . $show_user_answer . '</span>';
30
  } elseif ( ! $is_user_answer && $is_answer_correct ) {
43
  }
44
  }
45
  return $question_with_answer_text;
46
+ }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: quizsurvey,expresstech
3
  Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress quiz plugin
4
  Requires at least: 4.9
5
- Tested up to: 5.8
6
  Requires PHP: 5.4
7
- Stable tag: 7.3.9
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -108,11 +108,11 @@ If you like this plugin, consider exploring our other plugins:
108
 
109
  📙 [Projectopia](https://wordpress.org/plugins/projectopia-core/) - Project Management & Invoicing plugin for WordPress. Generate invoices, send quotes, generate leads, manage clients, provide support - all inside your WordPress website.
110
 
111
- 📅 [Booking Ultra](https://wordpress.org/plugins/booking-ultra-pro/) - Appointment Booking plugin for WordPress - Show a quick form to accept bookings for your services with pre-set booking slots. Ideal for salons, medical professionals, lawyers, consultants, etc.
112
 
113
- ⚡ [InstaWP](https://instawp.io/) - Launch a quick WordPress site with this sandbox service. Create New WordPress instance within a second.
114
 
115
- 🔒 [Hide My WP](https://hidemywp.net/) - Hide your WordPress from bots, attackers & spammers. Hides all the known URLs, paths, plugins, themes which can reveal that you are using WP, also comes with an in-built firewall & trust network.
116
 
117
  == Installation ==
118
 
@@ -160,6 +160,16 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
160
  18. Database
161
 
162
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
163
  = 7.3.9 (January 20, 2022) =
164
  * Hotfix: Issues with markup in email
165
  * Hotfix: Issues with quiz review for blank submissions
@@ -673,19 +683,4 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
673
  == Upgrade Notice ==
674
 
675
  = 6.2.1 =
676
- Upgrade to fix cut submit button on mobile issue
677
-
678
- 🌐Our Plugins
679
-
680
- If you like this plugin, consider exploring our other plugins:
681
-
682
- ☰ [Responsive Menu](https://wordpress.org/plugins/responsive-menu/) - Best WordPress Menu Builder Plugin to create awesome and interactive mobile & desktop menus for WordPress websites.
683
-
684
- 📙 [Projectopia](https://wordpress.org/plugins/projectopia-core/) - Project Management & Invoicing plugin for WordPress. Generate invoices, send quotes, generate leads, manage clients, provide support - all inside your WordPress website.
685
-
686
- 📅 [Booking Ultra](https://wordpress.org/plugins/booking-ultra-pro/) - Appointment Booking plugin for WordPress - Show a quick form to accept bookings for your services with pre-set booking slots. Ideal for salons, medical professionals, lawyers, consultants, etc.
687
-
688
- ⚡ [InstaWP](https://instawp.io/) - Launch a quick WordPress site with this sandbox service. Create New WordPress instance within a second.
689
-
690
- 🔒 [Hide My WP](https://hidemywp.net/) - Hide your WordPress from bots, attackers & spammers. Hides all the known URLs, paths, plugins, themes which can reveal that you are using WP, also comes with an in-built firewall & trust network.
691
-
2
  Contributors: quizsurvey,expresstech
3
  Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress quiz plugin
4
  Requires at least: 4.9
5
+ Tested up to: 5.9
6
  Requires PHP: 5.4
7
+ Stable tag: 7.3.10
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
108
 
109
  📙 [Projectopia](https://wordpress.org/plugins/projectopia-core/) - Project Management & Invoicing plugin for WordPress. Generate invoices, send quotes, generate leads, manage clients, provide support - all inside your WordPress website.
110
 
111
+ 📅 [Booking Ultra](https://wordpress.org/plugins/booking-ultra-pro/) - Appointment Booking plugin for WordPress - Show a quick form to accept bookings for your services with pre-set booking slots. Ideal for salons, medical professionals, lawyers, consultants, etc.
112
 
113
+ ⚡ [InstaWP](https://instawp.io/) - Launch a quick WordPress site with this sandbox service. Create New WordPress instance within a second.
114
 
115
+ 🔒 [Hide My WP](https://hidemywp.net/) - Hide your WordPress from bots, attackers & spammers. Hides all the known URLs, paths, plugins, themes which can reveal that you are using WP, also comes with an in-built firewall & trust network.
116
 
117
  == Installation ==
118
 
160
  18. Database
161
 
162
  == Changelog ==
163
+ = 7.3.10 (January 28, 2022) =
164
+ * Checked compatibility with WordPress 5.9
165
+ * Bug: Fixed UI issues in QSM dashboard banner
166
+ * Bug: Fixed CURRENT_DATE template variable with certificate addon
167
+ * Bug: Fixed CATEGORY_SCORE_X template variable
168
+ * Bug: Fixed incorrectly marked answers in survey & simple form
169
+ * Bug: Fixed translation issues
170
+ * Bug: Fixed issues with global default settings
171
+ * Bug: Fixed issues with multiple response question type
172
+
173
  = 7.3.9 (January 20, 2022) =
174
  * Hotfix: Issues with markup in email
175
  * Hotfix: Issues with quiz review for blank submissions
683
  == Upgrade Notice ==
684
 
685
  = 6.2.1 =
686
+ Upgrade to fix cut submit button on mobile issue.