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

Version Description

Upgrade for new Captcha question types!

Download this release

Release Info

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

Code changes from version 3.1.1 to 3.2.1

includes/mlw_newCaptcha.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $string = '';
3
+ for ($i = 0; $i < 5; $i++) {
4
+ $string .= chr(rand(97, 122));
5
+ }
6
+
7
+ $_SESSION['captcha'] = $string; //store the captcha
8
+
9
+ $image = imagecreatetruecolor(165, 50); //custom image size
10
+ $color = imagecolorallocate($image, 113, 193, 217); // custom color
11
+ $white = imagecolorallocate($image, 255, 255, 255); // custom background color
12
+ imagefilledrectangle($image,0,0,399,99,$white);
13
+ imagettftext ($image, 30, 0, 10, 40, $color, '', $_SESSION['captcha']);
14
+
15
+ header("Content-type: image/png");
16
+ imagepng($image);
17
+
18
+ ?>
includes/mlw_qmn_credits.php CHANGED
@@ -89,35 +89,25 @@ function mlw_generate_about_page()
89
  <div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
90
  <h2 class="nav-tab-wrapper">
91
  <a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
92
- What&#8217;s New In 3.1</a>
93
  <a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
94
  Changelog For <?php echo $mlw_quiz_version; ?> </a>
95
  <a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
96
  Requested Features</a>
97
  </h2>
98
  <div id="mlw_quiz_what_new">
99
- <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Duplicate Individual Questions</h2>
100
- <p style="text-align: center;">You now have the ability to duplicate a question on a quiz. If most of your questions will be similar, you can use the duplicate option on the Quiz Questions tab to make copies of an individual question.</p>
101
- <br />
102
  <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Question Type</h2>
103
- <p style="text-align: center;">You can now use the number input for when you require a numeric answer. This input has a small spinner attached.</p>
104
- <br />
105
- <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Non-Question Type</h2>
106
- <p style="text-align: center;">Several people have asked for a way to have a checkbox for terms and conditions or similar. The new Accept question type will allow you to place a checkbox with some text into your quiz.</p>
107
- <br />
108
- <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">First Stage Of Mandatory Questions</h2>
109
- <p style="text-align: center;">Many people have been asking for the ability to make questions mandatory. This version brings the initial system for requiring questions to be answered. In this version only Number, Accept, and Open Answer types are supported.</p>
110
  <br />
111
  <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Our Premium Add-Ons!</h2>
112
- <p style="text-align: center;">We have several new premium add-ons in our WordPress Store: MailChimp Integration (subscribes users to your Mailchimp list), Export Results (exports your quiz results), Extra Shortcodes (gives you extra shortcodes to use), User Dashboard (allow users to see the results from all the quizzes they have taken), and Advertisement Be Gone (gets rid of blue-border ads). Visit our <a href="http://mylocalwebstop.com/shop/">WordPress Store</a> for details! </p>
113
  </div>
114
  <div id="mlw_quiz_changelog" style="display: none;">
115
- <h3><?php echo $mlw_quiz_version; ?> (September 15, 2014)</h3>
116
  <ul>
117
- <li>* Added Ability To Duplicate Individual Questions</li>
118
- <li>* Added Ability To Require Accept, Number, And Open Answer Question Types</li>
119
- <li>* Added Number Question Type</li>
120
- <li>* Added Accept Non-Question Type</li>
121
  </ul>
122
  </div>
123
  <div id="mlw_quiz_requested" style="display: none;">
@@ -144,6 +134,9 @@ function mlw_generate_about_page()
144
  <li>Results Bar Graph For Users Taking Polls</li>
145
  <li>Head To Head Comparison Questions</li>
146
  <li>Enhanced Leaderboard</li>
 
 
 
147
  </ul>
148
  </div>
149
  </div>
89
  <div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
90
  <h2 class="nav-tab-wrapper">
91
  <a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
