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

Version Description

(March 19, 2014) = * Fixed Duplicate Quiz Bug * Fixed Uneditable Question Bug * Fixed Parse Bug * Made Email Now Send As HTML

Download this release

Release Info

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

Code changes from version 1.9.5 to 1.9.6

includes/mlw_qmn_credits.php CHANGED
@@ -57,12 +57,10 @@ function mlw_generate_about_page()
57
  <hr />
58
  <h3>What's New In <?php echo $mlw_quiz_version; ?></h3>
59
  <ul>
60
- <li>Added Ability To Delete Landing Pages</li>
61
- <li>Added Ability To Have HTML In Correct Answer Info Field</li>
62
- <li>Added %CURRENT_DATE% field to show current date</li>
63
- <li>Added Previous Question Button To Paginated Quiz</li>
64
- <li>Add Timer To Title Bar</li>
65
- <li>Minor Design Changes To Quiz</li>
66
  </ul>
67
  <h3>What's Coming Soon</h3>
68
  <ul>
57
  <hr />
58
  <h3>What's New In <?php echo $mlw_quiz_version; ?></h3>
59
  <ul>
60
+ <li>Fixed Duplicate Quiz Bug</li>
61
+ <li>Fixed Uneditable Question Bug</li>
62
+ <li>Fixed Parse Bug</li>
63
+ <li>Made Email Now Send As HTML</li>
 
 
64
  </ul>
65
  <h3>What's Coming Soon</h3>
66
  <ul>
