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

Version Description

Upgrade for many new features including unlimited answers, random answers, new question type, and more!

Download this release

Release Info

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

Code changes from version 2.4.1 to 2.5.1

assets/screenshot-2.png CHANGED
Binary file
assets/screenshot-3.png CHANGED
Binary file
includes/mlw_qmn_credits.php CHANGED
@@ -87,26 +87,32 @@ function mlw_generate_about_page()
87
  <a href="#" class="nav-tab nav-tab-active">
88
  What&#8217;s New In <?php echo $mlw_quiz_version; ?> </a>
89
  </h2>
90
- <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Now you can have send different emails based on score!</h2>
91
- <p>This new version adds the ability to send the user different emails based on the score earned. Simply go to the new Quiz Emails tab and fill in your default email. Click the Add New Email button to add a different email template.</p>
92
  <br />
93
- <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Premium Add-Ons!</h2>
 
 
 
 
 
 
94
  <p>We have recently added 3 new premium add-ons into our plugin store! Export Results (exports your quiz results), Extra Shortcodes (gives you extra shortcodes to use), and Advertisement Be Gone (gets rid of blue-border ads). Visit our <a href="http://mylocalwebstop.com/shop/">Plugin Add-On Store</a> for details! </p>
95
  <br />
96
  <h3>Changelog For <?php echo $mlw_quiz_version; ?></h3>
97
  <ul>
98
- <li>Added Ability To Send Different Emails To Users Based On Score</li>
99
- <li>Added New Quiz Emails Tab</li>
100
- <li>Fixed Required Question Bug</li>
101
- <li>Fixed Landing Page Bug</li>
 
 
102
  </ul>
103
  <h3>What's Coming Soon</h3>
104
  <ul>
105
  <li>Importing Questions</li>
 
106
  <li>Stats For Each Quiz</li>
107
- <li>Multiple Right Answers (Checkboxes)</li>
108
- <li>Unlimited Amount Of Answers</li>
109
- <li>Randomized Answers</li>
110
  <li>Force Login/Register Option</li>
111
  </ul>
112
 
87
  <a href="#" class="nav-tab nav-tab-active">
88
  What&#8217;s New In <?php echo $mlw_quiz_version; ?> </a>
89
  </h2>
90
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Now you can use the rebuilt answers system!</h2>
91
+ <p>In this new version, I completely rebuilt the system that handles the answers. This new system allows for unlimited answers! When adding or editing a question, you will see the new Add Answer button that will add a new answer to your list of answers.</p>
92
  <br />
93
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Question Type - Multiple Response (Checkboxes)</h2>
94
+ <p>The new answer systems allows for the new question type - multiple response. This is a feature that has been asked for several times and I am excited to finally have it built! When adding or editing a question, you will see the new question type.</p>
95
+ <br />
96
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Random Answers At Last</h2>
97
+ <p>The new answer systems also allows for the answers to be randomized as well! Simply navigate to the Quiz Options tab and the option "Are the questions random?" to the new "Random Questions And Answers" choice.</p>
98
+ <br />
99
+ <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>
100
  <p>We have recently added 3 new premium add-ons into our plugin store! Export Results (exports your quiz results), Extra Shortcodes (gives you extra shortcodes to use), and Advertisement Be Gone (gets rid of blue-border ads). Visit our <a href="http://mylocalwebstop.com/shop/">Plugin Add-On Store</a> for details! </p>
101
  <br />
102
  <h3>Changelog For <?php echo $mlw_quiz_version; ?></h3>
103
  <ul>
104
+ <li>Rebuilt Answer System</li>
105
+ <li>Added Ability To Have Unlimited Answers</li>
106
+ <li>Added Ability To Randomize Answers</li>
107
+ <li>Added New Question Type - Multiple Response (Checkboxes)</li>
108
+ <li>Added Ability To Send Admin Email To Multiple Users</li>
109
+ <li>Minor Design Changes To Quiz Options Page</li>
110
  </ul>
111
  <h3>What's Coming Soon</h3>
112
  <ul>
113
  <li>Importing Questions</li>
114
+ <li>Ability To Choose How Many Questions Shown Per Page</li>
115
  <li>Stats For Each Quiz</li>
 
 
 
116
  <li>Force Login/Register Option</li>
117
  </ul>
118
 
includes/mlw_quiz.php CHANGED
@@ -47,7 +47,7 @@ function mlw_quiz_shortcode($atts)
47
  {
48
  $sql .= "ORDER BY question_order ASC";
49
  }
50
- if ($mlw_quiz_options->randomness_order == 1)
51
  {
52
  $sql .= "ORDER BY rand()";
53
  }
@@ -56,6 +56,29 @@ function mlw_quiz_shortcode($atts)
56
  $sql .= " LIMIT ".$mlw_quiz_options->question_from_total;
57
  }
58
  $mlw_questions = $wpdb->get_results($sql);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
 
61
  //Variables to load if quiz has been taken
@@ -161,7 +184,7 @@ function mlw_quiz_shortcode($atts)
161
  }
162
  y = window.mlw_quiz_slide-1;
163
  jQuery( ".quiz_section.slide"+y ).hide();
164
- jQuery( ".quiz_section.slide"+window.mlw_quiz_slide ).show( "slide", {direction: "right"}, 300 );
165
 
166
  }
167
  function prevSlide()
@@ -178,7 +201,7 @@ function mlw_quiz_shortcode($atts)
178
  }
179
  y = window.mlw_quiz_slide+1;
180
  jQuery( ".quiz_section.slide"+y ).hide();
181
- jQuery( ".quiz_section.slide"+window.mlw_quiz_slide ).show( "slide", {direction: "left"}, 300 );
182
  }
183
  </script>
184
  <?php
@@ -345,92 +368,174 @@ function mlw_quiz_shortcode($atts)
345
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
346
  if ($mlw_question->question_type == 0)
347
  {
348
- if ($mlw_question->answer_one != "")
 
349
  {
350
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_one' value='1' /> <label for='question".$mlw_question->question_id."_one'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</label>";
351
- $mlw_display .= "<br />";
352
- }
353
- if ($mlw_question->answer_two != "")
354
- {
355
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_two' value='2' /> <label for='question".$mlw_question->question_id."_two'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</label>";
356
- $mlw_display .= "<br />";
357
- }
358
- if ($mlw_question->answer_three != "")
359
- {
360
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_three' value='3' /> <label for='question".$mlw_question->question_id."_three'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</label>";
361
- $mlw_display .= "<br />";
362
- }
363
- if ($mlw_question->answer_four != "")
364
- {
365
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_four' value='4' /> <label for='question".$mlw_question->question_id."_four'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</label>";
366
- $mlw_display .= "<br />";
367
  }
368
- if ($mlw_question->answer_five != "")
369
  {
370
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_five' value='5' /> <label for='question".$mlw_question->question_id."_five'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</label>";
371
- $mlw_display .= "<br />";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  }
373
- if ($mlw_question->answer_six != "")
 
 
 
 
374
  {
375
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_six' value='6' /> <label for='question".$mlw_question->question_id."_six'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</label>";
376
- $mlw_display .= "<br />";
 
 
 
 
 
 
 
 
 
 
 
 
377
  }
378
  }
379
  elseif ($mlw_question->question_type == 1)
380
  {
381
- if ($mlw_question->answer_one != "")
382
- {
383
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='1' />".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES);
384
- }
385
- if ($mlw_question->answer_two != "")
386
- {
387
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='2' />".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES);
388
- }
389
- if ($mlw_question->answer_three != "")
390
  {
391
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='3' />".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES);
392
- }
393
- if ($mlw_question->answer_four != "")
394
- {
395
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='4' />".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES);
396
- }
397
- if ($mlw_question->answer_five != "")
398
- {
399
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='5' />".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES);
 
 
 
 
400
  }
401
- if ($mlw_question->answer_six != "")
402
  {
403
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='6' />".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  }
405
  $mlw_display .= "<br />";
406
  }
407
  elseif ($mlw_question->question_type == 2)
408
  {
409
  $mlw_display .= "<select name='question".$mlw_question->question_id."'>";
410
- if ($mlw_question->answer_one != "")
411
- {
412
- $mlw_display .= "<option value='1'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</option>";
413
- }
414
- if ($mlw_question->answer_two != "")
415
- {
416
- $mlw_display .= "<option value='2'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</option>";
417
- }
418
- if ($mlw_question->answer_three != "")
419
- {
420
- $mlw_display .= "<option value='3'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</option>";
421
- }
422
- if ($mlw_question->answer_four != "")
423
  {
424
- $mlw_display .= "<option value='4'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</option>";
 
 
 
 
 
 
 
 
 
 
 
 
425
  }
426
- if ($mlw_question->answer_five != "")
427
  {
428
- $mlw_display .= "<option value='5'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</option>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  }
430
- if ($mlw_question->answer_six != "")
431
- {
432
- $mlw_display .= "<option value='6'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</option>";
433
- }
434
  $mlw_display .= "</select>";
435
  $mlw_display .= "<br />";
436
  }
@@ -509,11 +614,33 @@ function mlw_quiz_shortcode($atts)
509
  {
510
  $sql .= "ORDER BY question_order ASC";
511
  }
512
- if ($mlw_quiz_options->randomness_order == 1)
513
  {
514
  $sql .= "ORDER BY rand()";
515
  }
516
  $mlw_questions = $wpdb->get_results($sql);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
 
518
  //Variables needed for scoring
519
  $mlw_points = 0;
@@ -534,119 +661,113 @@ function mlw_quiz_shortcode($atts)
534
  $mlw_correct_text = "";
535
  $mlw_qmn_answer_array = array();
536
  foreach($mlw_questions as $mlw_question) {
537
- if (isset($_POST["question".$mlw_question->question_id]) || isset($_POST["mlwComment".$mlw_question->question_id]))
 
 
538
  {
539
- //$mlw_total_questions += 1;
540
- if ( isset($_POST["question".$mlw_question->question_id]) )
 
 
 
541
  {
542
- if ( $mlw_question->question_type == 0 || $mlw_question->question_type == 1 || $mlw_question->question_type == 2 )
 
 
 
 
 
543
  {
544
- $mlw_user_answer = $_POST["question".$mlw_question->question_id];
545
- if ($mlw_user_answer == $mlw_question->correct_answer)
 
546
  {
547
  $mlw_correct += 1;
548
  }
549
- if ($mlw_user_answer == 1)
550
- {
551
- $mlw_points += $mlw_question->answer_one_points;
552
- $mlw_user_text = $mlw_question->answer_one;
553
- }
554
- if ($mlw_user_answer == 2)
555
- {
556
- $mlw_points += $mlw_question->answer_two_points;
557
- $mlw_user_text = $mlw_question->answer_two;
558
- }
559
- if ($mlw_user_answer == 3)
560
- {
561
- $mlw_points += $mlw_question->answer_three_points;
562
- $mlw_user_text = $mlw_question->answer_three;
563
- }
564
- if ($mlw_user_answer == 4)
565
- {
566
- $mlw_points += $mlw_question->answer_four_points;
567
- $mlw_user_text = $mlw_question->answer_four;
568
- }
569
- if ($mlw_user_answer == 5)
570
- {
571
- $mlw_points += $mlw_question->answer_five_points;
572
- $mlw_user_text = $mlw_question->answer_five;
573
- }
574
- if ($mlw_user_answer == 6)
575
- {
576
- $mlw_points += $mlw_question->answer_six_points;
577
- $mlw_user_text = $mlw_question->answer_six;
578
- }
579
-
580
- if ($mlw_question->correct_answer == 1) {$mlw_correct_text = $mlw_question->answer_one;}
581
- if ($mlw_question->correct_answer == 2) {$mlw_correct_text = $mlw_question->answer_two;}
582
- if ($mlw_question->correct_answer == 3) {$mlw_correct_text = $mlw_question->answer_three;}
583
- if ($mlw_question->correct_answer == 4) {$mlw_correct_text = $mlw_question->answer_four;}
584
- if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
585
- if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
586
  }
587
- elseif ( $mlw_question->question_type == 3 )
588
  {
589
- $mlw_correct_text = $mlw_question->answer_one;
590
- $mlw_user_answer = $_POST["question".$mlw_question->question_id];
591
- if (strtoupper($mlw_user_answer) == strtoupper($mlw_question->answer_one))
592
- {
593
- $mlw_correct += 1;
594
- $mlw_points += $mlw_question->answer_one_points;
595
- $mlw_user_text = $mlw_question->answer_one;
596
- }
597
- elseif (strtoupper($mlw_user_answer) == strtoupper($mlw_question->answer_two))
598
- {
599
- $mlw_correct += 1;
600
- $mlw_points += $mlw_question->answer_two_points;
601
- $mlw_user_text = $mlw_question->answer_two;
602
- }
603
- elseif (strtoupper($mlw_user_answer) == strtoupper($mlw_question->answer_three))
604
- {
605
- $mlw_correct += 1;
606
- $mlw_points += $mlw_question->answer_three_points;
607
- $mlw_user_text = $mlw_question->answer_three;
608
- }
609
- elseif (strtoupper($mlw_user_answer) == strtoupper($mlw_question->answer_four))
610
- {
611
- $mlw_correct += 1;
612
- $mlw_points += $mlw_question->answer_four_points;
613
- $mlw_user_text = $mlw_question->answer_four;
614
- }
615
- elseif (strtoupper($mlw_user_answer) == strtoupper($mlw_question->answer_five))
616
- {
617
- $mlw_correct += 1;
618
- $mlw_points += $mlw_question->answer_five_points;
619
- $mlw_user_text = $mlw_question->answer_five;
620
- }
621
- elseif (strtoupper($mlw_user_answer) == strtoupper($mlw_question->answer_six))
622
- {
623
- $mlw_correct += 1;
624
- $mlw_points += $mlw_question->answer_six_points;
625
- $mlw_user_text = $mlw_question->answer_six;
626
- }
627
  }
628
  }
629
- if (isset($_POST["mlwComment".$mlw_question->question_id]))
 
 
 
 
630
  {
631
- $mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
632
  }
633
  else
634
  {
635
- $mlw_qm_question_comment = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
636
  }
637
-
638
- $mlw_question_answer_display = htmlspecialchars_decode($mlw_quiz_options->question_answer_template, ENT_QUOTES);
639
- $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
640
- $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
641
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
642
- $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $mlw_qm_question_comment, $mlw_question_answer_display);
643
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($mlw_question->question_answer_info, ENT_QUOTES), $mlw_question_answer_display);
644
-
645
- $mlw_qmn_answer_array[] = array($mlw_question->question_name, htmlspecialchars($mlw_user_text, ENT_QUOTES), htmlspecialchars($mlw_correct_text, ENT_QUOTES), htmlspecialchars(stripslashes($mlw_qm_question_comment), ENT_QUOTES));
646
-
647
- $mlw_question_answers .= $mlw_question_answer_display;
648
- $mlw_question_answers .= "<br />";
649
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
650
  }
651
 
652
  //Calculate Total Percent Score And Average Points Only If Total Questions Doesn't Equal Zero To Avoid Division By Zero Error
@@ -1005,7 +1126,11 @@ EOC;
1005
  $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
1006
  $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
1007
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
1008
- wp_mail($mlw_quiz_options->admin_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
 
 
 
 
1009
  }
1010
 
1011
  //Remove HTML type for emails
47
  {
48
  $sql .= "ORDER BY question_order ASC";
49
  }
50
+ if ($mlw_quiz_options->randomness_order == 1 || $mlw_quiz_options->randomness_order == 2)
51
  {
52
  $sql .= "ORDER BY rand()";
53
  }
56
  $sql .= " LIMIT ".$mlw_quiz_options->question_from_total;
57
  }