92
+ What&#8217;s New In 3.2</a>
93
  <a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
94
  Changelog For <?php echo $mlw_quiz_version; ?> </a>
95
  <a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
96
  Requested Features</a>
97
  </h2>
98
  <div id="mlw_quiz_what_new">
 
 
 
99
  <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Question Type</h2>
100
+ <p style="text-align: center;">You can now use the captcha question type to help fight spam!</p>
 
 
 
 
 
 
101
  <br />
102
  <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Our Premium Add-Ons!</h2>
103
+ <p style="text-align: center;">We have several new premium add-ons in our WordPress Store: MailPoet Integration (subscribes users to your MailPoet list), MailChimp Integration (subscribes users to your Mailchimp list), Export Results (exports your quiz results), Extra Shortcodes (gives you extra shortcodes to use), User Dashboard (allow users to see the results from all the quizzes they have taken), and Advertisement Be Gone (gets rid of blue-border ads). Visit our <a href="http://mylocalwebstop.com/shop/">WordPress Store</a> for details! </p>
104
  </div>
105
  <div id="mlw_quiz_changelog" style="display: none;">
106
+ <h3><?php echo $mlw_quiz_version; ?> (October 2, 2014)</h3>
107
  <ul>
108
+ <li>* Added New Captcha Question Type</li>
109
+ <li>* Fixed Number Question Type Validation Bug</li>
110
+ <li>* Fixed Validation Wrong Border Bug</li>
 
111
  </ul>
112
  </div>
113
  <div id="mlw_quiz_requested" style="display: none;">
134
  <li>Results Bar Graph For Users Taking Polls</li>
135
  <li>Head To Head Comparison Questions</li>
136
  <li>Enhanced Leaderboard</li>
137
+ <li>Different Social Media Sharing Text For Different Social Media</li>
138
+ <li>Ability To Highlight Incorrect Answers</li>
139
+ <li>Delete Multiple Results</li>
140
  </ul>
141
  </div>
142
  </div>
includes/mlw_quiz.php CHANGED
@@ -427,20 +427,32 @@ function mlw_quiz_shortcode($atts)
427
  }
428
 
