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

Version Description

(March 5, 2018) = * Fixes broken "Custom" styles * Fixes minor bugs in new question editor * Makes minor style adjustments

Download this release

Release Info

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

Code changes from version 5.2.0 to 5.2.1

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: 5.2.0
6
  * Author: Frank Corso
7
  * Author URI: https://www.quizandsurveymaster.com/
8
  * Plugin URI: https://www.quizandsurveymaster.com/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author Frank Corso
12
- * @version 5.2.0
13
  * @package QSM
14
  */
15
 
@@ -33,7 +33,7 @@ class MLWQuizMasterNext {
33
  * @var string
34
  * @since 4.0.0
35
  */
36
- public $version = '5.2.0';
37
 
38
  /**
39
  * 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: 5.2.1
6
  * Author: Frank Corso
7
  * Author URI: https://www.quizandsurveymaster.com/
8
  * Plugin URI: https://www.quizandsurveymaster.com/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author Frank Corso
12
+ * @version 5.2.1
13
  * @package QSM
14
  */
15
 
33
  * @var string
34
  * @since 4.0.0
35
  */
36
+ public $version = '5.2.1';
37
 
38
  /**
39
  * QSM Alert Manager Object
php/admin/options-page-contact-tab.php CHANGED
@@ -28,9 +28,9 @@ function qsm_options_contact_tab_content() {
28
 
29
  $contact_form = QSM_Contact_Manager::load_fields();
30
 
31
- wp_enqueue_script( 'qsm_contact_admin_script', plugins_url( '../../js/qsm-admin-contact.js' , __FILE__ ), array( 'jquery-ui-sortable' ) );
32
  wp_localize_script( 'qsm_contact_admin_script', 'qsmContactObject', array( 'contactForm' => $contact_form, 'quizID' => $quiz_id ) );
33
- wp_enqueue_style( 'qsm_contact_admin_style', plugins_url( '../../css/qsm-admin-contact.css' , __FILE__ ) );
34
 
35
  /**
36
  * Example contact form array
28
 
29
  $contact_form = QSM_Contact_Manager::load_fields();
30
 
31
+ wp_enqueue_script( 'qsm_contact_admin_script', plugins_url( '../../js/qsm-admin-contact.js' , __FILE__ ), array( 'jquery-ui-sortable' ), $mlwQuizMasterNext->version );
32
  wp_localize_script( 'qsm_contact_admin_script', 'qsmContactObject', array( 'contactForm' => $contact_form, 'quizID' => $quiz_id ) );
33
+ wp_enqueue_style( 'qsm_contact_admin_style', plugins_url( '../../css/qsm-admin-contact.css' , __FILE__ ), array(), $mlwQuizMasterNext->version );
34
 
35
  /**
36
  * Example contact form array
php/admin/options-page-questions-tab.php CHANGED
@@ -41,7 +41,7 @@ function qsm_options_questions_tab_content() {
41
  wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
42
  wp_enqueue_script( 'qsm_admin_question_js', plugins_url( '../../js/qsm-admin-question.js', __FILE__ ), array( 'backbone', 'underscore', 'jquery-ui-sortable', 'wp-util', 'micromodal_script' ), $mlwQuizMasterNext->version, true );
43
  wp_localize_script( 'qsm_admin_question_js', 'qsmQuestionSettings', $json_data );
44
- wp_enqueue_style( 'qsm_admin_question_css', plugins_url( '../../css/qsm-admin-question.css', __FILE__ ) );
45
  wp_enqueue_script( 'math_jax', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' );
46
  wp_enqueue_editor();
47
  wp_enqueue_media();
41
  wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
42
  wp_enqueue_script( 'qsm_admin_question_js', plugins_url( '../../js/qsm-admin-question.js', __FILE__ ), array( 'backbone', 'underscore', 'jquery-ui-sortable', 'wp-util', 'micromodal_script' ), $mlwQuizMasterNext->version, true );
43
  wp_localize_script( 'qsm_admin_question_js', 'qsmQuestionSettings', $json_data );
44
+ wp_enqueue_style( 'qsm_admin_question_css', plugins_url( '../../css/qsm-admin-question.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
45
  wp_enqueue_script( 'math_jax', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' );
46
  wp_enqueue_editor();
47
  wp_enqueue_media();
php/admin/quizzes-page.php CHANGED
@@ -24,7 +24,7 @@ function qsm_generate_quizzes_surveys_page() {
24
  global $mlwQuizMasterNext;
25
 
26
  // Enqueue our styles and scripts.
27
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ) );
28
  wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/qsm-admin.js', __FILE__ ), array( 'wp-util', 'underscore', 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-button' ), $mlwQuizMasterNext->version );
29
  wp_enqueue_style( 'qsm_jquery_redmond_theme', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css' );
30
 
24
  global $mlwQuizMasterNext;
25
 
26
  // Enqueue our styles and scripts.
27
+ wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
28
  wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/qsm-admin.js', __FILE__ ), array( 'wp-util', 'underscore', 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-button' ), $mlwQuizMasterNext->version );
29
  wp_enqueue_style( 'qsm_jquery_redmond_theme', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css' );
30
 
php/classes/class-qmn-quiz-creator.php CHANGED
@@ -276,7 +276,7 @@ class QMNQuizCreator
276
  array(
277
  'quiz_name' => $quiz_name,
278
  'message_before' => 'Welcome to your %QUIZ_NAME%',
279
- 'message_after' => '%QUESTIONS_ANSWERS%',
280
  'message_comment' => 'Please fill in the comment box below.',
281
  'message_end_template' => '',
282
  'user_email_template' => '%QUESTIONS_ANSWERS%',
276
  array(
277
  'quiz_name' => $quiz_name,
278
  'message_before' => 'Welcome to your %QUIZ_NAME%',
279
+ 'message_after' => 'Thanks for submitting your response! You can edit this message on the "Results Pages" tab. <br>%CONTACT_ALL% <br>%QUESTIONS_ANSWERS%',
280
  'message_comment' => 'Please fill in the comment box below.',
281
  'message_end_template' => '',
282
  'user_email_template' => '%QUESTIONS_ANSWERS%',
php/classes/class-qmn-quiz-manager.php CHANGED
@@ -87,8 +87,9 @@ class QMNQuizManager {
87
  }
88
 
89
  // Loads Quiz Template.
 
90
  if ( 'default' == $qmn_quiz_options->theme_selected ) {
91
- $return_display .= '<style type="text/css">' . $qmn_quiz_options->quiz_style . '</style>';
92
  wp_enqueue_style( 'qmn_quiz_style', plugins_url( '../../css/qmn_quiz.css', __FILE__ ) );
93
  } else {
94
  $registered_template = $mlwQuizMasterNext->pluginHelper->get_quiz_templates( $qmn_quiz_options->theme_selected );
@@ -101,7 +102,7 @@ class QMNQuizManager {
101
  } elseif ( $registered_template && file_exists( get_stylesheet_directory_uri() . '/templates/' . $registered_template['path'] ) ) {
102
  wp_enqueue_style( 'qmn_quiz_template', get_stylesheet_directory_uri() . '/templates/' . $registered_template['path'], array(), $mlwQuizMasterNext->version );
103
  } else {
104
- echo "<style type='text/css'>{$qmn_quiz_options->quiz_style}</style>";
105
  }
106
  }
107
 
87
  }
88
 
89
  // Loads Quiz Template.
90
+ // The quiz_stye is misspelled because it has always been misspelled and fixing it would break many sites :(.
91
  if ( 'default' == $qmn_quiz_options->theme_selected ) {
92
+ $return_display .= '<style type="text/css">' . $qmn_quiz_options->quiz_stye . '</style>';
93
  wp_enqueue_style( 'qmn_quiz_style', plugins_url( '../../css/qmn_quiz.css', __FILE__ ) );
94
  } else {
95
  $registered_template = $mlwQuizMasterNext->pluginHelper->get_quiz_templates( $qmn_quiz_options->theme_selected );
102
  } elseif ( $registered_template && file_exists( get_stylesheet_directory_uri() . '/templates/' . $registered_template['path'] ) ) {
103
  wp_enqueue_style( 'qmn_quiz_template', get_stylesheet_directory_uri() . '/templates/' . $registered_template['path'], array(), $mlwQuizMasterNext->version );
104
  } else {
105
+ echo "<style type='text/css'>{$qmn_quiz_options->quiz_stye}</style>";
106
  }
107
  }
108
 
php/classes/class-qmn-review-message.php CHANGED
@@ -59,8 +59,8 @@ class QMN_Review_Message {
59
  public function check_message_trigger() {
60
  $trigger = get_option( 'qmn_review_message_trigger' );
61
  if ( empty( $trigger ) || is_null( $trigger ) ) {
62
- add_option('qmn_review_message_trigger', 10 );
63
- return 10;
64
  }
65
  return intval( $trigger );
66
  }
@@ -112,7 +112,7 @@ class QMN_Review_Message {
112
  $update_trigger = -1;
113
  if ( $this->trigger === -1 ) {
114
  exit;
115
- } else if ( $this->trigger === 10 ) {
116
  $update_trigger = 100;
117
  } else if ( $this->trigger === 100 ) {
118
  $update_trigger = 1000;
59
  public function check_message_trigger() {
60
  $trigger = get_option( 'qmn_review_message_trigger' );
61
  if ( empty( $trigger ) || is_null( $trigger ) ) {
62
+ add_option('qmn_review_message_trigger', 20 );
63
+ return 20;
64
  }
65
  return intval( $trigger );
66
  }
112
  $update_trigger = -1;
113
  if ( $this->trigger === -1 ) {
114
  exit;
115
+ } else if ( $this->trigger === 20 ) {
116
  $update_trigger = 100;
117
  } else if ( $this->trigger === 100 ) {
118
  $update_trigger = 1000;
php/classes/class-qsm-questions.php CHANGED
@@ -251,7 +251,7 @@ class QSM_Questions {
251
 
252
  foreach ( $answers as $key => $answer ) {
253
  $answers[ $key ] = array(
254
- htmlspecialchars( stripslashes( $answer[0] ), ENT_QUOTES ),
255
  floatval( $answer[1] ),
256
  intval( $answer[2] ),
257
  );
@@ -259,11 +259,11 @@ class QSM_Questions {
259
 
260
  $values = array(
261
  'quiz_id' => intval( $data['quiz_id'] ),
262
- 'question_name' => trim( preg_replace( '/\s+/', ' ', htmlspecialchars( nl2br( wp_kses_post( stripslashes( $data['name'] ) ) ), ENT_QUOTES ) ) ),
263
  'answer_array' => serialize( $answers ),
264
- 'question_answer_info' => htmlspecialchars( stripslashes( $data['answer_info'] ), ENT_QUOTES ),
265
- 'comments' => htmlspecialchars( stripslashes( $data['comments'] ), ENT_QUOTES ),
266
- 'hints' => htmlspecialchars( stripslashes( $data['hint'] ), ENT_QUOTES ),
267
  'question_order' => intval( $data['order'] ),
268
  'question_type_new' => sanitize_text_field( $data['type'] ),
269
  'question_settings' => serialize( $settings ),
251
 
252
  foreach ( $answers as $key => $answer ) {
253
  $answers[ $key ] = array(
254
+ htmlspecialchars( $answer[0], ENT_QUOTES ),
255
  floatval( $answer[1] ),
256
  intval( $answer[2] ),
257
  );
259
 
260
  $values = array(
261
  'quiz_id' => intval( $data['quiz_id'] ),
262
+ 'question_name' => trim( preg_replace( '/\s+/', ' ', htmlspecialchars( nl2br( wp_kses_post( $data['name'] ) ), ENT_QUOTES ) ) ),
263
  'answer_array' => serialize( $answers ),
264
+ 'question_answer_info' => htmlspecialchars( $data['answer_info'], ENT_QUOTES ),
265
+ 'comments' => htmlspecialchars( $data['comments'], ENT_QUOTES ),
266
+ 'hints' => htmlspecialchars( $data['hint'], ENT_QUOTES ),
267
  'question_order' => intval( $data['order'] ),
268
  'question_type_new' => sanitize_text_field( $data['type'] ),
269
  'question_settings' => serialize( $settings ),
php/rest-api.php CHANGED
@@ -51,11 +51,11 @@ function qsm_rest_get_question( WP_REST_Request $request ) {
51
  'id' => $question['question_id'],
52
  'quizID' => $question['quiz_id'],
53
  'type' => $question['question_type_new'],
54
- 'name' => esc_js( $question['question_name'] ),
55
- 'answerInfo' => esc_js( $question['question_answer_info'] ),
56
  'comments' => $question['comments'],
57
- 'hint' => esc_js( $question['hints'] ),
58
- 'category' => esc_js( $question['category'] ),
59
  'required' => $question['settings']['required'],
60
  'answers' => $question['answers'],
61
  'page' => $question['page'],
@@ -96,11 +96,11 @@ function qsm_rest_get_questions( WP_REST_Request $request ) {
96
  'id' => $question['question_id'],
97
  'quizID' => $question['quiz_id'],
98
  'type' => $question['question_type_new'],
99
- 'name' => esc_js( $question['question_name'] ),
100
- 'answerInfo' => esc_js( $question['question_answer_info'] ),
101
  'comments' => $question['comments'],
102
- 'hint' => esc_js( $question['hints'] ),
103
- 'category' => esc_js( $question['category'] ),
104
  'required' => $question['settings']['required'],
105
  'answers' => $question['answers'],
106
  'page' => $question['page'],
51
  'id' => $question['question_id'],
52
  'quizID' => $question['quiz_id'],
53
  'type' => $question['question_type_new'],
54
+ 'name' => $question['question_name'],
55
+ 'answerInfo' => $question['question_answer_info'],
56
  'comments' => $question['comments'],
57
+ 'hint' => $question['hints'],
58
+ 'category' => $question['category'],
59
  'required' => $question['settings']['required'],
60
  'answers' => $question['answers'],
61
  'page' => $question['page'],
96
  'id' => $question['question_id'],
97
  'quizID' => $question['quiz_id'],
98
  'type' => $question['question_type_new'],
99
+ 'name' => $question['question_name'],
100
+ 'answerInfo' => $question['question_answer_info'],
101
  'comments' => $question['comments'],
102
+ 'hint' => $question['hints'],
103
+ 'category' => $question['category'],
104
  'required' => $question['settings']['required'],
105
  'answers' => $question['answers'],
106
  'page' => $question['page'],
php/template-variables.php CHANGED
@@ -195,22 +195,28 @@ function qsm_all_contact_fields_variable( $content, $results ) {
195
  return $content;
196
  }
197
 
198
- function mlw_qmn_variable_question_answers($content, $mlw_quiz_array)
199
- {
200
- while (strpos($content, '%QUESTIONS_ANSWERS%') !== false)
201
- {
 
 
 
 
 
 
202
  global $mlwQuizMasterNext;
203
  global $wpdb;
204
  $display = '';
205
  $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br>%USER_ANSWER%' );
206
- $qmn_questions_sql = $wpdb->get_results( $wpdb->prepare( "SELECT question_id, question_answer_info FROM " . $wpdb->prefix . "mlw_questions WHERE quiz_id=%d", $mlw_quiz_array['quiz_id'] ) );
207
  $qmn_questions = array();
208
- foreach($qmn_questions_sql as $question)
209
- {
210
- $qmn_questions[$question->question_id] = $question->question_answer_info;
211
  }
212
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
213
- {
 
214
  if ( $answer["correct"] === "correct" ){
215
  $user_answer_class = "qmn_user_correct_answer";
216
  $question_answer_class = "qmn_question_answer_correct";
@@ -230,6 +236,7 @@ function mlw_qmn_variable_question_answers($content, $mlw_quiz_array)
230
  }
231
  return $content;
232
  }
 
233
  function mlw_qmn_variable_comments($content, $mlw_quiz_array)
234
  {
235
  $content = str_replace( "%COMMENT_SECTION%" , $mlw_quiz_array["comments"], $content);
195
  return $content;
196
  }
197
 
198
+ /**
199
+ * Converts the %QUESTIONS_ANSWERS% into the template
200
+ *
201
+ * @param string $content The content to be checked for the template
202
+ * @param array $mlw_quiz_array The array for the response data
203
+ */
204
+ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
205
+
206
+ // Checks if the variable is present in the content.
207
+ while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false ) {
208
  global $mlwQuizMasterNext;
209
  global $wpdb;
210
  $display = '';
211
  $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br>%USER_ANSWER%' );
212
+ $questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
213
  $qmn_questions = array();
214
+ foreach ( $questions as $question ) {
215
+ $qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
 
216
  }
217
+
218
+ // Cycles through each answer in the responses.
219
+ foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
220
  if ( $answer["correct"] === "correct" ){
221
  $user_answer_class = "qmn_user_correct_answer";
222
  $question_answer_class = "qmn_question_answer_correct";
236
  }
237
  return $content;
238
  }