58
  $mlw_questions = $wpdb->get_results($sql);
59
+
60
+
61
+ //Load and prepare answer arrays
62
+ $mlw_qmn_answer_arrays = array();
63
+ foreach($mlw_questions as $mlw_question_info) {
64
+ $mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
65
+ if ( !is_array($mlw_qmn_answer_array_each) )
66
+ {
67
+ $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
68
+ $mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
69
+ $mlw_qmn_answer_arrays[$mlw_question_info->question_id] = array(
70
+ array($mlw_question_info->answer_one, $mlw_question_info->answer_one_points, $mlw_answer_array_correct[0]),
71
+ array($mlw_question_info->answer_two, $mlw_question_info->answer_two_points, $mlw_answer_array_correct[1]),
72
+ array($mlw_question_info->answer_three, $mlw_question_info->answer_three_points, $mlw_answer_array_correct[2]),
73
+ array($mlw_question_info->answer_four, $mlw_question_info->answer_four_points, $mlw_answer_array_correct[3]),
74
+ array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
75
+ array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
76
+ }
77
+ else
78
+ {
79
+ $mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
80
+ }
81
+ }
82
 
83
 
84
  //Variables to load if quiz has been taken
184
  }
185
  y = window.mlw_quiz_slide-1;
186
  jQuery( ".quiz_section.slide"+y ).hide();
187
+ jQuery( ".quiz_section.slide"+window.mlw_quiz_slide ).show();
188
 
189
  }
190
  function prevSlide()
201
  }
202
  y = window.mlw_quiz_slide+1;
203
  jQuery( ".quiz_section.slide"+y ).hide();
204
+ jQuery( ".quiz_section.slide"+window.mlw_quiz_slide ).show();
205
  }
206
  </script>
207
  <?php
368
  $mlw_display .= htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
369
  if ($mlw_question->question_type == 0)
370
  {
371
+ $mlw_qmn_answer_array = $mlw_qmn_answer_arrays[$mlw_question->question_id];
372
+ if (is_array($mlw_qmn_answer_array))
373
  {
374
+ if ($mlw_quiz_options->randomness_order == 2)
375
+ {
376
+ shuffle($mlw_qmn_answer_array);
377
+ }
378
+ $mlw_answer_total = 0;
379
+ foreach($mlw_qmn_answer_array as $mlw_qmn_answer_each)
380
+ {
381
+ $mlw_answer_total++;
382
+ if ($mlw_qmn_answer_each[0] != "")
383
+ {
384
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_".$mlw_answer_total."' value='".esc_attr($mlw_qmn_answer_each[0])."' /> <label for='question".$mlw_question->question_id."_".$mlw_answer_total."'>".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES)."</label>";
385
+ $mlw_display .= "<br />";
386
+ }
387
+ }
 
 
 
388
  }
389
+ else
390
  {
391
+ if ($mlw_question->answer_one != "")
392
+ {
393
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_one' value='1' /> <label for='question".$mlw_question->question_id."_one'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</label>";
394
+ $mlw_display .= "<br />";
395
+ }
396
+ if ($mlw_question->answer_two != "")
397
+ {
398
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_two' value='2' /> <label for='question".$mlw_question->question_id."_two'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</label>";
399
+ $mlw_display .= "<br />";
400
+ }
401
+ if ($mlw_question->answer_three != "")
402
+ {
403
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_three' value='3' /> <label for='question".$mlw_question->question_id."_three'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</label>";
404
+ $mlw_display .= "<br />";
405
+ }
406
+ if ($mlw_question->answer_four != "")
407
+ {
408
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_four' value='4' /> <label for='question".$mlw_question->question_id."_four'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</label>";
409
+ $mlw_display .= "<br />";
410
+ }
411
+ if ($mlw_question->answer_five != "")
412
+ {
413
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_five' value='5' /> <label for='question".$mlw_question->question_id."_five'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</label>";
414
+ $mlw_display .= "<br />";
415
+ }
416
+ if ($mlw_question->answer_six != "")
417
+ {
418
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_six' value='6' /> <label for='question".$mlw_question->question_id."_six'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</label>";
419
+ $mlw_display .= "<br />";
420
+ }
421
  }
422
+ }
423
+ elseif ($mlw_question->question_type == 4)
424
+ {
425
+ $mlw_qmn_answer_array = $mlw_qmn_answer_arrays[$mlw_question->question_id];
426
+ if (is_array($mlw_qmn_answer_array))
427
  {
428
+ if ($mlw_quiz_options->randomness_order == 2)
429
+ {
430
+ shuffle($mlw_qmn_answer_array);
431
+ }
432
+ $mlw_answer_total = 0;
433
+ foreach($mlw_qmn_answer_array as $mlw_qmn_answer_each)
434
+ {
435
+ $mlw_answer_total++;
436
+ if ($mlw_qmn_answer_each[0] != "")
437
+ {
438
+ $mlw_display .= "<input type='checkbox' name='question".$mlw_question->question_id."_".$mlw_answer_total."' id='question".$mlw_question->question_id."_".$mlw_answer_total."' value='".esc_attr($mlw_qmn_answer_each[0])."' /> <label for='question".$mlw_question->question_id."_".$mlw_answer_total."'>".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES)."</label>";
439
+ $mlw_display .= "<br />";
440
+ }
441
+ }
442
  }
443
  }
444
  elseif ($mlw_question->question_type == 1)
445
  {
446
+ $mlw_qmn_answer_array = $mlw_qmn_answer_arrays[$mlw_question->question_id];
447
+ if (is_array($mlw_qmn_answer_array))
 
 
 
 
 
 
 
448
  {
449
+ if ($mlw_quiz_options->randomness_order == 2)
450
+ {
451
+ shuffle($mlw_qmn_answer_array);
452
+ }
453
+ $mlw_answer_total = 0;
454
+ foreach($mlw_qmn_answer_array as $mlw_qmn_answer_each)
455
+ {
456
+ $mlw_answer_total++;
457
+ if ($mlw_qmn_answer_each[0] != "")
458
+ {
459
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='".esc_attr($mlw_qmn_answer_each[0])."' />".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES);
460
+ }
461
+ }
462
  }
463
+ else
464
  {
465
+ if ($mlw_question->answer_one != "")
466
+ {
467
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='1' />".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES);
468
+ }
469
+ if ($mlw_question->answer_two != "")
470
+ {
471
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='2' />".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES);
472
+ }
473
+ if ($mlw_question->answer_three != "")
474
+ {
475
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='3' />".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES);
476
+ }
477
+ if ($mlw_question->answer_four != "")
478
+ {
479
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='4' />".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES);
480
+ }
481
+ if ($mlw_question->answer_five != "")
482
+ {
483
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='5' />".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES);
484
+ }
485
+ if ($mlw_question->answer_six != "")
486
+ {
487
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='6' />".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES);
488
+ }
489
  }
490
  $mlw_display .= "<br />";
491
  }
492
  elseif ($mlw_question->question_type == 2)