429
  jQuery('#quizForm *').filter(':input').each(function(){
 
430
  if (jQuery(this).attr('class'))
431
  {
432
- console.log('inside first if');
 
 
 
 
 
 
433
  if(jQuery(this).attr('class').indexOf('mlwRequiredText') > -1 && this.value == "")
434
  {
435
- console.log('inside text if');
436
  document.getElementById('mlw_error_message').innerHTML = '**Please complete all required fields!**';
437
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Please complete all required fields!**';
438
  jQuery(this).css("outline", "2px solid red");
439
  mlw_validateResult = false;
440
  }
 
 
 
 
 
 
 
441
  if(jQuery(this).attr('class').indexOf('mlwRequiredCheck') > -1 && !this.checked)
442
  {
443
- console.log('inside check if');
444
  document.getElementById('mlw_error_message').innerHTML = '**Please complete all required fields!**';
445
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Please complete all required fields!**';
446
  jQuery(this).css("outline", "2px solid red");
@@ -464,7 +476,7 @@ function mlw_quiz_shortcode($atts)
464
 
465
  //Begin the quiz
466
  $mlw_display .= "<div class='mlw_qmn_quiz'>";
467
- $mlw_display .= "<form name='quizForm' id='quizForm' action='' method='post' class='mlw_quiz_form' onsubmit='return mlw_validateForm()' >";
468
  $mlw_display .= "<span id='mlw_top_of_quiz'></span>";
469
  $mlw_display .= "<div class='quiz_section quiz_begin slide".$mlw_qmn_section_count."'>";
470
  $mlw_message_before = htmlspecialchars_decode($mlw_quiz_options->message_before, ENT_QUOTES);
@@ -706,7 +718,7 @@ function mlw_quiz_shortcode($atts)
706
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
707
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
708
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
709
- if ($mlw_question_settings['required'] == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
710
  $mlw_display .= "<input type='number' class='mlw_answer_number $mlw_requireClass' name='question".$mlw_question->question_id."' />";
711
  $mlw_display .= "<br />";
712
  }
@@ -717,6 +729,35 @@ function mlw_quiz_shortcode($atts)
717
  $mlw_display .= "<label for='mlwAcceptance'><span class='mlw_qmn_question' style='font-weight:bold;'>".htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span></label>";
718
  $mlw_display .= "<br />";
719
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720
  else
721
  {
722
  $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
@@ -799,7 +840,7 @@ function mlw_quiz_shortcode($atts)
799
  window.sessionStorage.setItem('mlw_started_quiz<?php echo $mlw_quiz_id; ?>', "no");
800
  </script>
801
  <?php
802
- if (empty($mlw_spam_email) && $mlw_qmn_isAllowed)
803
  {
804
 
805
  //Load questions
@@ -1403,6 +1444,10 @@ EOC;
1403
  $mlw_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message);
1404
  $mlw_display .= $mlw_message;
1405
  }
 
 
 
 
1406
  else { $mlw_display .= "Thank you."; }
1407
  }
1408
  }
427
  }
428
 
429
  jQuery('#quizForm *').filter(':input').each(function(){
430
+ jQuery(this).css("outline", "");
431
  if (jQuery(this).attr('class'))
432
  {
433
+ if(jQuery(this).attr('class').indexOf('mlwRequiredNumber') > -1 && this.value == "" && +this.value != NaN)
434
+ {
435
+ document.getElementById('mlw_error_message').innerHTML = '**This field must be a number!**';
436
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**This field must be a number!**';
437
+ jQuery(this).css("outline", "2px solid red");
438
+ mlw_validateResult = false;
439
+ }
440
  if(jQuery(this).attr('class').indexOf('mlwRequiredText') > -1 && this.value == "")
441
  {
 
442
  document.getElementById('mlw_error_message').innerHTML = '**Please complete all required fields!**';
443
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Please complete all required fields!**';
444
  jQuery(this).css("outline", "2px solid red");
445
  mlw_validateResult = false;
446
  }
447
+ if(jQuery(this).attr('class').indexOf('mlwRequiredCaptcha') > -1 && this.value != mlw_code)
448
+ {
449
+ document.getElementById('mlw_error_message').innerHTML = '**The entered text is not correct!**';
450
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**The entered text is not correct!**';
451
+ jQuery(this).css("outline", "2px solid red");
452
+ mlw_validateResult = false;
453
+ }
454
  if(jQuery(this).attr('class').indexOf('mlwRequiredCheck') > -1 && !this.checked)
455
  {
 
456
  document.getElementById('mlw_error_message').innerHTML = '**Please complete all required fields!**';
457
  document.getElementById('mlw_error_message_bottom').innerHTML = '**Please complete all required fields!**';
458
  jQuery(this).css("outline", "2px solid red");
476
 
477
  //Begin the quiz
478
  $mlw_display .= "<div class='mlw_qmn_quiz'>";
479
+ $mlw_display .= "<form name='quizForm' id='quizForm' action='' method='post' class='mlw_quiz_form' onsubmit='return mlw_validateForm()' novalidate >";
480
  $mlw_display .= "<span id='mlw_top_of_quiz'></span>";
481
  $mlw_display .= "<div class='quiz_section quiz_begin slide".$mlw_qmn_section_count."'>";
482
  $mlw_message_before = htmlspecialchars_decode($mlw_quiz_options->message_before, ENT_QUOTES);
718
  $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
719
  if ($mlw_quiz_options->question_numbering == 1) { $mlw_display .= $mlw_qmn_total_questions.") "; }
720
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
721
+ if ($mlw_question_settings['required'] == 0) {$mlw_requireClass = "mlwRequiredNumber";} else {$mlw_requireClass = "";}
722
  $mlw_display .= "<input type='number' class='mlw_answer_number $mlw_requireClass' name='question".$mlw_question->question_id."' />";
723
  $mlw_display .= "<br />";
724
  }
729
  $mlw_display .= "<label for='mlwAcceptance'><span class='mlw_qmn_question' style='font-weight:bold;'>".htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span></label>";
730
  $mlw_display .= "<br />";
731
  }
732
+ elseif ($mlw_question->question_type == 9)
733
+ {
734
+ if ($mlw_question_settings['required'] == 0) {$mlw_requireClass = "mlwRequiredCaptcha";} else {$mlw_requireClass = "";}
735
+ $mlw_display .= "<div class='mlw_captchaWrap'>";
736
+ $mlw_display .= "<canvas alt='' id='mlw_captcha' class='mlw_captcha' width='100' height='50'></canvas>";
737
+ $mlw_display .= "</div>";
738
+ $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
739
+ $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
740
+ $mlw_display .= "<input type='text' class='mlw_answer_open_text $mlw_requireClass' id='mlw_captcha_text' name='mlw_user_captcha'/>";
741
+ $mlw_display .= "<input type='hidden' name='mlw_code_captcha' id='mlw_code_captcha' value='none' />";
742
+ $mlw_display .= "<br />";
743
+ $mlw_display .= "<script>
744
+ var mlw_code = '';
745
+ var mlw_chars = '0123456789ABCDEFGHIJKL!@#$%^&*()MNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
746
+ var mlw_code_length = 5;
747
+ for (var i=0; i<mlw_code_length; i++) {
748
+ var rnum = Math.floor(Math.random() * mlw_chars.length);
749
+ mlw_code += mlw_chars.substring(rnum,rnum+1);
750
+ }
751
+ var mlw_captchaCTX = document.getElementById('mlw_captcha').getContext('2d');
752
+ mlw_captchaCTX.font = 'normal 24px Verdana';
753
+ mlw_captchaCTX.strokeStyle = '#000000';
754
+ mlw_captchaCTX.clearRect(0,0,100,50);
755
+ mlw_captchaCTX.strokeText(mlw_code,10,30,70);
756
+ mlw_captchaCTX.textBaseline = 'middle';
757
+ document.getElementById('mlw_code_captcha').value = mlw_code;
758
+ </script>
759
+ ";
760
+ }
761
  else
762
  {
763
  $mlw_display .= "<span class='mlw_qmn_question' style='font-weight:bold;'>";
840
  window.sessionStorage.setItem('mlw_started_quiz<?php echo $mlw_quiz_id; ?>', "no");
841
  </script>
842
  <?php
843
+ if (empty($mlw_spam_email) && $mlw_qmn_isAllowed && ((!isset($_POST["mlw_code_captcha"])) || isset($_POST["mlw_code_captcha"]) && $_POST["mlw_user_captcha"] == $_POST["mlw_code_captcha"]))
844
  {
845
 
846
  //Load questions
1444
  $mlw_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message);
1445
  $mlw_display .= $mlw_message;
1446
  }
1447
+ elseif (isset($_POST["mlw_code_captcha"]) && $_POST["mlw_user_captcha"] != $_POST["mlw_code_captcha"])
1448
+ {
1449
+ $mlw_display .= "There was an issue with the captcha verification. Please try again.";
1450
+ }
1451
  else { $mlw_display .= "Thank you."; }
1452
  }
1453
  }
includes/mlw_quiz_options.php CHANGED
@@ -1257,6 +1257,9 @@ function mlw_generate_quiz_options()
1257
  case 8:
1258
  $mlw_question_type_text = "Accept";
1259
  break;
 
 
 
1260
  default:
1261
  $mlw_question_type_text = "Error Code ";
1262
  }