239
+
240
  function mlw_qmn_variable_comments($content, $mlw_quiz_array)
241
  {
242
  $content = str_replace( "%COMMENT_SECTION%" , $mlw_quiz_array["comments"], $content);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question
4
  Requires at least: 4.8
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
- Stable tag: 5.2.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -110,7 +110,12 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
110
 
111
  == Changelog ==
112
 
113
- = 5.2.0 (February 25, 2018) =
 
 
 
 
 
114
  * Closed Enhancement: Make Quiz Results Extendable/Filterable - ([Issue #622](https://github.com/fpcorso/quiz_master_next/issues/622))
115
  * Closed Enhancement: New Question Editor - ([Issue #568](https://github.com/fpcorso/quiz_master_next/issues/568))
116
  * Closed Bug: Pagination Bug - ([Issue #477](https://github.com/fpcorso/quiz_master_next/issues/477))
4
  Requires at least: 4.8
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
+ Stable tag: 5.2.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
110
 
111
  == Changelog ==
112
 
113
+ = 5.2.1 (March 5, 2018) =
114
+ * Fixes broken "Custom" styles
115
+ * Fixes minor bugs in new question editor
116
+ * Makes minor style adjustments
117
+
118
+ = 5.2.0 (March 3, 2018) =
119
  * Closed Enhancement: Make Quiz Results Extendable/Filterable - ([Issue #622](https://github.com/fpcorso/quiz_master_next/issues/622))
120
  * Closed Enhancement: New Question Editor - ([Issue #568](https://github.com/fpcorso/quiz_master_next/issues/568))
121
  * Closed Bug: Pagination Bug - ([Issue #477](https://github.com/fpcorso/quiz_master_next/issues/477))