493
  {
494
  $mlw_display .= "<select name='question".$mlw_question->question_id."'>";
495
+ $mlw_qmn_answer_array = $mlw_qmn_answer_arrays[$mlw_question->question_id];
496
+ if (is_array($mlw_qmn_answer_array))
 
 
 
 
 
 
 
 
 
 
 
497
  {
498
+ if ($mlw_quiz_options->randomness_order == 2)
499
+ {
500
+ shuffle($mlw_qmn_answer_array);
501
+ }
502
+ $mlw_answer_total = 0;
503
+ foreach($mlw_qmn_answer_array as $mlw_qmn_answer_each)
504
+ {
505
+ $mlw_answer_total++;
506
+ if ($mlw_qmn_answer_each[0] != "")
507
+ {
508
+ $mlw_display .= "<option value='".esc_attr($mlw_qmn_answer_each[0])."'>".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES)."</option>";
509
+ }
510
+ }
511
  }
512
+ else
513
  {
514
+ if ($mlw_question->answer_one != "")
515
+ {
516
+ $mlw_display .= "<option value='1'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</option>";
517
+ }
518
+ if ($mlw_question->answer_two != "")
519
+ {
520
+ $mlw_display .= "<option value='2'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</option>";
521
+ }
522
+ if ($mlw_question->answer_three != "")
523
+ {
524
+ $mlw_display .= "<option value='3'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</option>";
525
+ }
526
+ if ($mlw_question->answer_four != "")
527
+ {
528
+ $mlw_display .= "<option value='4'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</option>";
529
+ }
530
+ if ($mlw_question->answer_five != "")
531
+ {
532
+ $mlw_display .= "<option value='5'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</option>";
533
+ }
534
+ if ($mlw_question->answer_six != "")
535
+ {
536
+ $mlw_display .= "<option value='6'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</option>";
537
+ }
538
  }
 
 
 
 
539
  $mlw_display .= "</select>";
540
  $mlw_display .= "<br />";
541
  }
614
  {
615
  $sql .= "ORDER BY question_order ASC";
616
  }
617
+ if ($mlw_quiz_options->randomness_order == 1 || $mlw_quiz_options->randomness_order == 2)
618
  {
619
  $sql .= "ORDER BY rand()";
620
  }
621
  $mlw_questions = $wpdb->get_results($sql);
622
+
623
+ //Load and prepare answer arrays
624
+ $mlw_qmn_loaded_answer_arrays = array();
625
+ foreach($mlw_questions as $mlw_question_info) {
626
+ $mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
627
+ if ( !is_array($mlw_qmn_answer_array_each) )
628
+ {
629
+ $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
630
+ $mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
631
+ $mlw_qmn_loaded_answer_arrays[$mlw_question_info->question_id] = array(
632
+ array($mlw_question_info->answer_one, $mlw_question_info->answer_one_points, $mlw_answer_array_correct[0]),
633
+ array($mlw_question_info->answer_two, $mlw_question_info->answer_two_points, $mlw_answer_array_correct[1]),
634
+ array($mlw_question_info->answer_three, $mlw_question_info->answer_three_points, $mlw_answer_array_correct[2]),
635
+ array($mlw_question_info->answer_four, $mlw_question_info->answer_four_points, $mlw_answer_array_correct[3]),
636
+ array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
637
+ array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
638
+ }
639
+ else
640
+ {
641
+ $mlw_qmn_loaded_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
642
+ }
643
+ }
644
 
645
  //Variables needed for scoring
646
  $mlw_points = 0;
661
  $mlw_correct_text = "";
662
  $mlw_qmn_answer_array = array();
663
  foreach($mlw_questions as $mlw_question) {
664
+ $mlw_user_text = "";
665
+ $mlw_correct_text = "";
666
+ if ( $mlw_question->question_type == 0 || $mlw_question->question_type == 1 || $mlw_question->question_type == 2)
667
  {
668
+ if (isset($_POST["question".$mlw_question->question_id]))
669
+ {
670
+ $mlw_user_answer = $_POST["question".$mlw_question->question_id];
671
+ }
672
+ else
673
  {
674
+ $mlw_user_answer = " ";
675
+ }
676
+ $mlw_qmn_question_answers_array = $mlw_qmn_loaded_answer_arrays[$mlw_question->question_id];
677
+ foreach($mlw_qmn_question_answers_array as $mlw_qmn_question_answers_each)
678
+ {
679
+ if (htmlspecialchars(stripslashes($mlw_user_answer), ENT_QUOTES) == esc_attr($mlw_qmn_question_answers_each[0]))
680
  {
681
+ $mlw_points += $mlw_qmn_question_answers_each[1];
682
+ $mlw_user_text .= strval($mlw_qmn_question_answers_each[0]);
683
+ if ($mlw_qmn_question_answers_each[2] == 1)
684
  {
685
  $mlw_correct += 1;
686
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
  }
688
+ if ($mlw_qmn_question_answers_each[2] == 1)
689
  {
690
+ $mlw_correct_text .= $mlw_qmn_question_answers_each[0];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
  }
692
  }
693
+ }
694
+ elseif ( $mlw_question->question_type == 3 )
695
+ {
696
+ $mlw_correct_text .= strval($mlw_question->answer_one);
697
+ if (isset($_POST["question".$mlw_question->question_id]))
698
  {
699
+ $mlw_user_answer = $_POST["question".$mlw_question->question_id];
700
  }
701
  else
702
  {
703
+ $mlw_user_answer = " ";
704
+ }
705
+ $mlw_user_text .= strval($mlw_user_answer);
706
+ $mlw_qmn_question_answers_array = $mlw_qmn_loaded_answer_arrays[$mlw_question->question_id];
707
+ foreach($mlw_qmn_question_answers_array as $mlw_qmn_question_answers_each)
708
+ {
709
+ if (strtoupper($mlw_user_answer) == strtoupper($mlw_qmn_question_answers_each[0]))
710
+ {
711
+ $mlw_correct += 1;
712
+ $mlw_points += $mlw_qmn_question_answers_each[1];
713
+ break;
714
+ }
715
+ }
716
+ }
717
+ elseif ( $mlw_question->question_type == 4 )
718
+ {
719
+ $mlw_qmn_user_correct_answers = 0;
720
+ $mlw_qmn_total_correct_answers = 0;
721
+ $mlw_qmn_question_answers_array = $mlw_qmn_loaded_answer_arrays[$mlw_question->question_id];
722
+ $mlw_qmn_total_answers = count($mlw_qmn_question_answers_array);
723
+ foreach($mlw_qmn_question_answers_array as $mlw_qmn_question_answers_each)
724
+ {
725
+ for ($i = 1; $i <= $mlw_qmn_total_answers; $i++) {
726
+ if (isset($_POST["question".$mlw_question->question_id."_".$i]) && htmlspecialchars(stripslashes($_POST["question".$mlw_question->question_id."_".$i]), ENT_QUOTES) == esc_attr($mlw_qmn_question_answers_each[0]))
727
+ {
728
+ $mlw_points += $mlw_qmn_question_answers_each[1];
729
+ $mlw_user_text .= strval($mlw_qmn_question_answers_each[0]).".";
730
+ if ($mlw_qmn_question_answers_each[2] == 1)
731
+ {
732
+ $mlw_qmn_user_correct_answers += 1;
733
+ }
734
+ else
735
+ {
736
+ $mlw_qmn_user_correct_answers = -1;
737
+ }
738
+ }
739
+ }
740
+ if ($mlw_qmn_question_answers_each[2] == 1)
741
+ {
742
+ $mlw_correct_text .= $mlw_qmn_question_answers_each[0].".";
743
+ $mlw_qmn_total_correct_answers++;
744
+ }
745
+ }
746
+ if ($mlw_qmn_user_correct_answers == $mlw_qmn_total_correct_answers)
747
+ {
748
+ $mlw_correct += 1;
749
  }
 
 
 
 
 
 
 
 
 
 
 
 
750
  }
751
+ if (isset($_POST["mlwComment".$mlw_question->question_id]))
752
+ {
753
+ $mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
754
+ }
755
+ else
756
+ {
757
+ $mlw_qm_question_comment = "";
758
+ }
759
+
760
+ $mlw_question_answer_display = htmlspecialchars_decode($mlw_quiz_options->question_answer_template, ENT_QUOTES);
761
+ $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
762
+ $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
763
+ $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
764
+ $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $mlw_qm_question_comment, $mlw_question_answer_display);
765
+ $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($mlw_question->question_answer_info, ENT_QUOTES), $mlw_question_answer_display);
766
+
767
+ $mlw_qmn_answer_array[] = array($mlw_question->question_name, htmlspecialchars($mlw_user_text, ENT_QUOTES), htmlspecialchars($mlw_correct_text, ENT_QUOTES), htmlspecialchars(stripslashes($mlw_qm_question_comment), ENT_QUOTES));
768
+
769
+ $mlw_question_answers .= $mlw_question_answer_display;
770
+ $mlw_question_answers .= "<br />";
771
  }
772
 
773
  //Calculate Total Percent Score And Average Points Only If Total Questions Doesn't Equal Zero To Avoid Division By Zero Error
1126
  $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
1127
  $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
1128
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
1129
+ $mlw_qmn_admin_emails = explode(",", $mlw_quiz_options->admin_email);
1130
+ foreach($mlw_qmn_admin_emails as $admin_email)
1131
+ {
1132
+ wp_mail($admin_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
1133
+ }
1134
  }
1135
 
1136
  //Remove HTML type for emails
includes/mlw_quiz_install.php CHANGED
@@ -127,6 +127,8 @@ function mlw_quiz_activate()
127
 
128
  question_name TEXT NOT NULL,
129
 
 
 
130
  answer_one TEXT NOT NULL,
131
 
132
  answer_one_points INT NOT NULL,
127
 
128
  question_name TEXT NOT NULL,
129
 
130
+ answer_array TEXT NOT NULL,
131
+
132
  answer_one TEXT NOT NULL,
133
 
134
  answer_one_points INT NOT NULL,