@@ -1355,6 +1358,7 @@ function mlw_generate_quiz_options()
1355
  <option value="6" <?php if ($mlw_question_info->question_type == 6) { echo 'selected="selected"'; } ?>>Text Block</option>
1356
  <option value="7" <?php if ($mlw_question_info->question_type == 7) { echo 'selected="selected"'; } ?>>Number</option>
1357
  <option value="8" <?php if ($mlw_question_info->question_type == 8) { echo 'selected="selected"'; } ?>>Accept</option>
 
1358
  </select>
1359
  </div></td>
1360
  </tr>
@@ -1509,6 +1513,7 @@ function mlw_generate_quiz_options()
1509
  <option value="6">Text Block</option>
1510
  <option value="7">Number</option>
1511
  <option value="8">Accept</option>
 
1512
  </select>
1513
  </div></td>
1514
  </tr>
1257
  case 8:
1258
  $mlw_question_type_text = "Accept";
1259
  break;
1260
+ case 9:
1261
+ $mlw_question_type_text = "Captcha";
1262
+ break;
1263
  default:
1264
  $mlw_question_type_text = "Error Code ";
1265
  }
1358
  <option value="6" <?php if ($mlw_question_info->question_type == 6) { echo 'selected="selected"'; } ?>>Text Block</option>
