Version Description
This update adds new widgets to Quiz Dashboard, adds a timer mechanism, and fixes several minor bugs.
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 1.7.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.3 to 1.7.1
- assets/screenshot-3.png +0 -0
- includes/images/green_triangle.png +0 -0
- includes/images/red_triangle.png +0 -0
- includes/mlw_dashboard.php +233 -25
- includes/mlw_qmn_credits.php +80 -0
- includes/mlw_quiz.php +54 -43
- includes/mlw_quiz_options.php +8 -3
- includes/mlw_update.php +6 -1
- mlw_quizmaster2.php +33 -1
- readme.txt +12 -1
- uninstall.php +2 -0
assets/screenshot-3.png
CHANGED
Binary file
|
includes/images/green_triangle.png
ADDED
Binary file
|
includes/images/red_triangle.png
ADDED
Binary file
|
includes/mlw_dashboard.php
CHANGED
@@ -56,6 +56,10 @@ function mlw_generate_quiz_dashboard(){
|
|
56 |
add_meta_box("wpss_mrts", 'Support', "mlw_dashboard_box_seven", "quiz_wpss7");
|
57 |
add_meta_box("wpss_mrts", 'Contribution', "mlw_dashboard_box_eight", "quiz_wpss8");
|
58 |
add_meta_box("wpss_mrts", 'News From My Local Webstop', "mlw_dashboard_box_nine", "quiz_wpss9");
|
|
|
|
|
|
|
|
|
59 |
?>
|
60 |
<!-- css -->
|
61 |
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
@@ -65,6 +69,7 @@ function mlw_generate_quiz_dashboard(){
|
|
65 |
wp_enqueue_script( 'jquery-ui-core' );
|
66 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
67 |
wp_enqueue_script( 'jquery-ui-button' );
|
|
|
68 |
wp_enqueue_script( 'jquery-effects-blind' );
|
69 |
wp_enqueue_script( 'jquery-effects-explode' );
|
70 |
?>
|
@@ -88,7 +93,11 @@ function mlw_generate_quiz_dashboard(){
|
|
88 |
$j('#opener').click(function() {
|
89 |
$j('#dialog').dialog('open');
|
90 |
return false;
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
});
|
93 |
$j(function() {
|
94 |
$j('.inlinesparkline').sparkline('html', {type: 'line', width: '400', height: '200'});
|
@@ -137,6 +146,26 @@ function mlw_generate_quiz_dashboard(){
|
|
137 |
<h3>Version <?php echo $mlw_quiz_version; ?></h3>
|
138 |
<p><?php _e("Thank you for trying out this plugin. I hope you find it beneficial to your website. If it is, please consider donating or please consider rating this plugin ", "mlw_qmn_text_domain"); ?><a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next"><?php _e("here", "mlw_qmn_text_domain"); ?></a>.</p>
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
<div style="float:left; width:38%;" class="inner-sidebar1">
|
141 |
<?php do_meta_boxes('quiz_wpss','advanced',''); ?>
|
142 |
</div>
|
@@ -145,9 +174,7 @@ function mlw_generate_quiz_dashboard(){
|
|
145 |
<?php do_meta_boxes('quiz_wpss4','advanced',''); ?>
|
146 |
</div>
|
147 |
|
148 |
-
|
149 |
-
<?php do_meta_boxes('quiz_wpss6','advanced',''); ?>
|
150 |
-
</div>
|
151 |
|
152 |
<!--<div style="clear:both">-->
|
153 |
|
@@ -367,39 +394,39 @@ function mlw_dashboard_box_five()
|
|
367 |
{
|
368 |
//Gather the monthly stats, one variable for each day for the graph
|
369 |
global $wpdb;
|
370 |
-
$mlw_this_month = mktime(0, 0, 0, date("m") , date("d")-
|
371 |
$mlw_this_month = date("Y-m-d", $mlw_this_month);
|
372 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_month." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0";
|
373 |
$mlw_quiz_taken_this_month = $wpdb->get_results($sql);
|
374 |
$mlw_quiz_taken_this_month = $wpdb->num_rows;
|
375 |
|
376 |
-
$mlw_last_month_first = mktime(0, 0, 0, date("m") , date("d")-
|
377 |
$mlw_last_month_first = date("Y-m-d", $mlw_last_month_first);
|
378 |
-
$mlw_last_month_last = mktime(0, 0, 0, date("m") , date("d")-
|
379 |
$mlw_last_month_last = date("Y-m-d", $mlw_last_month_last);
|
380 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_month_first." 00:00:00' AND '".$mlw_last_month_last." 23:59:59') AND deleted=0";
|
381 |
$mlw_quiz_taken_last_month = $wpdb->get_results($sql);
|
382 |
$mlw_quiz_taken_last_month = $wpdb->num_rows;
|
383 |
|
384 |
-
$mlw_two_month_first = mktime(0, 0, 0, date("m") , date("d")-
|
385 |
$mlw_two_month_first = date("Y-m-d", $mlw_two_month_first);
|
386 |
-
$mlw_two_month_last = mktime(0, 0, 0, date("m") , date("d")-
|
387 |
$mlw_two_month_last = date("Y-m-d", $mlw_two_month_last);
|
388 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_two_month_first." 00:00:00' AND '".$mlw_two_month_last." 23:59:59') AND deleted=0";
|
389 |
$mlw_quiz_taken_two_month = $wpdb->get_results($sql);
|
390 |
$mlw_quiz_taken_two_month = $wpdb->num_rows;
|
391 |
|
392 |
-
$mlw_three_month_first = mktime(0, 0, 0, date("m") , date("d")-
|
393 |
$mlw_three_month_first = date("Y-m-d", $mlw_three_month_first);
|
394 |
-
$mlw_three_month_last = mktime(0, 0, 0, date("m") , date("d")-
|
395 |
$mlw_three_month_last = date("Y-m-d", $mlw_three_month_last);
|
396 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_month_first." 00:00:00' AND '".$mlw_three_month_last." 23:59:59') AND deleted=0";
|
397 |
$mlw_quiz_taken_three_month = $wpdb->get_results($sql);
|
398 |
$mlw_quiz_taken_three_month = $wpdb->num_rows;
|
399 |
|
400 |
-
$mlw_four_month_first = mktime(0, 0, 0, date("m") , date("d")-
|
401 |
$mlw_four_month_first = date("Y-m-d", $mlw_four_month_first);
|
402 |
-
$mlw_four_month_last = mktime(0, 0, 0, date("m") , date("d")-
|
403 |
$mlw_four_month_last = date("Y-m-d", $mlw_four_month_last);
|
404 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_month_first." 00:00:00' AND '".$mlw_four_month_last." 23:59:59') AND deleted=0";
|
405 |
$mlw_quiz_taken_four_month = $wpdb->get_results($sql);
|
@@ -425,18 +452,6 @@ function mlw_dashboard_box_six()
|
|
425 |
<p>Up to 2 hours of consultation and training included.</p>
|
426 |
<br />
|
427 |
<p>Visit our <a href="http://mylocalwebstop.com/services/" target="_blank" style="color:blue;">services</a> page for details.</p>
|
428 |
-
<!--
|
429 |
-
<table width='100%'>
|
430 |
-
<tr>
|
431 |
-
<td align='left'>Plugin Premium Support includes priority response, priority feature requests, access to premium support-only forums forums, and access to WordPress training videos through wp101.</td>
|
432 |
-
</tr>
|
433 |
-
<tr>
|
434 |
-
<td align='left'>Up to 1 hour of consultation and training included during 1st month.</td>
|
435 |
-
</tr>
|
436 |
-
<tr>
|
437 |
-
<td align='left'>Visit our <a href="http://mylocalwebstop.com/services/" target="_blank" style="color:blue;">services</a> page for details.</td>
|
438 |
-
</tr>
|
439 |
-
</table>-->
|
440 |
</div>
|
441 |
<?php
|
442 |
}
|
@@ -562,4 +577,197 @@ function mlw_dashboard_box_nine()
|
|
562 |
</div>
|
563 |
<?php
|
564 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
?>
|
56 |
add_meta_box("wpss_mrts", 'Support', "mlw_dashboard_box_seven", "quiz_wpss7");
|
57 |
add_meta_box("wpss_mrts", 'Contribution', "mlw_dashboard_box_eight", "quiz_wpss8");
|
58 |
add_meta_box("wpss_mrts", 'News From My Local Webstop', "mlw_dashboard_box_nine", "quiz_wpss9");
|
59 |
+
add_meta_box("wpss_mrts", 'Quizzes Taken Today', "mlw_qmn_daily_percent_taken_widget", "quiz_wpss10");
|
60 |
+
add_meta_box("wpss_mrts", 'Quizzes Taken Last 7 Days', "mlw_qmn_weekly_percent_taken_widget", "quiz_wpss11");
|
61 |
+
add_meta_box("wpss_mrts", 'Quizzes Taken Last 30 Days', "mlw_qmn_monthly_percent_taken_widget", "quiz_wpss12");
|
62 |
+
add_meta_box("wpss_mrts", 'Quizzes Taken Last 120 Days', "mlw_qmn_quaterly_percent_taken_widget", "quiz_wpss13");
|
63 |
?>
|
64 |
<!-- css -->
|
65 |
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
69 |
wp_enqueue_script( 'jquery-ui-core' );
|
70 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
71 |
wp_enqueue_script( 'jquery-ui-button' );
|
72 |
+
wp_enqueue_script( 'jquery-ui-tooltip' );
|
73 |
wp_enqueue_script( 'jquery-effects-blind' );
|
74 |
wp_enqueue_script( 'jquery-effects-explode' );
|
75 |
?>
|
93 |
$j('#opener').click(function() {
|
94 |
$j('#dialog').dialog('open');
|
95 |
return false;
|
96 |
+
});
|
97 |
+
|
98 |
+
$j(function() {
|
99 |
+
$j( document ).tooltip();
|
100 |
+
});
|
101 |
});
|
102 |
$j(function() {
|
103 |
$j('.inlinesparkline').sparkline('html', {type: 'line', width: '400', height: '200'});
|
146 |
<h3>Version <?php echo $mlw_quiz_version; ?></h3>
|
147 |
<p><?php _e("Thank you for trying out this plugin. I hope you find it beneficial to your website. If it is, please consider donating or please consider rating this plugin ", "mlw_qmn_text_domain"); ?><a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next"><?php _e("here", "mlw_qmn_text_domain"); ?></a>.</p>
|
148 |
|
149 |
+
<div style="float:left; width:19%;" class="inner-sidebar1">
|
150 |
+
<?php do_meta_boxes('quiz_wpss10','advanced',''); ?>
|
151 |
+
</div>
|
152 |
+
|
153 |
+
<div style="float:left; width:19%;" class="inner-sidebar1">
|
154 |
+
<?php do_meta_boxes('quiz_wpss11','advanced',''); ?>
|
155 |
+
</div>
|
156 |
+
|
157 |
+
<div style="float:left; width:19%;" class="inner-sidebar1">
|
158 |
+
<?php do_meta_boxes('quiz_wpss12','advanced',''); ?>
|
159 |
+
</div>
|
160 |
+
|
161 |
+
<div style="float:left; width:19%;" class="inner-sidebar1">
|
162 |
+
<?php do_meta_boxes('quiz_wpss13','advanced',''); ?>
|
163 |
+
</div>
|
164 |
+
|
165 |
+
<div style="float:right; width:24%; " class="inner-sidebar1">
|
166 |
+
<?php do_meta_boxes('quiz_wpss6','advanced',''); ?>
|
167 |
+
</div>
|
168 |
+
|
169 |
<div style="float:left; width:38%;" class="inner-sidebar1">
|
170 |
<?php do_meta_boxes('quiz_wpss','advanced',''); ?>
|
171 |
</div>
|
174 |
<?php do_meta_boxes('quiz_wpss4','advanced',''); ?>
|
175 |
</div>
|
176 |
|
177 |
+
|
|
|
|
|
178 |
|
179 |
<!--<div style="clear:both">-->
|
180 |
|
394 |
{
|
395 |
//Gather the monthly stats, one variable for each day for the graph
|
396 |
global $wpdb;
|
397 |
+
$mlw_this_month = mktime(0, 0, 0, date("m") , date("d")-29, date("Y"));
|
398 |
$mlw_this_month = date("Y-m-d", $mlw_this_month);
|
399 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_month." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0";
|
400 |
$mlw_quiz_taken_this_month = $wpdb->get_results($sql);
|
401 |
$mlw_quiz_taken_this_month = $wpdb->num_rows;
|
402 |
|
403 |
+
$mlw_last_month_first = mktime(0, 0, 0, date("m") , date("d")-59, date("Y"));
|
404 |
$mlw_last_month_first = date("Y-m-d", $mlw_last_month_first);
|
405 |
+
$mlw_last_month_last = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
|
406 |
$mlw_last_month_last = date("Y-m-d", $mlw_last_month_last);
|
407 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_month_first." 00:00:00' AND '".$mlw_last_month_last." 23:59:59') AND deleted=0";
|
408 |
$mlw_quiz_taken_last_month = $wpdb->get_results($sql);
|
409 |
$mlw_quiz_taken_last_month = $wpdb->num_rows;
|
410 |
|
411 |
+
$mlw_two_month_first = mktime(0, 0, 0, date("m") , date("d")-89, date("Y"));
|
412 |
$mlw_two_month_first = date("Y-m-d", $mlw_two_month_first);
|
413 |
+
$mlw_two_month_last = mktime(0, 0, 0, date("m") , date("d")-60, date("Y"));
|
414 |
$mlw_two_month_last = date("Y-m-d", $mlw_two_month_last);
|
415 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_two_month_first." 00:00:00' AND '".$mlw_two_month_last." 23:59:59') AND deleted=0";
|
416 |
$mlw_quiz_taken_two_month = $wpdb->get_results($sql);
|
417 |
$mlw_quiz_taken_two_month = $wpdb->num_rows;
|
418 |
|
419 |
+
$mlw_three_month_first = mktime(0, 0, 0, date("m") , date("d")-119, date("Y"));
|
420 |
$mlw_three_month_first = date("Y-m-d", $mlw_three_month_first);
|
421 |
+
$mlw_three_month_last = mktime(0, 0, 0, date("m") , date("d")-90, date("Y"));
|
422 |
$mlw_three_month_last = date("Y-m-d", $mlw_three_month_last);
|
423 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_month_first." 00:00:00' AND '".$mlw_three_month_last." 23:59:59') AND deleted=0";
|
424 |
$mlw_quiz_taken_three_month = $wpdb->get_results($sql);
|
425 |
$mlw_quiz_taken_three_month = $wpdb->num_rows;
|
426 |
|
427 |
+
$mlw_four_month_first = mktime(0, 0, 0, date("m") , date("d")-149, date("Y"));
|
428 |
$mlw_four_month_first = date("Y-m-d", $mlw_four_month_first);
|
429 |
+
$mlw_four_month_last = mktime(0, 0, 0, date("m") , date("d")-120, date("Y"));
|
430 |
$mlw_four_month_last = date("Y-m-d", $mlw_four_month_last);
|
431 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_month_first." 00:00:00' AND '".$mlw_four_month_last." 23:59:59') AND deleted=0";
|
432 |
$mlw_quiz_taken_four_month = $wpdb->get_results($sql);
|
452 |
<p>Up to 2 hours of consultation and training included.</p>
|
453 |
<br />
|
454 |
<p>Visit our <a href="http://mylocalwebstop.com/services/" target="_blank" style="color:blue;">services</a> page for details.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
</div>
|
456 |
<?php
|
457 |
}
|
577 |
</div>
|
578 |
<?php
|
579 |
}
|
580 |
+
function mlw_qmn_weekly_percent_taken_widget()
|
581 |
+
{
|
582 |
+
global $wpdb;
|
583 |
+
|
584 |
+
$mlw_this_week = mktime(0, 0, 0, date("m") , date("d")-6, date("Y"));
|
585 |
+
$mlw_this_week = date("Y-m-d", $mlw_this_week);
|
586 |
+
$mlw_qmn_this_week_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_week." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
|
587 |
+
|
588 |
+
$mlw_last_week_start = mktime(0, 0, 0, date("m") , date("d")-13, date("Y"));
|
589 |
+
$mlw_last_week_start = date("Y-m-d", $mlw_last_week_start);
|
590 |
+
$mlw_last_week_end = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
|
591 |
+
$mlw_last_week_end = date("Y-m-d", $mlw_last_week_end);
|
592 |
+
$mlw_qmn_last_week_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week_start." 00:00:00' AND '".$mlw_last_week_end." 23:59:59') AND deleted=0");
|
593 |
+
|
594 |
+
if ($mlw_qmn_last_week_taken != 0)
|
595 |
+
{
|
596 |
+
$mlw_qmn_analyze_week = (($mlw_qmn_this_week_taken - $mlw_qmn_last_week_taken) / $mlw_qmn_last_week_taken) * 100;
|
597 |
+
}
|
598 |
+
else
|
599 |
+
{
|
600 |
+
$mlw_qmn_analyze_week = $mlw_qmn_this_week_taken * 100;
|
601 |
+
}
|
602 |
+
?>
|
603 |
+
<div>
|
604 |
+
<table width="100%">
|
605 |
+
<tr>
|
606 |
+
<td><div style="font-size: 60px; text-align:center;"><?php echo $mlw_qmn_this_week_taken; ?></div></td>
|
607 |
+
</tr>
|
608 |
+
<tr><td> </td></tr>
|
609 |
+
<tr>
|
610 |
+
<td>
|
611 |
+
<div style="font-size: 40px; text-align:center;">
|
612 |
+
<?php
|
613 |
+
echo "<span title='Compared to the previous 7 days'>".$mlw_qmn_analyze_week."%</span>";
|
614 |
+
if ($mlw_qmn_analyze_week >= 0)
|
615 |
+
{
|
616 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/green_triangle.png' width='40px' height='40px'/>";
|
617 |
+
}
|
618 |
+
else
|
619 |
+
{
|
620 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/red_triangle.png' width='40px' height='40px'/>";
|
621 |
+
}
|
622 |
+
?>
|
623 |
+
</div>
|
624 |
+
</td>
|
625 |
+
</tr>
|
626 |
+
</table>
|
627 |
+
</div>
|
628 |
+
<?php
|
629 |
+
}
|
630 |
+
function mlw_qmn_daily_percent_taken_widget()
|
631 |
+
{
|
632 |
+
global $wpdb;
|
633 |
+
$mlw_qmn_today_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".date("Y-m-d")." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
|
634 |
+
$mlw_last_week = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
|
635 |
+
$mlw_last_week = date("Y-m-d", $mlw_last_week);
|
636 |
+
$mlw_qmn_last_weekday_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0");
|
637 |
+
if ($mlw_qmn_last_weekday_taken != 0)
|
638 |
+
{
|
639 |
+
$mlw_qmn_analyze_today = (($mlw_qmn_today_taken - $mlw_qmn_last_weekday_taken) / $mlw_qmn_last_weekday_taken) * 100;
|
640 |
+
}
|
641 |
+
else
|
642 |
+
{
|
643 |
+
$mlw_qmn_analyze_today = $mlw_qmn_today_taken * 100;
|
644 |
+
}
|
645 |
+
?>
|
646 |
+
<div>
|
647 |
+
<table width="100%">
|
648 |
+
<tr>
|
649 |
+
<td><div style="font-size: 60px; text-align:center;"><?php echo $mlw_qmn_today_taken; ?></div></td>
|
650 |
+
</tr>
|
651 |
+
<tr><td> </td></tr>
|
652 |
+
<tr>
|
653 |
+
<td>
|
654 |
+
<div style="font-size: 40px; text-align:center;">
|
655 |
+
<?php
|
656 |
+
echo "<span title='Compared to this day last week'>".$mlw_qmn_analyze_today."%</span>";
|
657 |
+
if ($mlw_qmn_analyze_today >= 0)
|
658 |
+
{
|
659 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/green_triangle.png' width='40px' height='40px'/>";
|
660 |
+
}
|
661 |
+
else
|
662 |
+
{
|
663 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/red_triangle.png' width='40px' height='40px'/>";
|
664 |
+
}
|
665 |
+
?>
|
666 |
+
</div>
|
667 |
+
</td>
|
668 |
+
</tr>
|
669 |
+
</table>
|
670 |
+
</div>
|
671 |
+
<?php
|
672 |
+
}
|
673 |
+
function mlw_qmn_monthly_percent_taken_widget()
|
674 |
+
{
|
675 |
+
global $wpdb;
|
676 |
+
|
677 |
+
$mlw_this_month = mktime(0, 0, 0, date("m") , date("d")-29, date("Y"));
|
678 |
+
$mlw_this_month = date("Y-m-d", $mlw_this_month);
|
679 |
+
$mlw_qmn_this_month_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_month." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
|
680 |
+
|
681 |
+
$mlw_last_month_start = mktime(0, 0, 0, date("m") , date("d")-60, date("Y"));
|
682 |
+
$mlw_last_month_start = date("Y-m-d", $mlw_last_month_start);
|
683 |
+
$mlw_last_month_end = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
|
684 |
+
$mlw_last_month_end = date("Y-m-d", $mlw_last_month_end);
|
685 |
+
$mlw_qmn_last_month_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_month_start." 00:00:00' AND '".$mlw_last_month_end." 23:59:59') AND deleted=0");
|
686 |
+
|
687 |
+
if ($mlw_qmn_last_month_taken != 0)
|
688 |
+
{
|
689 |
+
$mlw_qmn_analyze_month = (($mlw_qmn_this_month_taken - $mlw_qmn_last_month_taken) / $mlw_qmn_last_month_taken) * 100;
|
690 |
+
}
|
691 |
+
else
|
692 |
+
{
|
693 |
+
$mlw_qmn_analyze_month = $mlw_qmn_this_month_taken * 100;
|
694 |
+
}
|
695 |
+
?>
|
696 |
+
<div>
|
697 |
+
<table width="100%">
|
698 |
+
<tr>
|
699 |
+
<td><div style="font-size: 60px; text-align:center;"><?php echo $mlw_qmn_this_month_taken; ?></div></td>
|
700 |
+
</tr>
|
701 |
+
<tr><td> </td></tr>
|
702 |
+
<tr>
|
703 |
+
<td>
|
704 |
+
<div style="font-size: 40px; text-align:center;">
|
705 |
+
<?php
|
706 |
+
echo "<span title='Compared to the previous 30 days'>".$mlw_qmn_analyze_month."%</span>";
|
707 |
+
if ($mlw_qmn_analyze_month >= 0)
|
708 |
+
{
|
709 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/green_triangle.png' width='40px' height='40px'/>";
|
710 |
+
}
|
711 |
+
else
|
712 |
+
{
|
713 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/red_triangle.png' width='40px' height='40px'/>";
|
714 |
+
}
|
715 |
+
?>
|
716 |
+
</div>
|
717 |
+
</td>
|
718 |
+
</tr>
|
719 |
+
</table>
|
720 |
+
</div>
|
721 |
+
<?php
|
722 |
+
}
|
723 |
+
function mlw_qmn_quaterly_percent_taken_widget()
|
724 |
+
{
|
725 |
+
global $wpdb;
|
726 |
+
|
727 |
+
$mlw_this_quater = mktime(0, 0, 0, date("m") , date("d")-119, date("Y"));
|
728 |
+
$mlw_this_quater = date("Y-m-d", $mlw_this_quater);
|
729 |
+
$mlw_qmn_this_quater_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_quater." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
|
730 |
+
|
731 |
+
$mlw_last_quater_start = mktime(0, 0, 0, date("m") , date("d")-240, date("Y"));
|
732 |
+
$mlw_last_quater_start = date("Y-m-d", $mlw_last_quater_start);
|
733 |
+
$mlw_last_quater_end = mktime(0, 0, 0, date("m") , date("d")-120, date("Y"));
|
734 |
+
$mlw_last_quater_end = date("Y-m-d", $mlw_last_quater_end);
|
735 |
+
$mlw_qmn_last_quater_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_quater_start." 00:00:00' AND '".$mlw_last_quater_end." 23:59:59') AND deleted=0");
|
736 |
+
|
737 |
+
if ($mlw_qmn_last_quater_taken != 0)
|
738 |
+
{
|
739 |
+
$mlw_qmn_analyze_quater = (($mlw_qmn_this_quater_taken - $mlw_qmn_last_quater_taken) / $mlw_qmn_last_quater_taken) * 100;
|
740 |
+
}
|
741 |
+
else
|
742 |
+
{
|
743 |
+
$mlw_qmn_analyze_quater = $mlw_qmn_this_quater_taken * 100;
|
744 |
+
}
|
745 |
+
?>
|
746 |
+
<div>
|
747 |
+
<table width="100%">
|
748 |
+
<tr>
|
749 |
+
<td><div style="font-size: 60px; text-align:center;"><?php echo $mlw_qmn_this_quater_taken; ?></div></td>
|
750 |
+
</tr>
|
751 |
+
<tr><td> </td></tr>
|
752 |
+
<tr>
|
753 |
+
<td>
|
754 |
+
<div style="font-size: 40px; text-align:center;">
|
755 |
+
<?php
|
756 |
+
echo "<span title='Compared to the previous 120 days'>".$mlw_qmn_analyze_quater."%</span>";
|
757 |
+
if ($mlw_qmn_analyze_quater >= 0)
|
758 |
+
{
|
759 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/green_triangle.png' width='40px' height='40px'/>";
|
760 |
+
}
|
761 |
+
else
|
762 |
+
{
|
763 |
+
echo "<img src='".plugin_dir_url( __FILE__ )."images/red_triangle.png' width='40px' height='40px'/>";
|
764 |
+
}
|
765 |
+
?>
|
766 |
+
</div>
|
767 |
+
</td>
|
768 |
+
</tr>
|
769 |
+
</table>
|
770 |
+
</div>
|
771 |
+
<?php
|
772 |
+
}
|
773 |
?>
|
includes/mlw_qmn_credits.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
This page shows the about page
|
4 |
+
*/
|
5 |
+
/*
|
6 |
+
Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
7 |
+
*/
|
8 |
+
|
9 |
+
function mlw_generate_about_page()
|
10 |
+
{
|
11 |
+
//Page Variables
|
12 |
+
$mlw_quiz_version = get_option('mlw_quiz_master_version');
|
13 |
+
|
14 |
+
|
15 |
+
?>
|
16 |
+
<!-- css -->
|
17 |
+
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
18 |
+
<!-- jquery scripts -->
|
19 |
+
<?php
|
20 |
+
wp_enqueue_script( 'jquery' );
|
21 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
22 |
+
wp_enqueue_script( 'jquery-ui-dialog' );
|
23 |
+
wp_enqueue_script( 'jquery-ui-button' );
|
24 |
+
wp_enqueue_script( 'jquery-effects-blind' );
|
25 |
+
wp_enqueue_script( 'jquery-effects-explode' );
|
26 |
+
?>
|
27 |
+
<!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
|
28 |
+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>-->
|
29 |
+
<script type="text/javascript">
|
30 |
+
var $j = jQuery.noConflict();
|
31 |
+
// increase the default animation speed to exaggerate the effect
|
32 |
+
$j.fx.speeds._default = 1000;
|
33 |
+
$j(function() {
|
34 |
+
$j('#dialog').dialog({
|
35 |
+
autoOpen: false,
|
36 |
+
show: 'blind',
|
37 |
+
hide: 'explode',
|
38 |
+
buttons: {
|
39 |
+
Ok: function() {
|
40 |
+
$j(this).dialog('close');
|
41 |
+
}
|
42 |
+
}
|
43 |
+
});
|
44 |
+
|
45 |
+
$j('#opener').click(function() {
|
46 |
+
$j('#dialog').dialog('open');
|
47 |
+
return false;
|
48 |
+
} );
|
49 |
+
});
|
50 |
+
$j(function() {
|
51 |
+
$j("button").button();
|
52 |
+
});
|
53 |
+
</script>
|
54 |
+
<div class="wrap about-wrap">
|
55 |
+
<h1>Welcome To Quiz Master Next <?php echo $mlw_quiz_version; ?><a id="opener" href="">(?)</a></h1>
|
56 |
+
<div class="about-text">Thank you for updating!</div>
|
57 |
+
<hr />
|
58 |
+
<h3>What's New In <?php echo $mlw_quiz_version; ?></h3>
|
59 |
+
<ul>
|
60 |
+
<li>Added Several New Widgets To Quiz Dashboard</li>
|
61 |
+
<li>Added A Timer Mechanism To Track How Long User Takes On Quiz</li>
|
62 |
+
<li>Added New About Update Page</li>
|
63 |
+
<li>Fixed Saving Results Bug</li>
|
64 |
+
<li>Fixed Random Number On Quiz Options Page Bug</li>
|
65 |
+
</ul>
|
66 |
+
<h3>What's Coming Soon</h3>
|
67 |
+
<ul>
|
68 |
+
<li>Time Limits</li>
|
69 |
+
<li>Quiz Pagination</li>
|
70 |
+
<li>Multiple Custom Landing Pages</li>
|
71 |
+
</ul>
|
72 |
+
|
73 |
+
<div id="dialog" title="Help">
|
74 |
+
<h3><b>Help</b></h3>
|
75 |
+
<p>This page contains the what's new section for the plugin!</p>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
<?php
|
79 |
+
}
|
80 |
+
?>
|
includes/mlw_quiz.php
CHANGED
@@ -7,6 +7,8 @@ function mlw_quiz_shortcode($atts)
|
|
7 |
extract(shortcode_atts(array(
|
8 |
'quiz' => 0
|
9 |
), $atts));
|
|
|
|
|
10 |
|
11 |
/*
|
12 |
Code before loading the quiz
|
@@ -17,6 +19,8 @@ function mlw_quiz_shortcode($atts)
|
|
17 |
$mlw_display = "";
|
18 |
global $wpdb;
|
19 |
$mlw_qmn_isAllowed = true;
|
|
|
|
|
20 |
|
21 |
|
22 |
//Load quiz
|
@@ -116,6 +120,7 @@ function mlw_quiz_shortcode($atts)
|
|
116 |
$mlw_views += 1;
|
117 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views='".$mlw_views."' WHERE quiz_id=".$mlw_quiz_id;
|
118 |
$results = $wpdb->query( $update );
|
|
|
119 |
|
120 |
//Form validation script
|
121 |
$mlw_display .= "
|
@@ -353,6 +358,7 @@ function mlw_quiz_shortcode($atts)
|
|
353 |
$mlw_questions = $wpdb->get_results($sql);
|
354 |
|
355 |
//Variables needed for scoring
|
|
|
356 |
$mlw_points = 0;
|
357 |
$mlw_correct = 0;
|
358 |
$mlw_total_questions = 0;
|
@@ -367,54 +373,56 @@ function mlw_quiz_shortcode($atts)
|
|
367 |
|
368 |
//See which answers were correct and award points if necessary
|
369 |
foreach($mlw_questions as $mlw_question) {
|
370 |
-
if (isset($_POST["question".$mlw_question->question_id]))
|
371 |
{
|
372 |
$mlw_user_text;
|
373 |
$mlw_correct_text;
|
374 |
$mlw_total_questions += 1;
|
375 |
-
|
376 |
-
if ($mlw_user_answer == $mlw_question->correct_answer)
|
377 |
-
{
|
378 |
-
$mlw_correct += 1;
|
379 |
-
}
|
380 |
-
if ($mlw_user_answer == 1)
|
381 |
-
{
|
382 |
-
$mlw_points += $mlw_question->answer_one_points;
|
383 |
-
$mlw_user_text = $mlw_question->answer_one;
|
384 |
-
}
|
385 |
-
if ($mlw_user_answer == 2)
|
386 |
-
{
|
387 |
-
$mlw_points += $mlw_question->answer_two_points;
|
388 |
-
$mlw_user_text = $mlw_question->answer_two;
|
389 |
-
}
|
390 |
-
if ($mlw_user_answer == 3)
|
391 |
{
|
392 |
-
$
|
393 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
}
|
395 |
-
if ($mlw_user_answer == 4)
|
396 |
-
{
|
397 |
-
$mlw_points += $mlw_question->answer_four_points;
|
398 |
-
$mlw_user_text = $mlw_question->answer_four;
|
399 |
-
}
|
400 |
-
if ($mlw_user_answer == 5)
|
401 |
-
{
|
402 |
-
$mlw_points += $mlw_question->answer_five_points;
|
403 |
-
$mlw_user_text = $mlw_question->answer_five;
|
404 |
-
}
|
405 |
-
if ($mlw_user_answer == 6)
|
406 |
-
{
|
407 |
-
$mlw_points += $mlw_question->answer_six_points;
|
408 |
-
$mlw_user_text = $mlw_question->answer_six;
|
409 |
-
}
|
410 |
-
|
411 |
-
if ($mlw_question->correct_answer == 1) {$mlw_correct_text = $mlw_question->answer_one;}
|
412 |
-
if ($mlw_question->correct_answer == 2) {$mlw_correct_text = $mlw_question->answer_two;}
|
413 |
-
if ($mlw_question->correct_answer == 3) {$mlw_correct_text = $mlw_question->answer_three;}
|
414 |
-
if ($mlw_question->correct_answer == 4) {$mlw_correct_text = $mlw_question->answer_four;}
|
415 |
-
if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
|
416 |
-
if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
|
417 |
-
|
418 |
if (isset($_POST["mlwComment".$mlw_question->question_id]))
|
419 |
{
|
420 |
$mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
|
@@ -461,6 +469,7 @@ function mlw_quiz_shortcode($atts)
|
|
461 |
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
462 |
$mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
|
463 |
$mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
|
|
|
464 |
$mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
|
465 |
$mlw_display .= $mlw_message_after;
|
466 |
|
@@ -483,6 +492,7 @@ function mlw_quiz_shortcode($atts)
|
|
483 |
$mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
|
484 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
485 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
|
|
486 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
487 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
488 |
wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
|
@@ -506,6 +516,7 @@ function mlw_quiz_shortcode($atts)
|
|
506 |
$mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
|
507 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
508 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
|
|
509 |
$mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
|
510 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
511 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
@@ -513,7 +524,7 @@ function mlw_quiz_shortcode($atts)
|
|
513 |
}
|
514 |
|
515 |
//Save the results into database
|
516 |
-
$mlw_quiz_results =
|
517 |
$mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
|
518 |
$mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
|
519 |
global $wpdb;
|
7 |
extract(shortcode_atts(array(
|
8 |
'quiz' => 0
|
9 |
), $atts));
|
10 |
+
|
11 |
+
|
12 |
|
13 |
/*
|
14 |
Code before loading the quiz
|
19 |
$mlw_display = "";
|
20 |
global $wpdb;
|
21 |
$mlw_qmn_isAllowed = true;
|
22 |
+
|
23 |
+
session_start();
|
24 |
|
25 |
|
26 |
//Load quiz
|
120 |
$mlw_views += 1;
|
121 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views='".$mlw_views."' WHERE quiz_id=".$mlw_quiz_id;
|
122 |
$results = $wpdb->query( $update );
|
123 |
+
$_SESSION['mlw_qmn_timer'] = time();
|
124 |
|
125 |
//Form validation script
|
126 |
$mlw_display .= "
|
358 |
$mlw_questions = $wpdb->get_results($sql);
|
359 |
|
360 |
//Variables needed for scoring
|
361 |
+
$mlw_qmn_timer = time() - $_SESSION['mlw_qmn_timer'];
|
362 |
$mlw_points = 0;
|
363 |
$mlw_correct = 0;
|
364 |
$mlw_total_questions = 0;
|
373 |
|
374 |
//See which answers were correct and award points if necessary
|
375 |
foreach($mlw_questions as $mlw_question) {
|
376 |
+
if (isset($_POST["question".$mlw_question->question_id]) || isset($_POST["mlwComment".$mlw_question->question_id]))
|
377 |
{
|
378 |
$mlw_user_text;
|
379 |
$mlw_correct_text;
|
380 |
$mlw_total_questions += 1;
|
381 |
+
if (isset($_POST["question".$mlw_question->question_id]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
{
|
383 |
+
$mlw_user_answer = $_POST["question".$mlw_question->question_id];
|
384 |
+
if ($mlw_user_answer == $mlw_question->correct_answer)
|
385 |
+
{
|
386 |
+
$mlw_correct += 1;
|
387 |
+
}
|
388 |
+
if ($mlw_user_answer == 1)
|
389 |
+
{
|
390 |
+
$mlw_points += $mlw_question->answer_one_points;
|
391 |
+
$mlw_user_text = $mlw_question->answer_one;
|
392 |
+
}
|
393 |
+
if ($mlw_user_answer == 2)
|
394 |
+
{
|
395 |
+
$mlw_points += $mlw_question->answer_two_points;
|
396 |
+
$mlw_user_text = $mlw_question->answer_two;
|
397 |
+
}
|
398 |
+
if ($mlw_user_answer == 3)
|
399 |
+
{
|
400 |
+
$mlw_points += $mlw_question->answer_three_points;
|
401 |
+
$mlw_user_text = $mlw_question->answer_three;
|
402 |
+
}
|
403 |
+
if ($mlw_user_answer == 4)
|
404 |
+
{
|
405 |
+
$mlw_points += $mlw_question->answer_four_points;
|
406 |
+
$mlw_user_text = $mlw_question->answer_four;
|
407 |
+
}
|
408 |
+
if ($mlw_user_answer == 5)
|
409 |
+
{
|
410 |
+
$mlw_points += $mlw_question->answer_five_points;
|
411 |
+
$mlw_user_text = $mlw_question->answer_five;
|
412 |
+
}
|
413 |
+
if ($mlw_user_answer == 6)
|
414 |
+
{
|
415 |
+
$mlw_points += $mlw_question->answer_six_points;
|
416 |
+
$mlw_user_text = $mlw_question->answer_six;
|
417 |
+
}
|
418 |
+
|
419 |
+
if ($mlw_question->correct_answer == 1) {$mlw_correct_text = $mlw_question->answer_one;}
|
420 |
+
if ($mlw_question->correct_answer == 2) {$mlw_correct_text = $mlw_question->answer_two;}
|
421 |
+
if ($mlw_question->correct_answer == 3) {$mlw_correct_text = $mlw_question->answer_three;}
|
422 |
+
if ($mlw_question->correct_answer == 4) {$mlw_correct_text = $mlw_question->answer_four;}
|
423 |
+
if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
|
424 |
+
if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
|
425 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
if (isset($_POST["mlwComment".$mlw_question->question_id]))
|
427 |
{
|
428 |
$mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
|
469 |
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
470 |
$mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
|
471 |
$mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
|
472 |
+
$mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
|
473 |
$mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
|
474 |
$mlw_display .= $mlw_message_after;
|
475 |
|
492 |
$mlw_message = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message);
|
493 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
494 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
495 |
+
$mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
|
496 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
497 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
498 |
wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
|
516 |
$mlw_message = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message);
|
517 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
518 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
519 |
+
$mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
|
520 |
$mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
|
521 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
522 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
524 |
}
|
525 |
|
526 |
//Save the results into database
|
527 |
+
$mlw_quiz_results = "Quiz was taken in: ".$mlw_qmn_timer." seconds."."\n".$mlw_question_answers."\n"."Comments: ".$mlw_qm_quiz_comments;
|
528 |
$mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
|
529 |
$mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
|
530 |
global $wpdb;
|
includes/mlw_quiz_options.php
CHANGED
@@ -33,7 +33,6 @@ function mlw_generate_quiz_options()
|
|
33 |
$edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
|
34 |
$edit_answer_one = htmlspecialchars($_POST["edit_answer_one"], ENT_QUOTES);
|
35 |
$edit_answer_one_points = intval($_POST["edit_answer_one_points"]);
|
36 |
-
echo $edit_answer_one_points;
|
37 |
$edit_answer_two = htmlspecialchars($_POST["edit_answer_two"], ENT_QUOTES);
|
38 |
$edit_answer_two_points = intval($_POST["edit_answer_two_points"]);
|
39 |
$edit_answer_three = htmlspecialchars($_POST["edit_answer_three"], ENT_QUOTES);
|
@@ -787,9 +786,9 @@ function mlw_generate_quiz_options()
|
|
787 |
?>
|
788 |
<table>
|
789 |
<tr>
|
790 |
-
<td><span style='font-weight:bold;'>Question
|
791 |
<td colspan="3">
|
792 |
-
<textarea name="question_name" id="question_name" style="width: 500px; height: 150px;"></textarea>
|
793 |
</td>
|
794 |
</tr>
|
795 |
<tr valign="top">
|
@@ -1152,6 +1151,9 @@ function mlw_generate_quiz_options()
|
|
1152 |
<td><strong>%USER_COMMENTS%</strong> - The comments the user provided in the comment field for the question</td>
|
1153 |
<td><strong>%CORRECT_ANSWER_INFO%</strong> - Reason why the correct answer is the correct answer</td>
|
1154 |
</tr>
|
|
|
|
|
|
|
1155 |
</table>
|
1156 |
<button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
|
1157 |
<?php
|
@@ -1200,6 +1202,7 @@ function mlw_generate_quiz_options()
|
|
1200 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
1201 |
<p style="margin: 2px 0">- %COMMENT_SECTION%</p>
|
1202 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
|
|
1203 |
</td>
|
1204 |
<td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_after_message"><?php echo $mlw_quiz_options->message_after; ?></textarea>
|
1205 |
</td>
|
@@ -1237,6 +1240,7 @@ function mlw_generate_quiz_options()
|
|
1237 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
1238 |
<p style="margin: 2px 0">- %COMMENT_SECTION%</p>
|
1239 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
|
|
1240 |
</td>
|
1241 |
<td><textarea cols="80" rows="15" id="mlw_quiz_user_email_template" name="mlw_quiz_user_email_template"><?php echo $mlw_quiz_options->user_email_template; ?></textarea>
|
1242 |
</td>
|
@@ -1258,6 +1262,7 @@ function mlw_generate_quiz_options()
|
|
1258 |
<p style="margin: 2px 0">- %QUIZ_NAME%</p>
|
1259 |
<p style="margin: 2px 0">- %COMMENT_SECTION%</p>
|
1260 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
|
|
1261 |
</td>
|
1262 |
<td><textarea cols="80" rows="15" id="mlw_quiz_admin_email_template" name="mlw_quiz_admin_email_template"><?php echo $mlw_quiz_options->admin_email_template; ?></textarea>
|
1263 |
</td>
|
33 |
$edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
|
34 |
$edit_answer_one = htmlspecialchars($_POST["edit_answer_one"], ENT_QUOTES);
|
35 |
$edit_answer_one_points = intval($_POST["edit_answer_one_points"]);
|
|
|
36 |
$edit_answer_two = htmlspecialchars($_POST["edit_answer_two"], ENT_QUOTES);
|
37 |
$edit_answer_two_points = intval($_POST["edit_answer_two_points"]);
|
38 |
$edit_answer_three = htmlspecialchars($_POST["edit_answer_three"], ENT_QUOTES);
|
786 |
?>
|
787 |
<table>
|
788 |
<tr>
|
789 |
+
<td><span style='font-weight:bold;'>Question</span></td>
|
790 |
<td colspan="3">
|
791 |
+
<textarea name="question_name" id="question_name" style="width: 500px; height: 150px;" title="Enter the question here. Feel free to use HTML, embed Youtube videos, link to images, etc..."></textarea>
|
792 |
</td>
|
793 |
</tr>
|
794 |
<tr valign="top">
|
1151 |
<td><strong>%USER_COMMENTS%</strong> - The comments the user provided in the comment field for the question</td>
|
1152 |
<td><strong>%CORRECT_ANSWER_INFO%</strong> - Reason why the correct answer is the correct answer</td>
|
1153 |
</tr>
|
1154 |
+
<tr>
|
1155 |
+
<td><strong>%TIMER%</strong> - The amount of time user spent of quiz</td>
|
1156 |
+
</tr>
|
1157 |
</table>
|
1158 |
<button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
|
1159 |
<?php
|
1202 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
1203 |
<p style="margin: 2px 0">- %COMMENT_SECTION%</p>
|
1204 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
1205 |
+
<p style="margin: 2px 0">- %TIMER%</p>
|
1206 |
</td>
|
1207 |
<td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_after_message"><?php echo $mlw_quiz_options->message_after; ?></textarea>
|
1208 |
</td>
|
1240 |
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
1241 |
<p style="margin: 2px 0">- %COMMENT_SECTION%</p>
|
1242 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
1243 |
+
<p style="margin: 2px 0">- %TIMER%</p>
|
1244 |
</td>
|
1245 |
<td><textarea cols="80" rows="15" id="mlw_quiz_user_email_template" name="mlw_quiz_user_email_template"><?php echo $mlw_quiz_options->user_email_template; ?></textarea>
|
1246 |
</td>
|
1262 |
<p style="margin: 2px 0">- %QUIZ_NAME%</p>
|
1263 |
<p style="margin: 2px 0">- %COMMENT_SECTION%</p>
|
1264 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
1265 |
+
<p style="margin: 2px 0">- %TIMER%</p>
|
1266 |
</td>
|
1267 |
<td><textarea cols="80" rows="15" id="mlw_quiz_admin_email_template" name="mlw_quiz_admin_email_template"><?php echo $mlw_quiz_options->admin_email_template; ?></textarea>
|
1268 |
</td>
|
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.
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
@@ -153,6 +153,11 @@ function mlw_quiz_update()
|
|
153 |
}
|
154 |
|
155 |
update_option('mlw_quiz_master_version' , $data);
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
157 |
}
|
158 |
?>
|
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.7.1";
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
153 |
}
|
154 |
|
155 |
update_option('mlw_quiz_master_version' , $data);
|
156 |
+
if(!isset($_GET['activate-multi']))
|
157 |
+
{
|
158 |
+
wp_redirect( "admin.php?page=mlw_qmn_about" );
|
159 |
+
exit;
|
160 |
+
}
|
161 |
}
|
162 |
}
|
163 |
?>
|
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.
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
@@ -34,6 +34,7 @@ include("includes/mlw_leaderboard.php");
|
|
34 |
include("includes/mlw_help.php");
|
35 |
include("includes/mlw_update.php");
|
36 |
include("includes/mlw_qmn_widgets.php");
|
|
|
37 |
|
38 |
|
39 |
///Activation Actions
|
@@ -64,8 +65,39 @@ function mlw_add_menu()
|
|
64 |
add_submenu_page(__FILE__, 'Quiz Result Details', 'Quiz Result Details', 'moderate_comments', 'mlw_quiz_result_details', 'mlw_generate_result_details');
|
65 |
add_submenu_page(__FILE__, 'Tools', 'Tools', 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools');
|
66 |
add_submenu_page(__FILE__, 'How-To', 'How-To', 'moderate_comments', 'mlw_how_to', 'mlw_generate_help_page');
|
|
|
67 |
}
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
/*
|
70 |
|
71 |
|
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.7.1
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
34 |
include("includes/mlw_help.php");
|
35 |
include("includes/mlw_update.php");
|
36 |
include("includes/mlw_qmn_widgets.php");
|
37 |
+
include("includes/mlw_qmn_credits.php");
|
38 |
|
39 |
|
40 |
///Activation Actions
|
65 |
add_submenu_page(__FILE__, 'Quiz Result Details', 'Quiz Result Details', 'moderate_comments', 'mlw_quiz_result_details', 'mlw_generate_result_details');
|
66 |
add_submenu_page(__FILE__, 'Tools', 'Tools', 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools');
|
67 |
add_submenu_page(__FILE__, 'How-To', 'How-To', 'moderate_comments', 'mlw_how_to', 'mlw_generate_help_page');
|
68 |
+
add_submenu_page(__FILE__, 'QMN About', 'QMN About', 'manage_options', 'mlw_qmn_about', 'mlw_generate_about_page');
|
69 |
}
|
70 |
}
|
71 |
+
|
72 |
+
|
73 |
+
//Admin Notice
|
74 |
+
add_action('admin_notices', 'mlw_qmn_notice');
|
75 |
+
function mlw_qmn_notice() {
|
76 |
+
if ( get_option('mlw_qmn_review_notice') == 1 && current_user_can( 'manage_options' ) ) {
|
77 |
+
echo '<div class="updated"><p>';
|
78 |
+
printf(__('You have been using the Quiz Master Next plugin for a while now! Thanks for choosing to use this plugin. If it has benefited your website, please consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ">donation</a> or a <a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next">review</a>. | <a href="%1$s">Hide Notice</a>'), '?mlw_qmn_ignore_notice=0');
|
79 |
+
echo "</p></div>";
|
80 |
+
}
|
81 |
+
}
|
82 |
+
//Check to see if notices should be shown or dismissed
|
83 |
+
add_action('admin_init', 'mlw_qmn_notice_ignore');
|
84 |
+
function mlw_qmn_notice_ignore() {
|
85 |
+
global $wpdb;
|
86 |
+
if ( ! get_option('mlw_qmn_review_notice'))
|
87 |
+
{
|
88 |
+
add_option('mlw_qmn_review_notice' , '0');
|
89 |
+
}
|
90 |
+
if ($wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_results" ) >= 20 && get_option('mlw_qmn_review_notice') == 0)
|
91 |
+
{
|
92 |
+
update_option('mlw_qmn_review_notice' , '1');
|
93 |
+
}
|
94 |
+
if ( isset($_GET['mlw_qmn_ignore_notice']) && '0' == $_GET['mlw_qmn_ignore_notice'] ) {
|
95 |
+
update_option('mlw_qmn_review_notice' , '2');
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
/*
|
102 |
|
103 |
|
readme.txt
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
=== Quiz Master Next ===
|
2 |
Contributors: fpcorso
|
|
|
3 |
Tags: quiz, test, score, survey, contact, form, email, answer, question
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 3.8.1
|
6 |
-
Stable tag: 1.
|
7 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
|
9 |
Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
|
@@ -88,6 +89,13 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
88 |
|
89 |
== Changelog ==
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
= 1.6.3 (March 5, 2014) =
|
92 |
* Fixed Duplicated Shortcode Bug
|
93 |
* Quiz Dashboard Design Changes
|
@@ -319,6 +327,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
319 |
|
320 |
== Upgrade Notice ==
|
321 |
|
|
|
|
|
|
|
322 |
= 1.6.3 =
|
323 |
This update fixes minor bugs and adds minor design changes.
|
324 |
|
1 |
=== Quiz Master Next ===
|
2 |
Contributors: fpcorso
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ
|
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.7.1
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 1.7.1 (March 6, 2014) =
|
93 |
+
* Added Several New Widgets To Quiz Dashboard
|
94 |
+
* Added A Timer Mechanism To Track How Long User Takes On Quiz
|
95 |
+
* Added New About Update Page
|
96 |
+
* Fixed Saving Results Bug
|
97 |
+
* Fixed Random Number On Quiz Options Page Bug
|
98 |
+
|
99 |
= 1.6.3 (March 5, 2014) =
|
100 |
* Fixed Duplicated Shortcode Bug
|
101 |
* Quiz Dashboard Design Changes
|
327 |
|
328 |
== Upgrade Notice ==
|
329 |
|
330 |
+
= 1.7.1 =
|
331 |
+
This update adds new widgets to Quiz Dashboard, adds a timer mechanism, and fixes several minor bugs.
|
332 |
+
|
333 |
= 1.6.3 =
|
334 |
This update fixes minor bugs and adds minor design changes.
|
335 |
|
uninstall.php
CHANGED
@@ -26,4 +26,6 @@ global $wpdb;
|
|
26 |
$results = $wpdb->query( $sql );
|
27 |
|
28 |
delete_option('mlw_quiz_master_version');
|
|
|
|
|
29 |
?>
|
26 |
$results = $wpdb->query( $sql );
|
27 |
|
28 |
delete_option('mlw_quiz_master_version');
|
29 |
+
|
30 |
+
delete_option('mlw_qmn_review_notice');
|
31 |
?>
|