includes/mlw_quiz_options.php CHANGED
@@ -37,28 +37,33 @@ function mlw_generate_quiz_options()
37
  {
38
  //Variables from edit question form
39
  $edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
40
- $edit_answer_one = htmlspecialchars($_POST["edit_answer_one"], ENT_QUOTES);
41
- $edit_answer_one_points = intval($_POST["edit_answer_one_points"]);
42
- $edit_answer_two = htmlspecialchars($_POST["edit_answer_two"], ENT_QUOTES);
43
- $edit_answer_two_points = intval($_POST["edit_answer_two_points"]);
44
- $edit_answer_three = htmlspecialchars($_POST["edit_answer_three"], ENT_QUOTES);
45
- $edit_answer_three_points = intval($_POST["edit_answer_three_points"]);
46
- $edit_answer_four = htmlspecialchars($_POST["edit_answer_four"], ENT_QUOTES);
47
- $edit_answer_four_points = intval($_POST["edit_answer_four_points"]);
48
- $edit_answer_five = htmlspecialchars($_POST["edit_answer_five"], ENT_QUOTES);
49
- $edit_answer_five_points = intval($_POST["edit_answer_five_points"]);
50
- $edit_answer_six = htmlspecialchars($_POST["edit_answer_six"], ENT_QUOTES);
51
- $edit_answer_six_points = intval($_POST["edit_answer_six_points"]);
52
- $edit_correct_answer = htmlspecialchars($_POST["edit_correct_answer"], ENT_QUOTES);
53
  $edit_question_answer_info = $_POST["edit_correct_answer_info"];
54
  $mlw_edit_question_id = intval($_POST["edit_question_id"]);
55
  $mlw_edit_question_type = $_POST["edit_question_type"];
56
  $edit_comments = htmlspecialchars($_POST["edit_comments"], ENT_QUOTES);
57
  $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
58
  $edit_question_order = intval($_POST["edit_question_order"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  $quiz_id = $_POST["quiz_id"];
60
 
61
- $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."', answer_one='".$edit_answer_one."', answer_one_points='".$edit_answer_one_points."', answer_two='".$edit_answer_two."', answer_two_points='".$edit_answer_two_points."', answer_three='".$edit_answer_three."', answer_three_points='".$edit_answer_three_points."', answer_four='".$edit_answer_four."', answer_four_points='".$edit_answer_four_points."', answer_five='".$edit_answer_five."', answer_five_points='".$edit_answer_five_points."', answer_six='".$edit_answer_six."', answer_six_points='".$edit_answer_six_points."', correct_answer='".$edit_correct_answer."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."' WHERE question_id=".$mlw_edit_question_id;
62
  $results = $wpdb->query( $update );
63
  if ($results != false)
64
  {
@@ -114,28 +119,33 @@ function mlw_generate_quiz_options()
114
  {
115
  //Variables from new question form
116
  $question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["question_name"], ENT_QUOTES))));
117
- $answer_one = htmlspecialchars($_POST["answer_one"], ENT_QUOTES);
118
- $answer_one_points = intval($_POST["answer_one_points"]);
119
- $answer_two = htmlspecialchars($_POST["answer_two"], ENT_QUOTES);
120
- $answer_two_points = intval($_POST["answer_two_points"]);
121
- $answer_three = htmlspecialchars($_POST["answer_three"], ENT_QUOTES);
122
- $answer_three_points = intval($_POST["answer_three_points"]);
123
- $answer_four = htmlspecialchars($_POST["answer_four"], ENT_QUOTES);
124
- $answer_four_points = intval($_POST["answer_four_points"]);
125
- $answer_five = htmlspecialchars($_POST["answer_five"], ENT_QUOTES);
126
- $answer_five_points = intval($_POST["answer_five_points"]);
127
- $answer_six = htmlspecialchars($_POST["answer_six"], ENT_QUOTES);
128
- $answer_six_points = intval($_POST["answer_six_points"]);
129
- $correct_answer = htmlspecialchars($_POST["correct_answer"], ENT_QUOTES);
130
  $question_answer_info = $_POST["correct_answer_info"];
131
  $question_type = $_POST["question_type"];
132
  $comments = htmlspecialchars($_POST["comments"], ENT_QUOTES);
133
  $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
134
  $new_question_order = intval($_POST["new_question_order"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  $quiz_id = $_POST["quiz_id"];
136
  $table_name = $wpdb->prefix . "mlw_questions";
137
  $insert = "INSERT INTO " . $table_name .
138
- " (question_id, quiz_id, question_name, answer_one, answer_one_points, answer_two, answer_two_points, answer_three, answer_three_points, answer_four, answer_four_points, answer_five, answer_five_points, answer_six, answer_six_points, correct_answer, question_answer_info, comments, hints, question_order, question_type, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '" . $answer_one . "', ".$answer_one_points.", '" . $answer_two . "', ".$answer_two_points.", '" . $answer_three . "', ".$answer_three_points.", '" . $answer_four . "', ".$answer_four_points.", '" . $answer_five . "', ".$answer_five_points.", '" . $answer_six . "', ".$answer_six_points.", ".$correct_answer.", '".$question_answer_info."', '".$comments."', '".$hint."', ".$new_question_order.", '".$question_type."', 0)";
139
  $results = $wpdb->query( $insert );
140
  if ($results != false)
141
  {
@@ -611,6 +621,29 @@ function mlw_generate_quiz_options()
611
  }
612
  }
613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  //Load Certificate Options Variables
615
  $mlw_certificate_options = @unserialize($mlw_quiz_options->certificate_template);
616
  if (!is_array($mlw_certificate_options)) {
@@ -861,20 +894,11 @@ function mlw_generate_quiz_options()
861
  $j(function() {
862
  $j( "#comments" ).buttonset();
863
  });
864
- $j(function() {
865
- $j( "#question_type" ).buttonset();
866
- });
867
- $j(function() {
868
- $j( "#edit_question_type" ).buttonset();
869
- });
870
  $j(function() {
871
  $j( "#enableCertificates" ).buttonset();
872
  });
873
- $j(function() {
874
- $j( "#edit_comments" ).buttonset();
875
- });
876
  $j(function() {
877
- $j("button, #prev_page, #next_page, #new_email_button_top, #new_email_button_bottom").button();
878
 
879
  });
880
  $j(function() {
@@ -918,8 +942,8 @@ function mlw_generate_quiz_options()
918
  idText.innerHTML = id;
919
  idHidden.value = id;
920
  };
921
- function editQuestion(id, question, answerOne, answerOnePoints, answerTwo, answerTwoPoints, answerThree, answerThreePoints, answerFour, answerFourPoints, answerFive, answerFivePoints, answerSix, answerSixPoints, correctAnswer, answer_info, comments, hint, question_order, question_type){
922
- $j("#edit_question_dialog").dialog({
923
  autoOpen: false,
924
  show: 'blind',
925
  width:800,
@@ -930,38 +954,7 @@ function mlw_generate_quiz_options()
930
  }
931
  }
932
  });
933
- $j("#edit_question_dialog").dialog('open');
934
- var idHidden = document.getElementById("edit_question_id");
935
- idHidden.value = id;
936
- document.getElementById("edit_question_name").value = question;
937
- document.getElementById("edit_answer_one").value = answerOne;
938
- document.getElementById("edit_answer_two").value = answerTwo;
939
- document.getElementById("edit_answer_three").value = answerThree;
940
- document.getElementById("edit_answer_four").value = answerFour;
941
- document.getElementById("edit_answer_five").value = answerFive;
942
- document.getElementById("edit_answer_six").value = answerSix;
943
- document.getElementById("edit_answer_one_points").value = answerOnePoints;
944
- document.getElementById("edit_answer_two_points").value = answerTwoPoints;
945
- document.getElementById("edit_answer_three_points").value = answerThreePoints;
946
- document.getElementById("edit_answer_four_points").value = answerFourPoints;
947
- document.getElementById("edit_answer_five_points").value = answerFivePoints;
948
- document.getElementById("edit_answer_six_points").value = answerSixPoints;
949
- document.getElementById("edit_correct_answer_info").value = answer_info;
950
- document.getElementById("edit_hint").value = hint;
951
- document.getElementById("edit_question_order").value = question_order;
952
- if (correctAnswer == 1) document.getElementById("edit_correct_one").checked = true;
953
- if (correctAnswer == 2) document.getElementById("edit_correct_two").checked = true;
954
- if (correctAnswer == 3) document.getElementById("edit_correct_three").checked = true;
955
- if (correctAnswer == 4) document.getElementById("edit_correct_four").checked = true;
956
- if (correctAnswer == 5) document.getElementById("edit_correct_five").checked = true;
957
- if (correctAnswer == 6) document.getElementById("edit_correct_six").checked = true;
958
- if (question_type == 0) $j('#editTypeRadio1').attr('checked', true).button('refresh');
959
- if (question_type == 1) $j('#editTypeRadio2').attr('checked', true).button('refresh');
960
- if (question_type == 2) $j('#editTypeRadio3').attr('checked', true).button('refresh');
961
- if (question_type == 3) $j('#editTypeRadio4').attr('checked', true).button('refresh');
962
- if (comments == 0) $j('#editCommentRadio1').attr('checked', true).button('refresh');
963
- if (comments == 1) $j('#editCommentRadio2').attr('checked', true).button('refresh');
964
- if (comments == 2) $j('#editCommentRadio3').attr('checked', true).button('refresh');
965
  };
966
  function delete_landing(id)
967
  {
@@ -973,6 +966,20 @@ function mlw_generate_quiz_options()
973
  document.getElementById('user_email_'+id).value = "Delete";
974
  document.mlw_quiz_save_email_form.submit();
975
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
976
  </script>
977
  <div class="wrap">
978
  <div class='mlw_quiz_options'>
@@ -1122,7 +1129,7 @@ function mlw_generate_quiz_options()
1122
  <li><a href="#tabs-4">Quiz Leaderboard</a></li>
1123
  <li><a href="#tabs-5">Quiz Certificate (Beta)</a></li>
1124
  <li><a href="#tabs-9">Quiz Emails</a></li>
1125
- <li><a href="#tabs-6">Quiz Landing Page</a></li>
1126
  <li><a href="#tabs-7">Quiz Styling</a></li>
1127
  <li><a href="#tabs-8">Quiz Tools</a></li>
1128
  </ul>
@@ -1138,8 +1145,118 @@ function mlw_generate_quiz_options()
1138
  else $alternate = " class=\"alternate\"";
1139
  $question_list .= "<tr{$alternate}>";
1140
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
1141
- $question_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_question_info->question_name ."</span><div><span style='color:green;font-size:12px;'><a onclick=\"editQuestion('".$mlw_question_info->question_id."','".esc_js(htmlspecialchars_decode($mlw_question_info->question_name, ENT_QUOTES))."', '".esc_js(htmlspecialchars_decode($mlw_question_info->answer_one, ENT_QUOTES))."','".$mlw_question_info->answer_one_points."','".esc_js(htmlspecialchars_decode($mlw_question_info->answer_two, ENT_QUOTES))."','".$mlw_question_info->answer_two_points."','".esc_js(htmlspecialchars_decode($mlw_question_info->answer_three, ENT_QUOTES))."','".$mlw_question_info->answer_three_points."','".esc_js(htmlspecialchars_decode($mlw_question_info->answer_four, ENT_QUOTES))."','".$mlw_question_info->answer_four_points."','".esc_js(htmlspecialchars_decode($mlw_question_info->answer_five, ENT_QUOTES))."','".$mlw_question_info->answer_five_points."','".esc_js(htmlspecialchars_decode($mlw_question_info->answer_six, ENT_QUOTES))."','".$mlw_question_info->answer_six_points."','".$mlw_question_info->correct_answer."', '".esc_js(htmlspecialchars_decode($mlw_question_info->question_answer_info, ENT_QUOTES))."', '".$mlw_question_info->comments."','".esc_js(htmlspecialchars_decode($mlw_question_info->hints, ENT_QUOTES))."', '".$mlw_question_info->question_order."', '".$mlw_question_info->question_type."')\" href='#'>Edit</a> | <a onclick=\"deleteQuestion('".$mlw_question_info->question_id."')\" href='#'>Delete</a></span></div></td>";
1142
  $question_list .= "</tr>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1143
  }
1144
 
1145
  if( $mlw_qmn_question_page > 0 )
@@ -1185,7 +1302,7 @@ function mlw_generate_quiz_options()
1185
  echo "<input type='hidden' name='create_question' value='confirmation' />";
1186
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1187
  ?>
1188
- <table>
1189
  <tr>
1190
  <td><span style='font-weight:bold;'>Question</span></td>
1191
  <td colspan="3">
@@ -1202,96 +1319,30 @@ function mlw_generate_quiz_options()
1202
  <td><span style='font-weight:bold;'>Points Worth<a href="#" title="If you have your quiz set up using the point system, enter how many points this answer is worth here. If you are not using the point system, leave this as 0.">?</a></span></td>
1203
  <td><span style='font-weight:bold;'>Correct Answer<a href="#" title="Select the correct answer.">?</a></span></td>
1204
  </tr>
 
 
 
 
1205
  <tr valign="top">
1206
- <td><span style='font-weight:bold;'>Answer One</span></td>
1207
- <td>
1208
- <input type="text" name="answer_one" value="" style="border-color:#000000;
1209
- color:#3300CC;
1210
- cursor:hand;
1211
- width: 250px;"/>
1212
- </td>
1213
- <td>
1214
- <input type="text" name="answer_one_points" value="0" style="border-color:#000000;
1215
- color:#3300CC;
1216
- cursor:hand;"/>
1217
- </td>
1218
- <td><input type="radio" name="correct_answer" checked="checked" value=1 /></td>
1219
- </tr>
1220
- <tr valign="top">
1221
- <td><span style='font-weight:bold;'>Answer Two</span></td>
1222
- <td>
1223
- <input type="text" name="answer_two" value="" style="border-color:#000000;
1224
- color:#3300CC;
1225
- cursor:hand;
1226
- width: 250px;"/>
1227
- </td>
1228
- <td>
1229
- <input type="text" name="answer_two_points" value="0" style="border-color:#000000;
1230
- color:#3300CC;
1231
- cursor:hand;"/>
1232
- </td>
1233
- <td><input type="radio" name="correct_answer" value=2 /></td>
1234
- </tr>
1235
- <tr valign="top">
1236
- <td><span style='font-weight:bold;'>Answer Three</span></td>
1237
- <td>
1238
- <input type="text" name="answer_three" value="" style="border-color:#000000;
1239
- color:#3300CC;
1240
- cursor:hand;
1241
- width: 250px;"/>
1242
- </td>
1243
- <td>
1244
- <input type="text" name="answer_three_points" value="0" style="border-color:#000000;
1245
- color:#3300CC;
1246
- cursor:hand;"/>
1247
- </td>
1248
- <td><input type="radio" name="correct_answer" value=3 /></td>
1249
- </tr>
1250
- <tr valign="top">
1251
- <td><span style='font-weight:bold;'>Answer Four</span></td>
1252
- <td>
1253
- <input type="text" name="answer_four" value="" style="border-color:#000000;
1254
- color:#3300CC;
1255
- cursor:hand;
1256
- width: 250px;"/>
1257
- </td>
1258
- <td>
1259
- <input type="text" name="answer_four_points" value="0" style="border-color:#000000;
1260
- color:#3300CC;
1261
- cursor:hand;"/>
1262
- </td>
1263
- <td><input type="radio" name="correct_answer" value=4 /></td>
1264
- </tr>
1265
- <tr valign="top">
1266
- <td><span style='font-weight:bold;'>Answer Five</span></td>
1267
- <td>
1268
- <input type="text" name="answer_five" value="" style="border-color:#000000;
1269
- color:#3300CC;
1270
- cursor:hand;
1271
- width: 250px;"/>
1272
- </td>
1273
- <td>
1274
- <input type="text" name="answer_five_points" value="0" style="border-color:#000000;
1275
- color:#3300CC;
1276
- cursor:hand;"/>
1277
- </td>
1278
- <td><input type="radio" name="correct_answer" value=5 /></td>
1279
- </tr>
1280
- <tr valign="top">
1281
- <td><span style='font-weight:bold;'>Answer Six</span></td>
1282
  <td>
1283
- <input type="text" name="answer_six" value="" style="border-color:#000000;
1284
  color:#3300CC;
1285
  cursor:hand;
1286
  width: 250px;"/>
1287
  </td>
1288
  <td>
1289
- <input type="text" name="answer_six_points" value="0" style="border-color:#000000;
1290
  color:#3300CC;
1291
  cursor:hand;"/>
1292
  </td>
1293
- <td><input type="radio" name="correct_answer" value=6 /></td>
1294
  </tr>
 
 
 
 
 
1295
  <tr>
1296
  <td><span style='font-weight:bold;'>Correct Answer Info<a href="#" title="Enter in the reason why the correct answer is correct. Add this to the %QUESTIONS_ANSWERS% template using the new %CORRECT_ANSWER_INFO% variable.">?</a></span></td>
1297
  <td colspan="3"><input type="text" name="correct_answer_info" value="" id="correct_answer_info" style="border-color:#000000;
@@ -1312,11 +1363,14 @@ function mlw_generate_quiz_options()
1312
  <tr><td>&nbsp;</td></tr>
1313
  <tr valign="top">
1314
  <td><span style='font-weight:bold;'>Question Type<a href="#" title="The normal setting will show the question as it would normally; the horizontal setting will show the answers going across rather than down; the drop down setting will show the answers in a drop down menu instead of the raidio button." >?</a></span></td>
1315
- <td colspan="3"><div id="question_type">
1316
- <input type="radio" id="typeRadio1" name="question_type" checked="checked" value=0 /><label for="typeRadio1">Normal (Vertical Radio)</label>
1317
- <input type="radio" id="typeRadio2" name="question_type" value=1 /><label for="typeRadio2">Horizontal Radio</label>
1318
- <input type="radio" id="typeRadio3" name="question_type" value=2 /><label for="typeRadio3">Drop Down</label>
1319
- <input type="radio" id="typeRadio4" name="question_type" value=3 /><label for="typeRadio4">Open Answer</label>
 
 
 
1320
  </div></td>
1321
  </tr>
1322
  <tr valign="top">
@@ -1336,6 +1390,7 @@ function mlw_generate_quiz_options()
1336
  </td>
1337
  </tr>
1338
  </table>
 
1339
  <?php
1340
  echo "<p class='submit'><input type='submit' class='button-primary' value='Create Question' /></p>";
1341
  echo "</form>";
@@ -1343,169 +1398,7 @@ function mlw_generate_quiz_options()
1343
  </div>
1344
 
1345
 
1346
- <div id="edit_question_dialog" title="Edit Question" style="display:none;">
1347
- <?php
1348
- echo "<form action='' method='post'>";
1349
- echo "<input type='hidden' name='edit_question' value='confirmation' />";
1350
- echo "<input type='hidden' id='edit_question_id' name='edit_question_id' value='' />";
1351
- echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1352
- ?>
1353
- <table class="wide" style="text-align: left; white-space: nowrap;">
1354
- <tr>
1355
- <td><span style='font-weight:bold;'>Question</span></td>
1356
- <td colspan="3">
1357
- <textarea name="edit_question_name" id="edit_question_name" style="width: 500px; height: 150px;"></textarea>
1358
- </td>
1359
- </tr>
1360
- <tr valign="top">
1361
- <td>&nbsp;</td>
1362
- <td>&nbsp;</td>
1363
- </tr>
1364
- <tr valign="top">
1365
- <td>&nbsp;</td>
1366
- <td><span style='font-weight:bold;'>Answers</span></td>
1367
- <td><span style='font-weight:bold;'>Points Worth</span></td>
1368
- <td><span style='font-weight:bold;'>Correct Answer</span></td>
1369
- </tr>
1370
- <tr valign="top">
1371
- <td><span style='font-weight:bold;'>Answer One</span></td>
1372
- <td>
1373
- <input type="text" name="edit_answer_one" id="edit_answer_one" value="" style="border-color:#000000;
1374
- color:#3300CC;
1375
- cursor:hand;
1376
- width: 250px;"/>
1377
- </td>
1378
- <td>
1379
- <input type="text" name="edit_answer_one_points" id="edit_answer_one_points" value="0" style="border-color:#000000;
1380
- color:#3300CC;
1381
- cursor:hand;"/>
1382
- </td>
1383
- <td><input type="radio" id="edit_correct_one" name="edit_correct_answer" checked="checked" value=1 /></td>
1384
- </tr>
1385
- <tr valign="top">
1386
- <td><span style='font-weight:bold;'>Answer Two</span></td>
1387
- <td>
1388
- <input type="text" name="edit_answer_two" id="edit_answer_two" value="" style="border-color:#000000;
1389
- color:#3300CC;
1390
- cursor:hand;
1391
- width: 250px;"/>
1392
- </td>
1393
- <td>
1394
- <input type="text" name="edit_answer_two_points" id="edit_answer_two_points" value="0" style="border-color:#000000;
1395
- color:#3300CC;
1396
- cursor:hand;"/>
1397
- </td>
1398
- <td><input type="radio" id="edit_correct_two" name="edit_correct_answer" value=2 /></td>
1399
- </tr>
1400
- <tr valign="top">
1401
- <td><span style='font-weight:bold;'>Answer Three</span></td>
1402
- <td>
1403
- <input type="text" name="edit_answer_three" id="edit_answer_three" value="" style="border-color:#000000;
1404
- color:#3300CC;
1405
- cursor:hand;
1406
- width: 250px;"/>
1407
- </td>
1408
- <td>
1409
- <input type="text" name="edit_answer_three_points" id="edit_answer_three_points" value="0" style="border-color:#000000;
1410
- color:#3300CC;
1411
- cursor:hand;"/>
1412
- </td>
1413
- <td><input type="radio" id="edit_correct_three" name="edit_correct_answer" value=3 /></td>
1414
- </tr>
1415
- <tr valign="top">
1416
- <td><span style='font-weight:bold;'>Answer Four</span></td>
1417
- <td>
1418
- <input type="text" name="edit_answer_four" value="" id="edit_answer_four" style="border-color:#000000;
1419
- color:#3300CC;
1420
- cursor:hand;
1421
- width: 250px;"/>
1422
- </td>
1423
- <td>
1424
- <input type="text" name="edit_answer_four_points" id="edit_answer_four_points" value="0" style="border-color:#000000;
1425
- color:#3300CC;
1426
- cursor:hand;"/>
1427
- </td>
1428
- <td><input type="radio" id="edit_correct_four" name="edit_correct_answer" value=4 /></td>
1429
- </tr>
1430
- <tr valign="top">
1431
- <td><span style='font-weight:bold;'>Answer Five</span></td>
1432
- <td>
1433
- <input type="text" name="edit_answer_five" value="" id="edit_answer_five" style="border-color:#000000;
1434
- color:#3300CC;
1435
- cursor:hand;
1436
- width: 250px;"/>
1437
- </td>
1438
- <td>
1439
- <input type="text" name="edit_answer_five_points" id="edit_answer_five_points" value="0" style="border-color:#000000;
1440
- color:#3300CC;
1441
- cursor:hand;"/>
1442
- </td>
1443
- <td><input type="radio" id="edit_correct_five" name="edit_correct_answer" value=5 /></td>
1444
- </tr>
1445
- <tr valign="top">
1446
- <td><span style='font-weight:bold;'>Answer Six</span></td>
1447
- <td>
1448
- <input type="text" name="edit_answer_six" value="" id="edit_answer_six" style="border-color:#000000;
1449
- color:#3300CC;
1450
- cursor:hand;
1451
- width: 250px;"/>
1452
- </td>
1453
- <td>
1454
- <input type="text" name="edit_answer_six_points" id="edit_answer_six_points" value="0" style="border-color:#000000;
1455
- color:#3300CC;
1456
- cursor:hand;"/>
1457
- </td>
1458
- <td><input type="radio" id="edit_correct_six" name="edit_correct_answer" value=6 /></td>
1459
- </tr>
1460
- <tr>
1461
- <td><span style='font-weight:bold;'>Correct Answer Info:</span></td>
1462
- <td colspan="3"><input type="text" name="edit_correct_answer_info" value="" id="edit_correct_answer_info" style="border-color:#000000;
1463
- color:#3300CC;
1464
- cursor:hand;
1465
- width:550px;"/></td>
1466
- </tr>
1467
- <tr valign="top">
1468
- <td><span style='font-weight:bold;'>Hint</span></td>
1469
- <td colspan="3">
1470
- <input type="text" name="edit_hint" value="" id="edit_hint" style="border-color:#000000;
1471
- color:#3300CC;
1472
- cursor:hand;
1473
- width:550px;"/>
1474
- </td>
1475
- </tr>
1476
- <tr><td>&nbsp;</td></tr>
1477
- <tr><td>&nbsp;</td></tr>
1478
- <tr valign="top">
1479
- <td><span style='font-weight:bold;'>Question Type?</span></td>
1480
- <td colspan="3"><div id="edit_question_type">
1481
- <input type="radio" id="editTypeRadio1" name="edit_question_type" checked="checked" value=0 /><label for="editTypeRadio1">Normal (Vertical Radio)</label>
1482
- <input type="radio" id="editTypeRadio2" name="edit_question_type" value=1 /><label for="editTypeRadio2">Horizontal Radio</label>
1483
- <input type="radio" id="editTypeRadio3" name="edit_question_type" value=2 /><label for="editTypeRadio3">Drop Down</label>
1484
- <input type="radio" id="editTypeRadio4" name="edit_question_type" value=3 /><label for="editTypeRadio4">Open Answer</label>
1485
- </div></td>
1486
- </tr>
1487
- <tr valign="top">
1488
- <td><span style='font-weight:bold;'>Comment Field?</span></td>
1489
- <td colspan="3"><div id="edit_comments">
1490
- <input type="radio" id="editCommentRadio1" name="edit_comments" value=0 /><label for="editCommentRadio1">Small Text Field</label>
1491
- <input type="radio" id="editCommentRadio3" name="edit_comments" value=2 /><label for="editCommentRadio3">Large Text Field</label>
1492
- <input type="radio" id="editCommentRadio2" name="edit_comments" value=1 /><label for="editCommentRadio2">None</label>
1493
- </div></td>
1494
- </tr>
1495
- <tr valign="top">
1496
- <td><span style='font-weight:bold;'>Question Order</span></td>
1497
- <td>
1498
- <input type="number" step="1" min="1" name="edit_question_order" value="" id="edit_question_order" style="border-color:#000000;
1499
- color:#3300CC;
1500
- cursor:hand;"/>
1501
- </td>
1502
- </tr>
1503
- </table>
1504
- <?php
1505
- echo "<p class='submit'><input type='submit' class='button-primary' value='Edit Question' /></p>";
1506
- echo "</form>";
1507
- ?>
1508
- </div>
1509
 
1510
  </div>
1511
  <div id="tabs-2">
@@ -1769,8 +1662,9 @@ function mlw_generate_quiz_options()
1769
  <tr valign="top">
1770
  <th scope="row"><label for="randomness_order">Are the questions random? (Question Order will not apply if this is yes)</label></th>
1771
  <td><div id="randomness_order">
 
 
1772
  <input type="radio" id="radio23" name="randomness_order" <?php if ($mlw_quiz_options->randomness_order == 0) {echo 'checked="checked"';} ?> value='0' /><label for="radio23">No</label>
1773
- <input type="radio" id="radio24" name="randomness_order" <?php if ($mlw_quiz_options->randomness_order == 1) {echo 'checked="checked"';} ?> value='1' /><label for="radio24">Yes</label>
1774
  </div></td>
1775
  </tr>
1776
  <tr valign="top">
@@ -1841,7 +1735,7 @@ function mlw_generate_quiz_options()
1841
  </div></td>
1842
  </tr>
1843
  <tr valign="top">
1844
- <th scope="row"><label for="adminEmail">What email should we send the admin email to?</label></th>
1845
  <td><input name="adminEmail" type="email" id="adminEmail" value="<?php echo $mlw_quiz_options->admin_email; ?>" class="regular-text" /></td>
1846
  </tr>
1847
  <tr valign="top">
37
  {
38
  //Variables from edit question form
39
  $edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  $edit_question_answer_info = $_POST["edit_correct_answer_info"];
41
  $mlw_edit_question_id = intval($_POST["edit_question_id"]);
42
  $mlw_edit_question_type = $_POST["edit_question_type"];
43
  $edit_comments = htmlspecialchars($_POST["edit_comments"], ENT_QUOTES);
44
  $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
45
  $edit_question_order = intval($_POST["edit_question_order"]);
46
+ $mlw_edit_answer_total = intval($_POST["question_".$mlw_edit_question_id."_answer_total"]);
47
+ $i = 1;
48
+ $mlw_qmn_new_answer_array = array();
49
+ while ($i <= $mlw_edit_answer_total)
50
+ {
51
+ if ($_POST["edit_answer_".$i] != "")
52
+ {
53
+ $mlw_qmn_correct = 0;
54
+ if (isset($_POST["edit_answer_".$i."_correct"]) && $_POST["edit_answer_".$i."_correct"] == 1)
55
+ {
56
+ $mlw_qmn_correct = 1;
57
+ }
58
+ $mlw_qmn_answer_each = array(htmlspecialchars(stripslashes($_POST["edit_answer_".$i]), ENT_QUOTES), intval($_POST["edit_answer_".$i."_points"]), $mlw_qmn_correct);
59
+ $mlw_qmn_new_answer_array[] = $mlw_qmn_answer_each;
60
+ }
61
+ $i++;
62
+ }
63
+ $mlw_qmn_new_answer_array = serialize($mlw_qmn_new_answer_array);
64
  $quiz_id = $_POST["quiz_id"];
65
 
66
+ $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."',answer_array='".$mlw_qmn_new_answer_array."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."' WHERE question_id=".$mlw_edit_question_id;
67
  $results = $wpdb->query( $update );
68
  if ($results != false)
69
  {
119
  {
120
  //Variables from new question form
121
  $question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["question_name"], ENT_QUOTES))));
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  $question_answer_info = $_POST["correct_answer_info"];
123
  $question_type = $_POST["question_type"];
124
  $comments = htmlspecialchars($_POST["comments"], ENT_QUOTES);
125
  $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
126
  $new_question_order = intval($_POST["new_question_order"]);
127
+ $mlw_answer_total = intval($_POST["new_question_answer_total"]);
128
+ $i = 1;
129
+ $mlw_qmn_new_answer_array = array();
130
+ while ($i <= $mlw_answer_total)
131
+ {
132
+ if ($_POST["answer_".$i] != "")
133
+ {
134
+ $mlw_qmn_correct = 0;
135
+ if (isset($_POST["answer_".$i."_correct"]) && $_POST["answer_".$i."_correct"] == 1)
136
+ {
137
+ $mlw_qmn_correct = 1;
138
+ }
139
+ $mlw_qmn_answer_each = array(htmlspecialchars(stripslashes($_POST["answer_".$i]), ENT_QUOTES), intval($_POST["answer_".$i."_points"]), $mlw_qmn_correct);
140
+ $mlw_qmn_new_answer_array[] = $mlw_qmn_answer_each;
141
+ }
142
+ $i++;
143
+ }
144
+ $mlw_qmn_new_answer_array = serialize($mlw_qmn_new_answer_array);
145
  $quiz_id = $_POST["quiz_id"];
146
  $table_name = $wpdb->prefix . "mlw_questions";
147
  $insert = "INSERT INTO " . $table_name .
148
+ " (question_id, quiz_id, question_name, answer_array, question_answer_info, comments, hints, question_order, question_type, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '".$mlw_qmn_new_answer_array."', '".$question_answer_info."', '".$comments."', '".$hint."', ".$new_question_order.", '".$question_type."', 0)";
149
  $results = $wpdb->query( $insert );
150
  if ($results != false)
151
  {
621
  }
622
  }