includes/mlw_quiz.php CHANGED
@@ -1,992 +1,1010 @@
1
- <?php
2
- /*
3
- This function is the very heart of the plugin. This function displays the quiz to the user as well as handles all the scripts that are part of the quiz. Please be very careful if you are editing this script without my assistance.
4
- */
5
- function mlw_quiz_shortcode($atts)
6
- {
7
- extract(shortcode_atts(array(
8
- 'quiz' => 0
9
- ), $atts));
10
-
11
-
12
-
13
- /*
14
- Code before loading the quiz
15
- */
16
-
17
- //Variables needed throughout script
18
- $mlw_quiz_id = $quiz;
19
- $mlw_display = "";
20
- global $wpdb;
21
- $mlw_qmn_isAllowed = true;
22
- $mlw_qmn_section_count = 1;
23
- $mlw_qmn_section_limit = 0;
24
-
25
-
26
- //Load quiz
27
- $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
28
- $mlw_quiz_options = $wpdb->get_results($sql);
29
-
30
- foreach($mlw_quiz_options as $mlw_eaches) {
31
- $mlw_quiz_options = $mlw_eaches;
32
- break;
33
- }
34
-
35
- //Check to see if there is limit on the amount of tries
36
- if ( $mlw_quiz_options->total_user_tries != 0 && is_user_logged_in() )
37
- {
38
- $current_user = wp_get_current_user();
39
- $mlw_qmn_user_try_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_results WHERE email='%s' AND deleted='0' AND quiz_id=%d", $current_user->user_email, $mlw_quiz_id ) );
40
- if ($mlw_qmn_user_try_count >= $mlw_quiz_options->total_user_tries) { $mlw_qmn_isAllowed = false; }
41
- }
42
-
43
-
44
- //Load questions
45
- $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_questions" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' ";
46
- if ($mlw_quiz_options->randomness_order == 0)
47
- {
48
- $sql .= "ORDER BY question_order ASC";
49
- }
50
- if ($mlw_quiz_options->randomness_order == 1)
51
- {
52
- $sql .= "ORDER BY rand()";
53
- }
54
- if ($mlw_quiz_options->question_from_total != 0)
55
- {
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
62
- if (isset($_POST["complete_quiz"]) && $_POST["complete_quiz"] == "confirmation")
63
- {
64
- $mlw_success = $_POST["complete_quiz"];
65
- $mlw_user_name = isset($_POST["mlwUserName"]) ? $_POST["mlwUserName"] : 'None';
66
- $mlw_user_comp = isset($_POST["mlwUserComp"]) ? $_POST["mlwUserComp"] : 'None';
67
- $mlw_user_email = isset($_POST["mlwUserEmail"]) ? $_POST["mlwUserEmail"] : 'None';
68
- $mlw_user_phone = isset($_POST["mlwUserPhone"]) ? $_POST["mlwUserPhone"] : 'None';
69
- $mlw_qmn_timer = isset($_POST["timer"]) ? $_POST["timer"] : 0;
70
- $mlw_spam_email = $_POST["email"];
71
- }
72
-
73
- wp_enqueue_script( 'jquery' );
74
- wp_enqueue_script( 'jquery-ui-core' );
75
- wp_enqueue_script( 'jquery-effects-core' );
76
- wp_enqueue_script( 'jquery-effects-slide' );
77
- wp_enqueue_script( 'jquery-ui-dialog' );
78
- wp_enqueue_script( 'jquery-ui-button' );
79
- wp_enqueue_script( 'jquery-ui-accordion' );
80
- wp_enqueue_script( 'jquery-ui-tooltip' );
81
- wp_enqueue_script( 'jquery-ui-tabs' );
82
- ?>
83
- <!-- css -->
84
- <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
85
- <script type="text/javascript">
86
- var $j = jQuery.noConflict();
87
- // increase the default animation speed to exaggerate the effect
88
- $j.fx.speeds._default = 1000;
89
- $j(function() {
90
- $j( document ).tooltip();
91
- });
92
- </script>
93
- <style type="text/css">
94
- .ui-tooltip
95
- {
96
- /* tooltip container box */
97
- max-width: 500px !important;
98
- }
99
- .ui-tooltip-content
100
- {
101
- /* tooltip content */
102
- max-width: 500px !important;
103
- }
104
- </style>
105
- <?php
106
-
107
- /*
108
- The following code is for displaying the quiz and completion screen
109
- */
110
-
111
- //If there is no quiz for the shortcode provided
112
- if ($mlw_quiz_options->quiz_name == "")
113
- {
114
- $mlw_display .= "It appears that this quiz is not set up correctly.";
115
- return $mlw_display;
116
- }
117
-
118
- //Display Quiz
119
- if (!isset($_POST["complete_quiz"]) && $mlw_quiz_options->quiz_name != "" && $mlw_qmn_isAllowed)
120
- {
121
- $mlw_qmn_total_questions = 0;
122
- //Calculate number of pages if pagination is turned on
123
- if ($mlw_quiz_options->pagination != 0)
124
- {
125
- $mlw_qmn_section_limit = 2 + $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_questions WHERE quiz_id=%d AND deleted=0", $mlw_quiz_id ) );
126
- if ($mlw_quiz_options->comment_section == 0)
127
- {
128
- $mlw_qmn_section_limit = $mlw_qmn_section_limit + 1;
129
- }
130
-
131
- //Gather text for pagination buttons
132
- $mlw_qmn_pagination_text = "";
133
- $mlw_qmn_pagination_text = @unserialize($mlw_quiz_options->pagination_text);
134
- if (!is_array($mlw_qmn_pagination_text)) {
135
- $mlw_qmn_pagination_text = array('Previous', $mlw_quiz_options->pagination_text);
136
- }
137
- ?>
138
- <script type="text/javascript">
139
- var $j = jQuery.noConflict();
140
- $j(function() {
141
- $j( ".quiz_section" ).hide();
142
- $j( ".quiz_section" ).append( "<br />" );
143
- $j( ".quiz_section" ).not( ".quiz_begin" ).append( "<a class=\"mlw_qmn_quiz_link\" href='#' onclick=\"prevSlide();\"><?php echo $mlw_qmn_pagination_text[0]; ?></a>" );
144
- $j( ".quiz_section" ).not( ".quiz_end" ).append( "<a class=\"mlw_qmn_quiz_link\" href='#' onclick=\"nextSlide();\"><?php echo $mlw_qmn_pagination_text[1]; ?></a>" );
145
- window.mlw_quiz_slide = 0;
146
- window.mlw_quiz_total_slides = <?php echo $mlw_qmn_section_limit; ?>;
147
- nextSlide();
148
- });
149
- function nextSlide()
150
- {
151
- window.mlw_quiz_slide++;
152
- if (window.mlw_quiz_slide == window.mlw_quiz_total_slides)
153
- {
154
- $j(".quiz_link").html("Submit");
155
- }
156
- if (window.mlw_quiz_slide > window.mlw_quiz_total_slides)
157
- {
158
- document.quizForm.submit();
159
- exit();
160
- }
161
- y = window.mlw_quiz_slide-1;
162
- $j( ".quiz_section.slide"+y ).hide();
163
- $j( ".quiz_section.slide"+window.mlw_quiz_slide ).show( "slide", {direction: "right"}, 300 );
164
-
165
- }
166
- function prevSlide()
167
- {
168
- window.mlw_quiz_slide--;
169
- if (window.mlw_quiz_slide == window.mlw_quiz_total_slides)
170
- {
171
- $j(".quiz_link").html("Submit");
172
- }
173
- if (window.mlw_quiz_slide > window.mlw_quiz_total_slides)
174
- {
175
- document.quizForm.submit();
176
- exit();
177
- }
178
- y = window.mlw_quiz_slide+1;
179
- $j( ".quiz_section.slide"+y ).hide();
180
- $j( ".quiz_section.slide"+window.mlw_quiz_slide ).show( "slide", {direction: "left"}, 300 );
181
- }
182
- </script>
183
- <style type="text/css">
184
- a.mlw_qmn_quiz_link
185
- {
186
- border-radius: 4px;
187
- position: relative;
188
- background-image: linear-gradient(#fff,#dedede);
189
- background-color: #eee;
190
- border: #ccc solid 1px;
191
- color: #333;
192
- text-shadow: 0 1px 0 rgba(255,255,255,.5);
193
- box-sizing: border-box;
194
- display: inline-block;
195
- padding: 5px 5px 5px 5px;
196
- margin: auto;
197
- }
198
- </style>
199
- <?php
200
- }
201
- if ($mlw_quiz_options->timer_limit != 0)
202
- {
203
- ?>
204
- <div id="mlw_qmn_timer"></div>
205
- <script type="text/javascript">
206
- var minutes = <?php echo $mlw_quiz_options->timer_limit; ?>;
207
- window.amount = (minutes*60);
208
- window.titleText = window.document.title;
209
- document.getElementById("mlw_qmn_timer").innerHTML = minToSec(window.amount);
210
- window.counter=setInterval(timer, 1000); //1000 will run it every 1 second
211
- function timer()
212
- {
213
- window.amount=window.amount-1;
214
- document.getElementById("mlw_qmn_timer").innerHTML = minToSec(window.amount);
215
- window.document.title = minToSec(window.amount) + " " + window.titleText;
216
- if (window.amount <= 0)
217
- {
218
- clearInterval(window.counter);
219
- document.quizForm.submit();
220
- return;
221
- }
222
- }
223
- function minToSec(amount)
224
- {
225
- var minutes = Math.floor(amount/60);
226
- var seconds = amount - (minutes * 60);
227
- if (seconds == '0')
228
- {
229
- seconds = "00";
230
- }
231
- else if (seconds < 10)
232
- {
233
- seconds = '0' + seconds;
234
- }
235
- return minutes+":"+seconds;
236
- }
237
- </script>
238
- <style type="text/css">
239
- #mlw_qmn_timer {
240
- position:fixed;
241
- top:200px;
242
- right:0px;
243
- width:130px;
244
- color:#00CCFF;
245
- border-radius: 15px;
246
- background:#000000;
247
- text-align: center;
248
- padding: 15px 15px 15px 15px
249
- }
250
- </style>
251
- <?php
252
- }
253
-
254
- ?>
255
- <script type="text/javascript">
256
- var myVar=setInterval("mlwQmnTimer();",1000);
257
- function mlwQmnTimer()
258
- {
259
- var x = +document.getElementById("timer").value;
260
- x = x + 1;
261
- document.getElementById("timer").value = x;
262
- }
263
-
264
- </script>
265
- <style type="text/css">
266
- div.mlw_qmn_quiz input[type=radio],
267
- div.mlw_qmn_quiz input[type=submit],
268
- div.mlw_qmn_quiz label {
269
- cursor: pointer;
270
- }
271
- div.mlw_qmn_quiz input:not([type=submit]):focus,
272
- div.mlw_qmn_quiz textarea:focus {
273
- background: #eaeaea;
274
- }
275
- div.mlw_qmn_quiz_section
276
- {
277
-
278
- }
279
- </style>
280
- <?
281
- //Update the quiz views
282
- $mlw_views = $mlw_quiz_options->quiz_views;
283
- $mlw_views += 1;
284
- $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views='".$mlw_views."' WHERE quiz_id=".$mlw_quiz_id;
285
- $results = $wpdb->query( $update );
286
-
287
- //Form validation script
288
- $mlw_display .= "
289
- <script>
290
- function clear_field(field)
291
- {
292
- if (field.defaultValue == field.value) field.value = '';
293
- }
294
-
295
- function mlw_validateForm()
296
- {
297
- ";
298
- if ($mlw_quiz_options->user_name == 1)
299
- {
300
- $mlw_display .= "
301
- var x=document.forms['quizForm']['mlwUserName'].value;
302
- if (x==null || x=='')
303
- {
304
- document.getElementById('mlw_error_message').innerHTML = '**Name must be filled out!**';
305
- document.getElementById('mlw_error_message_bottom').innerHTML = '**Name must be filled out!**';
306
- return false;
307
- }";
308
- }
309
- if ($mlw_quiz_options->user_comp == 1)
310
- {
311
- $mlw_display .= "
312
- var x=document.forms['quizForm']['mlwUserComp'].value;
313
- if (x==null || x=='')
314
- {
315
- document.getElementById('mlw_error_message').innerHTML = '**Business must be filled out!**';
316
- document.getElementById('mlw_error_message_bottom').innerHTML = '**Business must be filled out!**';
317
- return false;
318
- }";
319
- }
320
- if ($mlw_quiz_options->user_email == 1)
321
- {
322
- $mlw_display .= "
323
- var x=document.forms['quizForm']['mlwUserEmail'].value;
324
- if (x==null || x=='')
325
- {
326
- document.getElementById('mlw_error_message').innerHTML = '**Email must be filled out!**';
327
- document.getElementById('mlw_error_message_bottom').innerHTML = '**Email must be filled out!**';
328
- return false;
329
- }";
330
- }
331
- if ($mlw_quiz_options->user_phone == 1)
332
- {
333
- $mlw_display .= "
334
- var x=document.forms['quizForm']['mlwUserPhone'].value;
335
- if (x==null || x=='')
336
- {
337
- document.getElementById('mlw_error_message').innerHTML = '**Phone number must be filled out!**';
338
- document.getElementById('mlw_error_message_bottom').innerHTML = '**Phone number must be filled out!**';
339
- return false;
340
- }";
341
- }
342
- $mlw_display .= "
343
- if (document.forms['quizForm']['mlwUserEmail'].defaultValue != document.forms['quizForm']['mlwUserEmail'].value)
344
- {
345
- var x=document.forms['quizForm']['mlwUserEmail'].value;
346
- var atpos=x.indexOf('@');
347
- var dotpos=x.lastIndexOf('.');
348
- if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
349
- {
350
- document.getElementById('mlw_error_message').innerHTML = '**Not a valid e-mail address!**';
351
- document.getElementById('mlw_error_message_bottom').innerHTML = '**Not a valid e-mail address!**';
352
- return false;
353
- }
354
- }
355
- }
356
- </script>";
357
-
358
- //Begin the quiz
359
- $mlw_display .= "<div class='mlw_qmn_quiz'>";
360
- $mlw_display .= "<form name='quizForm' action='' method='post' class='mlw_quiz_form' onsubmit='return mlw_validateForm()' >";
361
- $mlw_display .= "<div class='quiz_section quiz_begin slide".$mlw_qmn_section_count."'>";
362
- $mlw_message_before = $mlw_quiz_options->message_before;
363
- $mlw_message_before = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_before);
364
- $mlw_message_before = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_before);
365
- $mlw_display .= "<span>".$mlw_message_before."</span><br />";
366
- $mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
367
-
368
- if ($mlw_quiz_options->contact_info_location == 0)
369
- {
370
- $mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
371
- }
372
- $mlw_display .= "</div>";
373
-
374
- //Display the questions
375
- foreach($mlw_questions as $mlw_question) {
376
- $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
377
- $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
378
- $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count."'>";
379
- $mlw_display .= "<span style='font-weight:bold;'>".htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
380
- if ($mlw_question->question_type == 0)
381
- {
382
- if ($mlw_question->answer_one != "")
383
- {
384
- $mlw_display .= "<input type='radio' required 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>";
385
- $mlw_display .= "<br />";
386
- }
387
- if ($mlw_question->answer_two != "")
388
- {
389
- $mlw_display .= "<input type='radio' required 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>";
390
- $mlw_display .= "<br />";
391
- }
392
- if ($mlw_question->answer_three != "")
393
- {
394
- $mlw_display .= "<input type='radio' required 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>";
395
- $mlw_display .= "<br />";
396
- }
397
- if ($mlw_question->answer_four != "")
398
- {
399
- $mlw_display .= "<input type='radio' required 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>";
400
- $mlw_display .= "<br />";
401
- }
402
- if ($mlw_question->answer_five != "")
403
- {
404
- $mlw_display .= "<input type='radio' required 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>";
405
- $mlw_display .= "<br />";
406
- }
407
- if ($mlw_question->answer_six != "")
408
- {
409
- $mlw_display .= "<input type='radio' required 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>";
410
- $mlw_display .= "<br />";
411
- }
412
- }
413
- elseif ($mlw_question->question_type == 1)
414
- {
415
- if ($mlw_question->answer_one != "")
416
- {
417
- $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='1' />".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES);
418
- }
419
- if ($mlw_question->answer_two != "")
420
- {
421
- $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='2' />".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES);
422
- }
423
- if ($mlw_question->answer_three != "")
424
- {
425
- $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='3' />".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES);
426
- }
427
- if ($mlw_question->answer_four != "")
428
- {
429
- $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='4' />".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES);
430
- }
431
- if ($mlw_question->answer_five != "")
432
- {
433
- $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='5' />".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES);
434
- }
435
- if ($mlw_question->answer_six != "")
436
- {
437
- $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='6' />".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES);
438
- }
439
- $mlw_display .= "<br />";
440
- }
441
- else
442
- {
443
- $mlw_display .= "<select required name='question".$mlw_question->question_id."'>";
444
- if ($mlw_question->answer_one != "")
445
- {
446
- $mlw_display .= "<option value='1'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</option>";
447
- }
448
- if ($mlw_question->answer_two != "")
449
- {
450
- $mlw_display .= "<option value='2'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</option>";
451
- }
452
- if ($mlw_question->answer_three != "")
453
- {
454
- $mlw_display .= "<option value='3'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</option>";
455
- }
456
- if ($mlw_question->answer_four != "")
457
- {
458
- $mlw_display .= "<option value='4'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</option>";
459
- }
460
- if ($mlw_question->answer_five != "")
461
- {
462
- $mlw_display .= "<option value='5'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</option>";
463
- }
464
- if ($mlw_question->answer_six != "")
465
- {
466
- $mlw_display .= "<option value='6'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</option>";
467
- }
468
- $mlw_display .= "</select>";
469
- $mlw_display .= "<br />";
470
- }
471
- if ($mlw_question->comments == 0)
472
- {
473
- $mlw_display .= "<input type='text' x-webkit-speech id='mlwComment".$mlw_question->question_id."' name='mlwComment".$mlw_question->question_id."' value='".$mlw_quiz_options->comment_field_text."' onclick='clear_field(this)'/>";
474
- $mlw_display .= "<br />";
475
- }
476
- if ($mlw_question->comments == 2)
477
- {
478
- $mlw_display .= "<textarea cols='70' rows='5' id='mlwComment".$mlw_question->question_id."' name='mlwComment".$mlw_question->question_id."' onclick='clear_field(this)'>".$mlw_quiz_options->comment_field_text."</textarea>";
479
- $mlw_display .= "<br />";
480
- }
481
- if ($mlw_question->hints != "")
482
- {
483
- $mlw_display .= "<span title=\"".htmlspecialchars_decode($mlw_question->hints, ENT_QUOTES)."\" style=\"text-decoration:underline;color:rgb(0,0,255);\">Hint</span>";
484
- $mlw_display .= "<br /><br />";
485
- }
486
- $mlw_display .= "</div>";
487
- if ( $mlw_quiz_options->pagination == 0) { $mlw_display .= "<br />"; }
488
- }
489
-
490
- //Display comment box if needed
491
- if ($mlw_quiz_options->comment_section == 0)
492
- {
493
- $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
494
- $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count."'>";
495
- $mlw_message_comments = $mlw_quiz_options->message_comment;
496
- $mlw_message_comments = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_comments);
497
- $mlw_message_comments = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_comments);
498
- $mlw_display .= "<label for='mlwQuizComments' style='font-weight:bold;'>".$mlw_message_comments."</label><br />";
499
- $mlw_display .= "<textarea cols='70' rows='15' id='mlwQuizComments' name='mlwQuizComments' ></textarea>";
500
- $mlw_display .= "</div>";
501
- if ( $mlw_quiz_options->pagination == 0) { $mlw_display .= "<br /><br />"; }
502
- }
503
- $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
504
- $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count." quiz_end'>";
505
- if ($mlw_quiz_options->message_end_template != '')
506
- {
507
- $mlw_message_end = $mlw_quiz_options->message_end_template;
508
- $mlw_message_end = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_end);
509
- $mlw_message_end = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_end);
510
- $mlw_display .= "<span>".$mlw_message_end."</span>";
511
- $mlw_display .= "<br /><br />";
512
- }
513
- if ($mlw_quiz_options->contact_info_location == 1)
514
- {
515
- $mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
516
- }
517
- $mlw_display .= "<span style='display: none;'>If you are human, leave this field blank or you will be considered spam:</span>";
518
- $mlw_display .= "<input style='display: none;' type='text' name='email' id='email' />";
519
- $mlw_display .= "<input type='hidden' name='total_questions' id='total_questions' value='".$mlw_qmn_total_questions."'/>";
520
- $mlw_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
521
- $mlw_display .= "<input type='hidden' name='complete_quiz' value='confirmation' />";
522
- $mlw_display .= "<input type='submit' value='".$mlw_quiz_options->submit_button_text."' />";
523
- $mlw_display .= "<span name='mlw_error_message_bottom' id='mlw_error_message_bottom' style='color: red;'></span><br />";
524
- $mlw_display .= "</form>";
525
- $mlw_display .= "</div>";
526
- $mlw_display .= "</div>";
527
-
528
- }
529
- //Display Completion Screen
530
- else
531
- {
532
- if (empty($mlw_spam_email) && $mlw_qmn_isAllowed)
533
- {
534
-
535
- //Load questions
536
- $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_questions" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' ";
537
- if ($mlw_quiz_options->randomness_order == 0)
538
- {
539
- $sql .= "ORDER BY question_order ASC";
540
- }
541
- if ($mlw_quiz_options->randomness_order == 1)
542
- {
543
- $sql .= "ORDER BY rand()";
544
- }
545
- $mlw_questions = $wpdb->get_results($sql);
546
-
547
- //Variables needed for scoring
548
- $mlw_points = 0;
549
- $mlw_correct = 0;
550
- $mlw_total_questions = 0;
551
- $mlw_total_score = 0;
552
- $mlw_question_answers = "";
553
- isset($_POST["total_questions"]) ? $mlw_total_questions = intval($_POST["total_questions"]) : $mlw_total_questions = 0;
554
-
555
- //Update the amount of times the quiz has been taken
556
- $mlw_taken = $mlw_quiz_options->quiz_taken;
557
- $mlw_taken += 1;
558
- $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_taken='".$mlw_taken."' WHERE quiz_id=".$mlw_quiz_id;
559
- $results = $wpdb->query( $update );
560
-
561
- //See which answers were correct and award points if necessary
562
- foreach($mlw_questions as $mlw_question) {
563
- if (isset($_POST["question".$mlw_question->question_id]) || isset($_POST["mlwComment".$mlw_question->question_id]))
564
- {
565
- $mlw_user_text;
566
- $mlw_correct_text;
567
- //$mlw_total_questions += 1;
568
- if (isset($_POST["question".$mlw_question->question_id]))
569
- {
570
- $mlw_user_answer = $_POST["question".$mlw_question->question_id];
571
- if ($mlw_user_answer == $mlw_question->correct_answer)
572
- {
573
- $mlw_correct += 1;
574
- }
575
- if ($mlw_user_answer == 1)
576
- {
577
- $mlw_points += $mlw_question->answer_one_points;
578
- $mlw_user_text = $mlw_question->answer_one;
579
- }
580
- if ($mlw_user_answer == 2)
581
- {
582
- $mlw_points += $mlw_question->answer_two_points;
583
- $mlw_user_text = $mlw_question->answer_two;
584
- }
585
- if ($mlw_user_answer == 3)
586
- {
587
- $mlw_points += $mlw_question->answer_three_points;
588
- $mlw_user_text = $mlw_question->answer_three;
589
- }
590
- if ($mlw_user_answer == 4)
591
- {
592
- $mlw_points += $mlw_question->answer_four_points;
593
- $mlw_user_text = $mlw_question->answer_four;
594
- }
595
- if ($mlw_user_answer == 5)
596
- {
597
- $mlw_points += $mlw_question->answer_five_points;
598
- $mlw_user_text = $mlw_question->answer_five;
599
- }
600
- if ($mlw_user_answer == 6)
601
- {
602
- $mlw_points += $mlw_question->answer_six_points;
603
- $mlw_user_text = $mlw_question->answer_six;
604
- }
605
-
606
- if ($mlw_question->correct_answer == 1) {$mlw_correct_text = $mlw_question->answer_one;}
607
- if ($mlw_question->correct_answer == 2) {$mlw_correct_text = $mlw_question->answer_two;}
608
- if ($mlw_question->correct_answer == 3) {$mlw_correct_text = $mlw_question->answer_three;}
609
- if ($mlw_question->correct_answer == 4) {$mlw_correct_text = $mlw_question->answer_four;}
610
- if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
611
- if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
612
- }
613
- if (isset($_POST["mlwComment".$mlw_question->question_id]))
614
- {
615
- $mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
616
- }
617
- else
618
- {
619
- $mlw_qm_question_comment = "";
620
- }
621
-
622
- $mlw_question_answer_display = $mlw_quiz_options->question_answer_template;
623
- $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
624
- $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
625
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
626
- $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $mlw_qm_question_comment, $mlw_question_answer_display);
627
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($mlw_question->question_answer_info), $mlw_question_answer_display);
628
-
629
- $mlw_question_answers .= $mlw_question_answer_display;
630
- $mlw_question_answers .= "<br />";
631
- }
632
- }
633
-
634
- //Calculate Total Percent Score And Average Points Only If Total Questions Doesn't Equal Zero To Avoid Division By Zero Error
635
- if ($mlw_total_questions != 0)
636
- {
637
- $mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
638
- $mlw_average_points = round(($mlw_points/$mlw_total_questions), 2);
639
- }
640
- else
641
- {
642
- $mlw_total_score = 0;
643
- $mlw_average_points = 0;
644
- }
645
-
646
- //Prepare comment section if set
647
- if (isset($_POST["mlwQuizComments"]))
648
- {
649
- $mlw_qm_quiz_comments = $_POST["mlwQuizComments"];
650
- }
651
- else
652
- {
653
- $mlw_qm_quiz_comments = "";
654
- }
655
-
656
-
657
- //Prepare Certificate
658
- $mlw_certificate_link = "";
659
- $mlw_certificate_options = unserialize($mlw_quiz_options->certificate_template);
660
- if (!is_array($mlw_certificate_options)) {
661
- // something went wrong, initialize to empty array
662
- $mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
663
- }
664
- if ($mlw_certificate_options[4] == 0)
665
- {
666
- $mlw_message_certificate = $mlw_certificate_options[1];
667
- $mlw_message_certificate = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_certificate);
668
- $mlw_message_certificate = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_certificate);
669
- $mlw_message_certificate = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_certificate);
670
- $mlw_message_certificate = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_certificate);
671
- $mlw_message_certificate = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_certificate);
672
- $mlw_message_certificate = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_certificate);
673
- $mlw_message_certificate = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_certificate);
674
- $mlw_message_certificate = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_certificate);
675
- $mlw_message_certificate = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_certificate);
676
- $mlw_message_certificate = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_certificate);
677
- $mlw_message_certificate = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_certificate);
678
- $mlw_message_certificate = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_certificate);
679
- $mlw_message_certificate = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_certificate);
680
- $mlw_message_certificate = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_certificate);
681
- $mlw_message_certificate = str_replace( "\n" , "<br>", $mlw_message_certificate);
682
- $mlw_plugindirpath = plugin_dir_path( __FILE__ );
683
- $plugindirpath=plugin_dir_path( __FILE__ );
684
- $mlw_qmn_certificate_file=<<<EOC
685
- <?php
686
- include("$plugindirpath/WriteHTML.php");
687
- \$pdf=new PDF_HTML();
688
- \$pdf->AddPage('L');
689
- EOC;
690
- $mlw_qmn_certificate_file.=$mlw_certificate_options[3] != '' ? '$pdf->Image("'.$mlw_certificate_options[3].'",0,0,$pdf->w, $pdf->h);' : '';
691
- $mlw_qmn_certificate_file.=<<<EOC
692
- \$pdf->Ln(20);
693
- \$pdf->SetFont('Arial','B',24);
694
- \$pdf->MultiCell(280,20,'$mlw_certificate_options[0]',0,'C');
695
- \$pdf->Ln(15);
696
- \$pdf->SetFont('Arial','',16);
697
- \$pdf->WriteHTML("<p align='center'>$mlw_message_certificate</p>");
698
- EOC;
699
- $mlw_qmn_certificate_file.=$mlw_certificate_options[2] != '' ? '$pdf->Image("'.$mlw_certificate_options[2].'",110,130);' : '';
700
- $mlw_qmn_certificate_file.=<<<EOC
701
- \$pdf->Output('mlw_qmn_certificate.pdf','D');
702
- unlink(__FILE__);
703
- EOC;
704
- $mlw_qmn_certificate_filename = str_replace(home_url()."/", '', plugin_dir_url( __FILE__ ))."certificates/mlw_qmn_quiz".date("YmdHis").$mlw_qmn_timer.".php";
705
- file_put_contents($mlw_qmn_certificate_filename, $mlw_qmn_certificate_file);
706
- $mlw_qmn_certificate_filename = plugin_dir_url( __FILE__ )."certificates/mlw_qmn_quiz".date("YmdHis").$mlw_qmn_timer.".php";
707
- $mlw_certificate_link = "<a href='".$mlw_qmn_certificate_filename."' style='color: blue;'>Download Certificate</a>";
708
- }
709
-
710
- /*
711
- Prepare the landing page
712
- -First, unserialize message_after column
713
- -Second, check for array in case user has not updated
714
- Message array = (array( bottomvalue, topvalue, text),array( bottomvalue, topvalue, text), etc..., array(0,0,text))
715
- */
716
- $mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
717
- if (is_array($mlw_message_after_array))
718
- {
719
- //Cycle through landing pages
720
- foreach($mlw_message_after_array as $mlw_each)
721
- {
722
- //Check to see if default
723
- if ($mlw_each[0] == 0 && $mlw_each[1] == 0)
724
- {
725
- $mlw_message_after = $mlw_each[2];
726
- $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
727
- $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
728
- $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
729
- $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
730
- $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
731
- $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
732
- $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
733
- $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
734
- $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
735
- $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
736
- $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
737
- $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
738
- $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
739
- $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
740
- $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
741
- $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
742
- $mlw_display .= $mlw_message_after;
743
- break;
744
- }
745
- else
746
- {
747
- //Check to see if points fall in correct range
748
- if ($mlw_points >= $mlw_each[0] && $mlw_points <= $mlw_each[1])
749
- {
750
- $mlw_message_after = $mlw_each[2];
751
- $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
752
- $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
753
- $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
754
- $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
755
- $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
756
- $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
757
- $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
758
- $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
759
- $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
760
- $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
761
- $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
762
- $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
763
- $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
764
- $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
765
- $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
766
- $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
767
- $mlw_display .= $mlw_message_after;
768
- break;
769
- }
770
- //Check to see if score fall in correct range
771
- if ($mlw_total_score >= $mlw_each[0] && $mlw_total_score <= $mlw_each[1])
772
- {
773
- $mlw_message_after = $mlw_each[2];
774
- $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
775
- $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
776
- $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
777
- $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
778
- $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
779
- $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
780
- $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
781
- $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
782
- $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
783
- $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
784
- $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
785
- $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
786
- $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
787
- $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
788
- $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
789
- $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
790
- $mlw_display .= $mlw_message_after;
791
- break;
792
- }
793
- }
794
- }
795
- }
796
- else
797
- {
798
- //Prepare the after quiz message
799
- $mlw_message_after = $mlw_quiz_options->message_after;
800
- $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
801
- $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
802
- $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
803
- $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
804
- $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
805
- $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
806
- $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
807
- $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
808
- $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
809
- $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
810
- $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
811
- $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
812
- $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
813
- $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
814
- $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
815
- $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
816
- $mlw_display .= $mlw_message_after;
817
- }
818
-
819
- if ($mlw_quiz_options->social_media == 1)
820
- {
821
- $mlw_social_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_quiz_options->social_media_text);
822
- $mlw_social_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_social_message);
823
- $mlw_social_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_social_message);
824
- $mlw_social_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_social_message);
825
- $mlw_social_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_social_message);
826
- $mlw_social_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_social_message);
827
- $mlw_social_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_social_message);
828
- $mlw_social_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_social_message);
829
- $mlw_display .= "<br />
830
- <a href=\"https://twitter.com/share\" data-size=\"large\" data-text=\"".esc_attr($mlw_social_message)."\" class=\"twitter-share-button\" data-lang=\"en\">Tweet</a>
831
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"https://platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script>
832
- <br />";
833
- }
834
-
835
- //Prepare and send the user email
836
- $mlw_message = "";
837
- if ($mlw_quiz_options->send_user_email == "0")
838
- {
839
- if ($mlw_user_email != "")
840
- {
841
- $mlw_message = $mlw_quiz_options->user_email_template;
842
- $mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
843
- $mlw_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message);
844
- $mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
845
- $mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
846
- $mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
847
- $mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
848
- $mlw_message = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message);
849
- $mlw_message = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message);
850
- $mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
851
- $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
852
- $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
853
- $mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
854
- $mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
855
- $mlw_message = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message);
856
- $mlw_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message);
857
- $mlw_message = str_replace( "<br />" , "\n", $mlw_message);
858
- $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
859
- wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
860
- }
861
- }
862
-
863
- //Prepare and send the admin email
864
- $mlw_message = "";
865
- if ($mlw_quiz_options->send_admin_email == "0")
866
- {
867
- $mlw_message = $mlw_quiz_options->admin_email_template;
868
- $mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
869
- $mlw_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message);
870
- $mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
871
- $mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
872
- $mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
873
- $mlw_message = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message);
874
- $mlw_message = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message);
875
- $mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
876
- $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
877
- $mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
878
- $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
879
- $mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
880
- $mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
881
- $mlw_message = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message);
882
- $mlw_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message);
883
- $mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
884
- $mlw_message = str_replace( "<br />" , "\n", $mlw_message);
885
- $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
886
- wp_mail($mlw_quiz_options->admin_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
887
- }
888
-
889
- //Save the results into database
890
- $mlw_quiz_results = "Quiz was taken in: ".$mlw_qmn_timer." seconds."."\n".$mlw_question_answers."\n".$mlw_qm_quiz_comments;
891
- $mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
892
- $mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
893
- global $wpdb;
894
- $table_name = $wpdb->prefix . "mlw_results";
895
- $insert = "INSERT INTO " . $table_name .
896
- "(result_id, quiz_id, quiz_name, quiz_system, point_score, correct_score, correct, total, name, business, email, phone, time_taken, time_taken_real, quiz_results, deleted) " .
897
- "VALUES (NULL , " . $mlw_quiz_id . " , '".$mlw_quiz_options->quiz_name."', ".$mlw_quiz_options->system.", ".$mlw_points.", ".$mlw_total_score.", ".$mlw_correct.", ".$mlw_total_questions.", '".$mlw_user_name."', '".$mlw_user_comp."', '".$mlw_user_email."', '".$mlw_user_phone."', '".date("h:i:s A m/d/Y")."', '".date("Y-m-d H:i:s")."', '".$mlw_quiz_results."', 0)";
898
- $results = $wpdb->query( $insert );
899
- }
900
- else
901
- {
902
- if (!$mlw_qmn_isAllowed)
903
- {
904
- $mlw_display .= $mlw_quiz_options->total_user_tries_text;
905
- }
906
- else { $mlw_display .= "Thank you."; }
907
- }
908
- }
909
- return $mlw_display;
910
- }
911
-
912
-
913
- /*
914
- This function displays fields to ask for contact information
915
- */
916
- function mlwDisplayContactInfo($mlw_quiz_options)
917
- {
918
- $mlw_contact_display = "";
919
- //Check to see if user is logged in, then ask for contact if not
920
- if ( is_user_logged_in() )
921
- {
922
- //If this quiz does not let user edit contact information we hide this section
923
- if ($mlw_quiz_options->loggedin_user_contact == 1)
924
- {
925
- $mlw_contact_display .= "<div style='display:none;'>";
926
- }
927
-
928
- //Retrieve current user information and save into text fields for contact information
929
- $current_user = wp_get_current_user();
930
- if ($mlw_quiz_options->user_name != 2)
931
- {
932
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
933
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserName' value='".$current_user->display_name."' />";
934
- $mlw_contact_display .= "<br /><br />";
935
-
936
- }
937
- if ($mlw_quiz_options->user_comp != 2)
938
- {
939
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
940
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserComp' value='' />";
941
- $mlw_contact_display .= "<br /><br />";
942
- }
943
- if ($mlw_quiz_options->user_email != 2)
944
- {
945
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
946
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserEmail' value='".$current_user->user_email."' />";
947
- $mlw_contact_display .= "<br /><br />";
948
- }
949
- if ($mlw_quiz_options->user_phone != 2)
950
- {
951
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
952
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserPhone' value='' />";
953
- $mlw_contact_display .= "<br /><br />";
954
- }
955
-
956
- //End of hidden section div
957
- if ($mlw_quiz_options->loggedin_user_contact == 1)
958
- {
959
- $mlw_contact_display .= "</div>";
960
- }
961
- }
962
- else
963
- {
964
- //See if the site wants to ask for any contact information, then ask for it
965
- if ($mlw_quiz_options->user_name != 2)
966
- {
967
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
968
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserName' value='' />";
969
- $mlw_contact_display .= "<br /><br />";
970
- }
971
- if ($mlw_quiz_options->user_comp != 2)
972
- {
973
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
974
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserComp' value='' />";
975
- $mlw_contact_display .= "<br /><br />";
976
- }
977
- if ($mlw_quiz_options->user_email != 2)
978
- {
979
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
980
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserEmail' value='' />";
981
- $mlw_contact_display .= "<br /><br />";
982
- }
983
- if ($mlw_quiz_options->user_phone != 2)
984
- {
985
- $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
986
- $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserPhone' value='' />";
987
- $mlw_contact_display .= "<br /><br />";
988
- }
989
- }
990
- return $mlw_contact_display;
991
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
992
  ?>
1
+ <?php
2
+ /*
3
+ This function is the very heart of the plugin. This function displays the quiz to the user as well as handles all the scripts that are part of the quiz. Please be very careful if you are editing this script without my assistance.
4
+ */
5
+ function mlw_quiz_shortcode($atts)
6
+ {
7
+ extract(shortcode_atts(array(
8
+ 'quiz' => 0
9
+ ), $atts));
10
+
11
+
12
+
13
+ /*
14
+ Code before loading the quiz
15
+ */
16
+
17
+ //Variables needed throughout script
18
+ $mlw_quiz_id = $quiz;
19
+ $mlw_display = "";
20
+ global $wpdb;
21
+ $mlw_qmn_isAllowed = true;
22
+ $mlw_qmn_section_count = 1;
23
+ $mlw_qmn_section_limit = 0;
24
+
25
+
26
+ //Load quiz
27
+ $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
28
+ $mlw_quiz_options = $wpdb->get_results($sql);
29
+
30
+ foreach($mlw_quiz_options as $mlw_eaches) {
31
+ $mlw_quiz_options = $mlw_eaches;
32
+ break;
33
+ }
34
+
35
+ //Check to see if there is limit on the amount of tries
36
+ if ( $mlw_quiz_options->total_user_tries != 0 && is_user_logged_in() )
37
+ {
38
+ $current_user = wp_get_current_user();
39
+ $mlw_qmn_user_try_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_results WHERE email='%s' AND deleted='0' AND quiz_id=%d", $current_user->user_email, $mlw_quiz_id ) );
40
+ if ($mlw_qmn_user_try_count >= $mlw_quiz_options->total_user_tries) { $mlw_qmn_isAllowed = false; }
41
+ }
42
+
43
+
44
+ //Load questions
45
+ $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_questions" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' ";
46
+ if ($mlw_quiz_options->randomness_order == 0)
47
+ {
48
+ $sql .= "ORDER BY question_order ASC";
49
+ }
50
+ if ($mlw_quiz_options->randomness_order == 1)
51
+ {
52
+ $sql .= "ORDER BY rand()";
53
+ }
54
+ if ($mlw_quiz_options->question_from_total != 0)
55
+ {
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
62
+ if (isset($_POST["complete_quiz"]) && $_POST["complete_quiz"] == "confirmation")
63
+ {
64
+ $mlw_success = $_POST["complete_quiz"];
65
+ $mlw_user_name = isset($_POST["mlwUserName"]) ? $_POST["mlwUserName"] : 'None';
66
+ $mlw_user_comp = isset($_POST["mlwUserComp"]) ? $_POST["mlwUserComp"] : 'None';
67
+ $mlw_user_email = isset($_POST["mlwUserEmail"]) ? $_POST["mlwUserEmail"] : 'None';
68
+ $mlw_user_phone = isset($_POST["mlwUserPhone"]) ? $_POST["mlwUserPhone"] : 'None';
69
+ $mlw_qmn_timer = isset($_POST["timer"]) ? $_POST["timer"] : 0;
70
+ $mlw_spam_email = $_POST["email"];
71
+ }
72
+
73
+ wp_enqueue_script( 'jquery' );
74
+ wp_enqueue_script( 'jquery-ui-core' );
75
+ wp_enqueue_script( 'jquery-effects-core' );
76
+ wp_enqueue_script( 'jquery-effects-slide' );
77
+ wp_enqueue_script( 'jquery-ui-dialog' );
78
+ wp_enqueue_script( 'jquery-ui-button' );
79
+ wp_enqueue_script( 'jquery-ui-accordion' );
80
+ wp_enqueue_script( 'jquery-ui-tooltip' );
81
+ wp_enqueue_script( 'jquery-ui-tabs' );
82
+ ?>
83
+ <!-- css -->
84
+ <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
85
+ <script type="text/javascript">
86
+ var $j = jQuery.noConflict();
87
+ // increase the default animation speed to exaggerate the effect
88
+ $j.fx.speeds._default = 1000;
89
+ $j(function() {
90
+ $j( document ).tooltip();
91
+ });
92
+ </script>
93
+ <style type="text/css">
94
+ .ui-tooltip
95
+ {
96
+ /* tooltip container box */
97
+ max-width: 500px !important;
98
+ }
99
+ .ui-tooltip-content
100
+ {
101
+ /* tooltip content */
102
+ max-width: 500px !important;
103
+ }
104
+ </style>
105
+ <?php
106
+
107
+ /*
108
+ The following code is for displaying the quiz and completion screen
109
+ */
110
+
111
+ //If there is no quiz for the shortcode provided
112
+ if ($mlw_quiz_options->quiz_name == "")
113
+ {
114
+ $mlw_display .= "It appears that this quiz is not set up correctly.";
115
+ return $mlw_display;
116
+ }
117
+
118
+ //Display Quiz
119
+ if (!isset($_POST["complete_quiz"]) && $mlw_quiz_options->quiz_name != "" && $mlw_qmn_isAllowed)
120
+ {
121
+ $mlw_qmn_total_questions = 0;
122
+ //Calculate number of pages if pagination is turned on
123
+ if ($mlw_quiz_options->pagination != 0)
124
+ {
125
+ $mlw_qmn_section_limit = 2 + $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_questions WHERE quiz_id=%d AND deleted=0", $mlw_quiz_id ) );
126
+ if ($mlw_quiz_options->comment_section == 0)
127
+ {
128
+ $mlw_qmn_section_limit = $mlw_qmn_section_limit + 1;
129
+ }
130
+
131
+ //Gather text for pagination buttons
132
+ $mlw_qmn_pagination_text = "";
133
+ $mlw_qmn_pagination_text = @unserialize($mlw_quiz_options->pagination_text);
134
+ if (!is_array($mlw_qmn_pagination_text)) {
135
+ $mlw_qmn_pagination_text = array('Previous', $mlw_quiz_options->pagination_text);
136
+ }
137
+ ?>
138
+ <script type="text/javascript">
139
+ var $j = jQuery.noConflict();
140
+ $j(function() {
141
+ $j( ".quiz_section" ).hide();
142
+ $j( ".quiz_section" ).append( "<br />" );
143
+ $j( ".quiz_section" ).not( ".quiz_begin" ).append( "<a class=\"mlw_qmn_quiz_link\" href='#' onclick=\"prevSlide();\"><?php echo $mlw_qmn_pagination_text[0]; ?></a>" );
144
+ $j( ".quiz_section" ).not( ".quiz_end" ).append( "<a class=\"mlw_qmn_quiz_link\" href='#' onclick=\"nextSlide();\"><?php echo $mlw_qmn_pagination_text[1]; ?></a>" );
145
+ window.mlw_quiz_slide = 0;
146
+ window.mlw_quiz_total_slides = <?php echo $mlw_qmn_section_limit; ?>;
147
+ nextSlide();
148
+ });
149
+ function nextSlide()
150
+ {
151
+ window.mlw_quiz_slide++;
152
+ if (window.mlw_quiz_slide == window.mlw_quiz_total_slides)
153
+ {
154
+ $j(".quiz_link").html("Submit");
155
+ }
156
+ if (window.mlw_quiz_slide > window.mlw_quiz_total_slides)
157
+ {
158
+ document.quizForm.submit();
159
+ exit();
160
+ }
161
+ y = window.mlw_quiz_slide-1;
162
+ $j( ".quiz_section.slide"+y ).hide();
163
+ $j( ".quiz_section.slide"+window.mlw_quiz_slide ).show( "slide", {direction: "right"}, 300 );
164
+
165
+ }
166
+ function prevSlide()
167
+ {
168
+ window.mlw_quiz_slide--;
169
+ if (window.mlw_quiz_slide == window.mlw_quiz_total_slides)
170
+ {
171
+ $j(".quiz_link").html("Submit");
172
+ }
173
+ if (window.mlw_quiz_slide > window.mlw_quiz_total_slides)
174
+ {
175
+ document.quizForm.submit();
176
+ exit();
177
+ }
178
+ y = window.mlw_quiz_slide+1;
179
+ $j( ".quiz_section.slide"+y ).hide();
180
+ $j( ".quiz_section.slide"+window.mlw_quiz_slide ).show( "slide", {direction: "left"}, 300 );
181
+ }
182
+ </script>
183
+ <style type="text/css">
184
+ a.mlw_qmn_quiz_link
185
+ {
186
+ border-radius: 4px;
187
+ position: relative;
188
+ background-image: linear-gradient(#fff,#dedede);
189
+ background-color: #eee;
190
+ border: #ccc solid 1px;
191
+ color: #333;
192
+ text-shadow: 0 1px 0 rgba(255,255,255,.5);
193
+ box-sizing: border-box;
194
+ display: inline-block;
195
+ padding: 5px 5px 5px 5px;
196
+ margin: auto;
197
+ }
198
+ </style>
199
+ <?php
200
+ }
201
+ if ($mlw_quiz_options->timer_limit != 0)
202
+ {
203
+ ?>
204
+ <div id="mlw_qmn_timer"></div>
205
+ <script type="text/javascript">
206
+ var minutes = <?php echo $mlw_quiz_options->timer_limit; ?>;
207
+ window.amount = (minutes*60);
208
+ window.titleText = window.document.title;
209
+ document.getElementById("mlw_qmn_timer").innerHTML = minToSec(window.amount);
210
+ window.counter=setInterval(timer, 1000); //1000 will run it every 1 second
211
+ function timer()
212
+ {
213
+ window.amount=window.amount-1;
214
+ document.getElementById("mlw_qmn_timer").innerHTML = minToSec(window.amount);
215
+ window.document.title = minToSec(window.amount) + " " + window.titleText;
216
+ if (window.amount <= 0)
217
+ {
218
+ clearInterval(window.counter);
219
+ document.quizForm.submit();
220
+ return;
221
+ }
222
+ }
223
+ function minToSec(amount)
224
+ {
225
+ var minutes = Math.floor(amount/60);
226
+ var seconds = amount - (minutes * 60);
227
+ if (seconds == '0')
228
+ {
229
+ seconds = "00";
230
+ }
231
+ else if (seconds < 10)
232
+ {
233
+ seconds = '0' + seconds;
234
+ }
235
+ return minutes+":"+seconds;
236
+ }
237
+ </script>
238
+ <style type="text/css">
239
+ #mlw_qmn_timer {
240
+ position:fixed;
241
+ top:200px;
242
+ right:0px;
243
+ width:130px;
244
+ color:#00CCFF;
245
+ border-radius: 15px;
246
+ background:#000000;
247
+ text-align: center;
248
+ padding: 15px 15px 15px 15px
249
+ }
250
+ </style>
251
+ <?php
252
+ }
253
+
254
+ ?>
255
+ <script type="text/javascript">
256
+ var myVar=setInterval("mlwQmnTimer();",1000);
257
+ function mlwQmnTimer()
258
+ {
259
+ var x = +document.getElementById("timer").value;
260
+ x = x + 1;
261
+ document.getElementById("timer").value = x;
262
+ }
263
+
264
+ </script>
265
+ <style type="text/css">
266
+ div.mlw_qmn_quiz input[type=radio],
267
+ div.mlw_qmn_quiz input[type=submit],
268
+ div.mlw_qmn_quiz label {
269
+ cursor: pointer;
270
+ }
271
+ div.mlw_qmn_quiz input:not([type=submit]):focus,
272
+ div.mlw_qmn_quiz textarea:focus {
273
+ background: #eaeaea;
274
+ }
275
+ div.mlw_qmn_quiz_section
276
+ {
277
+
278
+ }
279
+ </style>
280
+ <?php
281
+ //Update the quiz views
282
+ $mlw_views = $mlw_quiz_options->quiz_views;
283
+ $mlw_views += 1;
284
+ $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views='".$mlw_views."' WHERE quiz_id=".$mlw_quiz_id;
285
+ $results = $wpdb->query( $update );
286
+
287
+ //Form validation script
288
+ $mlw_display .= "
289
+ <script>
290
+ function clear_field(field)
291
+ {
292
+ if (field.defaultValue == field.value) field.value = '';
293
+ }
294
+
295
+ function mlw_validateForm()
296
+ {
297
+ ";
298
+ if ($mlw_quiz_options->user_name == 1)
299
+ {
300
+ $mlw_display .= "
301
+ var x=document.forms['quizForm']['mlwUserName'].value;
302
+ if (x==null || x=='')
303
+ {
304
+ document.getElementById('mlw_error_message').innerHTML = '**Name must be filled out!**';
305
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Name must be filled out!**';
306
+ return false;
307
+ }";
308
+ }
309
+ if ($mlw_quiz_options->user_comp == 1)
310
+ {
311
+ $mlw_display .= "
312
+ var x=document.forms['quizForm']['mlwUserComp'].value;
313
+ if (x==null || x=='')
314
+ {
315
+ document.getElementById('mlw_error_message').innerHTML = '**Business must be filled out!**';
316
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Business must be filled out!**';
317
+ return false;
318
+ }";
319
+ }
320
+ if ($mlw_quiz_options->user_email == 1)
321
+ {
322
+ $mlw_display .= "
323
+ var x=document.forms['quizForm']['mlwUserEmail'].value;
324
+ if (x==null || x=='')
325
+ {
326
+ document.getElementById('mlw_error_message').innerHTML = '**Email must be filled out!**';
327
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Email must be filled out!**';
328
+ return false;
329
+ }";
330
+ }
331
+ if ($mlw_quiz_options->user_phone == 1)
332
+ {
333
+ $mlw_display .= "
334
+ var x=document.forms['quizForm']['mlwUserPhone'].value;
335
+ if (x==null || x=='')
336
+ {
337
+ document.getElementById('mlw_error_message').innerHTML = '**Phone number must be filled out!**';
338
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Phone number must be filled out!**';
339
+ return false;
340
+ }";
341
+ }
342
+ $mlw_display .= "
343
+ if (document.forms['quizForm']['mlwUserEmail'].defaultValue != document.forms['quizForm']['mlwUserEmail'].value)
344
+ {
345
+ var x=document.forms['quizForm']['mlwUserEmail'].value;
346
+ var atpos=x.indexOf('@');
347
+ var dotpos=x.lastIndexOf('.');
348
+ if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
349
+ {
350
+ document.getElementById('mlw_error_message').innerHTML = '**Not a valid e-mail address!**';
351
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Not a valid e-mail address!**';
352
+ return false;
353
+ }
354
+ }
355
+ }
356
+ </script>";
357
+
358
+ //Begin the quiz
359
+ $mlw_display .= "<div class='mlw_qmn_quiz'>";
360
+ $mlw_display .= "<form name='quizForm' action='' method='post' class='mlw_quiz_form' onsubmit='return mlw_validateForm()' >";
361
+ $mlw_display .= "<div class='quiz_section quiz_begin slide".$mlw_qmn_section_count."'>";
362
+ $mlw_message_before = htmlspecialchars_decode($mlw_quiz_options->message_before, ENT_QUOTES);
363
+ $mlw_message_before = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_before);
364
+ $mlw_message_before = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_before);
365
+ $mlw_display .= "<span>".$mlw_message_before."</span><br />";
366
+ $mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
367
+
368
+ if ($mlw_quiz_options->contact_info_location == 0)
369
+ {
370
+ $mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
371
+ }
372
+ $mlw_display .= "</div>";
373
+
374
+ //Display the questions
375
+ foreach($mlw_questions as $mlw_question) {
376
+ $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
377
+ $mlw_qmn_total_questions = $mlw_qmn_total_questions + 1;
378
+ $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count."'>";
379
+ $mlw_display .= "<span style='font-weight:bold;'>".htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES)."</span><br />";
380
+ if ($mlw_question->question_type == 0)
381
+ {
382
+ if ($mlw_question->answer_one != "")
383
+ {
384
+ $mlw_display .= "<input type='radio' required 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>";
385
+ $mlw_display .= "<br />";
386
+ }
387
+ if ($mlw_question->answer_two != "")
388
+ {
389
+ $mlw_display .= "<input type='radio' required 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>";
390
+ $mlw_display .= "<br />";
391
+ }
392
+ if ($mlw_question->answer_three != "")
393
+ {
394
+ $mlw_display .= "<input type='radio' required 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>";
395
+ $mlw_display .= "<br />";
396
+ }
397
+ if ($mlw_question->answer_four != "")
398
+ {
399
+ $mlw_display .= "<input type='radio' required 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>";
400
+ $mlw_display .= "<br />";
401
+ }
402
+ if ($mlw_question->answer_five != "")
403
+ {
404
+ $mlw_display .= "<input type='radio' required 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>";
405
+ $mlw_display .= "<br />";
406
+ }
407
+ if ($mlw_question->answer_six != "")
408
+ {
409
+ $mlw_display .= "<input type='radio' required 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>";
410
+ $mlw_display .= "<br />";
411
+ }
412
+ }
413
+ elseif ($mlw_question->question_type == 1)
414
+ {
415
+ if ($mlw_question->answer_one != "")
416
+ {
417
+ $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='1' />".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES);
418
+ }
419
+ if ($mlw_question->answer_two != "")
420
+ {
421
+ $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='2' />".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES);
422
+ }
423
+ if ($mlw_question->answer_three != "")
424
+ {
425
+ $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='3' />".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES);
426
+ }
427
+ if ($mlw_question->answer_four != "")
428
+ {
429
+ $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='4' />".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES);
430
+ }
431
+ if ($mlw_question->answer_five != "")
432
+ {
433
+ $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='5' />".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES);
434
+ }
435
+ if ($mlw_question->answer_six != "")
436
+ {
437
+ $mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='6' />".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES);
438
+ }
439
+ $mlw_display .= "<br />";
440
+ }
441
+ else
442
+ {
443
+ $mlw_display .= "<select required name='question".$mlw_question->question_id."'>";
444
+ if ($mlw_question->answer_one != "")
445
+ {
446
+ $mlw_display .= "<option value='1'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</option>";
447
+ }
448
+ if ($mlw_question->answer_two != "")
449
+ {
450
+ $mlw_display .= "<option value='2'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</option>";
451
+ }
452
+ if ($mlw_question->answer_three != "")
453
+ {
454
+ $mlw_display .= "<option value='3'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</option>";
455
+ }
456
+ if ($mlw_question->answer_four != "")
457
+ {
458
+ $mlw_display .= "<option value='4'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</option>";
459
+ }
460
+ if ($mlw_question->answer_five != "")
461
+ {
462
+ $mlw_display .= "<option value='5'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</option>";
463
+ }
464
+ if ($mlw_question->answer_six != "")
465
+ {
466
+ $mlw_display .= "<option value='6'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</option>";
467
+ }
468
+ $mlw_display .= "</select>";
469
+ $mlw_display .= "<br />";
470
+ }
471
+ if ($mlw_question->comments == 0)
472
+ {
473
+ $mlw_display .= "<input type='text' x-webkit-speech id='mlwComment".$mlw_question->question_id."' name='mlwComment".$mlw_question->question_id."' value='".esc_attr(htmlspecialchars_decode($mlw_quiz_options->comment_field_text, ENT_QUOTES))."' onclick='clear_field(this)'/>";
474
+ $mlw_display .= "<br />";
475
+ }
476
+ if ($mlw_question->comments == 2)
477
+ {
478
+ $mlw_display .= "<textarea cols='70' rows='5' id='mlwComment".$mlw_question->question_id."' name='mlwComment".$mlw_question->question_id."' onclick='clear_field(this)'>".htmlspecialchars_decode($mlw_quiz_options->comment_field_text, ENT_QUOTES)."</textarea>";
479
+ $mlw_display .= "<br />";
480
+ }
481
+ if ($mlw_question->hints != "")
482
+ {
483
+ $mlw_display .= "<span title=\"".htmlspecialchars_decode($mlw_question->hints, ENT_QUOTES)."\" style=\"text-decoration:underline;color:rgb(0,0,255);\">Hint</span>";
484
+ $mlw_display .= "<br /><br />";
485
+ }
486
+ $mlw_display .= "</div>";
487
+ if ( $mlw_quiz_options->pagination == 0) { $mlw_display .= "<br />"; }
488
+ }
489
+
490
+ //Display comment box if needed
491
+ if ($mlw_quiz_options->comment_section == 0)
492
+ {
493
+ $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
494
+ $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count."'>";
495
+ $mlw_message_comments = htmlspecialchars_decode($mlw_quiz_options->message_comment, ENT_QUOTES);
496
+ $mlw_message_comments = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_comments);
497
+ $mlw_message_comments = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_comments);
498
+ $mlw_display .= "<label for='mlwQuizComments' style='font-weight:bold;'>".$mlw_message_comments."</label><br />";
499
+ $mlw_display .= "<textarea cols='70' rows='15' id='mlwQuizComments' name='mlwQuizComments' ></textarea>";
500
+ $mlw_display .= "</div>";
501
+ if ( $mlw_quiz_options->pagination == 0) { $mlw_display .= "<br /><br />"; }
502
+ }
503
+ $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
504
+ $mlw_display .= "<div class='quiz_section slide".$mlw_qmn_section_count." quiz_end'>";
505
+ if ($mlw_quiz_options->message_end_template != '')
506
+ {
507
+ $mlw_message_end = htmlspecialchars_decode($mlw_quiz_options->message_end_template, ENT_QUOTES);
508
+ $mlw_message_end = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_end);
509
+ $mlw_message_end = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_end);
510
+ $mlw_display .= "<span>".$mlw_message_end."</span>";
511
+ $mlw_display .= "<br /><br />";
512
+ }
513
+ if ($mlw_quiz_options->contact_info_location == 1)
514
+ {
515
+ $mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
516
+ }
517
+ $mlw_display .= "<span style='display: none;'>If you are human, leave this field blank or you will be considered spam:</span>";
518
+ $mlw_display .= "<input style='display: none;' type='text' name='email' id='email' />";
519
+ $mlw_display .= "<input type='hidden' name='total_questions' id='total_questions' value='".$mlw_qmn_total_questions."'/>";
520
+ $mlw_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
521
+ $mlw_display .= "<input type='hidden' name='complete_quiz' value='confirmation' />";
522
+ $mlw_display .= "<input type='submit' value='".esc_attr(htmlspecialchars_decode($mlw_quiz_options->submit_button_text, ENT_QUOTES))."' />";
523
+ $mlw_display .= "<span name='mlw_error_message_bottom' id='mlw_error_message_bottom' style='color: red;'></span><br />";
524
+ $mlw_display .= "</form>";
525
+ $mlw_display .= "</div>";
526
+ $mlw_display .= "</div>";
527
+
528
+ }
529
+ //Display Completion Screen
530
+ else
531
+ {
532
+ if (empty($mlw_spam_email) && $mlw_qmn_isAllowed)
533
+ {
534
+
535
+ //Load questions
536
+ $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_questions" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' ";
537
+ if ($mlw_quiz_options->randomness_order == 0)
538
+ {
539
+ $sql .= "ORDER BY question_order ASC";
540
+ }
541
+ if ($mlw_quiz_options->randomness_order == 1)
542
+ {
543
+ $sql .= "ORDER BY rand()";
544
+ }
545
+ $mlw_questions = $wpdb->get_results($sql);
546
+
547
+ //Variables needed for scoring
548
+ $mlw_points = 0;
549
+ $mlw_correct = 0;
550
+ $mlw_total_questions = 0;
551
+ $mlw_total_score = 0;
552
+ $mlw_question_answers = "";
553
+ isset($_POST["total_questions"]) ? $mlw_total_questions = intval($_POST["total_questions"]) : $mlw_total_questions = 0;
554
+
555
+ //Update the amount of times the quiz has been taken
556
+ $mlw_taken = $mlw_quiz_options->quiz_taken;
557
+ $mlw_taken += 1;
558
+ $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_taken='".$mlw_taken."' WHERE quiz_id=".$mlw_quiz_id;
559
+ $results = $wpdb->query( $update );
560
+
561
+ //See which answers were correct and award points if necessary
562
+ $mlw_user_text = "";
563
+ $mlw_correct_text = "";
564
+ foreach($mlw_questions as $mlw_question) {
565
+ if (isset($_POST["question".$mlw_question->question_id]) || isset($_POST["mlwComment".$mlw_question->question_id]))
566
+ {
567
+ //$mlw_total_questions += 1;
568
+ if (isset($_POST["question".$mlw_question->question_id]))
569
+ {
570
+ $mlw_user_answer = $_POST["question".$mlw_question->question_id];
571
+ if ($mlw_user_answer == $mlw_question->correct_answer)
572
+ {
573
+ $mlw_correct += 1;
574
+ }
575
+ if ($mlw_user_answer == 1)
576
+ {
577
+ $mlw_points += $mlw_question->answer_one_points;
578
+ $mlw_user_text = $mlw_question->answer_one;
579
+ }
580
+ if ($mlw_user_answer == 2)
581
+ {
582
+ $mlw_points += $mlw_question->answer_two_points;
583
+ $mlw_user_text = $mlw_question->answer_two;
584
+ }
585
+ if ($mlw_user_answer == 3)
586
+ {
587
+ $mlw_points += $mlw_question->answer_three_points;
588
+ $mlw_user_text = $mlw_question->answer_three;
589
+ }
590
+ if ($mlw_user_answer == 4)
591
+ {
592
+ $mlw_points += $mlw_question->answer_four_points;
593
+ $mlw_user_text = $mlw_question->answer_four;
594
+ }
595
+ if ($mlw_user_answer == 5)
596
+ {
597
+ $mlw_points += $mlw_question->answer_five_points;
598
+ $mlw_user_text = $mlw_question->answer_five;
599
+ }
600
+ if ($mlw_user_answer == 6)
601
+ {
602
+ $mlw_points += $mlw_question->answer_six_points;
603
+ $mlw_user_text = $mlw_question->answer_six;
604
+ }
605
+
606
+ if ($mlw_question->correct_answer == 1) {$mlw_correct_text = $mlw_question->answer_one;}
607
+ if ($mlw_question->correct_answer == 2) {$mlw_correct_text = $mlw_question->answer_two;}
608
+ if ($mlw_question->correct_answer == 3) {$mlw_correct_text = $mlw_question->answer_three;}
609
+ if ($mlw_question->correct_answer == 4) {$mlw_correct_text = $mlw_question->answer_four;}
610
+ if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
611
+ if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
612
+ }
613
+ if (isset($_POST["mlwComment".$mlw_question->question_id]))
614
+ {
615
+ $mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
616
+ }
617
+ else
618
+ {
619
+ $mlw_qm_question_comment = "";
620
+ }
621
+
622
+ $mlw_question_answer_display = htmlspecialchars_decode($mlw_quiz_options->question_answer_template, ENT_QUOTES);
623
+ $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
624
+ $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
625
+ $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
626
+ $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $mlw_qm_question_comment, $mlw_question_answer_display);
627
+ $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($mlw_question->question_answer_info, ENT_QUOTES), $mlw_question_answer_display);
628
+
629
+ $mlw_question_answers .= $mlw_question_answer_display;
630
+ $mlw_question_answers .= "<br />";
631
+ }
632
+ }
633
+
634
+ //Calculate Total Percent Score And Average Points Only If Total Questions Doesn't Equal Zero To Avoid Division By Zero Error
635
+ if ($mlw_total_questions != 0)
636
+ {
637
+ $mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
638
+ $mlw_average_points = round(($mlw_points/$mlw_total_questions), 2);
639
+ }
640
+ else
641
+ {
642
+ $mlw_total_score = 0;
643
+ $mlw_average_points = 0;
644
+ }
645
+
646
+ //Prepare comment section if set
647
+ if (isset($_POST["mlwQuizComments"]))
648
+ {
649
+ $mlw_qm_quiz_comments = $_POST["mlwQuizComments"];
650
+ }
651
+ else
652
+ {
653
+ $mlw_qm_quiz_comments = "";
654
+ }
655
+
656
+
657
+ //Prepare Certificate
658
+ $mlw_certificate_link = "";
659
+ $mlw_certificate_options = unserialize($mlw_quiz_options->certificate_template);
660
+ if (!is_array($mlw_certificate_options)) {
661
+ // something went wrong, initialize to empty array
662
+ $mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
663
+ }
664
+ if ($mlw_certificate_options[4] == 0)
665
+ {
666
+ $mlw_message_certificate = $mlw_certificate_options[1];
667
+ $mlw_message_certificate = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_certificate);
668
+ $mlw_message_certificate = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_certificate);
669
+ $mlw_message_certificate = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_certificate);
670
+ $mlw_message_certificate = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_certificate);
671
+ $mlw_message_certificate = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_certificate);
672
+ $mlw_message_certificate = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_certificate);
673
+ $mlw_message_certificate = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_certificate);
674
+ $mlw_message_certificate = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_certificate);
675
+ $mlw_message_certificate = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_certificate);
676
+ $mlw_message_certificate = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_certificate);
677
+ $mlw_message_certificate = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_certificate);
678
+ $mlw_message_certificate = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_certificate);
679
+ $mlw_message_certificate = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_certificate);
680
+ $mlw_message_certificate = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_certificate);
681
+ $mlw_message_certificate = str_replace( "\n" , "<br>", $mlw_message_certificate);
682
+ $mlw_plugindirpath = plugin_dir_path( __FILE__ );
683
+ $plugindirpath=plugin_dir_path( __FILE__ );
684
+ $mlw_qmn_certificate_file=<<<EOC
685
+ <?php
686
+ include("$plugindirpath/WriteHTML.php");
687
+ \$pdf=new PDF_HTML();
688
+ \$pdf->AddPage('L');
689
+ EOC;
690
+ $mlw_qmn_certificate_file.=$mlw_certificate_options[3] != '' ? '$pdf->Image("'.$mlw_certificate_options[3].'",0,0,$pdf->w, $pdf->h);' : '';
691
+ $mlw_qmn_certificate_file.=<<<EOC
692
+ \$pdf->Ln(20);
693
+ \$pdf->SetFont('Arial','B',24);
694
+ \$pdf->MultiCell(280,20,'$mlw_certificate_options[0]',0,'C');
695
+ \$pdf->Ln(15);
696
+ \$pdf->SetFont('Arial','',16);
697
+ \$pdf->WriteHTML("<p align='center'>$mlw_message_certificate</p>");
698
+ EOC;
699
+ $mlw_qmn_certificate_file.=$mlw_certificate_options[2] != '' ? '$pdf->Image("'.$mlw_certificate_options[2].'",110,130);' : '';
700
+ $mlw_qmn_certificate_file.=<<<EOC
701
+ \$pdf->Output('mlw_qmn_certificate.pdf','D');
702
+ unlink(__FILE__);
703
+ EOC;
704
+ $mlw_qmn_certificate_filename = str_replace(home_url()."/", '', plugin_dir_url( __FILE__ ))."certificates/mlw_qmn_quiz".date("YmdHis").$mlw_qmn_timer.".php";
705
+ file_put_contents($mlw_qmn_certificate_filename, $mlw_qmn_certificate_file);
706
+ $mlw_qmn_certificate_filename = plugin_dir_url( __FILE__ )."certificates/mlw_qmn_quiz".date("YmdHis").$mlw_qmn_timer.".php";
707
+ $mlw_certificate_link = "<a href='".$mlw_qmn_certificate_filename."' style='color: blue;'>Download Certificate</a>";
708
+ }
709
+
710
+ /*
711
+ Prepare the landing page
712
+ -First, unserialize message_after column
713
+ -Second, check for array in case user has not updated
714
+ Message array = (array( bottomvalue, topvalue, text),array( bottomvalue, topvalue, text), etc..., array(0,0,text))
715
+ */
716
+ $mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
717
+ if (is_array($mlw_message_after_array))
718
+ {
719
+ //Cycle through landing pages
720
+ foreach($mlw_message_after_array as $mlw_each)
721
+ {
722
+ //Check to see if default
723
+ if ($mlw_each[0] == 0 && $mlw_each[1] == 0)
724
+ {
725
+ $mlw_message_after = htmlspecialchars_decode($mlw_each[2], ENT_QUOTES);
726
+ $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
727
+ $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
728
+ $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
729
+ $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
730
+ $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
731
+ $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
732
+ $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
733
+ $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
734
+ $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
735
+ $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
736
+ $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
737
+ $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
738
+ $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
739
+ $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
740
+ $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
741
+ $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
742
+ $mlw_display .= $mlw_message_after;
743
+ break;
744
+ }
745
+ else
746
+ {
747
+ //Check to see if points fall in correct range
748
+ if ($mlw_points >= $mlw_each[0] && $mlw_points <= $mlw_each[1])
749
+ {
750
+ $mlw_message_after = htmlspecialchars_decode($mlw_each[2], ENT_QUOTES);
751
+ $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
752
+ $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
753
+ $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
754
+ $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
755
+ $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
756
+ $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
757
+ $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
758
+ $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
759
+ $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
760
+ $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
761
+ $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
762
+ $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
763
+ $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
764
+ $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
765
+ $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
766
+ $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
767
+ $mlw_display .= $mlw_message_after;
768
+ break;
769
+ }
770
+ //Check to see if score fall in correct range
771
+ if ($mlw_total_score >= $mlw_each[0] && $mlw_total_score <= $mlw_each[1])
772
+ {
773
+ $mlw_message_after = htmlspecialchars_decode($mlw_each[2], ENT_QUOTES);
774
+ $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
775
+ $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
776
+ $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
777
+ $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
778
+ $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
779
+ $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
780
+ $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
781
+ $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
782
+ $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
783
+ $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
784
+ $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
785
+ $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
786
+ $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
787
+ $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
788
+ $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
789
+ $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
790
+ $mlw_display .= $mlw_message_after;
791
+ break;
792
+ }
793
+ }
794
+ }
795
+ }
796
+ else
797
+ {
798
+ //Prepare the after quiz message
799
+ $mlw_message_after = htmlspecialchars_decode($mlw_quiz_options->message_after, ENT_QUOTES);
800
+ $mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
801
+ $mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
802
+ $mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
803
+ $mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
804
+ $mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
805
+ $mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
806
+ $mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
807
+ $mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
808
+ $mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
809
+ $mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
810
+ $mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
811
+ $mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
812
+ $mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
813
+ $mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
814
+ $mlw_message_after = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message_after);
815
+ $mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
816
+ $mlw_display .= $mlw_message_after;
817
+ }
818
+
819
+ if ($mlw_quiz_options->social_media == 1)
820
+ {
821
+ $mlw_social_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_quiz_options->social_media_text);
822
+ $mlw_social_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_social_message);
823
+ $mlw_social_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_social_message);
824
+ $mlw_social_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_social_message);
825
+ $mlw_social_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_social_message);
826
+ $mlw_social_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_social_message);
827
+ $mlw_social_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_social_message);
828
+ $mlw_social_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_social_message);
829
+ $mlw_display .= "<br />
830
+ <a href=\"https://twitter.com/share\" data-size=\"large\" data-text=\"".esc_attr($mlw_social_message)."\" class=\"twitter-share-button\" data-lang=\"en\">Tweet</a>
831
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"https://platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script>
832
+ <br />";
833
+ }
834
+
835
+ //Switch email type to HTML
836
+ add_filter( 'wp_mail_content_type', 'mlw_qmn_set_html_content_type' );
837
+
838
+ //Prepare and send the user email
839
+ $mlw_message = "";
840
+ if ($mlw_quiz_options->send_user_email == "0")
841
+ {
842
+ if ($mlw_user_email != "")
843
+ {
844
+ $mlw_message = htmlspecialchars_decode($mlw_quiz_options->user_email_template, ENT_QUOTES);
845
+ $mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
846
+ $mlw_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message);
847
+ $mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
848
+ $mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
849
+ $mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
850
+ $mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
851
+ $mlw_message = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message);
852
+ $mlw_message = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message);
853
+ $mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
854
+ $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
855
+ $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
856
+ $mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
857
+ $mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
858
+ $mlw_message = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message);
859
+ $mlw_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message);
860
+ $mlw_message = str_replace( "\n" , "<br>", $mlw_message);
861
+ $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
862
+ $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
863
+ $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
864
+ wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
865
+ }
866
+ }
867
+
868
+ //Prepare and send the admin email
869
+ $mlw_message = "";
870
+ if ($mlw_quiz_options->send_admin_email == "0")
871
+ {
872
+ $mlw_message = htmlspecialchars_decode($mlw_quiz_options->admin_email_template, ENT_QUOTES);
873
+ $mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
874
+ $mlw_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message);
875
+ $mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
876
+ $mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
877
+ $mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
878
+ $mlw_message = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message);
879
+ $mlw_message = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message);
880
+ $mlw_message = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message);
881
+ $mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
882
+ $mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
883
+ $mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
884
+ $mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
885
+ $mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
886
+ $mlw_message = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message);
887
+ $mlw_message = str_replace( "%CURRENT_DATE%" , date("F jS Y"), $mlw_message);
888
+ $mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
889
+ $mlw_message = str_replace( "\n" , "<br>", $mlw_message);
890
+ $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
891
+ $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
892
+ $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
893
+ wp_mail($mlw_quiz_options->admin_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
894
+ }
895
+
896
+ //Remove HTML type for emails
897
+ remove_filter( 'wp_mail_content_type', 'mlw_qmn_set_html_content_type' );
898
+
899
+ //Save the results into database
900
+ $mlw_quiz_results = "Quiz was taken in: ".$mlw_qmn_timer." seconds."."\n".$mlw_question_answers."\n".$mlw_qm_quiz_comments;
901
+ $mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
902
+ $mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
903
+ global $wpdb;
904
+ $table_name = $wpdb->prefix . "mlw_results";
905
+ $insert = "INSERT INTO " . $table_name .
906
+ "(result_id, quiz_id, quiz_name, quiz_system, point_score, correct_score, correct, total, name, business, email, phone, time_taken, time_taken_real, quiz_results, deleted) " .
907
+ "VALUES (NULL , " . $mlw_quiz_id . " , '".$mlw_quiz_options->quiz_name."', ".$mlw_quiz_options->system.", ".$mlw_points.", ".$mlw_total_score.", ".$mlw_correct.", ".$mlw_total_questions.", '".$mlw_user_name."', '".$mlw_user_comp."', '".$mlw_user_email."', '".$mlw_user_phone."', '".date("h:i:s A m/d/Y")."', '".date("Y-m-d H:i:s")."', '".$mlw_quiz_results."', 0)";
908
+ $results = $wpdb->query( $insert );
909
+ }
910
+ else
911
+ {
912
+ if (!$mlw_qmn_isAllowed)
913
+ {
914
+ $mlw_display .= $mlw_quiz_options->total_user_tries_text;
915
+ }
916
+ else { $mlw_display .= "Thank you."; }
917
+ }
918
+ }
919
+ return $mlw_display;
920
+ }
921
+
922
+
923
+ /*
924
+ This function displays fields to ask for contact information
925
+ */
926
+ function mlwDisplayContactInfo($mlw_quiz_options)
927
+ {
928
+ $mlw_contact_display = "";
929
+ //Check to see if user is logged in, then ask for contact if not
930
+ if ( is_user_logged_in() )
931
+ {
932
+ //If this quiz does not let user edit contact information we hide this section
933
+ if ($mlw_quiz_options->loggedin_user_contact == 1)
934
+ {
935
+ $mlw_contact_display .= "<div style='display:none;'>";
936
+ }
937
+
938
+ //Retrieve current user information and save into text fields for contact information
939
+ $current_user = wp_get_current_user();
940
+ if ($mlw_quiz_options->user_name != 2)
941
+ {
942
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->name_field_text, ENT_QUOTES)."</span><br />";
943
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserName' value='".$current_user->display_name."' />";
944
+ $mlw_contact_display .= "<br /><br />";
945
+
946
+ }
947
+ if ($mlw_quiz_options->user_comp != 2)
948
+ {
949
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->business_field_text, ENT_QUOTES)."</span><br />";
950
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserComp' value='' />";
951
+ $mlw_contact_display .= "<br /><br />";
952
+ }
953
+ if ($mlw_quiz_options->user_email != 2)
954
+ {
955
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->email_field_text, ENT_QUOTES)."</span><br />";
956
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserEmail' value='".$current_user->user_email."' />";
957
+ $mlw_contact_display .= "<br /><br />";
958
+ }
959
+ if ($mlw_quiz_options->user_phone != 2)
960
+ {
961
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->phone_field_text, ENT_QUOTES)."</span><br />";
962
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserPhone' value='' />";
963
+ $mlw_contact_display .= "<br /><br />";
964
+ }
965
+
966
+ //End of hidden section div
967
+ if ($mlw_quiz_options->loggedin_user_contact == 1)
968
+ {
969
+ $mlw_contact_display .= "</div>";
970
+ }
971
+ }
972
+ else
973
+ {
974
+ //See if the site wants to ask for any contact information, then ask for it
975
+ if ($mlw_quiz_options->user_name != 2)
976
+ {
977
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->name_field_text, ENT_QUOTES)."</span><br />";
978
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserName' value='' />";
979
+ $mlw_contact_display .= "<br /><br />";
980
+ }
981
+ if ($mlw_quiz_options->user_comp != 2)
982
+ {
983
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->business_field_text, ENT_QUOTES)."</span><br />";
984
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserComp' value='' />";
985
+ $mlw_contact_display .= "<br /><br />";
986
+ }
987
+ if ($mlw_quiz_options->user_email != 2)
988
+ {
989
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->email_field_text, ENT_QUOTES)."</span><br />";
990
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserEmail' value='' />";
991
+ $mlw_contact_display .= "<br /><br />";
992
+ }
993
+ if ($mlw_quiz_options->user_phone != 2)
994
+ {
995
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->phone_field_text, ENT_QUOTES)."</span><br />";
996
+ $mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserPhone' value='' />";
997
+ $mlw_contact_display .= "<br /><br />";
998
+ }
999
+ }
1000
+ return $mlw_contact_display;
1001
+ }
1002
+
1003
+ /*
1004
+ This function helps set the email type to HTML
1005
+ */
1006
+ function mlw_qmn_set_html_content_type() {
1007
+
1008
+ return 'text/html';
1009
+ }
1010
  ?>
