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

Version Description

This update fixes minor bugs.

Download this release

Release Info

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

Code changes from version 1.0 to 1.0.1

includes/mlw_leaderboard.php CHANGED
@@ -1,66 +1,75 @@
1
- <?php
2
- /*
3
- This function creates the leaderboard from the shortcode.
4
- */
5
- function mlw_quiz_leaderboard_shortcode($atts)
6
- {
7
- extract(shortcode_atts(array(
8
- 'mlw_quiz' => 0
9
- ), $atts));
10
- $mlw_quiz_id = $mlw_quiz;
11
- $mlw_quiz_leaderboard_display = "";
12
-
13
-
14
- global $wpdb;
15
- $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
16
- $mlw_quiz_options = $wpdb->get_results($sql);
17
- foreach($mlw_quiz_options as $mlw_eaches) {
18
- $mlw_quiz_options = $mlw_eaches;
19
- break;
20
- }
21
- $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' LIMIT 10";
22
- $mlw_result_data = $wpdb->get_results($sql);
23
-
24
- $mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
25
- $mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_quiz_leaderboard_display);
26
-
27
- $leader_count = 0;
28
- foreach($mlw_result_data as $mlw_eaches) {
29
- $leader_count++;
30
- if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
31
- if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
32
- if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
33
- if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
34
- if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
35
- if ($mlw_quiz_options->system == 0)
36
- {
37
- if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
38
- if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
39
- if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
40
- if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
41
- if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
42
- }
43
- if ($mlw_quiz_options->system == 1)
44
- {
45
- if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
46
- if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
47
- if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
48
- if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
49
- if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
50
- }
51
- }
52
- $mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , " ", $mlw_quiz_leaderboard_display);
53
- $mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
54
- $mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
55
- $mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
56
- $mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
57
- $mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
58
- $mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
59
- $mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
60
- $mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
61
- $mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
62
- $mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
63
-
64
- return $mlw_quiz_leaderboard_display;
65
- }
 
 
 
 
 
 
 
 
 
66
  ?>
1
+ <?php
2
+ /*
3
+ This function creates the leaderboard from the shortcode.
4
+ */
5
+ function mlw_quiz_leaderboard_shortcode($atts)
6
+ {
7
+ extract(shortcode_atts(array(
8
+ 'mlw_quiz' => 0
9
+ ), $atts));
10
+ $mlw_quiz_id = $mlw_quiz;
11
+ $mlw_quiz_leaderboard_display = "";
12
+
13
+
14
+ global $wpdb;
15
+ $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
16
+ $mlw_quiz_options = $wpdb->get_results($sql);
17
+ foreach($mlw_quiz_options as $mlw_eaches) {
18
+ $mlw_quiz_options = $mlw_eaches;
19
+ break;
20
+ }
21
+ $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
22
+ if ($mlw_quiz_options->system == 0)
23
+ {
24
+ $sql .= " ORDER BY correct_score DESC";
25
+ }
26
+ if ($mlw_quiz_options->system == 1)
27
+ {
28
+ $sql .= " ORDER BY point_score DESC";
29
+ }
30
+ $sql .= " LIMIT 10";
31
+ $mlw_result_data = $wpdb->get_results($sql);
32
+
33
+ $mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
34
+ $mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_quiz_leaderboard_display);
35
+
36
+ $leader_count = 0;
37
+ foreach($mlw_result_data as $mlw_eaches) {
38
+ $leader_count++;
39
+ if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
40
+ if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
41
+ if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
42
+ if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
43
+ if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , $mlw_eaches->name, $mlw_quiz_leaderboard_display);}
44
+ if ($mlw_quiz_options->system == 0)
45
+ {
46
+ if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
47
+ if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
48
+ if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
49
+ if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
50
+ if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->correct_score."%", $mlw_quiz_leaderboard_display);}
51
+ }
52
+ if ($mlw_quiz_options->system == 1)
53
+ {
54
+ if ($leader_count == 1) {$mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
55
+ if ($leader_count == 2) {$mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
56
+ if ($leader_count == 3) {$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
57
+ if ($leader_count == 4) {$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
58
+ if ($leader_count == 5) {$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , $mlw_eaches->point_score." Points", $mlw_quiz_leaderboard_display);}
59
+ }
60
+ }
61
+ $mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , " ", $mlw_quiz_leaderboard_display);
62
+ $mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
63
+ $mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
64
+ $mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
65
+ $mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
66
+ $mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_NAME%" , " ", $mlw_quiz_leaderboard_display);
67
+ $mlw_quiz_leaderboard_display = str_replace( "%FIRST_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
68
+ $mlw_quiz_leaderboard_display = str_replace( "%SECOND_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
69
+ $mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
70
+ $mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
71
+ $mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
72
+
73
+ return $mlw_quiz_leaderboard_display;
74
+ }
75
  ?>
includes/mlw_qmn_widgets.php CHANGED
@@ -65,7 +65,16 @@ class Mlw_Qmn_Leaderboard_Widget extends WP_Widget {
65
  $mlw_quiz_options = $mlw_eaches;
66
  break;
67
  }
68
- $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' LIMIT 10";
 
 
 
 
 
 
 
 
 
69
  $mlw_result_data = $wpdb->get_results($sql);
70
 
71
  $mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
65
  $mlw_quiz_options = $mlw_eaches;
66
  break;
67
  }
68
+ $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
69
+ if ($mlw_quiz_options->system == 0)
70
+ {
71
+ $sql .= " ORDER BY correct_score DESC";
72
+ }
73
+ if ($mlw_quiz_options->system == 1)
74
+ {
75
+ $sql .= " ORDER BY point_score DESC";
76
+ }
77
+ $sql .= " LIMIT 10";
78
  $mlw_result_data = $wpdb->get_results($sql);
79
 
80
  $mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
includes/mlw_quiz.php CHANGED
@@ -450,9 +450,7 @@ function mlw_quiz_shortcode($atts)
450
  $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $_POST["mlwQuizComments"], $mlw_message_after);