623
 
624
+ //Load and prepare answer arrays
625
+ $mlw_qmn_answer_arrays = array();
626
+ foreach($mlw_question_data as $mlw_question_info) {
627
+ $mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
628
+ if ( !is_array($mlw_qmn_answer_array_each) )
629
+ {
630
+ $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
631
+ $mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
632
+ $mlw_qmn_answer_arrays[$mlw_question_info->question_id] = array(
633
+ array($mlw_question_info->answer_one, $mlw_question_info->answer_one_points, $mlw_answer_array_correct[0]),
634
+ array($mlw_question_info->answer_two, $mlw_question_info->answer_two_points, $mlw_answer_array_correct[1]),
635
+ array($mlw_question_info->answer_three, $mlw_question_info->answer_three_points, $mlw_answer_array_correct[2]),
636
+ array($mlw_question_info->answer_four, $mlw_question_info->answer_four_points, $mlw_answer_array_correct[3]),
637
+ array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
638
+ array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
639
+ }
640
+ else
641
+ {
642
+ $mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
643
+ }
644
+ }
645
+
646
+
647
  //Load Certificate Options Variables
648
  $mlw_certificate_options = @unserialize($mlw_quiz_options->certificate_template);
649
  if (!is_array($mlw_certificate_options)) {
894
  $j(function() {
895
  $j( "#comments" ).buttonset();
896
  });
 
 
 
 
 
 
897
  $j(function() {
898
  $j( "#enableCertificates" ).buttonset();
899
  });
 
 
 
900
  $j(function() {
901
+ $j("button, #prev_page, #next_page, #new_email_button_top, #new_email_button_bottom, #new_answer_button").button();
902
 
903
  });
904
  $j(function() {
942
  idText.innerHTML = id;
943
  idHidden.value = id;
944
  };
945
+ function editQuestion(id){
946
+ $j("#edit_question_dialog_"+id).dialog({
947
  autoOpen: false,
948
  show: 'blind',
949
  width:800,
954
  }
955
  }
956
  });
957
+ $j("#edit_question_dialog_"+id).dialog('open');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958
  };
959
  function delete_landing(id)
960
  {
966
  document.getElementById('user_email_'+id).value = "Delete";
967
  document.mlw_quiz_save_email_form.submit();
968
  }
969
+ function mlw_add_new_question(id)
970
+ {
971
+ var total_answers = parseFloat(document.getElementById("question_"+id+"_answer_total").value);
972
+ total_answers = total_answers + 1;
973
+ document.getElementById("question_"+id+"_answer_total").value = total_answers;
974
+ jQuery("#question_"+id+"_answers").append("<tr valign='top'><td><span style='font-weight:bold;'>Answer "+total_answers+"</span></td><td><input type='text' name='edit_answer_"+total_answers+"' id='edit_answer_"+total_answers+"' style='border-color:#000000;color:#3300CC;cursor:hand;width: 250px;'/></td><td><input type='text' name='edit_answer_"+total_answers+"_points' id='edit_answer_"+total_answers+"_points' value=0 style='border-color:#000000;color:#3300CC; cursor:hand;'/></td><td><input type='checkbox' id='edit_answer_"+total_answers+"_correct' name='edit_answer_"+total_answers+"_correct' value=1 /></td></tr>");
975
+ }
976
+ function mlw_add_answer_to_new_question()
977
+ {
978
+ var total_answers = parseFloat(document.getElementById("new_question_answer_total").value);
979
+ total_answers = total_answers + 1;
980
+ document.getElementById("new_question_answer_total").value = total_answers;
981
+ jQuery("#new_question_answers").append("<tr valign='top'><td><span style='font-weight:bold;'>Answer "+total_answers+"</span></td><td><input type='text' name='answer_"+total_answers+"' id='answer_"+total_answers+"' style='border-color:#000000;color:#3300CC;cursor:hand;width: 250px;'/></td><td><input type='text' name='answer_"+total_answers+"_points' id='answer_"+total_answers+"_points' value=0 style='border-color:#000000;color:#3300CC; cursor:hand;'/></td><td><input type='checkbox' id='answer_"+total_answers+"_correct' name='answer_"+total_answers+"_correct' value=1 /></td></tr>");
982
+ }
983
  </script>
984
  <div class="wrap">
985
  <div class='mlw_quiz_options'>
1129
  <li><a href="#tabs-4">Quiz Leaderboard</a></li>
1130
  <li><a href="#tabs-5">Quiz Certificate (Beta)</a></li>
1131
  <li><a href="#tabs-9">Quiz Emails</a></li>
1132
+ <li><a href="#tabs-6">Quiz Results Page</a></li>
1133
  <li><a href="#tabs-7">Quiz Styling</a></li>
1134
  <li><a href="#tabs-8">Quiz Tools</a></li>
1135
  </ul>
1145
  else $alternate = " class=\"alternate\"";
1146
  $question_list .= "<tr{$alternate}>";
1147
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
1148
+ $question_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_question_info->question_name ."</span><div><span style='color:green;font-size:12px;'><a onclick=\"editQuestion('".$mlw_question_info->question_id."')\" href='#'>Edit</a> | <a onclick=\"deleteQuestion('".$mlw_question_info->question_id."')\" href='#'>Delete</a></span></div></td>";
1149
  $question_list .= "</tr>";
1150
+
1151
+
1152
+ $mlw_question_answer_array = $mlw_qmn_answer_arrays[$mlw_question_info->question_id];
1153
+ ?>
1154
+ <div id="edit_question_dialog_<?php echo $mlw_question_info->question_id; ?>" title="Edit Question" style="display:none;">
1155
+ <?php
1156
+ echo "<form action='' method='post'>";
1157
+ echo "<input type='hidden' name='edit_question' value='confirmation' />";
1158
+ echo "<input type='hidden' id='edit_question_id' name='edit_question_id' value='".$mlw_question_info->question_id."' />";
1159
+ echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1160
+ ?>
1161
+ <table class="wide" style="text-align: left; white-space: nowrap;" id="question_<?php echo $mlw_question_info->question_id; ?>_answers" name="question_<?php echo $mlw_question_info->question_id; ?>_answers">
1162
+ <tr>
1163
+ <td><span style='font-weight:bold;'>Question</span></td>
1164
+ <td colspan="3">
1165
+ <textarea name="edit_question_name" id="edit_question_name" style="width: 500px; height: 150px;"><?php echo htmlspecialchars_decode($mlw_question_info->question_name, ENT_QUOTES); ?></textarea>
1166
+ </td>
1167
+ </tr>
1168
+ <tr valign="top">
1169
+ <td>&nbsp;</td>
1170
+ <td>&nbsp;</td>
1171
+ </tr>
1172
+ <tr valign="top">
1173
+ <td>&nbsp;</td>
1174
+ <td><span style='font-weight:bold;'>Answers</span></td>
1175
+ <td><span style='font-weight:bold;'>Points Worth</span></td>
1176
+ <td><span style='font-weight:bold;'>Correct Answer</span></td>
1177
+ </tr>
1178
+ <?php
1179
+ $mlw_answer_total = 0;
1180
+ foreach($mlw_question_answer_array as $mlw_question_answer_each)
1181
+ {
1182
+ $mlw_answer_total = $mlw_answer_total + 1;
1183
+ ?>
1184
+ <tr valign="top">
1185
+ <td><span style='font-weight:bold;'>Answer <?php echo $mlw_answer_total; ?></span></td>
1186
+ <td>
1187
+ <input type="text" name="edit_answer_<?php echo $mlw_answer_total; ?>" id="edit_answer_<?php echo $mlw_answer_total; ?>" value="<?php echo esc_attr(htmlspecialchars_decode($mlw_question_answer_each[0], ENT_QUOTES)); ?>" style="border-color:#000000;
1188
+ color:#3300CC;
1189
+ cursor:hand;
1190
+ width: 250px;"/>
1191
+ </td>
1192
+ <td>
1193
+ <input type="text" name="edit_answer_<?php echo $mlw_answer_total; ?>_points" id="edit_answer_<?php echo $mlw_answer_total; ?>_points" value="<?php echo $mlw_question_answer_each[1]; ?>" style="border-color:#000000;
1194
+ color:#3300CC;
1195
+ cursor:hand;"/>
1196
+ </td>
1197
+ <td><input type="checkbox" id="edit_answer_<?php echo $mlw_answer_total; ?>_correct" name="edit_answer_<?php echo $mlw_answer_total; ?>_correct" <?php if ($mlw_question_answer_each[2] == 1) { echo 'checked="checked"'; } ?> value=1 /></td>
1198
+ </tr>
1199
+ <?php
1200
+ }
1201
+ ?>
1202
+ </table>
1203
+ <a href="#" id="new_answer_button" onclick="mlw_add_new_question(<?php echo $mlw_question_info->question_id; ?>);">Add New Answer!</a>
1204
+ <br />
1205
+ <br />
1206
+ <table class="wide" style="text-align: left; white-space: nowrap;">
1207
+ <tr>
1208
+ <td><span style='font-weight:bold;'>Correct Answer Info:</span></td>
1209
+ <td colspan="3"><input type="text" name="edit_correct_answer_info" id="edit_correct_answer_info" style="border-color:#000000;
1210
+ color:#3300CC;
1211
+ cursor:hand;
1212
+ width:550px;" value="<?php echo esc_attr(htmlspecialchars_decode($mlw_question_info->question_answer_info, ENT_QUOTES)); ?>"/></td>
1213
+ </tr>
1214
+ <tr valign="top">
1215
+ <td><span style='font-weight:bold;'>Hint</span></td>
1216
+ <td colspan="3">
1217
+ <input type="text" name="edit_hint" id="edit_hint" style="border-color:#000000;
1218
+ color:#3300CC;
1219
+ cursor:hand;
1220
+ width:550px;" value="<?php echo htmlspecialchars_decode($mlw_question_info->hints, ENT_QUOTES); ?>"/>
1221
+ </td>
1222
+ </tr>
1223
+ <tr><td>&nbsp;</td></tr>
1224
+ <tr><td>&nbsp;</td></tr>
1225
+ <tr valign="top">
1226
+ <td><span style='font-weight:bold;'>Question Type?</span></td>
1227
+ <td colspan="3">
1228
+ <select name="edit_question_type">
1229
+ <option value="0" <?php if ($mlw_question_info->question_type == 0) { echo 'selected="selected"'; } ?>>Normal Multiple Choice (Vertical Radio)</option>
1230
+ <option value="1" <?php if ($mlw_question_info->question_type == 1) { echo 'selected="selected"'; } ?>>Horizontal Multiple Choice (Horizontal Radio)</option>
1231
+ <option value="2" <?php if ($mlw_question_info->question_type == 2) { echo 'selected="selected"'; } ?>>Drop Down (Select)</option>
1232
+ <option value="3" <?php if ($mlw_question_info->question_type == 3) { echo 'selected="selected"'; } ?>>Open Answer (Text Input)</option>
1233
+ <option value="4" <?php if ($mlw_question_info->question_type == 4) { echo 'selected="selected"'; } ?>>Multiple Response (Checkbox)</option>
1234
+ </select>
1235
+ </div></td>
1236
+ </tr>
1237
+ <tr valign="top">
1238
+ <td><span style='font-weight:bold;'>Comment Field?</span></td>
1239
+ <td colspan="3">
1240
+ <input type="radio" id="<?php echo $mlw_question_info->question_id; ?>_editCommentRadio1" name="edit_comments" value=0 <?php if ($mlw_question_info->comments == 0) { echo 'checked="checked"'; } ?>/><label for="<?php echo $mlw_question_info->question_id; ?>_editCommentRadio1">Small Text Field</label>
1241
+ <input type="radio" id="<?php echo $mlw_question_info->question_id; ?>_editCommentRadio3" name="edit_comments" value=2 <?php if ($mlw_question_info->comments == 2) { echo 'checked="checked"'; } ?>/><label for="<?php echo $mlw_question_info->question_id; ?>_editCommentRadio3">Large Text Field</label>
1242
+ <input type="radio" id="<?php echo $mlw_question_info->question_id; ?>_editCommentRadio2" name="edit_comments" value=1 <?php if ($mlw_question_info->comments == 1) { echo 'checked="checked"'; } ?>/><label for="<?php echo $mlw_question_info->question_id; ?>_editCommentRadio2">None</label>
1243
+ </td>
1244
+ </tr>
1245
+ <tr valign="top">
1246
+ <td><span style='font-weight:bold;'>Question Order</span></td>
1247
+ <td>
1248
+ <input type="number" step="1" min="1" name="edit_question_order" value="<?php echo $mlw_question_info->question_order; ?>" id="edit_question_order" style="border-color:#000000;
1249
+ color:#3300CC;
1250
+ cursor:hand;"/>
1251
+ </td>
1252
+ </tr>
1253
+ </table>
1254
+ <input type="hidden" name="question_<?php echo $mlw_question_info->question_id; ?>_answer_total" id="question_<?php echo $mlw_question_info->question_id; ?>_answer_total" value="<?php echo $mlw_answer_total; ?>" />
1255
+ <p class='submit'><input type='submit' class='button-primary' value='Edit Question' /></p>
1256
+ </form>
1257
+ </div>
1258
+
1259
+ <?php
1260
  }