includes/mlw_quiz_admin.php CHANGED
@@ -20,7 +20,7 @@ function mlw_generate_quiz_admin()
20
  //Create new quiz
21
  if ( isset( $_POST["create_quiz"] ) && $_POST["create_quiz"] == "confirmation" )
22
  {
23
- $quiz_name = $_POST["quiz_name"];
24
  //Insert New Quiz Into Table
25
  $mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
26
  1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
@@ -90,7 +90,7 @@ function mlw_generate_quiz_admin()
90
  if (isset($_POST["quiz_name_editted"]) && $_POST["quiz_name_editted"] == "confirmation")
91
  {
92
  $mlw_edit_quiz_id = $_POST["edit_quiz_id"];
93
- $mlw_edit_quiz_name = $_POST["edit_quiz_name"];
94
  $mlw_update_quiz_table = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_name='".$mlw_edit_quiz_name."' WHERE quiz_id=".$mlw_edit_quiz_id;
95
  $results = $wpdb->query( $mlw_update_quiz_table );
96
  if ($results != false)
@@ -118,7 +118,7 @@ function mlw_generate_quiz_admin()
118
  {
119
  $table_name = $wpdb->prefix . "mlw_quizzes";
120
  $mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
121
- $mlw_duplicate_quiz_name = $_POST["duplicate_new_quiz_name"];
122
  $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
123
  $results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, message_end_template, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, certificate_template, social_media, social_media_text, pagination, pagination_text, timer_limit, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->message_end_template."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", ".$mlw_qmn_duplicate_data->total_user_tries.", '".$mlw_qmn_duplicate_data->total_user_tries_text."', '".$mlw_qmn_duplicate_data->certificate_template."', ".$mlw_qmn_duplicate_data->social_media.", '".$mlw_qmn_duplicate_data->social_media_text."', ".$mlw_qmn_duplicate_data->pagination.", '".$mlw_qmn_duplicate_data->pagination_text."', ".$mlw_qmn_duplicate_data->timer_limit.", 0, 0, 0)" );
124
  if ($results != false)
@@ -350,7 +350,7 @@ function mlw_generate_quiz_admin()
350
  else $alternate = " class=\"alternate\"";
351
  $quotes_list .= "<tr{$alternate}>";
352
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_id . "</span></td>";
353
- $quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name ." </span><span style='color:green;font-size:12px;'><a onclick=\"editQuizName('".$mlw_quiz_info->quiz_id."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_quiz_info->quiz_name, ENT_QUOTES))."')\" href='#'>(Edit Name)</a></span><div><span style='color:green;font-size:12px;'><a href='admin.php?page=mlw_quiz_options&&quiz_id=".$mlw_quiz_info->quiz_id."'>Edit</a> | <a onclick=\"deleteQuiz('".$mlw_quiz_info->quiz_id."','".$mlw_quiz_info->quiz_name."')\" href='#'>Delete</a> | <a href='admin.php?page=mlw_quiz_results&&quiz_id=".$mlw_quiz_info->quiz_id."'>Results</a> | <a href='#' onclick=\"duplicateQuiz('".$mlw_quiz_info->quiz_id."','".$mlw_quiz_info->quiz_name."')\">Duplicate</a></span></div></td>";
354
  $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
355
  $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster_leaderboard mlw_quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
356
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_views . "</span></td>";
20
  //Create new quiz
21
  if ( isset( $_POST["create_quiz"] ) && $_POST["create_quiz"] == "confirmation" )
22
  {
23
+ $quiz_name = htmlspecialchars($_POST["quiz_name"], ENT_QUOTES);
24
  //Insert New Quiz Into Table
25
  $mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
26
  1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
90
  if (isset($_POST["quiz_name_editted"]) && $_POST["quiz_name_editted"] == "confirmation")
91
  {
92
  $mlw_edit_quiz_id = $_POST["edit_quiz_id"];
93
+ $mlw_edit_quiz_name = htmlspecialchars($_POST["edit_quiz_name"], ENT_QUOTES);
94
  $mlw_update_quiz_table = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_name='".$mlw_edit_quiz_name."' WHERE quiz_id=".$mlw_edit_quiz_id;
95
  $results = $wpdb->query( $mlw_update_quiz_table );
96
  if ($results != false)
118
  {
119
  $table_name = $wpdb->prefix . "mlw_quizzes";
120
  $mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
121
+ $mlw_duplicate_quiz_name = htmlspecialchars($_POST["duplicate_new_quiz_name"], ENT_QUOTES);
122
  $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
123
  $results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, message_end_template, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, certificate_template, social_media, social_media_text, pagination, pagination_text, timer_limit, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->message_end_template."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", ".$mlw_qmn_duplicate_data->total_user_tries.", '".$mlw_qmn_duplicate_data->total_user_tries_text."', '".$mlw_qmn_duplicate_data->certificate_template."', ".$mlw_qmn_duplicate_data->social_media.", '".$mlw_qmn_duplicate_data->social_media_text."', ".$mlw_qmn_duplicate_data->pagination.", '".$mlw_qmn_duplicate_data->pagination_text."', ".$mlw_qmn_duplicate_data->timer_limit.", 0, 0, 0)" );
124
  if ($results != false)
350
  else $alternate = " class=\"alternate\"";
351
  $quotes_list .= "<tr{$alternate}>";
352
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_id . "</span></td>";
353
+ $quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . esc_js($mlw_quiz_info->quiz_name) ." </span><span style='color:green;font-size:12px;'><a onclick=\"editQuizName('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='#'>(Edit Name)</a></span><div><span style='color:green;font-size:12px;'><a href='admin.php?page=mlw_quiz_options&&quiz_id=".$mlw_quiz_info->quiz_id."'>Edit</a> | <a onclick=\"deleteQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='#'>Delete</a> | <a href='admin.php?page=mlw_quiz_results&&quiz_id=".$mlw_quiz_info->quiz_id."'>Results</a> | <a href='#' onclick=\"duplicateQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\">Duplicate</a></span></div></td>";
354
  $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
355
  $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster_leaderboard mlw_quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
356
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_views . "</span></td>";
includes/mlw_quiz_options.php CHANGED
@@ -186,22 +186,22 @@ function mlw_generate_quiz_options()
186
  if ( isset($_POST["save_templates"]) && $_POST["save_templates"] == "confirmation")
187
  {
188
  //Variables for save templates form
189
- $mlw_before_message = $_POST["mlw_quiz_before_message"];
190
- $mlw_qmn_message_end = $_POST["message_end_template"];
191
- $mlw_qmn_social_medi_text = $_POST["mlw_quiz_social_media_text_template"];
192
- $mlw_user_tries_text = $_POST["mlw_quiz_total_user_tries_text"];
193
- $mlw_user_email_template = $_POST["mlw_quiz_user_email_template"];
194
- $mlw_admin_email_template = $_POST["mlw_quiz_admin_email_template"];
195
- $mlw_submit_button_text = $_POST["mlw_submitText"];
196
- $mlw_name_field_text = $_POST["mlw_nameText"];
197
- $mlw_business_field_text = $_POST["mlw_businessText"];
198
- $mlw_email_field_text = $_POST["mlw_emailText"];
199
- $mlw_phone_field_text = $_POST["mlw_phoneText"];
200
- $mlw_before_comments = $_POST["mlw_quiz_before_comments"];
201
- $mlw_comment_field_text = $_POST["mlw_commentText"];
202
  $mlw_qmn_pagination_field = serialize(array( $_POST["pagination_prev_text"], $_POST["pagination_next_text"] ));
203
  $mlw_email_from_text = $_POST["emailFromText"];
204
- $mlw_question_answer_template = $_POST["mlw_quiz_question_answer_template"];
205
  $quiz_id = $_POST["quiz_id"];
206
 
207
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', message_end_template='".$mlw_qmn_message_end."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."', user_email_template='".$mlw_user_email_template."', admin_email_template='".$mlw_admin_email_template."', total_user_tries_text='".$mlw_user_tries_text."', social_media_text='".$mlw_qmn_social_medi_text."', pagination_text='".$mlw_qmn_pagination_field."' WHERE quiz_id=".$quiz_id;
@@ -410,7 +410,7 @@ function mlw_generate_quiz_options()
410
  {
411
  if ($_POST["message_after_".$i] != "Delete")
412
  {
413
- $mlw_qmn_landing_each = array(intval($_POST["message_after_begin_".$i]), intval($_POST["message_after_end_".$i]), $_POST["message_after_".$i]);
414
  $mlw_qmn_new_landing_array[] = $mlw_qmn_landing_each;
415
  }
416
  $i++;
@@ -958,7 +958,7 @@ function mlw_generate_quiz_options()
958
  else $alternate = " class=\"alternate\"";
959
  $question_list .= "<tr{$alternate}>";
960
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
961
- $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."','".str_replace('"', '&quot;', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->question_name, ENT_QUOTES)))."', '".str_replace('"', '&quot;', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_one, ENT_QUOTES)))."','".$mlw_question_info->answer_one_points."','".str_replace('"', '&quot;', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_two, ENT_QUOTES)))."','".$mlw_question_info->answer_two_points."','".str_replace('"', '&quot;', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_three, ENT_QUOTES)))."','".$mlw_question_info->answer_three_points."','".str_replace('"', '&quot;', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_four, ENT_QUOTES)))."','".$mlw_question_info->answer_four_points."','".str_replace('"', '&quot;', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_five, ENT_QUOTES)))."','".$mlw_question_info->answer_five_points."','".str_replace('"', '&quot;', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_six, ENT_QUOTES)))."','".$mlw_question_info->answer_six_points."','".$mlw_question_info->correct_answer."', '".esc_attr(htmlspecialchars_decode($mlw_question_info->question_answer_info, ENT_QUOTES))."', '".$mlw_question_info->comments."','".str_replace("'", "\'", 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>";
962
  $question_list .= "</tr>";
963
  }