1359
  <option value="7" <?php if ($mlw_question_info->question_type == 7) { echo 'selected="selected"'; } ?>>Number</option>
1360
  <option value="8" <?php if ($mlw_question_info->question_type == 8) { echo 'selected="selected"'; } ?>>Accept</option>
1361
+ <option value="9" <?php if ($mlw_question_info->question_type == 9) { echo 'selected="selected"'; } ?>>Captcha</option>
1362
  </select>
1363
  </div></td>
1364
  </tr>
1513
  <option value="6">Text Block</option>
1514
  <option value="7">Number</option>
1515
  <option value="8">Accept</option>
1516
+ <option value="9">Captcha</option>
1517
  </select>
1518
  </div></td>
1519
  </tr>
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 = "3.1.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
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 = "3.2.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
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: 3.1.1
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: 3.2.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: quiz, test, score, exam, survey, contact, form, email, answer, question
5
  Requires at least: 3.8.1
6
  Tested up to: 4.0
7
- Stable tag: 3.1.1
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  The easiest and most flexible way to add multiple quizzes, tests, and surveys to your website.
@@ -104,6 +104,11 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
107
  = 3.1.1 (September 15, 2014) =
108
  * Added Ability To Duplicate Individual Questions
109
  * Added Ability To Require Accept, Number, And Open Answer Question Types
@@ -499,6 +504,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
499
 
500
  == Upgrade Notice ==
501
 
 
 
 
502
  = 3.1.1 =
503
  Upgrade for new Accept and Number question types. Also, now you have the ability to duplicate individual questions!
504
 
4
  Tags: quiz, test, score, exam, survey, contact, form, email, answer, question
5
  Requires at least: 3.8.1
6
  Tested up to: 4.0
7
+ Stable tag: 3.2.1
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  The easiest and most flexible way to add multiple quizzes, tests, and surveys to your website.
104
 
105
  == Changelog ==
106
 
107
+ = 3.2.1 (October 2, 2014) =
108
+ * Added New Captcha Question Type
109
+ * Fixed Number Question Type Validation Bug
110
+ * Fixed Validation Wrong Border Bug
111
+
112
  = 3.1.1 (September 15, 2014) =
113
  * Added Ability To Duplicate Individual Questions
114
  * Added Ability To Require Accept, Number, And Open Answer Question Types
504
 
505
  == Upgrade Notice ==
506
 
507
+ = 3.2.1 =
508
+ Upgrade for new Captcha question types!
509
+
510
  = 3.1.1 =
511
  Upgrade for new Accept and Number question types. Also, now you have the ability to duplicate individual questions!
512