1261
 
1262
  if( $mlw_qmn_question_page > 0 )
1302
  echo "<input type='hidden' name='create_question' value='confirmation' />";
1303
  echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
1304
  ?>
1305
+ <table class="wide" style="text-align: left; white-space: nowrap;" id="new_question_answers" name="new_question_answers">
1306
  <tr>
1307
  <td><span style='font-weight:bold;'>Question</span></td>
1308
  <td colspan="3">
1319
  <td><span style='font-weight:bold;'>Points Worth<a href="#" title="If you have your quiz set up using the point system, enter how many points this answer is worth here. If you are not using the point system, leave this as 0.">?</a></span></td>
1320
  <td><span style='font-weight:bold;'>Correct Answer<a href="#" title="Select the correct answer.">?</a></span></td>
1321
  </tr>
1322
+ <?php
1323
+ $mlw_answer_total = 0;
1324
+ $mlw_answer_total = $mlw_answer_total + 1;
1325
+ ?>
1326
  <tr valign="top">
1327
+ <td><span style='font-weight:bold;'>Answer <?php echo $mlw_answer_total; ?></span></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1328
  <td>
1329
+ <input type="text" name="answer_<?php echo $mlw_answer_total; ?>" id="answer_<?php echo $mlw_answer_total; ?>" value="" style="border-color:#000000;
1330
  color:#3300CC;
