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

Version Description

(September 18, 2017) = * Closed Bug: Answers of "0" disappear when adding or editing questions - (Issue #531)

Download this release

Release Info

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

Code changes from version 5.0.6 to 5.0.7

js/qsm-admin.js CHANGED
@@ -28,7 +28,7 @@ var QSMQuizzesSurveys;
28
  '<a class="qsm-action-link qsm-action-link-delete" href="#">Delete</a>' +
29
  '</div>' +
30
  '</td>' +
31
- '<td><a href="' + quizData.link + '">View Quiz</a>' +
32
  '<div class="row-actions">' +
33
  '<a class="qsm-action-link" href="post.php?post=' + quizData.postID + '&action=edit">Edit Post Settings</a>' +
34
  '</div>' +
28
  '<a class="qsm-action-link qsm-action-link-delete" href="#">Delete</a>' +
29
  '</div>' +
30
  '</td>' +
31
+ '<td><a href="' + quizData.link + '">View Quiz/Survey</a>' +
32
  '<div class="row-actions">' +
33
  '<a class="qsm-action-link" href="post.php?post=' + quizData.postID + '&action=edit">Edit Post Settings</a>' +
34
  '</div>' +
mlw_quizmaster2.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 5.0.6
6
  * Author: Frank Corso
7
  * Author URI: http://www.quizandsurveymaster.com/
8
  * Plugin URI: http://www.quizandsurveymaster.com/
@@ -10,7 +10,7 @@
10
  * Domain Path: /languages
11
  *
12
  * @author Frank Corso
13
- * @version 5.0.6
14
  */
15
  if ( ! defined( 'ABSPATH' ) ) exit;
16
 
@@ -30,7 +30,7 @@ class MLWQuizMasterNext {
30
  * @var string
31
  * @since 4.0.0
32
  */
33
- public $version = '5.0.6';
34
 
35
  /**
36
  * QSM Alert Manager Object
@@ -124,7 +124,7 @@ class MLWQuizMasterNext {
124
  include( "php/help-page.php" );
125
  include( "php/dashboard-widgets.php" );
126
  include( "php/options-page-questions-tab.php" );
127
- include("php/options-page-contact-tab.php");
128
  include( "php/options-page-text-tab.php" );
129
  include( "php/options-page-option-tab.php" );
130
  include( "php/options-page-leaderboard-tab.php" );
@@ -138,7 +138,7 @@ class MLWQuizMasterNext {
138
  include( "php/class-qmn-tracking.php" );
139
  include( "php/class-qmn-review-message.php" );
140
  }
141
- include( "php/class-qsm-contact-manager.php" );
142
  include( "php/class-qmn-quiz-manager.php" );
143
 
144
  include( "php/leaderboard-shortcode.php" );
@@ -211,7 +211,7 @@ class MLWQuizMasterNext {
211
  $settings = (array) get_option( 'qmn-settings' );
212
 
213
  // Checks if admin turned off archive
214
- if ( isset( $settings['cpt_archive'] ) && '1' == $settings['cpt_archive'] ) {
215
  $has_archive = false;
216
  }
217
 
@@ -254,7 +254,7 @@ class MLWQuizMasterNext {
254
  public function setup_admin_menu() {
255
  if ( function_exists( 'add_menu_page' ) ) {
256
  add_menu_page( 'Quiz And Survey Master', __( 'Quizzes/Surveys', 'quiz-master-next' ), 'moderate_comments', __FILE__, 'qsm_generate_quizzes_surveys_page', 'dashicons-feedback' );
257
- add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_options', 'mlw_generate_quiz_options' );
258
  add_submenu_page( __FILE__, __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );
259
  add_submenu_page( __FILE__, __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_result_details', 'mlw_generate_result_details' );
260
  add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 5.0.7
6
  * Author: Frank Corso
7
  * Author URI: http://www.quizandsurveymaster.com/
8
  * Plugin URI: http://www.quizandsurveymaster.com/
10
  * Domain Path: /languages
11
  *
12
  * @author Frank Corso
13
+ * @version 5.0.7
14
  */
15
  if ( ! defined( 'ABSPATH' ) ) exit;
16
 
30
  * @var string
31
  * @since 4.0.0
32
  */
33
+ public $version = '5.0.7';
34
 
35
  /**
36
  * QSM Alert Manager Object
124
  include( "php/help-page.php" );
125
  include( "php/dashboard-widgets.php" );
126
  include( "php/options-page-questions-tab.php" );
127
+ include("php/options-page-contact-tab.php");
128
  include( "php/options-page-text-tab.php" );
129
  include( "php/options-page-option-tab.php" );
130
  include( "php/options-page-leaderboard-tab.php" );
138
  include( "php/class-qmn-tracking.php" );
139
  include( "php/class-qmn-review-message.php" );
140
  }
141
+ include( "php/class-qsm-contact-manager.php" );
142
  include( "php/class-qmn-quiz-manager.php" );
143
 
144
  include( "php/leaderboard-shortcode.php" );
211
  $settings = (array) get_option( 'qmn-settings' );
212
 
213
  // Checks if admin turned off archive
214
+ if ( isset( $settings['cpt_archive'] ) && '1' == $settings['cpt_archive'] ) {
215
  $has_archive = false;
216
  }
217
 
254
  public function setup_admin_menu() {
255
  if ( function_exists( 'add_menu_page' ) ) {
256
  add_menu_page( 'Quiz And Survey Master', __( 'Quizzes/Surveys', 'quiz-master-next' ), 'moderate_comments', __FILE__, 'qsm_generate_quizzes_surveys_page', 'dashicons-feedback' );
257
+ add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_options', 'qsm_generate_quiz_options' );
258
  add_submenu_page( __FILE__, __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );
259
  add_submenu_page( __FILE__, __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_result_details', 'mlw_generate_result_details' );
260
  add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
php/about-page.php CHANGED
@@ -70,6 +70,7 @@ function mlw_generate_about_page() {
70
  </div>
71
  <div class="qsm-tab-content tab-2" style="display: none;">
72
  <h2>Changelog</h2>
 
73
  <?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 38 ); ?>
74
  <?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 37 ); ?>
75
  <?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 34 ); ?>
70
  </div>
71
  <div class="qsm-tab-content tab-2" style="display: none;">
72
  <h2>Changelog</h2>
73
+ <?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 39 ); ?>
74
  <?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 38 ); ?>
75
  <?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 37 ); ?>
76
  <?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 34 ); ?>
php/class-qmn-quiz-creator.php CHANGED
@@ -396,8 +396,8 @@ class QMNQuizCreator
396
  $quiz_post_id = wp_insert_post( $quiz_post );
397
  add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
398
 
399
- $mlwQuizMasterNext->alertManager->newAlert(__('Your new quiz has been created successfully. To begin editing your quiz, click the Edit link on the new quiz.', 'quiz-master-next'), 'success');
400
- $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz Has Been Created: $quiz_name" );
401
  do_action('qmn_quiz_created', $new_quiz);
402
  }
403
  else
@@ -456,8 +456,8 @@ class QMNQuizCreator
456
  }
457
  }
458
  wp_reset_postdata();
459
- $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been deleted successfully.', 'quiz-master-next'), 'success');
460
- $mlwQuizMasterNext->audit_manager->new_audit( "Quiz Has Been Deleted: $quiz_name" );
461
  }
462
  else
463
  {
@@ -490,8 +490,8 @@ class QMNQuizCreator
490
  array( '%d' )
491
  );
492
  if ( false != $results ) {
493
- $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz name has been updated successfully.', 'quiz-master-next'), 'success');
494
- $mlwQuizMasterNext->audit_manager->new_audit( "Quiz Name Has Been Edited: $quiz_name" );
495
  }
496
  else
497
  {
@@ -638,8 +638,8 @@ class QMNQuizCreator
638
  );
639
  $quiz_post_id = wp_insert_post( $quiz_post );
640
  add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
641
- $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been duplicated successfully.', 'quiz-master-next'), 'success');
642
- $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz Has Been Created: $quiz_name" );
643
  do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
644
  }
645
  else
396
  $quiz_post_id = wp_insert_post( $quiz_post );
397
  add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
398
 
399
+ $mlwQuizMasterNext->alertManager->newAlert(__('Your new quiz or survey has been created successfully. To begin editing, click the Edit link.', 'quiz-master-next'), 'success');
400
+ $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz/Survey Has Been Created: $quiz_name" );
401
  do_action('qmn_quiz_created', $new_quiz);
402
  }
403
  else
456
  }
457
  }
458
  wp_reset_postdata();
459
+ $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz or survey has been deleted successfully.', 'quiz-master-next'), 'success');
460
+ $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Has Been Deleted: $quiz_name" );
461
  }
462
  else
463
  {
490
  array( '%d' )
491
  );
492
  if ( false != $results ) {
493
+ $mlwQuizMasterNext->alertManager->newAlert(__('The name of your quiz or survey has been updated successfully.', 'quiz-master-next'), 'success');
494
+ $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Name Has Been Edited: $quiz_name" );
495
  }
496
  else
497
  {
638
  );
639
  $quiz_post_id = wp_insert_post( $quiz_post );
640
  add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
641
+ $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz or survey has been duplicated successfully.', 'quiz-master-next'), 'success');
642
+ $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz/Survey Has Been Created: $quiz_name" );
643
  do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
644
  }
645
  else
php/options-page-questions-tab.php CHANGED
@@ -77,12 +77,12 @@ function qsm_options_questions_tab_content() {
77
  $edit_question_order = intval( $_POST["new_question_order"] );
78
  $total_answers = intval( $_POST["new_question_answer_total"] );
79
 
80
- // Checks if a category was selected or entered
81
  if ( isset( $_POST["new_category"] ) ) {
82
 
83
  $edit_category = sanitize_text_field( $_POST["new_category"] );
84
 
85
- // Checks if the new category radio was selected
86
  if ( 'new_category' == $edit_category ) {
87
  $edit_category = sanitize_text_field( stripslashes( $_POST["new_new_category"] ) );
88
  }
@@ -90,7 +90,7 @@ function qsm_options_questions_tab_content() {
90
  $edit_category = '';
91
  }
92
 
93
- // Retrieves question settings and sets required field
94
  $row_settings = $wpdb->get_row( $wpdb->prepare( "SELECT question_settings FROM {$wpdb->prefix}mlw_questions WHERE question_id=%d", $edit_question_id ) );
95
  if ( is_serialized( $row_settings->question_settings ) && is_array( @unserialize( $row_settings->question_settings ) ) ) {
96
  $question_settings = @unserialize( $row_settings->question_settings );
@@ -104,26 +104,26 @@ function qsm_options_questions_tab_content() {
104
  $question_settings['required'] = intval( $_POST["required"] );
105
  $question_settings = serialize( $question_settings );
106
 
107
- // Cycles through answers
108
  $i = 1;
109
  $answer_array = array();
110
  while ( $i <= $total_answers ) {
111
 
112
- // Checks if that answer exists and it's not empty
113
- if ( isset( $_POST["answer_$i"] ) && ! empty( $_POST["answer_$i"] ) ) {
114
 
115
- // Checks if the answer was marked as correct
116
  $correct = 0;
117
  if ( isset( $_POST["answer_$i"."_correct"] ) && 1 == $_POST["answer_$i"."_correct"] ) {
118
  $correct = 1;
119
  }
120
 
121
- // Prepares this answer array
122
  $answer_array[] = array(
123
- htmlspecialchars( stripslashes( $_POST["answer_$i"] ), ENT_QUOTES ),
124
- floatval( $_POST["answer_".$i."_points"] ),
125
- $correct
126
- );
127
  }
128
  $i++;
129
  }
@@ -131,7 +131,7 @@ function qsm_options_questions_tab_content() {
131
  $answer_array = serialize( $answer_array );
132
  $quiz_id = intval( $_POST["quiz_id"] );
133
 
134
- // Updates question row in table
135
  $results = $wpdb->update(
136
  $wpdb->prefix . "mlw_questions",
137
  array(
@@ -281,12 +281,12 @@ function qsm_options_questions_tab_content() {
281
  $new_question_order = intval( $_POST["new_question_order"] );
282
  $total_answers = intval( $_POST["new_question_answer_total"] );
283
 
284
- // Checks if a category was selected or entered
285
  if ( isset( $_POST['new_category'] ) ) {
286
 
287
  $qmn_category = sanitize_text_field( $_POST["new_category"] );
288
 
289
- // Checks if the new category radio was selected
290
  if ( 'new_category' == $qmn_category ) {
291
  $qmn_category = sanitize_text_field( stripslashes( $_POST["new_new_category"] ) );
292
  }
@@ -294,31 +294,31 @@ function qsm_options_questions_tab_content() {
294
  $qmn_category = '';
295
  }
296
 
297
- // Creates question settings array
298
  $question_settings = array();
299
  $question_settings['required'] = intval($_POST["required"]);
300
  $question_settings = serialize($question_settings);
301
 
302
- // Cycles through answers
303
  $i = 1;
304
  $answer_array = array();
305
  while ( $i <= $total_answers ) {
306
 
307
- // Checks if that answer exists and it's not empty
308
- if ( isset( $_POST["answer_$i"] ) && ! empty( $_POST["answer_$i"] ) ) {
309
 
310
- // Checks if the answer was marked as correct
311
  $correct = 0;
312
  if ( isset( $_POST["answer_".$i."_correct"] ) && 1 == $_POST["answer_".$i."_correct"] ) {
313
  $correct = 1;
314
  }
315
 
316
- // Prepares answer array
317
  $answer_array[] = array(
318
- htmlspecialchars( stripslashes( $_POST["answer_".$i] ), ENT_QUOTES ),
319
- floatval( $_POST["answer_".$i."_points"] ),
320
- $correct
321
- );
322
  }
323
  $i++;
324
  }
@@ -326,12 +326,12 @@ function qsm_options_questions_tab_content() {
326
  $answer_array = serialize( $answer_array );
327
  $quiz_id = intval( $_POST["quiz_id"] );
328
 
329
- // Inserts new question into table
330
  $results = $wpdb->insert(
331
- $wpdb->prefix."mlw_questions",
332
- array(
333
- 'quiz_id' => $quiz_id,
334
- 'question_name' => $question_name,
335
  'answer_array' => $answer_array,
336
  'question_answer_info' => $question_answer_info,
337
  'comments' => $comments,
77
  $edit_question_order = intval( $_POST["new_question_order"] );
78
  $total_answers = intval( $_POST["new_question_answer_total"] );
79
 
80
+ // Checks if a category was selected or entered
81
  if ( isset( $_POST["new_category"] ) ) {
82
 
83
  $edit_category = sanitize_text_field( $_POST["new_category"] );
84
 
85
+ // Checks if the new category radio was selected
86
  if ( 'new_category' == $edit_category ) {
87
  $edit_category = sanitize_text_field( stripslashes( $_POST["new_new_category"] ) );
88
  }
90
  $edit_category = '';
91
  }
92
 
93
+ // Retrieves question settings and sets required field
94
  $row_settings = $wpdb->get_row( $wpdb->prepare( "SELECT question_settings FROM {$wpdb->prefix}mlw_questions WHERE question_id=%d", $edit_question_id ) );
95
  if ( is_serialized( $row_settings->question_settings ) && is_array( @unserialize( $row_settings->question_settings ) ) ) {
96
  $question_settings = @unserialize( $row_settings->question_settings );
104
  $question_settings['required'] = intval( $_POST["required"] );
105
  $question_settings = serialize( $question_settings );
106
 
107
+ // Cycles through answers
108
  $i = 1;
109
  $answer_array = array();
110
  while ( $i <= $total_answers ) {
111
 
112
+ // Checks if that answer exists and it's not empty
113
+ if ( isset( $_POST["answer_$i"] ) && ( '0' == $_POST["answer_$i"] || ! empty( $_POST["answer_$i"] ) ) ) {
114
 
115
+ // Checks if the answer was marked as correct
116
  $correct = 0;
117
  if ( isset( $_POST["answer_$i"."_correct"] ) && 1 == $_POST["answer_$i"."_correct"] ) {
118
  $correct = 1;
119
  }
120
 
121
+ // Prepares this answer array
122
  $answer_array[] = array(
123
+ htmlspecialchars( stripslashes( $_POST["answer_$i"] ), ENT_QUOTES ),
124
+ floatval( $_POST["answer_".$i."_points"] ),
125
+ $correct
126
+ );
127
  }
128
  $i++;
129
  }
131
  $answer_array = serialize( $answer_array );
132
  $quiz_id = intval( $_POST["quiz_id"] );
133
 
134
+ // Updates question row in table
135
  $results = $wpdb->update(
136
  $wpdb->prefix . "mlw_questions",
137
  array(
281
  $new_question_order = intval( $_POST["new_question_order"] );
282
  $total_answers = intval( $_POST["new_question_answer_total"] );
283
 
284
+ // Checks if a category was selected or entered
285
  if ( isset( $_POST['new_category'] ) ) {
286
 
287
  $qmn_category = sanitize_text_field( $_POST["new_category"] );
288
 
289
+ // Checks if the new category radio was selected
290
  if ( 'new_category' == $qmn_category ) {
291
  $qmn_category = sanitize_text_field( stripslashes( $_POST["new_new_category"] ) );
292
  }
294
  $qmn_category = '';
295
  }
296
 
297
+ // Creates question settings array
298
  $question_settings = array();
299
  $question_settings['required'] = intval($_POST["required"]);
300
  $question_settings = serialize($question_settings);
301
 
302
+ // Cycles through answers
303
  $i = 1;
304
  $answer_array = array();
305
  while ( $i <= $total_answers ) {
306
 
307
+ // Checks if that answer exists and it's not empty
308
+ if ( isset( $_POST["answer_$i"] ) && ( '0' == $_POST["answer_$i"] || ! empty( $_POST["answer_$i"] ) ) ) {
309
 
310
+ // Checks if the answer was marked as correct
311
  $correct = 0;
312
  if ( isset( $_POST["answer_".$i."_correct"] ) && 1 == $_POST["answer_".$i."_correct"] ) {
313
  $correct = 1;
314
  }
315
 
316
+ // Prepares answer array
317
  $answer_array[] = array(
318
+ htmlspecialchars( stripslashes( $_POST["answer_".$i] ), ENT_QUOTES ),
319
+ floatval( $_POST["answer_".$i."_points"] ),
320
+ $correct
321
+ );
322
  }
323
  $i++;
324
  }
326
  $answer_array = serialize( $answer_array );
327
  $quiz_id = intval( $_POST["quiz_id"] );
328
 
329
+ // Inserts new question into table
330
  $results = $wpdb->insert(
331
+ $wpdb->prefix."mlw_questions",
332
+ array(
333
+ 'quiz_id' => $quiz_id,
334
+ 'question_name' => $question_name,
335
  'answer_array' => $answer_array,
336
  'question_answer_info' => $question_answer_info,
337
  'comments' => $comments,
php/quiz-options-page.php CHANGED
@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
8
  * @return void
9
  * @since 4.4.0
10
  */
11
- function mlw_generate_quiz_options() {
12
 
13
  // Check if current user can
14
  if ( ! current_user_can('moderate_comments') ) {
@@ -23,13 +23,11 @@ function mlw_generate_quiz_options() {
23
  $active_tab = isset( $_GET[ 'tab' ] ) ? stripslashes( $_GET[ 'tab' ] ) : 'questions';
24
 
25
  // Prepare quiz
26
- $quiz_id = intval($_GET["quiz_id"]);
27
  if ( isset( $_GET["quiz_id"] ) ) {
28
- $table_name = $wpdb->prefix . "mlw_quizzes";
29
- $mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
30
  $mlwQuizMasterNext->quiz_settings->prepare_quiz( $_GET["quiz_id"] );
31
  }
32
-
33
  ?>
34
 
35
  <script type="text/javascript"
@@ -47,64 +45,60 @@ function mlw_generate_quiz_options() {
47
  wp_enqueue_style( 'qmn_jquery_redmond_theme', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css' );
48
  ?>
49
  <style>
50
- .mlw_tab_content
51
- {
52
  padding: 20px 20px 20px 20px;
53
  margin: 20px 20px 20px 20px;
54
  }
55
  </style>
56
  <div class="wrap">
57
  <div class='mlw_quiz_options'>
58
- <h1><?php
59
- /* translators: The %s corresponds to the name of the quiz */
60
- echo sprintf(__('Quiz Settings For %s', 'quiz-master-next'), $mlw_quiz_options->quiz_name);
61
- ?></h1>
62
- <?php
63
- // Put all output from tab into ob_get_contents below.
64
- ob_start();
65
 
66
- // If the quiz is set and not empty
67
- if ( ! empty( $quiz_id ) ) {
68
- ?>
69
- <h2 class="nav-tab-wrapper">
70
- <?php
71
- // Cycle through registered tabs to create navigation
72
- foreach( $tab_array as $tab ) {
73
- $active_class = '';
74
- if ( $active_tab == $tab['slug'] ) {
75
- $active_class = 'nav-tab-active';
76
- }
77
- echo "<a href=\"?page=mlw_quiz_options&quiz_id=$quiz_id&tab=".$tab['slug']."\" class=\"nav-tab $active_class\">".$tab['title']."</a>";
78
- }
79
  ?>
80
- </h2>
81
- <div class="mlw_tab_content">
82
- <?php
83
- // Cycle through tabs looking for current tab to create tab's content
84
  foreach( $tab_array as $tab ) {
 
85
  if ( $active_tab == $tab['slug'] ) {
86
- call_user_func( $tab['function'] );
87
  }
 
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  ?>
90
- </div>
91
- <?php
92
- } else {
93
- ?>
94
- <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
95
- <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
96
- <strong><?php _e('Error!', 'quiz-master-next'); ?></strong> <?php _e('Please go to the quizzes page and click on the Edit link from the quiz you wish to edit.', 'quiz-master-next'); ?></p>
97
- </div>
98
- <?php
99
- }
100
- $mlw_output = ob_get_contents();
101
- ob_end_clean();
102
 
103
- // Shows alerts, ads, then tab content
104
- $mlwQuizMasterNext->alertManager->showAlerts();
105
- echo mlw_qmn_show_adverts();
106
- echo $mlw_output;
107
- ?>
108
  </div>
109
  </div>
110
  <?php
8
  * @return void
9
  * @since 4.4.0
10
  */
11
+ function qsm_generate_quiz_options() {
12
 
13
  // Check if current user can
14
  if ( ! current_user_can('moderate_comments') ) {
23
  $active_tab = isset( $_GET[ 'tab' ] ) ? stripslashes( $_GET[ 'tab' ] ) : 'questions';
24
 
25
  // Prepare quiz
26
+ $quiz_id = intval( $_GET["quiz_id"] );
27
  if ( isset( $_GET["quiz_id"] ) ) {
28
+ $quiz_name = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $quiz_id ) );
 
29
  $mlwQuizMasterNext->quiz_settings->prepare_quiz( $_GET["quiz_id"] );
30
  }
 
31
  ?>
32
 
33
  <script type="text/javascript"
45
  wp_enqueue_style( 'qmn_jquery_redmond_theme', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css' );
46
  ?>
47
  <style>
48
+ .mlw_tab_content {
 
49
  padding: 20px 20px 20px 20px;
50
  margin: 20px 20px 20px 20px;
51
  }
52
  </style>
53
  <div class="wrap">
54
  <div class='mlw_quiz_options'>
55
+ <h1><?php echo $quiz_name; ?></h1>
56
+ <?php
57
+ // Put all output from tab into ob_get_contents below.
58
+ ob_start();
 
 
 
59
 
60
+ // If the quiz is set and not empty
61
+ if ( ! empty( $quiz_id ) ) {
 
 
 
 
 
 
 
 
 
 
 
62
  ?>
63
+ <h2 class="nav-tab-wrapper">
64
+ <?php
65
+ // Cycle through registered tabs to create navigation
 
66
  foreach( $tab_array as $tab ) {
67
+ $active_class = '';
68
  if ( $active_tab == $tab['slug'] ) {
69
+ $active_class = 'nav-tab-active';
70
  }
71
+ echo "<a href=\"?page=mlw_quiz_options&quiz_id=$quiz_id&tab=".$tab['slug']."\" class=\"nav-tab $active_class\">".$tab['title']."</a>";
72
  }
73
+ ?>
74
+ </h2>
75
+ <div class="mlw_tab_content">
76
+ <?php
77
+ // Cycle through tabs looking for current tab to create tab's content
78
+ foreach( $tab_array as $tab ) {
79
+ if ( $active_tab == $tab['slug'] ) {
80
+ call_user_func( $tab['function'] );
81
+ }
82
+ }
83
+ ?>
84
+ </div>
85
+ <?php
86
+ } else {
87
  ?>
88
+ <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
89
+ <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
90
+ <strong><?php _e('Error!', 'quiz-master-next'); ?></strong> <?php _e('Please go to the quizzes page and click on the Edit link from the quiz you wish to edit.', 'quiz-master-next'); ?></p>
91
+ </div>
92
+ <?php
93
+ }
94
+ $mlw_output = ob_get_contents();
95
+ ob_end_clean();
 
 
 
 
96
 
97
+ // Shows alerts, ads, then tab content
98
+ $mlwQuizMasterNext->alertManager->showAlerts();
99
+ echo mlw_qmn_show_adverts();
100
+ echo $mlw_output;
101
+ ?>
102
  </div>
103
  </div>
104
  <?php
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Quiz And Survey Master (Formerly Quiz Master Next) ===
2
  Contributors: fpcorso
3
  Tags: quiz, survey, lead, test, score, exam, questionnaire, answer, question, points
4
  Requires at least: 4.7
5
  Tested up to: 4.8
6
- Stable tag: 5.0.6
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -62,6 +62,7 @@ While Quiz And Survey Master is fully functional and is packed full of features
62
  **Free Add-ons**
63
 
64
  * [Certificates](https://quizandsurveymaster.com/downloads/certificate/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=certificate)
 
65
 
66
  **Premium Add-ons**
67
 
@@ -107,6 +108,9 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
107
 
108
  == Changelog ==
109
 
 
 
 
110
  = 5.0.6 (August 1, 2017) =
111
  * Closed Bug: HTML Entities causing incorrect answers and missing user answer - ([Issue #565](https://github.com/fpcorso/quiz_master_next/issues/565))
112
 
1
+ === Quiz And Survey Master (Formerly Quiz Master Next) ===
2
  Contributors: fpcorso
3
  Tags: quiz, survey, lead, test, score, exam, questionnaire, answer, question, points
4
  Requires at least: 4.7
5
  Tested up to: 4.8
6
+ Stable tag: 5.0.7
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
62
  **Free Add-ons**
63
 
64
  * [Certificates](https://quizandsurveymaster.com/downloads/certificate/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=certificate)
65
+ * [Leaderboards](https://quizandsurveymaster.com/downloads/leaderboards/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=leaderboads)
66
 
67
  **Premium Add-ons**
68
 
108
 
109
  == Changelog ==
110
 
111
+ = 5.0.7 (September 18, 2017) =
112
+ * Closed Bug: Answers of "0" disappear when adding or editing questions - ([Issue #531](https://github.com/fpcorso/quiz_master_next/issues/531))
113
+
114
  = 5.0.6 (August 1, 2017) =
115
  * Closed Bug: HTML Entities causing incorrect answers and missing user answer - ([Issue #565](https://github.com/fpcorso/quiz_master_next/issues/565))
116