451
  $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
452
  $mlw_display .= $mlw_message_after;
453
-
454
-
455
-
456
  //Prepare and send the user email
457
  $mlw_message = "";
458
  if ($mlw_quiz_options->send_user_email == "0")
@@ -502,6 +500,7 @@ function mlw_quiz_shortcode($atts)
502
  //Save the results into database
503
  $mlw_quiz_results = $mlw_question_answers."\n".$_POST["mlwQuizComments"];
504
  $mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
 
505
  global $wpdb;
506
  $table_name = $wpdb->prefix . "mlw_results";
507
  $insert = "INSERT INTO " . $table_name .
450
  $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $_POST["mlwQuizComments"], $mlw_message_after);
451
  $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
452
  $mlw_display .= $mlw_message_after;
453
+
 
 
454
  //Prepare and send the user email
455
  $mlw_message = "";
456
  if ($mlw_quiz_options->send_user_email == "0")
500
  //Save the results into database
501
  $mlw_quiz_results = $mlw_question_answers."\n".$_POST["mlwQuizComments"];
502
  $mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
503
+ $mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
504
  global $wpdb;
505
  $table_name = $wpdb->prefix . "mlw_results";
506
  $insert = "INSERT INTO " . $table_name .
includes/mlw_quiz_options.php CHANGED
@@ -12,6 +12,7 @@ function mlw_generate_quiz_options()
12
  global $wpdb;
13
  $table_name = $wpdb->prefix . "mlw_questions";
14
  $is_new_quiz = 0;
 
15
 
16
  /*
17
  Code for quiz questions tab
@@ -608,7 +609,7 @@ function mlw_generate_quiz_options()
608
  <li><a href="#tabs-1">Quiz Questions</a></li>
609
  <li><a href="#tabs-2">Quiz Text</a></li>
610
  <li><a href="#tabs-3">Quiz Options</a></li>
611
- <li><a href="#tabs-4">Quiz Leaderboard</a></li>
612
  <li><a href="#tabs-5">Quiz Tools</a></li>
613
  </ul>
614
  <div id="tabs-1">
12
  global $wpdb;
13
  $table_name = $wpdb->prefix . "mlw_questions";
14
  $is_new_quiz = 0;
15
+ $mlw_qmn_hasEditedSocial = false;
16
 
17
  /*
18
  Code for quiz questions tab
609
  <li><a href="#tabs-1">Quiz Questions</a></li>
610
  <li><a href="#tabs-2">Quiz Text</a></li>
611
  <li><a href="#tabs-3">Quiz Options</a></li>
612
+ <li><a href="#tabs-4">Quiz Leaderboard</a></li>
613
  <li><a href="#tabs-5">Quiz Tools</a></li>
614
  </ul>
615
  <div id="tabs-1">
includes/mlw_update.php CHANGED
@@ -6,7 +6,7 @@ function mlw_quiz_update()
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
- $data = "1.0";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
@@ -80,7 +80,6 @@ function mlw_quiz_update()
80
  $results = $wpdb->query( $update_sql );
81
  }
82
 
83
-
84
  global $wpdb;
85
  $table_name = $wpdb->prefix . "mlw_questions";
86
  //Update 0.5
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
+ $data = "1.0.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
80
  $results = $wpdb->query( $update_sql );
81
  }
82
 
 
83
  global $wpdb;
84
  $table_name = $wpdb->prefix . "mlw_questions";
85
  //Update 0.5
mlw_quizmaster2.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
- Version: 1.0
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 1.0.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: fpcorso
3
  Tags: quiz, test, score, survey, contact
4
  Requires at least: 3.0.1
5
  Tested up to: 3.8.1
6
- Stable tag: 1.0
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
9
  Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
@@ -64,6 +64,10 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
64
 
65
  == Changelog ==
66
 
 
 
 
 
67
  = 1.0 (February 1, 2014) =
68
  * Added Ability To Customize From Name For User And Admin Emails
69
  * Changed Question Editor
@@ -236,6 +240,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
236
 
237
  == Upgrade Notice ==
238
 
 
 
 
239
  = 1.0 =
240
  This update finally brings this plugin out of beta! This update brings the ability to edit the From Name part of the email sent to users and admin. Minor bug fixes.
241
 
3
  Tags: quiz, test, score, survey, contact
4
  Requires at least: 3.0.1
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.0.1
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
9
  Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
64
 
65
  == Changelog ==
66
 
67
+ = 1.0.1 (February 4, 2014) =
68
+ * Fixed Saving Results Bug
69
+ * Fixed Leaderboard Bug
70
+
71
  = 1.0 (February 1, 2014) =
72
  * Added Ability To Customize From Name For User And Admin Emails
73
  * Changed Question Editor
240
 
241
  == Upgrade Notice ==
242
 
243
+ = 1.0.1 =
244
+ This update fixes minor bugs.
245
+
246
  = 1.0 =
247
  This update finally brings this plugin out of beta! This update brings the ability to edit the From Name part of the email sent to users and admin. Minor bug fixes.
248