1331
  cursor:hand;
1332
  width: 250px;"/>
1333
  </td>
1334
  <td>
1335
+ <input type="text" name="answer_<?php echo $mlw_answer_total; ?>_points" id="answer_<?php echo $mlw_answer_total; ?>_points" value=0 style="border-color:#000000;
1336
  color:#3300CC;
1337
  cursor:hand;"/>
1338
  </td>
1339
+ <td><input type="checkbox" id="answer_<?php echo $mlw_answer_total; ?>_correct" name="answer_<?php echo $mlw_answer_total; ?>_correct" checked="checked" value=1 /></td>
1340
  </tr>
1341
+ </table>
1342
+ <a href="#" id="new_answer_button" onclick="mlw_add_answer_to_new_question();">Add New Answer!</a>
1343
+ <br />
1344
+ <br />
1345
+ <table class="wide" style="text-align: left; white-space: nowrap;">
1346
  <tr>
1347
  <td><span style='font-weight:bold;'>Correct Answer Info<a href="#" title="Enter in the reason why the correct answer is correct. Add this to the %QUESTIONS_ANSWERS% template using the new %CORRECT_ANSWER_INFO% variable.">?</a></span></td>
1348
  <td colspan="3"><input type="text" name="correct_answer_info" value="" id="correct_answer_info" style="border-color:#000000;