964
 
186
  if ( isset($_POST["save_templates"]) && $_POST["save_templates"] == "confirmation")
187
  {
188
  //Variables for save templates form
189
+ $mlw_before_message = htmlspecialchars($_POST["mlw_quiz_before_message"], ENT_QUOTES);
190
+ $mlw_qmn_message_end = htmlspecialchars($_POST["message_end_template"], ENT_QUOTES);
191
+ $mlw_qmn_social_medi_text = htmlspecialchars($_POST["mlw_quiz_social_media_text_template"], ENT_QUOTES);
192
+ $mlw_user_tries_text = htmlspecialchars($_POST["mlw_quiz_total_user_tries_text"], ENT_QUOTES);
193
+ $mlw_user_email_template = htmlspecialchars($_POST["mlw_quiz_user_email_template"], ENT_QUOTES);
194
+ $mlw_admin_email_template = htmlspecialchars($_POST["mlw_quiz_admin_email_template"], ENT_QUOTES);
195
+ $mlw_submit_button_text = htmlspecialchars($_POST["mlw_submitText"], ENT_QUOTES);
196
+ $mlw_name_field_text = htmlspecialchars($_POST["mlw_nameText"], ENT_QUOTES);
197
+ $mlw_business_field_text = htmlspecialchars($_POST["mlw_businessText"], ENT_QUOTES);
198
+ $mlw_email_field_text = htmlspecialchars($_POST["mlw_emailText"], ENT_QUOTES);
199
+ $mlw_phone_field_text = htmlspecialchars($_POST["mlw_phoneText"], ENT_QUOTES);
200
+ $mlw_before_comments = htmlspecialchars($_POST["mlw_quiz_before_comments"], ENT_QUOTES);
201
+ $mlw_comment_field_text = htmlspecialchars($_POST["mlw_commentText"], ENT_QUOTES);
202
  $mlw_qmn_pagination_field = serialize(array( $_POST["pagination_prev_text"], $_POST["pagination_next_text"] ));
203
  $mlw_email_from_text = $_POST["emailFromText"];
204
+ $mlw_question_answer_template = htmlspecialchars($_POST["mlw_quiz_question_answer_template"], ENT_QUOTES);
205
  $quiz_id = $_POST["quiz_id"];
206
 
207
  $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', message_end_template='".$mlw_qmn_message_end."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."', user_email_template='".$mlw_user_email_template."', admin_email_template='".$mlw_admin_email_template."', total_user_tries_text='".$mlw_user_tries_text."', social_media_text='".$mlw_qmn_social_medi_text."', pagination_text='".$mlw_qmn_pagination_field."' WHERE quiz_id=".$quiz_id;
410
  {
411
  if ($_POST["message_after_".$i] != "Delete")
412
  {
413
+ $mlw_qmn_landing_each = array(intval($_POST["message_after_begin_".$i]), intval($_POST["message_after_end_".$i]), htmlspecialchars($_POST["message_after_".$i], ENT_QUOTES));
414
  $mlw_qmn_new_landing_array[] = $mlw_qmn_landing_each;
415
  }
416
  $i++;
958
  else $alternate = " class=\"alternate\"";
959
  $question_list .= "<tr{$alternate}>";
960
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
961
+ $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>";
962
  $question_list .= "</tr>";
963
  }
964
 
includes/mlw_update.php CHANGED
@@ -6,7 +6,7 @@ function mlw_quiz_update()
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
- $data = "1.9.5";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
+ $data = "1.9.6";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
mlw_quizmaster2.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
- Version: 1.9.5
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 1.9.6
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: quiz, test, score, survey, contact, form, email, answer, question
5
  Requires at least: 3.3
6
  Tested up to: 3.8.1
7
- Stable tag: 1.9.5
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.
@@ -99,6 +99,12 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
99
 
100
  == Changelog ==
101
 
 
 
 
 
 
 
102
  = 1.9.5 (March 18, 2014) =
103
  * Fixed Bug
104
 
4
  Tags: quiz, test, score, survey, contact, form, email, answer, question
5
  Requires at least: 3.3
6
  Tested up to: 3.8.1
7
+ Stable tag: 1.9.6
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.
99
 
100
  == Changelog ==
101
 
102
+ = 1.9.6 (March 19, 2014) =
103
+ * Fixed Duplicate Quiz Bug
104
+ * Fixed Uneditable Question Bug
105
+ * Fixed Parse Bug
106
+ * Made Email Now Send As HTML
107
+
108
  = 1.9.5 (March 18, 2014) =
109
  * Fixed Bug
110