1363
  <tr><td>&nbsp;</td></tr>
1364
  <tr valign="top">
1365
  <td><span style='font-weight:bold;'>Question Type<a href="#" title="The normal setting will show the question as it would normally; the horizontal setting will show the answers going across rather than down; the drop down setting will show the answers in a drop down menu instead of the raidio button." >?</a></span></td>
1366
+ <td colspan="3">
1367
+ <select name="question_type">
1368
+ <option value="0" selected="selected">Normal Multiple Choice (Vertical Radio)</option>
1369
+ <option value="1">Horizontal Multiple Choice (Horizontal Radio)</option>
1370
+ <option value="2">Drop Down (Select)</option>
1371
+ <option value="3">Open Answer (Text Input)</option>
1372
+ <option value="4">Multiple Response (Checkbox)</option>
1373
+ </select>
1374
  </div></td>
1375
  </tr>
1376
  <tr valign="top">
1390
  </td>
1391
  </tr>
1392
  </table>
1393
+ <input type="hidden" name="new_question_answer_total" id="new_question_answer_total" value="<?php echo $mlw_answer_total; ?>" />
1394
  <?php
1395
  echo "<p class='submit'><input type='submit' class='button-primary' value='Create Question' /></p>";
1396
  echo "</form>";
1398
  </div>
1399
 
1400
 
1401
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1402
 
1403
  </div>
1404
  <div id="tabs-2">
1662
  <tr valign="top">
1663
  <th scope="row"><label for="randomness_order">Are the questions random? (Question Order will not apply if this is yes)</label></th>
1664
  <td><div id="randomness_order">
1665
+ <input type="radio" id="radio24" name="randomness_order" <?php if ($mlw_quiz_options->randomness_order == 1) {echo 'checked="checked"';} ?> value='1' /><label for="radio24">Random Questions</label>
1666
+ <input type="radio" id="randomness2" name="randomness_order" <?php if ($mlw_quiz_options->randomness_order == 2) {echo 'checked="checked"';} ?> value='2' /><label for="randomness2">Random Questions And Answers</label>
1667
  <input type="radio" id="radio23" name="randomness_order" <?php if ($mlw_quiz_options->randomness_order == 0) {echo 'checked="checked"';} ?> value='0' /><label for="radio23">No</label>
 
1668
  </div></td>
1669
  </tr>
1670
  <tr valign="top">
1735
  </div></td>
1736
  </tr>
1737
  <tr valign="top">
1738
+ <th scope="row"><label for="adminEmail">What emails should we send the admin email to? Separate emails with a comma.</label></th>
1739
  <td><input name="adminEmail" type="email" id="adminEmail" value="<?php echo $mlw_quiz_options->admin_email; ?>" class="regular-text" /></td>
1740
  </tr>
1741
  <tr valign="top">
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 = "2.4.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
@@ -266,6 +266,15 @@ function mlw_quiz_update()
266
  $results = $wpdb->query( $update_sql );
267
  }
268
 
 
 
 
 
 
 
 
 
 
269
  update_option('mlw_quiz_master_version' , $data);
270
  if(!isset($_GET['activate-multi']))
271
  {
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 = "2.5.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
266
  $results = $wpdb->query( $update_sql );
267
  }
268
 
269
+ //Update 2.5.1
270
+ if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'answer_array'") != "answer_array")
271
+ {
272
+ $sql = "ALTER TABLE ".$table_name." ADD answer_array TEXT NOT NULL AFTER question_name";
273
+ $results = $wpdb->query( $sql );
274
+ $update_sql = "UPDATE ".$table_name." SET answer_array=''";
275
+ $results = $wpdb->query( $update_sql );
276
+ }
277
+
278
  update_option('mlw_quiz_master_version' , $data);
279
  if(!isset($_GET['activate-multi']))
280
  {
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: 2.4.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
@@ -73,11 +73,34 @@ function mlw_add_menu()
73
  //Admin Notice
74
  add_action('admin_notices', 'mlw_qmn_notice');
75
  function mlw_qmn_notice() {
76
- if ( get_option('mlw_qmn_review_notice') == 1 && current_user_can( 'manage_options' ) ) {
77
- echo '<div class="updated"><p>';
78
- printf(__('You have been using the Quiz Master Next plugin for a while now! Thanks for choosing to use this plugin. If it has benefited your website, please consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ">donation</a>, a <a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next">review</a>, or taking this <a href="http://mylocalwebstop.com/sample-survey/" target="_blank">survey</a>. | <a href="%1$s">Hide Notice</a>'), '?mlw_qmn_ignore_notice=0');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  echo "</p></div>";
80
- }
81
  }
82
  //Check to see if notices should be shown or dismissed
83
  add_action('admin_init', 'mlw_qmn_notice_ignore');
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 2.5.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
73
  //Admin Notice
74
  add_action('admin_notices', 'mlw_qmn_notice');
75
  function mlw_qmn_notice() {
76
+ if ( get_option('mlw_qmn_review_notice') == 1 && current_user_can( 'manage_options' ) )
77
+ {
78
+ echo "
79
+ <style>
80
+ div.help_decide
81
+ {
82
+ display: block;
83
+ text-align:center;
84
+ letter-spacing: 1px;
85
+ margin: auto;
86
+ text-shadow: 0 1px 1px #000000;
87
+ background: #0d97d8;
88
+ border: 5px solid #106daa;
89
+ -moz-border-radius: 20px;
90
+ -webkit-border-radius: 20px;
91
+ -khtml-border-radius: 20px;
92
+ border-radius: 20px;
93
+ color: #FFFFFF;
94
+ }
95
+ div.help_decide a
96
+ {
97
+ color: yellow;
98
+ }
99
+ </style>";
100
+ echo '<div class="help_decide"><p>';
101
+ printf(__('You have been using the Quiz Master Next plugin for a while now! Thanks for choosing to use this plugin. If it has benefited your website, please consider purchasing an <a href="http://mylocalwebstop.com/shop/">add-on</a>, a <a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next">review</a>, or taking this <a href="http://mylocalwebstop.com/sample-survey/" target="_blank">survey</a>. | <a href="%1$s">Hide Notice</a>'), '?page=quiz-master-next/mlw_quizmaster2.php&&mlw_qmn_ignore_notice=0');
102
  echo "</p></div>";
103
+ }
104
  }
105
  //Check to see if notices should be shown or dismissed
106
  add_action('admin_init', 'mlw_qmn_notice_ignore');
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, survey, contact, form, email, answer, question
5
  Requires at least: 3.6
6
  Tested up to: 3.9
7
- Stable tag: 2.4.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.
@@ -14,13 +14,13 @@ The easiest and most flexible way to add multiple quizzes, tests, and surveys to
14
  The easiest and most flexible way to add multiple quizzes, tests, and surveys to your website. This plugin allows for unlimited quizzes each with unlimited amount of questions. The plugin allows you to create the quiz, add it to any page using a customized shortcode, allows the user to take the quiz, and then saves the results. You can set up what the user sees after he or she takes the quiz based on the user's score. You can also have the plugin create a certificate for the user as well!
15
 
16
  = Have Unlimted Quizzes, Tests, Surveys, Contact Forms, etc.. =
17
- Each of your quizzes can have **unlimited** questions! Your questions can contain **HTML** to show images, Youtube videos and more.
18
 
19
  = Customize Your Text =
20
  All the text your users see can be **customized**. Everything from the text blocks throughout the quiz to the submit button.
21
 
22
  = Different Types Of Questions =
23
- You can have *multiple choice* (radio buttons), *true and false*, and *open answer* question. More types are being supported in future updates!
24
 
25
  = Mulitple Landing Pages For Each Quiz =
26
  Each quiz can have **unlimited** results pages that can be customized with your text. Show different results pages based on the users score!
@@ -92,9 +92,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
92
 
93
  == Screenshots ==
94
 
95
- 1. Quiz Admin Page
96
- 2. Quiz Options Page
97
- 3. Quiz Dashboard Page
98
  4. Example Quiz
99
  5. Example Survey
100
  6. Quiz Results Page
@@ -102,6 +102,14 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
102
 
103
  == Changelog ==
104
 
 
 
 
 
 
 
 
 
105
  = 2.4.1 (April 20, 2014) =
106
  * Added New Quiz Emails Tab
107
  * Added Ability To Send Different Emails To Users Based On Score
@@ -419,6 +427,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
419
 
420
  == Upgrade Notice ==
421
 
 
 
 
422
  = 2.4.1 =
423
  Upgrade to be able to send different emails based on user's score. Also, minor bug fixes included.
424
 
4
  Tags: quiz, test, score, survey, contact, form, email, answer, question
5
  Requires at least: 3.6
6
  Tested up to: 3.9
7
+ Stable tag: 2.5.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.
14
  The easiest and most flexible way to add multiple quizzes, tests, and surveys to your website. This plugin allows for unlimited quizzes each with unlimited amount of questions. The plugin allows you to create the quiz, add it to any page using a customized shortcode, allows the user to take the quiz, and then saves the results. You can set up what the user sees after he or she takes the quiz based on the user's score. You can also have the plugin create a certificate for the user as well!
15
 
16
  = Have Unlimted Quizzes, Tests, Surveys, Contact Forms, etc.. =
17
+ Each of your quizzes can have **unlimited** questions and each of those questions can have **unlimited** answers! Your questions can contain **HTML** to show images, Youtube videos and more.
18
 
19
  = Customize Your Text =
20
  All the text your users see can be **customized**. Everything from the text blocks throughout the quiz to the submit button.
21
 
22
  = Different Types Of Questions =
23
+ You can have **multiple choice** (radio buttons), **true and false**, **open answer** question, **drop down**, and **multiple response** (checkboxes). More types are being supported in future updates!
24
 
25
  = Mulitple Landing Pages For Each Quiz =
26
  Each quiz can have **unlimited** results pages that can be customized with your text. Show different results pages based on the users score!
92
 
93
  == Screenshots ==
94
 
95
+ 1. Quiz Admin Page (With Advertisement Be Gone Add-On)
96
+ 2. Quiz Options Page (With Advertisement Be Gone Add-On)
97
+ 3. Quiz Dashboard Page (With Advertisement Be Gone Add-On)
98
  4. Example Quiz
99
  5. Example Survey
100
  6. Quiz Results Page
102
 
103
  == Changelog ==
104
 
105
+ = 2.5.1 (May 3, 2014) =
106
+ * Rebuilt Answer System
107
+ * Added Ability To Have Unlimited Answers
108
+ * Added Ability To Randomize Answers
109
+ * Added New Question Type - Multiple Response (Checkboxes)
110
+ * Added Ability To Send Admin Email To Multiple Users
111
+ * Minor Design Changes To Quiz Options Page
112
+
113
  = 2.4.1 (April 20, 2014) =
114
  * Added New Quiz Emails Tab
115
  * Added Ability To Send Different Emails To Users Based On Score
427
 
428
  == Upgrade Notice ==
429
 
430
+ = 2.5.1 =
431
+ Upgrade for many new features including unlimited answers, random answers, new question type, and more!
432
+
433
  = 2.4.1 =
434
  Upgrade to be able to send different emails based on user's score. Also, minor bug fixes included.
435