Version Description
Upgrade for ability to schedule when quiz will be active
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 3.7.1 |
Comparing to | |
See all releases |
Code changes from version 3.6.1 to 3.7.1
- assets/icon-128x128.png +0 -0
- includes/mlw_adverts.php +5 -8
- includes/mlw_alerts.php +0 -1
- includes/mlw_qmn_credits.php +9 -11
- includes/mlw_quiz.php +69 -33
- includes/mlw_quiz_admin.php +10 -410
- includes/mlw_quiz_creator.php +526 -0
- includes/mlw_quiz_install.php +4 -0
- includes/mlw_quiz_options.php +138 -75
- includes/mlw_results.php +4 -4
- includes/mlw_update.php +18 -2
- mlw_quizmaster2.php +26 -2
- readme.txt +18 -2
assets/icon-128x128.png
ADDED
Binary file
|
includes/mlw_adverts.php
CHANGED
@@ -6,7 +6,7 @@ function mlw_qmn_show_adverts()
|
|
6 |
$mlw_advert_text = "";
|
7 |
if ( get_option('mlw_advert_shows') == 'true' )
|
8 |
{
|
9 |
-
$mlw_random_int = rand(0,
|
10 |
switch ($mlw_random_int) {
|
11 |
case 0:
|
12 |
$mlw_advert_text = "Need support or features? Check out our Premium Support options! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details!";
|
@@ -21,19 +21,16 @@ function mlw_qmn_show_adverts()
|
|
21 |
$mlw_advert_text = "Would you like to support this plugin but do not need or want premium support? Please consider our inexpensive 'Advertisements Be Gone' add-on which will get rid of these ads. Visit our <a href=\"http://mylocalwebstop.com/shop/\">Plugin Add-On Store</a> for details!";
|
22 |
break;
|
23 |
case 4:
|
24 |
-
$mlw_advert_text = "Need
|
25 |
break;
|
26 |
case 5:
|
27 |
-
$mlw_advert_text = "
|
28 |
break;
|
29 |
case 6:
|
30 |
-
$mlw_advert_text = "
|
31 |
break;
|
32 |
case 7:
|
33 |
-
$mlw_advert_text = "
|
34 |
-
break;
|
35 |
-
case 8:
|
36 |
-
$mlw_advert_text = "Our new Popular Add-On Pack is now only $45 for 6 add-ons! Now is the time to save almost 50%! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details.";
|
37 |
break;
|
38 |
default:
|
39 |
$mlw_advert_text = "Need support or features? Check out our Premium Support options! Visit our <a href=\"http://mylocalwebstop.com/shop/\">Plugin Add-On Store</a> for details!";
|
6 |
$mlw_advert_text = "";
|
7 |
if ( get_option('mlw_advert_shows') == 'true' )
|
8 |
{
|
9 |
+
$mlw_random_int = rand(0, 7);
|
10 |
switch ($mlw_random_int) {
|
11 |
case 0:
|
12 |
$mlw_advert_text = "Need support or features? Check out our Premium Support options! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details!";
|
21 |
$mlw_advert_text = "Would you like to support this plugin but do not need or want premium support? Please consider our inexpensive 'Advertisements Be Gone' add-on which will get rid of these ads. Visit our <a href=\"http://mylocalwebstop.com/shop/\">Plugin Add-On Store</a> for details!";
|
22 |
break;
|
23 |
case 4:
|
24 |
+
$mlw_advert_text = "Need help keeping your plugins, themes, and WordPress up to date? Want around the clock security monitoring and off-site back-ups? How about WordPress training videos, a monthly status report, and support/consultation? Check out our <a href=\"http://mylocalwebstop.com/wordpress-maintenance-services/\">WordPress Maintenance Services</a> for more details!";
|
25 |
break;
|
26 |
case 5:
|
27 |
+
$mlw_advert_text = "Setting up a new site? Let us take care of the set-up so you back to running your business. Check out our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for more details!";
|
28 |
break;
|
29 |
case 6:
|
30 |
+
$mlw_advert_text = "Our new Popular Add-On Pack is now only $45 for 6 add-ons! Now is the time to save almost 50%! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details.";
|
31 |
break;
|
32 |
case 7:
|
33 |
+
$mlw_advert_text = "Please consider taking our survey so we can improve this add-on. The survey only takes a few minutes. When you are ready, please <a href='http://mylocalwebstop.com/quiz-master-next-survey/'>take our survey</a>";
|
|
|
|
|
|
|
34 |
break;
|
35 |
default:
|
36 |
$mlw_advert_text = "Need support or features? Check out our Premium Support options! Visit our <a href=\"http://mylocalwebstop.com/shop/\">Plugin Add-On Store</a> for details!";
|
includes/mlw_alerts.php
CHANGED
@@ -26,5 +26,4 @@ class MlwQmnAlertManager {
|
|
26 |
}
|
27 |
|
28 |
}
|
29 |
-
$mlwQmnAlertManager = new MlwQmnAlertManager();
|
30 |
?>
|
26 |
}
|
27 |
|
28 |
}
|
|
|
29 |
?>
|
includes/mlw_qmn_credits.php
CHANGED
@@ -89,18 +89,18 @@ function mlw_generate_about_page()
|
|
89 |
<div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
|
90 |
<h2 class="nav-tab-wrapper">
|
91 |
<a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
|
92 |
-
What’s New In 3.
|
93 |
<a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
|
94 |
Changelog For <?php echo $mlw_quiz_version; ?> </a>
|
95 |
<a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
|
96 |
Requested Features</a>
|
97 |
</h2>
|
98 |
<div id="mlw_quiz_what_new">
|
99 |
-
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">
|
100 |
-
<p style="text-align: center;">You can now
|
101 |
<br />
|
102 |
-
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">
|
103 |
-
<p style="text-align: center;">
|
104 |
<br />
|
105 |
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">We Are On GitHub Now</h2>
|
106 |
<p style="text-align: center;">We have had several users ask for this so we thought we would try it out. We now love github! Be sure to <a href="https://github.com/fpcorso/quiz_master_next/">make suggestions or contribute</a>.</p>
|
@@ -109,13 +109,11 @@ function mlw_generate_about_page()
|
|
109 |
<p style="text-align: center;">Our Popular Add-On Pack is now only $45 for 6 add-ons! Now is the time to save almost 50%! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details.</p>
|
110 |
</div>
|
111 |
<div id="mlw_quiz_changelog" style="display: none;">
|
112 |
-
<h3><?php echo $mlw_quiz_version; ?> (December
|
113 |
<ul>
|
114 |
-
<li>*
|
115 |
-
<li>*
|
116 |
-
<li>*
|
117 |
-
<li>* Created New Filter For Creating New Variables For Quiz Page</li>
|
118 |
-
<li>* Created New Filter For Creating New Variables For Results Page</li>
|
119 |
</ul>
|
120 |
</div>
|
121 |
<div id="mlw_quiz_requested" style="display: none;">
|
89 |
<div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
|
90 |
<h2 class="nav-tab-wrapper">
|
91 |
<a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
|
92 |
+
What’s New In 3.7</a>
|
93 |
<a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
|
94 |
Changelog For <?php echo $mlw_quiz_version; ?> </a>
|
95 |
<a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
|
96 |
Requested Features</a>
|
97 |
</h2>
|
98 |
<div id="mlw_quiz_what_new">
|
99 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Ability To Schedule When Quiz Is Active</h2>
|
100 |
+
<p style="text-align: center;">You can now set a time-frame of when the quiz is active. On the quiz options tab, you will see a spot to put in two dates. The quiz will now only be active during that time. Leave those fields blank to leave the quiz always active.</p>
|
101 |
<br />
|
102 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Please Take Our Survey To Better Improve This Plugin</h2>
|
103 |
+
<p style="text-align: center;">When you have a moment, please take our survey for this plugin. By filling out the survey, you are helping us improve this plugin. Users who take the survey between now and December 31st, 2014 will be emailed a 25% off coupon for our WordPress Store. When you are ready, please <a href='http://mylocalwebstop.com/quiz-master-next-survey/'>take our survey</a>.</p>
|
104 |
<br />
|
105 |
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">We Are On GitHub Now</h2>
|
106 |
<p style="text-align: center;">We have had several users ask for this so we thought we would try it out. We now love github! Be sure to <a href="https://github.com/fpcorso/quiz_master_next/">make suggestions or contribute</a>.</p>
|
109 |
<p style="text-align: center;">Our Popular Add-On Pack is now only $45 for 6 add-ons! Now is the time to save almost 50%! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details.</p>
|
110 |
</div>
|
111 |
<div id="mlw_quiz_changelog" style="display: none;">
|
112 |
+
<h3><?php echo $mlw_quiz_version; ?> (December 10, 2014)</h3>
|
113 |
<ul>
|
114 |
+
<li>* Added Ability To Schedule A Timeframe That The Quiz Is Active In</li>
|
115 |
+
<li>* In Backend: Moved Alert Class Inside Main Class</li>
|
116 |
+
<li>* In Backend: Created New Quiz Creator Class</li>
|
|
|
|
|
117 |
</ul>
|
118 |
</div>
|
119 |
<div id="mlw_quiz_requested" style="display: none;">
|
includes/mlw_quiz.php
CHANGED
@@ -8,7 +8,7 @@ function mlw_quiz_shortcode($atts)
|
|
8 |
'quiz' => 0
|
9 |
), $atts));
|
10 |
|
11 |
-
|
12 |
|
13 |
/*
|
14 |
Code before loading the quiz
|
@@ -43,11 +43,32 @@ function mlw_quiz_shortcode($atts)
|
|
43 |
{
|
44 |
$mlw_message = htmlspecialchars_decode($mlw_quiz_options->require_log_in_text, ENT_QUOTES);
|
45 |
$mlw_message = apply_filters( 'mlw_qmn_template_variable_quiz_page', $mlw_message, $mlw_qmn_quiz_options_array);
|
|
|
46 |
$mlw_display = $mlw_message;
|
47 |
$mlw_display .= wp_login_form( array('echo' => false) );
|
48 |
return $mlw_display;
|
49 |
$mlw_qmn_isAllowed = false;
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
//Check to see if there is limit on the amount of tries
|
53 |
if ( $mlw_quiz_options->total_user_tries != 0 && is_user_logged_in() )
|
@@ -78,8 +99,12 @@ function mlw_quiz_shortcode($atts)
|
|
78 |
//Load and prepare answer arrays
|
79 |
$mlw_qmn_answer_arrays = array();
|
80 |
foreach($mlw_questions as $mlw_question_info) {
|
81 |
-
$
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
{
|
84 |
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
|
85 |
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
|
@@ -91,10 +116,6 @@ function mlw_quiz_shortcode($atts)
|
|
91 |
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
|
92 |
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
|
93 |
}
|
94 |
-
else
|
95 |
-
{
|
96 |
-
$mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
|
97 |
-
}
|
98 |
}
|
99 |
|
100 |
|
@@ -209,10 +230,14 @@ function mlw_quiz_shortcode($atts)
|
|
209 |
|
210 |
//Gather text for pagination buttons
|
211 |
$mlw_qmn_pagination_text = "";
|
212 |
-
$
|
213 |
-
|
214 |
-
|
215 |
-
|
|
|
|
|
|
|
|
|
216 |
?>
|
217 |
<script type="text/javascript">
|
218 |
setTimeout(function(){
|
@@ -513,8 +538,11 @@ function mlw_quiz_shortcode($atts)
|
|
513 |
|
514 |
//Display the questions
|
515 |
foreach($mlw_questions as $mlw_question) {
|
516 |
-
$
|
517 |
-
|
|
|
|
|
|
|
518 |
{
|
519 |
$mlw_question_settings = array();
|
520 |
$mlw_question_settings['required'] = 1;
|
@@ -654,7 +682,7 @@ function mlw_quiz_shortcode($atts)
|
|
654 |
$mlw_answer_total++;
|
655 |
if ($mlw_qmn_answer_each[0] != "")
|
656 |
{
|
657 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='".esc_attr($mlw_qmn_answer_each[0])."' /> ".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES)." ";
|
658 |
}
|
659 |
}
|
660 |
$mlw_display .= "<input type='radio' style='display: none;' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_none' checked='checked' value='No Answer Provided' />";
|
@@ -901,8 +929,12 @@ function mlw_quiz_shortcode($atts)
|
|
901 |
//Load and prepare answer arrays
|
902 |
$mlw_qmn_loaded_answer_arrays = array();
|
903 |
foreach($mlw_questions as $mlw_question_info) {
|
904 |
-
$
|
905 |
-
|
|
|
|
|
|
|
|
|
906 |
{
|
907 |
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
|
908 |
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
|
@@ -914,10 +946,6 @@ function mlw_quiz_shortcode($atts)
|
|
914 |
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
|
915 |
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
|
916 |
}
|
917 |
-
else
|
918 |
-
{
|
919 |
-
$mlw_qmn_loaded_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
|
920 |
-
}
|
921 |
}
|
922 |
|
923 |
//Variables needed for scoring
|
@@ -1095,11 +1123,14 @@ function mlw_quiz_shortcode($atts)
|
|
1095 |
|
1096 |
//Prepare Certificate
|
1097 |
$mlw_certificate_link = "";
|
1098 |
-
$
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
|
|
|
|
|
|
1103 |
if ($mlw_certificate_options[4] == 0)
|
1104 |
{
|
1105 |
$mlw_message_certificate = $mlw_certificate_options[1];
|
@@ -1139,9 +1170,9 @@ EOC;
|
|
1139 |
-Second, check for array in case user has not updated
|
1140 |
Message array = (array( bottomvalue, topvalue, text),array( bottomvalue, topvalue, text), etc..., array(0,0,text))
|
1141 |
*/
|
1142 |
-
$
|
1143 |
-
if (is_array($mlw_message_after_array))
|
1144 |
{
|
|
|
1145 |
//Cycle through landing pages
|
1146 |
foreach($mlw_message_after_array as $mlw_each)
|
1147 |
{
|
@@ -1218,9 +1249,13 @@ EOC;
|
|
1218 |
<?php
|
1219 |
//Load Social Media Text
|
1220 |
$qmn_social_media_text = "";
|
1221 |
-
$
|
1222 |
-
|
1223 |
-
|
|
|
|
|
|
|
|
|
1224 |
'twitter' => $mlw_quiz_options->social_media_text,
|
1225 |
'facebook' => $mlw_quiz_options->social_media_text
|
1226 |
);
|
@@ -1246,9 +1281,10 @@ EOC;
|
|
1246 |
{
|
1247 |
if ($mlw_user_email != "")
|
1248 |
{
|
1249 |
-
$
|
1250 |
-
if (is_array($mlw_user_email_array))
|
1251 |
{
|
|
|
|
|
1252 |
//Cycle through landing pages
|
1253 |
foreach($mlw_user_email_array as $mlw_each)
|
1254 |
{
|
8 |
'quiz' => 0
|
9 |
), $atts));
|
10 |
|
11 |
+
date_default_timezone_set(get_option('timezone_string'));
|
12 |
|
13 |
/*
|
14 |
Code before loading the quiz
|
43 |
{
|
44 |
$mlw_message = htmlspecialchars_decode($mlw_quiz_options->require_log_in_text, ENT_QUOTES);
|
45 |
$mlw_message = apply_filters( 'mlw_qmn_template_variable_quiz_page', $mlw_message, $mlw_qmn_quiz_options_array);
|
46 |
+
$mlw_message = str_replace( "\n" , "<br>", $mlw_message);
|
47 |
$mlw_display = $mlw_message;
|
48 |
$mlw_display .= wp_login_form( array('echo' => false) );
|
49 |
return $mlw_display;
|
50 |
$mlw_qmn_isAllowed = false;
|
51 |
+
}
|
52 |
+
|
53 |
+
//Check if date is inside scheduled timeframe
|
54 |
+
if (is_serialized($mlw_quiz_options->scheduled_timeframe) && is_array(@unserialize($mlw_quiz_options->scheduled_timeframe)))
|
55 |
+
{
|
56 |
+
$qmn_scheduled_timeframe = @unserialize($mlw_quiz_options->scheduled_timeframe);
|
57 |
+
if ($qmn_scheduled_timeframe["start"] != '' && $qmn_scheduled_timeframe["end"] != '')
|
58 |
+
{
|
59 |
+
$qmn_scheduled_start = strtotime($qmn_scheduled_timeframe["start"]);
|
60 |
+
$qmn_scheduled_end = strtotime($qmn_scheduled_timeframe["end"]) + 86399; ///Added seconds to bring time to 11:59:59 PM of given day
|
61 |
+
if (time() < $qmn_scheduled_start | time() > $qmn_scheduled_end)
|
62 |
+
{
|
63 |
+
$mlw_message = htmlspecialchars_decode($mlw_quiz_options->scheduled_timeframe_text, ENT_QUOTES);
|
64 |
+
$mlw_message = apply_filters( 'mlw_qmn_template_variable_quiz_page', $mlw_message, $mlw_qmn_quiz_options_array);
|
65 |
+
$mlw_message = str_replace( "\n" , "<br>", $mlw_message);
|
66 |
+
$mlw_display = $mlw_message;
|
67 |
+
return $mlw_display;
|
68 |
+
$mlw_qmn_isAllowed = false;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
|
73 |
//Check to see if there is limit on the amount of tries
|
74 |
if ( $mlw_quiz_options->total_user_tries != 0 && is_user_logged_in() )
|
99 |
//Load and prepare answer arrays
|
100 |
$mlw_qmn_answer_arrays = array();
|
101 |
foreach($mlw_questions as $mlw_question_info) {
|
102 |
+
if (is_serialized($mlw_question_info->answer_array) && is_array(@unserialize($mlw_question_info->answer_array)))
|
103 |
+
{
|
104 |
+
$mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
|
105 |
+
$mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
|
106 |
+
}
|
107 |
+
else
|
108 |
{
|
109 |
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
|
110 |
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
|
116 |
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
|
117 |
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
|
118 |
}
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
|
230 |
|
231 |
//Gather text for pagination buttons
|
232 |
$mlw_qmn_pagination_text = "";
|
233 |
+
if (is_serialized($mlw_quiz_options->pagination_text) && is_array(@unserialize($mlw_quiz_options->pagination_text)))
|
234 |
+
{
|
235 |
+
$mlw_qmn_pagination_text = @unserialize($mlw_quiz_options->pagination_text);
|
236 |
+
}
|
237 |
+
else
|
238 |
+
{
|
239 |
+
$mlw_qmn_pagination_text = array('Previous', $mlw_quiz_options->pagination_text);
|
240 |
+
}
|
241 |
?>
|
242 |
<script type="text/javascript">
|
243 |
setTimeout(function(){
|
538 |
|
539 |
//Display the questions
|
540 |
foreach($mlw_questions as $mlw_question) {
|
541 |
+
if (is_serialized($mlw_question->question_settings) && is_array(@unserialize($mlw_question->question_settings)))
|
542 |
+
{
|
543 |
+
$mlw_question_settings = @unserialize($mlw_question->question_settings);
|
544 |
+
}
|
545 |
+
else
|
546 |
{
|
547 |
$mlw_question_settings = array();
|
548 |
$mlw_question_settings['required'] = 1;
|
682 |
$mlw_answer_total++;
|
683 |
if ($mlw_qmn_answer_each[0] != "")
|
684 |
{
|
685 |
+
$mlw_display .= "<input type='radio' id='question".$mlw_question->question_id."_".$mlw_answer_total."' name='question".$mlw_question->question_id."' value='".esc_attr($mlw_qmn_answer_each[0])."' /> <label for='question".$mlw_question->question_id."_".$mlw_answer_total."'>".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES)."</label> ";
|
686 |
}
|
687 |
}
|
688 |
$mlw_display .= "<input type='radio' style='display: none;' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_none' checked='checked' value='No Answer Provided' />";
|
929 |
//Load and prepare answer arrays
|
930 |
$mlw_qmn_loaded_answer_arrays = array();
|
931 |
foreach($mlw_questions as $mlw_question_info) {
|
932 |
+
if (is_serialized($mlw_question_info->answer_array) && is_array(@unserialize($mlw_question_info->answer_array)))
|
933 |
+
{
|
934 |
+
$mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
|
935 |
+
$mlw_qmn_loaded_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
|
936 |
+
}
|
937 |
+
else
|
938 |
{
|
939 |
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
|
940 |
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
|
946 |
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
|
947 |
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
|
948 |
}
|
|
|
|
|
|
|
|
|
949 |
}
|
950 |
|
951 |
//Variables needed for scoring
|
1123 |
|
1124 |
//Prepare Certificate
|
1125 |
$mlw_certificate_link = "";
|
1126 |
+
if (is_serialized($mlw_quiz_options->certificate_template) && is_array(@unserialize($mlw_quiz_options->certificate_template)))
|
1127 |
+
{
|
1128 |
+
$mlw_certificate_options = unserialize($mlw_quiz_options->certificate_template);
|
1129 |
+
}
|
1130 |
+
else
|
1131 |
+
{
|
1132 |
+
$mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
|
1133 |
+
}
|
1134 |
if ($mlw_certificate_options[4] == 0)
|
1135 |
{
|
1136 |
$mlw_message_certificate = $mlw_certificate_options[1];
|
1170 |
-Second, check for array in case user has not updated
|
1171 |
Message array = (array( bottomvalue, topvalue, text),array( bottomvalue, topvalue, text), etc..., array(0,0,text))
|
1172 |
*/
|
1173 |
+
if (is_serialized($mlw_quiz_options->message_after) && is_array(@unserialize($mlw_quiz_options->message_after)))
|
|
|
1174 |
{
|
1175 |
+
$mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
|
1176 |
//Cycle through landing pages
|
1177 |
foreach($mlw_message_after_array as $mlw_each)
|
1178 |
{
|
1249 |
<?php
|
1250 |
//Load Social Media Text
|
1251 |
$qmn_social_media_text = "";
|
1252 |
+
if (is_serialized($mlw_quiz_options->social_media_text) && is_array(@unserialize($mlw_quiz_options->social_media_text)))
|
1253 |
+
{
|
1254 |
+
$qmn_social_media_text = @unserialize($mlw_quiz_options->social_media_text);
|
1255 |
+
}
|
1256 |
+
else
|
1257 |
+
{
|
1258 |
+
$qmn_social_media_text = array(
|
1259 |
'twitter' => $mlw_quiz_options->social_media_text,
|
1260 |
'facebook' => $mlw_quiz_options->social_media_text
|
1261 |
);
|
1281 |
{
|
1282 |
if ($mlw_user_email != "")
|
1283 |
{
|
1284 |
+
if (is_serialized($mlw_quiz_options->user_email_template) && is_array(@unserialize($mlw_quiz_options->user_email_template)))
|
|
|
1285 |
{
|
1286 |
+
$mlw_user_email_array = @unserialize($mlw_quiz_options->user_email_template);
|
1287 |
+
|
1288 |
//Cycle through landing pages
|
1289 |
foreach($mlw_user_email_array as $mlw_each)
|
1290 |
{
|
includes/mlw_quiz_admin.php
CHANGED
@@ -9,443 +9,43 @@ Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
|
9 |
function mlw_generate_quiz_admin()
|
10 |
{
|
11 |
global $wpdb;
|
12 |
-
global $
|
13 |
$table_name = $wpdb->prefix . "mlw_quizzes";
|
14 |
|
15 |
//Create new quiz
|
16 |
if ( isset( $_POST["create_quiz"] ) && $_POST["create_quiz"] == "confirmation" )
|
17 |
{
|
18 |
$quiz_name = htmlspecialchars($_POST["quiz_name"], ENT_QUOTES);
|
19 |
-
|
20 |
-
$mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
|
21 |
-
1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
|
22 |
-
2. %SECOND_PLACE_NAME%-%SECOND_PLACE_SCORE%<br />
|
23 |
-
3. %THIRD_PLACE_NAME%-%THIRD_PLACE_SCORE%<br />
|
24 |
-
4. %FOURTH_PLACE_NAME%-%FOURTH_PLACE_SCORE%<br />
|
25 |
-
5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
|
26 |
-
$mlw_style_default = "
|
27 |
-
div.mlw_qmn_quiz input[type=radio],
|
28 |
-
div.mlw_qmn_quiz input[type=submit],
|
29 |
-
div.mlw_qmn_quiz label {
|
30 |
-
cursor: pointer;
|
31 |
-
}
|
32 |
-
div.mlw_qmn_quiz input:not([type=submit]):focus,
|
33 |
-
div.mlw_qmn_quiz textarea:focus {
|
34 |
-
background: #eaeaea;
|
35 |
-
}
|
36 |
-
div.mlw_qmn_quiz {
|
37 |
-
text-align: left;
|
38 |
-
}
|
39 |
-
div.quiz_section {
|
40 |
-
|
41 |
-
}
|
42 |
-
div.mlw_qmn_timer {
|
43 |
-
position:fixed;
|
44 |
-
top:200px;
|
45 |
-
right:0px;
|
46 |
-
width:130px;
|
47 |
-
color:#00CCFF;
|
48 |
-
border-radius: 15px;
|
49 |
-
background:#000000;
|
50 |
-
text-align: center;
|
51 |
-
padding: 15px 15px 15px 15px
|
52 |
-
}
|
53 |
-
div.mlw_qmn_quiz input[type=submit],
|
54 |
-
a.mlw_qmn_quiz_link
|
55 |
-
{
|
56 |
-
border-radius: 4px;
|
57 |
-
position: relative;
|
58 |
-
background-image: linear-gradient(#fff,#dedede);
|
59 |
-
background-color: #eee;
|
60 |
-
border: #ccc solid 1px;
|
61 |
-
color: #333;
|
62 |
-
text-shadow: 0 1px 0 rgba(255,255,255,.5);
|
63 |
-
box-sizing: border-box;
|
64 |
-
display: inline-block;
|
65 |
-
padding: 5px 5px 5px 5px;
|
66 |
-
margin: auto;
|
67 |
-
}";
|
68 |
-
$mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
|
69 |
-
$results = $wpdb->insert(
|
70 |
-
$wpdb->prefix . "mlw_quizzes",
|
71 |
-
array(
|
72 |
-
'quiz_name' => $quiz_name,
|
73 |
-
'message_before' => 'Enter your text here',
|
74 |
-
'message_after' => 'Enter your text here',
|
75 |
-
'message_comment' => 'Enter your text here',
|
76 |
-
'message_end_template' => '',
|
77 |
-
'user_email_template' => 'Enter your text here',
|
78 |
-
'admin_email_template' => 'Enter your text here',
|
79 |
-
'submit_button_text' => 'Submit Quiz',
|
80 |
-
'name_field_text' => 'Name',
|
81 |
-
'business_field_text' => 'Business',
|
82 |
-
'email_field_text' => 'Email',
|
83 |
-
'phone_field_text' => 'Phone Number',
|
84 |
-
'comment_field_text' => 'Comments',
|
85 |
-
'email_from_text' => 'Wordpress',
|
86 |
-
'question_answer_template' => $mlw_question_answer_default,
|
87 |
-
'leaderboard_template' => $mlw_leaderboard_default,
|
88 |
-
'system' => 0,
|
89 |
-
'randomness_order' => 0,
|
90 |
-
'loggedin_user_contact' => 0,
|
91 |
-
'show_score' => 0,
|
92 |
-
'send_user_email' => 0,
|
93 |
-
'send_admin_email' => 0,
|
94 |
-
'contact_info_location' => 0,
|
95 |
-
'user_name' => 0,
|
96 |
-
'user_comp' => 0,
|
97 |
-
'user_email' => 0,
|
98 |
-
'user_phone' => 0,
|
99 |
-
'admin_email' => get_option( 'admin_email', 'Enter email' ),
|
100 |
-
'comment_section' => 0,
|
101 |
-
'question_from_total' => 0,
|
102 |
-
'total_user_tries' => 0,
|
103 |
-
'total_user_tries_text' => 'Enter Your Text Here',
|
104 |
-
'certificate_template' => 'Enter Your Text Here!',
|
105 |
-
'social_media' => 0,
|
106 |
-
'social_media_text' => 'I just scored %CORRECT_SCORE%% on %QUIZ_NAME%!',
|
107 |
-
'pagination' => 0,
|
108 |
-
'pagination_text' => 'Next',
|
109 |
-
'timer_limit' => 0,
|
110 |
-
'quiz_stye' => $mlw_style_default,
|
111 |
-
'question_numbering' => 0,
|
112 |
-
'quiz_settings' => '',
|
113 |
-
'theme_selected' => 'default',
|
114 |
-
'last_activity' => date("Y-m-d H:i:s"),
|
115 |
-
'require_log_in' => 0,
|
116 |
-
'require_log_in_text' => 'Enter Your Text Here',
|
117 |
-
'limit_total_entries' => 0,
|
118 |
-
'limit_total_entries_text' => 'Enter Your Text Here',
|
119 |
-
'quiz_views' => 0,
|
120 |
-
'quiz_taken' => 0,
|
121 |
-
'deleted' => 0
|
122 |
-
),
|
123 |
-
array(
|
124 |
-
'%s',
|
125 |
-
'%s',
|
126 |
-
'%s',
|
127 |
-
'%s',
|
128 |
-
'%s',
|
129 |
-
'%s',
|
130 |
-
'%s',
|
131 |
-
'%s',
|
132 |
-
'%s',
|
133 |
-
'%s',
|
134 |
-
'%s',
|
135 |
-
'%s',
|
136 |
-
'%s',
|
137 |
-
'%s',
|
138 |
-
'%s',
|
139 |
-
'%s',
|
140 |
-
'%d',
|
141 |
-
'%d',
|
142 |
-
'%d',
|
143 |
-
'%d',
|
144 |
-
'%d',
|
145 |
-
'%d',
|
146 |
-
'%d',
|
147 |
-
'%d',
|
148 |
-
'%d',
|
149 |
-
'%d',
|
150 |
-
'%d',
|
151 |
-
'%s',
|
152 |
-
'%d',
|
153 |
-
'%d',
|
154 |
-
'%d',
|
155 |
-
'%s',
|
156 |
-
'%s',
|
157 |
-
'%d',
|
158 |
-
'%s',
|
159 |
-
'%d',
|
160 |
-
'%s',
|
161 |
-
'%d',
|
162 |
-
'%s',
|
163 |
-
'%d',
|
164 |
-
'%s',
|
165 |
-
'%s',
|
166 |
-
'%s',
|
167 |
-
'%d',
|
168 |
-
'%s',
|
169 |
-
'%d',
|
170 |
-
'%s',
|
171 |
-
'%d',
|
172 |
-
'%d',
|
173 |
-
'%d'
|
174 |
-
)
|
175 |
-
);
|
176 |
-
if ($results != false)
|
177 |
-
{
|
178 |
-
$mlwQmnAlertManager->newAlert('Your new quiz has been created successfully. To begin editing your quiz, click the Edit link on the new quiz.', 'success');
|
179 |
-
//Insert Action Into Audit Trail
|
180 |
-
global $current_user;
|
181 |
-
get_currentuserinfo();
|
182 |
-
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
183 |
-
$insert = "INSERT INTO " . $table_name .
|
184 |
-
"(trail_id, action_user, action, time) " .
|
185 |
-
"VALUES (NULL , '" . $current_user->display_name . "' , 'New Quiz Has Been Created: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
186 |
-
$results = $wpdb->query( $insert );
|
187 |
-
}
|
188 |
-
else
|
189 |
-
{
|
190 |
-
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0001.', 'error');
|
191 |
-
}
|
192 |
-
|
193 |
}
|
194 |
|
195 |
//Delete quiz
|
196 |
if (isset( $_POST["delete_quiz"] ) && $_POST["delete_quiz"] == "confirmation")
|
197 |
{
|
198 |
-
|
199 |
-
//Variables from delete question form
|
200 |
-
$mlw_quiz_id = $_POST["quiz_id"];
|
201 |
$quiz_name = $_POST["delete_quiz_name"];
|
202 |
-
$
|
203 |
-
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET deleted=1 WHERE quiz_id=".$mlw_quiz_id;
|
204 |
-
$results = $wpdb->query( $update );
|
205 |
-
$update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE quiz_id=".$mlw_quiz_id;
|
206 |
-
$delete_question_results = $wpdb->query( $update );
|
207 |
-
if ($results != false)
|
208 |
-
{
|
209 |
-
$mlwQmnAlertManager->newAlert('Your quiz has been deleted successfully.', 'success');
|
210 |
-
|
211 |
-
//Insert Action Into Audit Trail
|
212 |
-
global $current_user;
|
213 |
-
get_currentuserinfo();
|
214 |
-
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
215 |
-
$insert = "INSERT INTO " . $table_name .
|
216 |
-
"(trail_id, action_user, action, time) " .
|
217 |
-
"VALUES (NULL , '" . $current_user->display_name . "' , 'Quiz Has Been Deleted: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
218 |
-
$results = $wpdb->query( $insert );
|
219 |
-
}
|
220 |
-
else
|
221 |
-
{
|
222 |
-
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0002.', 'error');
|
223 |
-
}
|
224 |
-
|
225 |
}
|
226 |
|
227 |
//Edit Quiz Name
|
228 |
if (isset($_POST["quiz_name_editted"]) && $_POST["quiz_name_editted"] == "confirmation")
|
229 |
{
|
230 |
-
$mlw_edit_quiz_id = $_POST["edit_quiz_id"];
|
231 |
$mlw_edit_quiz_name = htmlspecialchars($_POST["edit_quiz_name"], ENT_QUOTES);
|
232 |
-
$
|
233 |
-
$results = $wpdb->query( $mlw_update_quiz_table );
|
234 |
-
if ($results != false)
|
235 |
-
{
|
236 |
-
$mlwQmnAlertManager->newAlert('Your quiz name has been updated successfully.', 'success');
|
237 |
-
|
238 |
-
//Insert Action Into Audit Trail
|
239 |
-
global $current_user;
|
240 |
-
get_currentuserinfo();
|
241 |
-
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
242 |
-
$insert = "INSERT INTO " . $table_name .
|
243 |
-
"(trail_id, action_user, action, time) " .
|
244 |
-
"VALUES (NULL , '" . $current_user->display_name . "' , 'Quiz Name Has Been Edited: ".$mlw_edit_quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
245 |
-
$results = $wpdb->query( $insert );
|
246 |
-
}
|
247 |
-
else
|
248 |
-
{
|
249 |
-
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0003.', 'error');
|
250 |
-
}
|
251 |
}
|
252 |
|
253 |
//Duplicate Quiz
|
254 |
if (isset($_POST["duplicate_quiz"]) && $_POST["duplicate_quiz"] == "confirmation")
|
255 |
{
|
256 |
-
$
|
257 |
-
$mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
|
258 |
$mlw_duplicate_quiz_name = htmlspecialchars($_POST["duplicate_new_quiz_name"], ENT_QUOTES);
|
259 |
-
$
|
260 |
-
$results = $wpdb->insert(
|
261 |
-
$table_name,
|
262 |
-
array(
|
263 |
-
'quiz_name' => $mlw_duplicate_quiz_name,
|
264 |
-
'message_before' => $mlw_qmn_duplicate_data->message_before,
|
265 |
-
'message_after' => $mlw_qmn_duplicate_data->message_after,
|
266 |
-
'message_comment' => $mlw_qmn_duplicate_data->message_comment,
|
267 |
-
'message_end_template' => $mlw_qmn_duplicate_data->message_end_template,
|
268 |
-
'user_email_template' => $mlw_qmn_duplicate_data->user_email_template,
|
269 |
-
'admin_email_template' => $mlw_qmn_duplicate_data->admin_email_template,
|
270 |
-
'submit_button_text' => $mlw_qmn_duplicate_data->submit_button_text,
|
271 |
-
'name_field_text' => $mlw_qmn_duplicate_data->name_field_text,
|
272 |
-
'business_field_text' => $mlw_qmn_duplicate_data->business_field_text,
|
273 |
-
'email_field_text' => $mlw_qmn_duplicate_data->email_field_text,
|
274 |
-
'phone_field_text' => $mlw_qmn_duplicate_data->phone_field_text,
|
275 |
-
'comment_field_text' => $mlw_qmn_duplicate_data->comment_field_text,
|
276 |
-
'email_from_text' => $mlw_qmn_duplicate_data->email_from_text,
|
277 |
-
'question_answer_template' => $mlw_qmn_duplicate_data->question_answer_template,
|
278 |
-
'leaderboard_template' => $mlw_qmn_duplicate_data->leaderboard_template,
|
279 |
-
'system' => $mlw_qmn_duplicate_data->system,
|
280 |
-
'randomness_order' => $mlw_qmn_duplicate_data->randomness_order,
|
281 |
-
'loggedin_user_contact' => $mlw_qmn_duplicate_data->loggedin_user_contact,
|
282 |
-
'show_score' => $mlw_qmn_duplicate_data->show_score,
|
283 |
-
'send_user_email' => $mlw_qmn_duplicate_data->send_user_email,
|
284 |
-
'send_admin_email' => $mlw_qmn_duplicate_data->send_admin_email,
|
285 |
-
'contact_info_location' => $mlw_qmn_duplicate_data->contact_info_location,
|
286 |
-
'user_name' => $mlw_qmn_duplicate_data->user_name,
|
287 |
-
'user_comp' => $mlw_qmn_duplicate_data->user_comp,
|
288 |
-
'user_email' => $mlw_qmn_duplicate_data->user_email,
|
289 |
-
'user_phone' => $mlw_qmn_duplicate_data->user_phone,
|
290 |
-
'admin_email' => get_option( 'admin_email', 'Enter email' ),
|
291 |
-
'comment_section' => $mlw_qmn_duplicate_data->comment_section,
|
292 |
-
'question_from_total' => $mlw_qmn_duplicate_data->question_from_total,
|
293 |
-
'total_user_tries' => $mlw_qmn_duplicate_data->total_user_tries,
|
294 |
-
'total_user_tries_text' => $mlw_qmn_duplicate_data->total_user_tries_text,
|
295 |
-
'certificate_template' => $mlw_qmn_duplicate_data->certificate_template,
|
296 |
-
'social_media' => $mlw_qmn_duplicate_data->social_media,
|
297 |
-
'social_media_text' => $mlw_qmn_duplicate_data->social_media_text,
|
298 |
-
'pagination' => $mlw_qmn_duplicate_data->pagination,
|
299 |
-
'pagination_text' => $mlw_qmn_duplicate_data->pagination_text,
|
300 |
-
'timer_limit' => $mlw_qmn_duplicate_data->timer_limit,
|
301 |
-
'quiz_stye' => $mlw_qmn_duplicate_data->quiz_stye,
|
302 |
-
'question_numbering' => $mlw_qmn_duplicate_data->question_numbering,
|
303 |
-
'quiz_settings' => $mlw_qmn_duplicate_data->quiz_settings,
|
304 |
-
'theme_selected' => $mlw_qmn_duplicate_data->theme_selected,
|
305 |
-
'last_activity' => date("Y-m-d H:i:s"),
|
306 |
-
'quiz_views' => 0,
|
307 |
-
'quiz_taken' => 0,
|
308 |
-
'deleted' => 0
|
309 |
-
),
|
310 |
-
array(
|
311 |
-
'%s',
|
312 |
-
'%s',
|
313 |
-
'%s',
|
314 |
-
'%s',
|
315 |
-
'%s',
|
316 |
-
'%s',
|
317 |
-
'%s',
|
318 |
-
'%s',
|
319 |
-
'%s',
|
320 |
-
'%s',
|
321 |
-
'%s',
|
322 |
-
'%s',
|
323 |
-
'%s',
|
324 |
-
'%s',
|
325 |
-
'%s',
|
326 |
-
'%s',
|
327 |
-
'%d',
|
328 |
-
'%d',
|
329 |
-
'%d',
|
330 |
-
'%d',
|
331 |
-
'%d',
|
332 |
-
'%d',
|
333 |
-
'%d',
|
334 |
-
'%d',
|
335 |
-
'%d',
|
336 |
-
'%d',
|
337 |
-
'%d',
|
338 |
-
'%s',
|
339 |
-
'%d',
|
340 |
-
'%d',
|
341 |
-
'%d',
|
342 |
-
'%s',
|
343 |
-
'%s',
|
344 |
-
'%d',
|
345 |
-
'%s',
|
346 |
-
'%d',
|
347 |
-
'%s',
|
348 |
-
'%d',
|
349 |
-
'%s',
|
350 |
-
'%d',
|
351 |
-
'%s',
|
352 |
-
'%s',
|
353 |
-
'%s',
|
354 |
-
'%d',
|
355 |
-
'%d',
|
356 |
-
'%d',
|
357 |
-
)
|
358 |
-
);
|
359 |
-
$mlw_new_id = $wpdb->insert_id;
|
360 |
-
//$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_stye, question_numbering, 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.", '".$mlw_qmn_duplicate_data->quiz_stye."', ".$mlw_qmn_duplicate_data->question_numbering.", 0, 0, 0)" );
|
361 |
-
if ($results != false)
|
362 |
-
{
|
363 |
-
$mlwQmnAlertManager->newAlert('Your quiz has been duplicated successfully.', 'success');
|
364 |
-
$hasDuplicatedQuiz = true;
|
365 |
-
|
366 |
-
//Insert Action Into Audit Trail
|
367 |
-
global $current_user;
|
368 |
-
get_currentuserinfo();
|
369 |
-
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
370 |
-
$insert = "INSERT INTO " . $table_name .
|
371 |
-
"(trail_id, action_user, action, time) " .
|
372 |
-
"VALUES (NULL , '" . $current_user->display_name . "' , 'New Quiz Has Been Created: ".$mlw_duplicate_quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
373 |
-
$results = $wpdb->query( $insert );
|
374 |
-
}
|
375 |
-
else
|
376 |
-
{
|
377 |
-
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0011.', 'error');
|
378 |
-
}
|
379 |
-
if (isset($_POST["duplicate_questions"]))
|
380 |
-
{
|
381 |
-
$table_name = $wpdb->prefix."mlw_questions";
|
382 |
-
$mlw_current_questions = $wpdb->get_results("SELECT * FROM ".$table_name." WHERE deleted=0 AND quiz_id=".$mlw_duplicate_quiz_id);
|
383 |
-
foreach ($mlw_current_questions as $mlw_question)
|
384 |
-
{
|
385 |
-
$question_results = $wpdb->insert(
|
386 |
-
$table_name,
|
387 |
-
array(
|
388 |
-
'quiz_id' => $mlw_new_id,
|
389 |
-
'question_name' => $mlw_question->question_name,
|
390 |
-
'answer_array' => $mlw_question->answer_array,
|
391 |
-
'answer_one' => $mlw_question->answer_one,
|
392 |
-
'answer_one_points' => $mlw_question->answer_one_points,
|
393 |
-
'answer_two' => $mlw_question->answer_two,
|
394 |
-
'answer_two_points' => $mlw_question->answer_two_points,
|
395 |
-
'answer_three' => $mlw_question->answer_three,
|
396 |
-
'answer_three_points' => $mlw_question->answer_three_points,
|
397 |
-
'answer_four' => $mlw_question->answer_four,
|
398 |
-
'answer_four_points' => $mlw_question->answer_four_points,
|
399 |
-
'answer_five' => $mlw_question->answer_five,
|
400 |
-
'answer_five_points' => $mlw_question->answer_five_points,
|
401 |
-
'answer_six' => $mlw_question->answer_six,
|
402 |
-
'answer_six_points' => $mlw_question->answer_six_points,
|
403 |
-
'correct_answer' => $mlw_question->correct_answer,
|
404 |
-
'question_answer_info' => $mlw_question->question_answer_info,
|
405 |
-
'comments' => $mlw_question->comments,
|
406 |
-
'hints' => $mlw_question->hints,
|
407 |
-
'question_order' => $mlw_question->question_order,
|
408 |
-
'question_type' => $mlw_question->question_type,
|
409 |
-
'question_settings' => $mlw_question->question_settings,
|
410 |
-
'deleted' => 0
|
411 |
-
),
|
412 |
-
array(
|
413 |
-
'%d',
|
414 |
-
'%s',
|
415 |
-
'%s',
|
416 |
-
'%s',
|
417 |
-
'%d',
|
418 |
-
'%s',
|
419 |
-
'%d',
|
420 |
-
'%s',
|
421 |
-
'%d',
|
422 |
-
'%s',
|
423 |
-
'%d',
|
424 |
-
'%s',
|
425 |
-
'%d',
|
426 |
-
'%s',
|
427 |
-
'%d',
|
428 |
-
'%d',
|
429 |
-
'%s',
|
430 |
-
'%d',
|
431 |
-
'%s',
|
432 |
-
'%d',
|
433 |
-
'%d',
|
434 |
-
'%s',
|
435 |
-
'%d'
|
436 |
-
)
|
437 |
-
);
|
438 |
-
if ($question_results == false)
|
439 |
-
{
|
440 |
-
$mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0020.', 'error');
|
441 |
-
}
|
442 |
-
}
|
443 |
-
}
|
444 |
}
|
445 |
|
446 |
//Retrieve list of quizzes
|
447 |
global $wpdb;
|
448 |
-
$mlw_qmn_table_limit =
|
449 |
$mlw_qmn_quiz_count = $wpdb->get_var( "SELECT COUNT(quiz_id) FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted='0'" );
|
450 |
|
451 |
if( isset($_GET{'mlw_quiz_page'} ) )
|
@@ -579,7 +179,7 @@ function mlw_generate_quiz_admin()
|
|
579 |
<div class="wrap">
|
580 |
<div class='mlw_quiz_options'>
|
581 |
<h2>Quizzes<a id="new_quiz_button" href="javascript:();" class="add-new-h2">Add New</a></h2>
|
582 |
-
<?php $
|
583 |
<div class="tablenav top">
|
584 |
<div class="tablenav-pages">
|
585 |
<span class="displaying-num"><?php echo $mlw_qmn_quiz_count; ?> quizzes</span>
|
9 |
function mlw_generate_quiz_admin()
|
10 |
{
|
11 |
global $wpdb;
|
12 |
+
global $mlwQuizMasterNext;
|
13 |
$table_name = $wpdb->prefix . "mlw_quizzes";
|
14 |
|
15 |
//Create new quiz
|
16 |
if ( isset( $_POST["create_quiz"] ) && $_POST["create_quiz"] == "confirmation" )
|
17 |
{
|
18 |
$quiz_name = htmlspecialchars($_POST["quiz_name"], ENT_QUOTES);
|
19 |
+
$mlwQuizMasterNext->quizCreator->create_quiz($quiz_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
//Delete quiz
|
23 |
if (isset( $_POST["delete_quiz"] ) && $_POST["delete_quiz"] == "confirmation")
|
24 |
{
|
25 |
+
$mlw_quiz_id = intval($_POST["quiz_id"]);
|
|
|
|
|
26 |
$quiz_name = $_POST["delete_quiz_name"];
|
27 |
+
$mlwQuizMasterNext->quizCreator->delete_quiz($mlw_quiz_id, $quiz_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
//Edit Quiz Name
|
31 |
if (isset($_POST["quiz_name_editted"]) && $_POST["quiz_name_editted"] == "confirmation")
|
32 |
{
|
33 |
+
$mlw_edit_quiz_id = intval($_POST["edit_quiz_id"]);
|
34 |
$mlw_edit_quiz_name = htmlspecialchars($_POST["edit_quiz_name"], ENT_QUOTES);
|
35 |
+
$mlwQuizMasterNext->quizCreator->edit_quiz_name($mlw_edit_quiz_id, $mlw_edit_quiz_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
//Duplicate Quiz
|
39 |
if (isset($_POST["duplicate_quiz"]) && $_POST["duplicate_quiz"] == "confirmation")
|
40 |
{
|
41 |
+
$mlw_duplicate_quiz_id = intval($_POST["duplicate_quiz_id"]);
|
|
|
42 |
$mlw_duplicate_quiz_name = htmlspecialchars($_POST["duplicate_new_quiz_name"], ENT_QUOTES);
|
43 |
+
$mlwQuizMasterNext->quizCreator->duplicate_quiz($mlw_duplicate_quiz_id, $mlw_duplicate_quiz_name, isset($_POST["duplicate_questions"]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
//Retrieve list of quizzes
|
47 |
global $wpdb;
|
48 |
+
$mlw_qmn_table_limit = 25;
|
49 |
$mlw_qmn_quiz_count = $wpdb->get_var( "SELECT COUNT(quiz_id) FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted='0'" );
|
50 |
|
51 |
if( isset($_GET{'mlw_quiz_page'} ) )
|
179 |
<div class="wrap">
|
180 |
<div class='mlw_quiz_options'>
|
181 |
<h2>Quizzes<a id="new_quiz_button" href="javascript:();" class="add-new-h2">Add New</a></h2>
|
182 |
+
<?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
|
183 |
<div class="tablenav top">
|
184 |
<div class="tablenav-pages">
|
185 |
<span class="displaying-num"><?php echo $mlw_qmn_quiz_count; ?> quizzes</span>
|
includes/mlw_quiz_creator.php
ADDED
@@ -0,0 +1,526 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* QMN Quiz Creator Class
|
4 |
+
*
|
5 |
+
* This class handles quiz creation, update, and deletion from the admin panel
|
6 |
+
*
|
7 |
+
* The Quiz Creator class handles all the quiz management functions that is done from the admin panel
|
8 |
+
*
|
9 |
+
* @since 3.7.1
|
10 |
+
*/
|
11 |
+
class QMNQuizCreator
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* QMN ID of quiz
|
15 |
+
*
|
16 |
+
* @var object
|
17 |
+
* @since 3.7.1
|
18 |
+
*/
|
19 |
+
private $quiz_id;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* If the quiz ID is set, store it as the class quiz ID
|
23 |
+
*
|
24 |
+
* @since 3.7.1
|
25 |
+
*/
|
26 |
+
public function __construct()
|
27 |
+
{
|
28 |
+
if (isset($_GET["quiz_id"]))
|
29 |
+
{
|
30 |
+
$this->quiz_id = intval($_GET["quiz_id"]);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Creates a new quiz with the default settings
|
36 |
+
*
|
37 |
+
* @access public
|
38 |
+
* @since 3.7.1
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
public function create_quiz($quiz_name)
|
42 |
+
{
|
43 |
+
global $mlwQuizMasterNext;
|
44 |
+
global $wpdb;
|
45 |
+
$mlw_leaderboard_default = "<h3>Leaderboard for %QUIZ_NAME%</h3>
|
46 |
+
1. %FIRST_PLACE_NAME%-%FIRST_PLACE_SCORE%<br />
|
47 |
+
2. %SECOND_PLACE_NAME%-%SECOND_PLACE_SCORE%<br />
|
48 |
+
3. %THIRD_PLACE_NAME%-%THIRD_PLACE_SCORE%<br />
|
49 |
+
4. %FOURTH_PLACE_NAME%-%FOURTH_PLACE_SCORE%<br />
|
50 |
+
5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
|
51 |
+
$mlw_style_default = "
|
52 |
+
div.mlw_qmn_quiz input[type=radio],
|
53 |
+
div.mlw_qmn_quiz input[type=submit],
|
54 |
+
div.mlw_qmn_quiz label {
|
55 |
+
cursor: pointer;
|
56 |
+
}
|
57 |
+
div.mlw_qmn_quiz input:not([type=submit]):focus,
|
58 |
+
div.mlw_qmn_quiz textarea:focus {
|
59 |
+
background: #eaeaea;
|
60 |
+
}
|
61 |
+
div.mlw_qmn_quiz {
|
62 |
+
text-align: left;
|
63 |
+
}
|
64 |
+
div.quiz_section {
|
65 |
+
|
66 |
+
}
|
67 |
+
div.mlw_qmn_timer {
|
68 |
+
position:fixed;
|
69 |
+
top:200px;
|
70 |
+
right:0px;
|
71 |
+
width:130px;
|
72 |
+
color:#00CCFF;
|
73 |
+
border-radius: 15px;
|
74 |
+
background:#000000;
|
75 |
+
text-align: center;
|
76 |
+
padding: 15px 15px 15px 15px
|
77 |
+
}
|
78 |
+
div.mlw_qmn_quiz input[type=submit],
|
79 |
+
a.mlw_qmn_quiz_link
|
80 |
+
{
|
81 |
+
border-radius: 4px;
|
82 |
+
position: relative;
|
83 |
+
background-image: linear-gradient(#fff,#dedede);
|
84 |
+
background-color: #eee;
|
85 |
+
border: #ccc solid 1px;
|
86 |
+
color: #333;
|
87 |
+
text-shadow: 0 1px 0 rgba(255,255,255,.5);
|
88 |
+
box-sizing: border-box;
|
89 |
+
display: inline-block;
|
90 |
+
padding: 5px 5px 5px 5px;
|
91 |
+
margin: auto;
|
92 |
+
}";
|
93 |
+
$mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
|
94 |
+
$results = $wpdb->insert(
|
95 |
+
$wpdb->prefix . "mlw_quizzes",
|
96 |
+
array(
|
97 |
+
'quiz_name' => $quiz_name,
|
98 |
+
'message_before' => 'Enter your text here',
|
99 |
+
'message_after' => 'Enter your text here',
|
100 |
+
'message_comment' => 'Enter your text here',
|
101 |
+
'message_end_template' => '',
|
102 |
+
'user_email_template' => 'Enter your text here',
|
103 |
+
'admin_email_template' => 'Enter your text here',
|
104 |
+
'submit_button_text' => 'Submit Quiz',
|
105 |
+
'name_field_text' => 'Name',
|
106 |
+
'business_field_text' => 'Business',
|
107 |
+
'email_field_text' => 'Email',
|
108 |
+
'phone_field_text' => 'Phone Number',
|
109 |
+
'comment_field_text' => 'Comments',
|
110 |
+
'email_from_text' => 'Wordpress',
|
111 |
+
'question_answer_template' => $mlw_question_answer_default,
|
112 |
+
'leaderboard_template' => $mlw_leaderboard_default,
|
113 |
+
'system' => 0,
|
114 |
+
'randomness_order' => 0,
|
115 |
+
'loggedin_user_contact' => 0,
|
116 |
+
'show_score' => 0,
|
117 |
+
'send_user_email' => 0,
|
118 |
+
'send_admin_email' => 0,
|
119 |
+
'contact_info_location' => 0,
|
120 |
+
'user_name' => 0,
|
121 |
+
'user_comp' => 0,
|
122 |
+
'user_email' => 0,
|
123 |
+
'user_phone' => 0,
|
124 |
+
'admin_email' => get_option( 'admin_email', 'Enter email' ),
|
125 |
+
'comment_section' => 0,
|
126 |
+
'question_from_total' => 0,
|
127 |
+
'total_user_tries' => 0,
|
128 |
+
'total_user_tries_text' => 'Enter Your Text Here',
|
129 |
+
'certificate_template' => 'Enter Your Text Here!',
|
130 |
+
'social_media' => 0,
|
131 |
+
'social_media_text' => 'I just scored %CORRECT_SCORE%% on %QUIZ_NAME%!',
|
132 |
+
'pagination' => 0,
|
133 |
+
'pagination_text' => 'Next',
|
134 |
+
'timer_limit' => 0,
|
135 |
+
'quiz_stye' => $mlw_style_default,
|
136 |
+
'question_numbering' => 0,
|
137 |
+
'quiz_settings' => '',
|
138 |
+
'theme_selected' => 'default',
|
139 |
+
'last_activity' => date("Y-m-d H:i:s"),
|
140 |
+
'require_log_in' => 0,
|
141 |
+
'require_log_in_text' => 'Enter Your Text Here',
|
142 |
+
'limit_total_entries' => 0,
|
143 |
+
'limit_total_entries_text' => 'Enter Your Text Here',
|
144 |
+
'scheduled_timeframe' => '',
|
145 |
+
'scheduled_timeframe_text' => '',
|
146 |
+
'quiz_views' => 0,
|
147 |
+
'quiz_taken' => 0,
|
148 |
+
'deleted' => 0
|
149 |
+
),
|
150 |
+
array(
|
151 |
+
'%s',
|
152 |
+
'%s',
|
153 |
+
'%s',
|
154 |
+
'%s',
|
155 |
+
'%s',
|
156 |
+
'%s',
|
157 |
+
'%s',
|
158 |
+
'%s',
|
159 |
+
'%s',
|
160 |
+
'%s',
|
161 |
+
'%s',
|
162 |
+
'%s',
|
163 |
+
'%s',
|
164 |
+
'%s',
|
165 |
+
'%s',
|
166 |
+
'%s',
|
167 |
+
'%d',
|
168 |
+
'%d',
|
169 |
+
'%d',
|
170 |
+
'%d',
|
171 |
+
'%d',
|
172 |
+
'%d',
|
173 |
+
'%d',
|
174 |
+
'%d',
|
175 |
+
'%d',
|
176 |
+
'%d',
|
177 |
+
'%d',
|
178 |
+
'%s',
|
179 |
+
'%d',
|
180 |
+
'%d',
|
181 |
+
'%d',
|
182 |
+
'%s',
|
183 |
+
'%s',
|
184 |
+
'%d',
|
185 |
+
'%s',
|
186 |
+
'%d',
|
187 |
+
'%s',
|
188 |
+
'%d',
|
189 |
+
'%s',
|
190 |
+
'%d',
|
191 |
+
'%s',
|
192 |
+
'%s',
|
193 |
+
'%s',
|
194 |
+
'%d',
|
195 |
+
'%s',
|
196 |
+
'%d',
|
197 |
+
'%s',
|
198 |
+
'%s',
|
199 |
+
'%s',
|
200 |
+
'%d',
|
201 |
+
'%d',
|
202 |
+
'%d'
|
203 |
+
)
|
204 |
+
);
|
205 |
+
if ($results != false)
|
206 |
+
{
|
207 |
+
$mlwQuizMasterNext->alertManager->newAlert('Your new quiz has been created successfully. To begin editing your quiz, click the Edit link on the new quiz.', 'success');
|
208 |
+
//Insert Action Into Audit Trail
|
209 |
+
global $current_user;
|
210 |
+
get_currentuserinfo();
|
211 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
212 |
+
$insert = "INSERT INTO " . $table_name .
|
213 |
+
"(trail_id, action_user, action, time) " .
|
214 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'New Quiz Has Been Created: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
215 |
+
$results = $wpdb->query( $insert );
|
216 |
+
}
|
217 |
+
else
|
218 |
+
{
|
219 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0001.', 'error');
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Deletes a quiz with the given quiz_id
|
225 |
+
*
|
226 |
+
* @access public
|
227 |
+
* @since 3.7.1
|
228 |
+
* @return void
|
229 |
+
*/
|
230 |
+
public function delete_quiz($quiz_id, $quiz_name)
|
231 |
+
{
|
232 |
+
global $mlwQuizMasterNext;
|
233 |
+
global $wpdb;
|
234 |
+
$results = $wpdb->update(
|
235 |
+
$wpdb->prefix . "mlw_quizzes",
|
236 |
+
array(
|
237 |
+
'deleted' => 1
|
238 |
+
),
|
239 |
+
array( 'quiz_id' => $quiz_id ),
|
240 |
+
array(
|
241 |
+
'%d'
|
242 |
+
),
|
243 |
+
array( '%d' )
|
244 |
+
);
|
245 |
+
$delete_question_results = $wpdb->update(
|
246 |
+
$wpdb->prefix . "mlw_questions",
|
247 |
+
array(
|
248 |
+
'deleted' => 1
|
249 |
+
),
|
250 |
+
array( 'quiz_id' => $quiz_id ),
|
251 |
+
array(
|
252 |
+
'%d'
|
253 |
+
),
|
254 |
+
array( '%d' )
|
255 |
+
);
|
256 |
+
if ($results != false)
|
257 |
+
{
|
258 |
+
$mlwQuizMasterNext->alertManager->newAlert('Your quiz has been deleted successfully.', 'success');
|
259 |
+
|
260 |
+
//Insert Action Into Audit Trail
|
261 |
+
global $current_user;
|
262 |
+
get_currentuserinfo();
|
263 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
264 |
+
$insert = "INSERT INTO " . $table_name .
|
265 |
+
"(trail_id, action_user, action, time) " .
|
266 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Quiz Has Been Deleted: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
267 |
+
$results = $wpdb->query( $insert );
|
268 |
+
}
|
269 |
+
else
|
270 |
+
{
|
271 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0002.', 'error');
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Edits the name of the quiz with the given ID
|
277 |
+
*
|
278 |
+
* @access public
|
279 |
+
* @since 3.7.1
|
280 |
+
* @return void
|
281 |
+
*/
|
282 |
+
public function edit_quiz_name($quiz_id, $quiz_name)
|
283 |
+
{
|
284 |
+
global $mlwQuizMasterNext;
|
285 |
+
global $wpdb;
|
286 |
+
$results = $wpdb->update(
|
287 |
+
$wpdb->prefix . "mlw_quizzes",
|
288 |
+
array(
|
289 |
+
'quiz_name' => $quiz_name
|
290 |
+
),
|
291 |
+
array( 'quiz_id' => $quiz_id ),
|
292 |
+
array(
|
293 |
+
'%s'
|
294 |
+
),
|
295 |
+
array( '%d' )
|
296 |
+
);
|
297 |
+
if ($results != false)
|
298 |
+
{
|
299 |
+
$mlwQuizMasterNext->alertManager->newAlert('Your quiz name has been updated successfully.', 'success');
|
300 |
+
|
301 |
+
//Insert Action Into Audit Trail
|
302 |
+
global $current_user;
|
303 |
+
get_currentuserinfo();
|
304 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
305 |
+
$insert = "INSERT INTO " . $table_name .
|
306 |
+
"(trail_id, action_user, action, time) " .
|
307 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Quiz Name Has Been Edited: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
308 |
+
$results = $wpdb->query( $insert );
|
309 |
+
}
|
310 |
+
else
|
311 |
+
{
|
312 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0003.', 'error');
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Duplicates the quiz with the given ID and gives new quiz the given quiz name
|
318 |
+
*
|
319 |
+
* @access public
|
320 |
+
* @since 3.7.1
|
321 |
+
* @return void
|
322 |
+
*/
|
323 |
+
public function duplicate_quiz($quiz_id, $quiz_name, $is_duplicating_questions)
|
324 |
+
{
|
325 |
+
global $mlwQuizMasterNext;
|
326 |
+
global $wpdb;
|
327 |
+
|
328 |
+
$table_name = $wpdb->prefix . "mlw_quizzes";
|
329 |
+
$mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE quiz_id=%d", $quiz_id ) );
|
330 |
+
$results = $wpdb->insert(
|
331 |
+
$table_name,
|
332 |
+
array(
|
333 |
+
'quiz_name' => $quiz_name,
|
334 |
+
'message_before' => $mlw_qmn_duplicate_data->message_before,
|
335 |
+
'message_after' => $mlw_qmn_duplicate_data->message_after,
|
336 |
+
'message_comment' => $mlw_qmn_duplicate_data->message_comment,
|
337 |
+
'message_end_template' => $mlw_qmn_duplicate_data->message_end_template,
|
338 |
+
'user_email_template' => $mlw_qmn_duplicate_data->user_email_template,
|
339 |
+
'admin_email_template' => $mlw_qmn_duplicate_data->admin_email_template,
|
340 |
+
'submit_button_text' => $mlw_qmn_duplicate_data->submit_button_text,
|
341 |
+
'name_field_text' => $mlw_qmn_duplicate_data->name_field_text,
|
342 |
+
'business_field_text' => $mlw_qmn_duplicate_data->business_field_text,
|
343 |
+
'email_field_text' => $mlw_qmn_duplicate_data->email_field_text,
|
344 |
+
'phone_field_text' => $mlw_qmn_duplicate_data->phone_field_text,
|
345 |
+
'comment_field_text' => $mlw_qmn_duplicate_data->comment_field_text,
|
346 |
+
'email_from_text' => $mlw_qmn_duplicate_data->email_from_text,
|
347 |
+
'question_answer_template' => $mlw_qmn_duplicate_data->question_answer_template,
|
348 |
+
'leaderboard_template' => $mlw_qmn_duplicate_data->leaderboard_template,
|
349 |
+
'system' => $mlw_qmn_duplicate_data->system,
|
350 |
+
'randomness_order' => $mlw_qmn_duplicate_data->randomness_order,
|
351 |
+
'loggedin_user_contact' => $mlw_qmn_duplicate_data->loggedin_user_contact,
|
352 |
+
'show_score' => $mlw_qmn_duplicate_data->show_score,
|
353 |
+
'send_user_email' => $mlw_qmn_duplicate_data->send_user_email,
|
354 |
+
'send_admin_email' => $mlw_qmn_duplicate_data->send_admin_email,
|
355 |
+
'contact_info_location' => $mlw_qmn_duplicate_data->contact_info_location,
|
356 |
+
'user_name' => $mlw_qmn_duplicate_data->user_name,
|
357 |
+
'user_comp' => $mlw_qmn_duplicate_data->user_comp,
|
358 |
+
'user_email' => $mlw_qmn_duplicate_data->user_email,
|
359 |
+
'user_phone' => $mlw_qmn_duplicate_data->user_phone,
|
360 |
+
'admin_email' => get_option( 'admin_email', 'Enter email' ),
|
361 |
+
'comment_section' => $mlw_qmn_duplicate_data->comment_section,
|
362 |
+
'question_from_total' => $mlw_qmn_duplicate_data->question_from_total,
|
363 |
+
'total_user_tries' => $mlw_qmn_duplicate_data->total_user_tries,
|
364 |
+
'total_user_tries_text' => $mlw_qmn_duplicate_data->total_user_tries_text,
|
365 |
+
'certificate_template' => $mlw_qmn_duplicate_data->certificate_template,
|
366 |
+
'social_media' => $mlw_qmn_duplicate_data->social_media,
|
367 |
+
'social_media_text' => $mlw_qmn_duplicate_data->social_media_text,
|
368 |
+
'pagination' => $mlw_qmn_duplicate_data->pagination,
|
369 |
+
'pagination_text' => $mlw_qmn_duplicate_data->pagination_text,
|
370 |
+
'timer_limit' => $mlw_qmn_duplicate_data->timer_limit,
|
371 |
+
'quiz_stye' => $mlw_qmn_duplicate_data->quiz_stye,
|
372 |
+
'question_numbering' => $mlw_qmn_duplicate_data->question_numbering,
|
373 |
+
'quiz_settings' => $mlw_qmn_duplicate_data->quiz_settings,
|
374 |
+
'theme_selected' => $mlw_qmn_duplicate_data->theme_selected,
|
375 |
+
'last_activity' => date("Y-m-d H:i:s"),
|
376 |
+
'require_log_in' => $mlw_qmn_duplicate_data->require_log_in,
|
377 |
+
'require_log_in_text' => $mlw_qmn_duplicate_data->require_log_in_text,
|
378 |
+
'limit_total_entries' => $mlw_qmn_duplicate_data->limit_total_entries,
|
379 |
+
'limit_total_entries_text' => $mlw_qmn_duplicate_data->limit_total_entries_text,
|
380 |
+
'scheduled_timeframe' => $mlw_qmn_duplicate_data->scheduled_timeframe,
|
381 |
+
'scheduled_timeframe_text' => $mlw_qmn_duplicate_data->scheduled_timeframe_text,
|
382 |
+
'quiz_views' => 0,
|
383 |
+
'quiz_taken' => 0,
|
384 |
+
'deleted' => 0
|
385 |
+
),
|
386 |
+
array(
|
387 |
+
'%s',
|
388 |
+
'%s',
|
389 |
+
'%s',
|
390 |
+
'%s',
|
391 |
+
'%s',
|
392 |
+
'%s',
|
393 |
+
'%s',
|
394 |
+
'%s',
|
395 |
+
'%s',
|
396 |
+
'%s',
|
397 |
+
'%s',
|
398 |
+
'%s',
|
399 |
+
'%s',
|
400 |
+
'%s',
|
401 |
+
'%s',
|
402 |
+
'%s',
|
403 |
+
'%d',
|
404 |
+
'%d',
|
405 |
+
'%d',
|
406 |
+
'%d',
|
407 |
+
'%d',
|
408 |
+
'%d',
|
409 |
+
'%d',
|
410 |
+
'%d',
|
411 |
+
'%d',
|
412 |
+
'%d',
|
413 |
+
'%d',
|
414 |
+
'%s',
|
415 |
+
'%d',
|
416 |
+
'%d',
|
417 |
+
'%d',
|
418 |
+
'%s',
|
419 |
+
'%s',
|
420 |
+
'%d',
|
421 |
+
'%s',
|
422 |
+
'%d',
|
423 |
+
'%s',
|
424 |
+
'%d',
|
425 |
+
'%s',
|
426 |
+
'%d',
|
427 |
+
'%s',
|
428 |
+
'%s',
|
429 |
+
'%s',
|
430 |
+
'%d',
|
431 |
+
'%s',
|
432 |
+
'%d',
|
433 |
+
'%s',
|
434 |
+
'%s',
|
435 |
+
'%s',
|
436 |
+
'%d',
|
437 |
+
'%d',
|
438 |
+
'%d',
|
439 |
+
)
|
440 |
+
);
|
441 |
+
$mlw_new_id = $wpdb->insert_id;
|
442 |
+
if ($results != false)
|
443 |
+
{
|
444 |
+
$mlwQuizMasterNext->alertManager->newAlert('Your quiz has been duplicated successfully.', 'success');
|
445 |
+
|
446 |
+
//Insert Action Into Audit Trail
|
447 |
+
global $current_user;
|
448 |
+
get_currentuserinfo();
|
449 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
450 |
+
$insert = "INSERT INTO " . $table_name .
|
451 |
+
"(trail_id, action_user, action, time) " .
|
452 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'New Quiz Has Been Created: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
453 |
+
$results = $wpdb->query( $insert );
|
454 |
+
}
|
455 |
+
else
|
456 |
+
{
|
457 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0011.', 'error');
|
458 |
+
}
|
459 |
+
if ($is_duplicating_questions)
|
460 |
+
{
|
461 |
+
$table_name = $wpdb->prefix."mlw_questions";
|
462 |
+
$mlw_current_questions = $wpdb->get_results("SELECT * FROM $table_name WHERE deleted=0 AND quiz_id=".$quiz_id);
|
463 |
+
foreach ($mlw_current_questions as $mlw_question)
|
464 |
+
{
|
465 |
+
$question_results = $wpdb->insert(
|
466 |
+
$table_name,
|
467 |
+
array(
|
468 |
+
'quiz_id' => $mlw_new_id,
|
469 |
+
'question_name' => $mlw_question->question_name,
|
470 |
+
'answer_array' => $mlw_question->answer_array,
|
471 |
+
'answer_one' => $mlw_question->answer_one,
|
472 |
+
'answer_one_points' => $mlw_question->answer_one_points,
|
473 |
+
'answer_two' => $mlw_question->answer_two,
|
474 |
+
'answer_two_points' => $mlw_question->answer_two_points,
|
475 |
+
'answer_three' => $mlw_question->answer_three,
|
476 |
+
'answer_three_points' => $mlw_question->answer_three_points,
|
477 |
+
'answer_four' => $mlw_question->answer_four,
|
478 |
+
'answer_four_points' => $mlw_question->answer_four_points,
|
479 |
+
'answer_five' => $mlw_question->answer_five,
|
480 |
+
'answer_five_points' => $mlw_question->answer_five_points,
|
481 |
+
'answer_six' => $mlw_question->answer_six,
|
482 |
+
'answer_six_points' => $mlw_question->answer_six_points,
|
483 |
+
'correct_answer' => $mlw_question->correct_answer,
|
484 |
+
'question_answer_info' => $mlw_question->question_answer_info,
|
485 |
+
'comments' => $mlw_question->comments,
|
486 |
+
'hints' => $mlw_question->hints,
|
487 |
+
'question_order' => $mlw_question->question_order,
|
488 |
+
'question_type' => $mlw_question->question_type,
|
489 |
+
'question_settings' => $mlw_question->question_settings,
|
490 |
+
'deleted' => 0
|
491 |
+
),
|
492 |
+
array(
|
493 |
+
'%d',
|
494 |
+
'%s',
|
495 |
+
'%s',
|
496 |
+
'%s',
|
497 |
+
'%d',
|
498 |
+
'%s',
|
499 |
+
'%d',
|
500 |
+
'%s',
|
501 |
+
'%d',
|
502 |
+
'%s',
|
503 |
+
'%d',
|
504 |
+
'%s',
|
505 |
+
'%d',
|
506 |
+
'%s',
|
507 |
+
'%d',
|
508 |
+
'%d',
|
509 |
+
'%s',
|
510 |
+
'%d',
|
511 |
+
'%s',
|
512 |
+
'%d',
|
513 |
+
'%d',
|
514 |
+
'%s',
|
515 |
+
'%d'
|
516 |
+
)
|
517 |
+
);
|
518 |
+
if ($question_results == false)
|
519 |
+
{
|
520 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0020.', 'error');
|
521 |
+
}
|
522 |
+
}
|
523 |
+
}
|
524 |
+
}
|
525 |
+
}
|
526 |
+
?>
|
includes/mlw_quiz_install.php
CHANGED
@@ -109,6 +109,10 @@ function mlw_quiz_activate()
|
|
109 |
limit_total_entries INT NOT NULL,
|
110 |
|
111 |
limit_total_entries_text TEXT NOT NULL,
|
|
|
|
|
|
|
|
|
112 |
|
113 |
quiz_views INT NOT NULL,
|
114 |
|
109 |
limit_total_entries INT NOT NULL,
|
110 |
|
111 |
limit_total_entries_text TEXT NOT NULL,
|
112 |
+
|
113 |
+
scheduled_timeframe TEXT NOT NULL,
|
114 |
+
|
115 |
+
scheduled_timeframe_text TEXT NOT NULL,
|
116 |
|
117 |
quiz_views INT NOT NULL,
|
118 |
|
includes/mlw_quiz_options.php
CHANGED
@@ -9,7 +9,7 @@ Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
|
9 |
function mlw_generate_quiz_options()
|
10 |
{
|
11 |
global $wpdb;
|
12 |
-
global $
|
13 |
$quiz_id = $_GET["quiz_id"];
|
14 |
if (isset($_GET["quiz_id"]))
|
15 |
{
|
@@ -29,6 +29,7 @@ function mlw_generate_quiz_options()
|
|
29 |
wp_enqueue_script( 'jquery-ui-core' );
|
30 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
31 |
wp_enqueue_script( 'jquery-ui-button' );
|
|
|
32 |
wp_enqueue_script( 'jquery-ui-accordion' );
|
33 |
wp_enqueue_script( 'jquery-ui-tooltip' );
|
34 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
@@ -79,11 +80,10 @@ function mlw_generate_quiz_options()
|
|
79 |
}
|
80 |
$mlw_output = ob_get_contents();
|
81 |
ob_end_clean();
|
82 |
-
$
|
|
|
83 |
echo $mlw_output;
|
84 |
?>
|
85 |
-
|
86 |
-
<?php echo mlw_qmn_show_adverts(); ?>
|
87 |
</div>
|
88 |
</div>
|
89 |
<?php
|
@@ -155,7 +155,7 @@ add_action('mlw_qmn_options_tab_content', 'mlw_options_preview_tab_content');
|
|
155 |
function mlw_options_questions_tab_content()
|
156 |
{
|
157 |
global $wpdb;
|
158 |
-
global $
|
159 |
$quiz_id = $_GET["quiz_id"];
|
160 |
|
161 |
//Edit question
|
@@ -171,8 +171,11 @@ function mlw_options_questions_tab_content()
|
|
171 |
$edit_question_order = intval($_POST["edit_question_order"]);
|
172 |
$mlw_edit_answer_total = intval($_POST["question_".$mlw_edit_question_id."_answer_total"]);
|
173 |
$mlw_row_settings = $wpdb->get_row( $wpdb->prepare( "SELECT question_settings FROM " . $wpdb->prefix . "mlw_questions" . " WHERE question_id=%d", $mlw_edit_question_id ) );
|
174 |
-
$
|
175 |
-
|
|
|
|
|
|
|
176 |
{
|
177 |
$mlw_settings = array();
|
178 |
$mlw_settings['required'] = intval($_POST["edit_required"]);
|
@@ -206,7 +209,7 @@ function mlw_options_questions_tab_content()
|
|
206 |
$results = $wpdb->query( $update );
|
207 |
if ($results != false)
|
208 |
{
|
209 |
-
$
|
210 |
|
211 |
//Insert Action Into Audit Trail
|
212 |
global $current_user;
|
@@ -219,7 +222,7 @@ function mlw_options_questions_tab_content()
|
|
219 |
}
|
220 |
else
|
221 |
{
|
222 |
-
$
|
223 |
}
|
224 |
}
|
225 |
|
@@ -234,7 +237,7 @@ function mlw_options_questions_tab_content()
|
|
234 |
$results = $wpdb->query( $update );
|
235 |
if ($results != false)
|
236 |
{
|
237 |
-
$
|
238 |
|
239 |
//Insert Action Into Audit Trail
|
240 |
global $current_user;
|
@@ -247,7 +250,7 @@ function mlw_options_questions_tab_content()
|
|
247 |
}
|
248 |
else
|
249 |
{
|
250 |
-
$
|
251 |
}
|
252 |
}
|
253 |
|
@@ -316,7 +319,7 @@ function mlw_options_questions_tab_content()
|
|
316 |
|
317 |
if ($results != false)
|
318 |
{
|
319 |
-
$
|
320 |
|
321 |
//Insert Action Into Audit Trail
|
322 |
global $current_user;
|
@@ -329,7 +332,7 @@ function mlw_options_questions_tab_content()
|
|
329 |
}
|
330 |
else
|
331 |
{
|
332 |
-
$
|
333 |
}
|
334 |
}
|
335 |
|
@@ -372,7 +375,7 @@ function mlw_options_questions_tab_content()
|
|
372 |
$results = $wpdb->query( $insert );
|
373 |
if ($results != false)
|
374 |
{
|
375 |
-
$
|
376 |
|
377 |
//Insert Action Into Audit Trail
|
378 |
global $current_user;
|
@@ -385,7 +388,7 @@ function mlw_options_questions_tab_content()
|
|
385 |
}
|
386 |
else
|
387 |
{
|
388 |
-
$
|
389 |
}
|
390 |
}
|
391 |
|
@@ -416,8 +419,12 @@ function mlw_options_questions_tab_content()
|
|
416 |
//Load and prepare answer arrays
|
417 |
$mlw_qmn_answer_arrays = array();
|
418 |
foreach($mlw_question_data as $mlw_question_info) {
|
419 |
-
$
|
420 |
-
|
|
|
|
|
|
|
|
|
421 |
{
|
422 |
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
|
423 |
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
|
@@ -429,10 +436,6 @@ function mlw_options_questions_tab_content()
|
|
429 |
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
|
430 |
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
|
431 |
}
|
432 |
-
else
|
433 |
-
{
|
434 |
-
$mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
|
435 |
-
}
|
436 |
}
|
437 |
$is_new_quiz = $wpdb->num_rows;
|
438 |
?>
|
@@ -551,8 +554,12 @@ function mlw_options_questions_tab_content()
|
|
551 |
$display = "";
|
552 |
$alternate = "";
|
553 |
foreach($mlw_question_data as $mlw_question_info) {
|
554 |
-
$
|
555 |
-
|
|
|
|
|
|
|
|
|
556 |
$mlw_question_settings = array();
|
557 |
$mlw_question_settings['required'] = 1;
|
558 |
}
|
@@ -915,7 +922,7 @@ function mlw_options_questions_tab_content()
|
|
915 |
function mlw_options_text_tab_content()
|
916 |
{
|
917 |
global $wpdb;
|
918 |
-
global $
|
919 |
$quiz_id = $_GET["quiz_id"];
|
920 |
//Submit saved templates into database
|
921 |
if ( isset($_POST["save_templates"]) && $_POST["save_templates"] == "confirmation")
|
@@ -932,6 +939,7 @@ function mlw_options_text_tab_content()
|
|
932 |
$mlw_before_comments = htmlspecialchars($_POST["mlw_quiz_before_comments"], ENT_QUOTES);
|
933 |
$mlw_comment_field_text = htmlspecialchars($_POST["mlw_commentText"], ENT_QUOTES);
|
934 |
$mlw_require_log_in_text = htmlspecialchars($_POST["mlw_require_log_in_text"], ENT_QUOTES);
|
|
|
935 |
$mlw_limit_total_entries_text = htmlspecialchars($_POST["mlw_limit_total_entries_text"], ENT_QUOTES);
|
936 |
$mlw_qmn_pagination_field = serialize(array( $_POST["pagination_prev_text"], $_POST["pagination_next_text"] ));
|
937 |
$qmn_social_media_text = serialize(array('twitter' => $_POST["mlw_quiz_twitter_text_template"], 'facebook' => $_POST["mlw_quiz_facebook_text_template"]));
|
@@ -939,11 +947,11 @@ function mlw_options_text_tab_content()
|
|
939 |
$mlw_question_answer_template = htmlspecialchars($_POST["mlw_quiz_question_answer_template"], ENT_QUOTES);
|
940 |
$quiz_id = $_POST["quiz_id"];
|
941 |
|
942 |
-
$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."', total_user_tries_text='".$mlw_user_tries_text."', social_media_text='".$qmn_social_media_text."', pagination_text='".$mlw_qmn_pagination_field."', require_log_in_text='".$mlw_require_log_in_text."', limit_total_entries_text='".$mlw_limit_total_entries_text."', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=".$quiz_id;
|
943 |
$results = $wpdb->query( $update );
|
944 |
if ($results != false)
|
945 |
{
|
946 |
-
$
|
947 |
|
948 |
//Insert Action Into Audit Trail
|
949 |
global $current_user;
|
@@ -956,7 +964,7 @@ function mlw_options_text_tab_content()
|
|
956 |
}
|
957 |
else
|
958 |
{
|
959 |
-
$
|
960 |
}
|
961 |
}
|
962 |
|
@@ -968,16 +976,24 @@ function mlw_options_text_tab_content()
|
|
968 |
|
969 |
//Load Pagination Text
|
970 |
$mlw_qmn_pagination_text = "";
|
971 |
-
|
972 |
-
|
973 |
-
|
|
|
|
|
|
|
|
|
974 |
}
|
975 |
|
976 |
//Load Social Media Text
|
977 |
$qmn_social_media_text = "";
|
978 |
-
$
|
979 |
-
|
980 |
-
|
|
|
|
|
|
|
|
|
981 |
'twitter' => $mlw_quiz_options->social_media_text,
|
982 |
'facebook' => $mlw_quiz_options->social_media_text
|
983 |
);
|
@@ -1100,6 +1116,17 @@ function mlw_options_text_tab_content()
|
|
1100 |
<td><textarea cols="80" rows="15" id="mlw_require_log_in_text" name="mlw_require_log_in_text"><?php echo $mlw_quiz_options->require_log_in_text; ?></textarea>
|
1101 |
</td>
|
1102 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
<tr>
|
1104 |
<td width="30%">
|
1105 |
<strong>Message Displayed If The Limit Of Total Entries Has Been Reached</strong>
|
@@ -1208,7 +1235,7 @@ function mlw_options_text_tab_content()
|
|
1208 |
function mlw_options_option_tab_content()
|
1209 |
{
|
1210 |
global $wpdb;
|
1211 |
-
global $
|
1212 |
$quiz_id = $_GET["quiz_id"];
|
1213 |
//Submit saved options into database
|
1214 |
if ( isset($_POST["save_options"]) && $_POST["save_options"] == "confirmation")
|
@@ -1234,13 +1261,14 @@ function mlw_options_option_tab_content()
|
|
1234 |
$mlw_admin_email = $_POST["adminEmail"];
|
1235 |
$mlw_comment_section = $_POST["commentSection"];
|
1236 |
$mlw_qmn_loggedin_contact = $_POST["loggedin_user_contact"];
|
|
|
1237 |
$quiz_id = $_POST["quiz_id"];
|
1238 |
|
1239 |
-
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', loggedin_user_contact='".$mlw_qmn_loggedin_contact."', contact_info_location=".$mlw_contact_location.", user_name='".$mlw_user_name."', user_comp='".$mlw_user_comp."', user_email='".$mlw_user_email."', user_phone='".$mlw_user_phone."', admin_email='".$mlw_admin_email."', comment_section='".$mlw_comment_section."', randomness_order='".$mlw_randomness_order."', question_from_total=".$mlw_qmn_questions_from_total.", total_user_tries=".$mlw_total_user_tries.", social_media=".$mlw_qmn_social_media.", pagination=".$mlw_qmn_pagination.", timer_limit=".$mlw_qmn_timer.", question_numbering=".$mlw_qmn_question_numbering.", require_log_in=".$mlw_require_log_in.", limit_total_entries=".$mlw_limit_total_entries.", last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=".$quiz_id;
|
1240 |
$results = $wpdb->query( $update );
|
1241 |
if ($results != false)
|
1242 |
{
|
1243 |
-
$
|
1244 |
|
1245 |
//Insert Action Into Audit Trail
|
1246 |
global $current_user;
|
@@ -1253,7 +1281,7 @@ function mlw_options_option_tab_content()
|
|
1253 |
}
|
1254 |
else
|
1255 |
{
|
1256 |
-
$
|
1257 |
}
|
1258 |
}
|
1259 |
|
@@ -1262,11 +1290,23 @@ function mlw_options_option_tab_content()
|
|
1262 |
$table_name = $wpdb->prefix . "mlw_quizzes";
|
1263 |
$mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
|
1264 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1265 |
?>
|
1266 |
<div id="tabs-3" class="mlw_tab_content">
|
1267 |
<script>
|
1268 |
jQuery(function() {
|
1269 |
jQuery( "#system, #require_log_in, #randomness_order, #loggedin_user_contact, #sendUserEmail, #sendAdminEmail, #contact_info_location, #userName, #userComp, #userEmail, #userPhone, #pagination, #commentSection, #social_media, #question_numbering, #comments" ).buttonset();
|
|
|
1270 |
});
|
1271 |
</script>
|
1272 |
<button id="save_options_button" onclick="javascript: document.quiz_options_form.submit();">Save Options</button>
|
@@ -1321,6 +1361,15 @@ function mlw_options_option_tab_content()
|
|
1321 |
<input name="question_from_total" type="number" step="1" min="0" id="question_from_total" value="<?php echo $mlw_quiz_options->question_from_total; ?>" class="regular-text" />
|
1322 |
</td>
|
1323 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1324 |
<tr valign="top">
|
1325 |
<th scope="row"><label for="randomness_order">Are the questions random? (Question Order will not apply if this is yes)</label></th>
|
1326 |
<td><div id="randomness_order">
|
@@ -1424,7 +1473,7 @@ function mlw_options_option_tab_content()
|
|
1424 |
function mlw_options_leaderboard_tab_content()
|
1425 |
{
|
1426 |
global $wpdb;
|
1427 |
-
global $
|
1428 |
$quiz_id = $_GET["quiz_id"];
|
1429 |
///Submit saved leaderboard template into database
|
1430 |
if ( isset($_POST["save_leaderboard_options"]) && $_POST["save_leaderboard_options"] == "confirmation")
|
@@ -1436,7 +1485,7 @@ function mlw_options_leaderboard_tab_content()
|
|
1436 |
$results = $wpdb->query( $update );
|
1437 |
if ($results != false)
|
1438 |
{
|
1439 |
-
$
|
1440 |
|
1441 |
//Insert Action Into Audit Trail
|
1442 |
global $current_user;
|
@@ -1449,7 +1498,7 @@ function mlw_options_leaderboard_tab_content()
|
|
1449 |
}
|
1450 |
else
|
1451 |
{
|
1452 |
-
$
|
1453 |
}
|
1454 |
}
|
1455 |
|
@@ -1528,7 +1577,7 @@ function mlw_options_leaderboard_tab_content()
|
|
1528 |
function mlw_options_certificate_tab_content()
|
1529 |
{
|
1530 |
global $wpdb;
|
1531 |
-
global $
|
1532 |
$quiz_id = $_GET["quiz_id"];
|
1533 |
//Saved Certificate Options
|
1534 |
if (isset($_POST["save_certificate_options"]) && $_POST["save_certificate_options"] == "confirmation")
|
@@ -1547,7 +1596,7 @@ function mlw_options_certificate_tab_content()
|
|
1547 |
|
1548 |
if ($mlw_certificate_sql_results != false)
|
1549 |
{
|
1550 |
-
$
|
1551 |
|
1552 |
//Insert Action Into Audit Trail
|
1553 |
global $current_user;
|
@@ -1560,7 +1609,7 @@ function mlw_options_certificate_tab_content()
|
|
1560 |
}
|
1561 |
else
|
1562 |
{
|
1563 |
-
$
|
1564 |
}
|
1565 |
}
|
1566 |
if (isset($_GET["quiz_id"]))
|
@@ -1570,11 +1619,14 @@ function mlw_options_certificate_tab_content()
|
|
1570 |
}
|
1571 |
|
1572 |
//Load Certificate Options Variables
|
1573 |
-
$
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
|
|
|
|
|
|
1578 |
?>
|
1579 |
<div id="tabs-5" class="mlw_tab_content">
|
1580 |
<script>
|
@@ -1650,7 +1702,7 @@ function mlw_options_certificate_tab_content()
|
|
1650 |
function mlw_options_emails_tab_content()
|
1651 |
{
|
1652 |
global $wpdb;
|
1653 |
-
global $
|
1654 |
$quiz_id = $_GET["quiz_id"];
|
1655 |
//Check to add new user email template
|
1656 |
if (isset($_POST["mlw_add_email_page"]) && $_POST["mlw_add_email_page"] == "confirmation")
|
@@ -1660,9 +1712,9 @@ function mlw_options_emails_tab_content()
|
|
1660 |
$mlw_qmn_user_email = $wpdb->get_var( $wpdb->prepare( "SELECT user_email_template FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_qmn_add_email_id ) );
|
1661 |
|
1662 |
//Load user email and check if it is array already. If not, turn it into one
|
1663 |
-
$
|
1664 |
-
if (is_array($mlw_qmn_email_array))
|
1665 |
{
|
|
|
1666 |
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', 'Quiz Results For %QUIZ_NAME%');
|
1667 |
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
1668 |
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
@@ -1679,7 +1731,7 @@ function mlw_options_emails_tab_content()
|
|
1679 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_email_array, $mlw_qmn_add_email_id ) );
|
1680 |
if ($mlw_new_email_results != false)
|
1681 |
{
|
1682 |
-
$
|
1683 |
|
1684 |
//Insert Action Into Audit Trail
|
1685 |
global $current_user;
|
@@ -1692,7 +1744,7 @@ function mlw_options_emails_tab_content()
|
|
1692 |
}
|
1693 |
else
|
1694 |
{
|
1695 |
-
$
|
1696 |
}
|
1697 |
}
|
1698 |
|
@@ -1720,7 +1772,7 @@ function mlw_options_emails_tab_content()
|
|
1720 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', admin_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_new_email_array, $mlw_qmn_admin_email, $mlw_qmn_email_id ) );
|
1721 |
if ($mlw_new_email_results != false)
|
1722 |
{
|
1723 |
-
$
|
1724 |
|
1725 |
//Insert Action Into Audit Trail
|
1726 |
global $current_user;
|
@@ -1733,7 +1785,7 @@ function mlw_options_emails_tab_content()
|
|
1733 |
}
|
1734 |
else
|
1735 |
{
|
1736 |
-
$
|
1737 |
}
|
1738 |
}
|
1739 |
|
@@ -1744,10 +1796,18 @@ function mlw_options_emails_tab_content()
|
|
1744 |
}
|
1745 |
|
1746 |
//Load Email Templates
|
1747 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1748 |
if (!is_array($mlw_qmn_user_email_array)) {
|
1749 |
// something went wrong, initialize to empty array
|
1750 |
-
|
1751 |
}
|
1752 |
?>
|
1753 |
|
@@ -1933,7 +1993,7 @@ function mlw_options_emails_tab_content()
|
|
1933 |
function mlw_options_results_tab_content()
|
1934 |
{
|
1935 |
global $wpdb;
|
1936 |
-
global $
|
1937 |
$quiz_id = $_GET["quiz_id"];
|
1938 |
//Check to add new results page
|
1939 |
if (isset($_POST["mlw_add_landing_page"]) && $_POST["mlw_add_landing_page"] == "confirmation")
|
@@ -1942,9 +2002,9 @@ function mlw_options_results_tab_content()
|
|
1942 |
$mlw_qmn_landing_id = intval($_POST["mlw_add_landing_quiz_id"]);
|
1943 |
$mlw_qmn_message_after = $wpdb->get_var( $wpdb->prepare( "SELECT message_after FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_qmn_landing_id ) );
|
1944 |
//Load message_after and check if it is array already. If not, turn it into one
|
1945 |
-
$
|
1946 |
-
if (is_array($mlw_qmn_landing_array))
|
1947 |
{
|
|
|
1948 |
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here');
|
1949 |
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
1950 |
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
@@ -1962,7 +2022,7 @@ function mlw_options_results_tab_content()
|
|
1962 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after=%s, last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_landing_array, $mlw_qmn_landing_id ) );
|
1963 |
if ($mlw_new_landing_results != false)
|
1964 |
{
|
1965 |
-
$
|
1966 |
|
1967 |
//Insert Action Into Audit Trail
|
1968 |
global $current_user;
|
@@ -1975,7 +2035,7 @@ function mlw_options_results_tab_content()
|
|
1975 |
}
|
1976 |
else
|
1977 |
{
|
1978 |
-
$
|
1979 |
}
|
1980 |
}
|
1981 |
|
@@ -2002,7 +2062,7 @@ function mlw_options_results_tab_content()
|
|
2002 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_new_landing_array, $mlw_qmn_landing_id ) );
|
2003 |
if ($mlw_new_landing_results != false)
|
2004 |
{
|
2005 |
-
$
|
2006 |
|
2007 |
//Insert Action Into Audit Trail
|
2008 |
global $current_user;
|
@@ -2015,7 +2075,7 @@ function mlw_options_results_tab_content()
|
|
2015 |
}
|
2016 |
else
|
2017 |
{
|
2018 |
-
$
|
2019 |
}
|
2020 |
}
|
2021 |
|
@@ -2026,11 +2086,14 @@ function mlw_options_results_tab_content()
|
|
2026 |
}
|
2027 |
|
2028 |
//Load Landing Pages
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
|
|
|
|
|
|
2034 |
?>
|
2035 |
<div id="tabs-6" class="mlw_tab_content">
|
2036 |
<script>
|
@@ -2165,7 +2228,7 @@ function mlw_options_results_tab_content()
|
|
2165 |
function mlw_options_styling_tab_content()
|
2166 |
{
|
2167 |
global $wpdb;
|
2168 |
-
global $
|
2169 |
$quiz_id = $_GET["quiz_id"];
|
2170 |
if (isset($_POST["save_style_options"]) && $_POST["save_style_options"] == "confirmation")
|
2171 |
{
|
@@ -2178,7 +2241,7 @@ function mlw_options_styling_tab_content()
|
|
2178 |
$mlw_save_stle_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET quiz_stye='%s', theme_selected='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_style, $mlw_qmn_theme, $mlw_qmn_style_id ) );
|
2179 |
if ($mlw_save_stle_results != false)
|
2180 |
{
|
2181 |
-
$
|
2182 |
|
2183 |
//Insert Action Into Audit Trail
|
2184 |
global $current_user;
|
@@ -2191,7 +2254,7 @@ function mlw_options_styling_tab_content()
|
|
2191 |
}
|
2192 |
else
|
2193 |
{
|
2194 |
-
$
|
2195 |
}
|
2196 |
}
|
2197 |
|
@@ -2320,7 +2383,7 @@ function mlw_options_styling_tab_content()
|
|
2320 |
function mlw_options_tools_tab_content()
|
2321 |
{
|
2322 |
global $wpdb;
|
2323 |
-
global $
|
2324 |
$quiz_id = $_GET["quiz_id"];
|
2325 |
//Update Quiz Table
|
2326 |
if (isset($_POST["mlw_reset_quiz_stats"]) && $_POST["mlw_reset_quiz_stats"] == "confirmation")
|
@@ -2331,7 +2394,7 @@ function mlw_options_tools_tab_content()
|
|
2331 |
$mlw_reset_sql_results = $wpdb->query( $mlw_reset_update_sql );
|
2332 |
if ($mlw_reset_sql_results != false)
|
2333 |
{
|
2334 |
-
$
|
2335 |
|
2336 |
//Insert Action Into Audit Trail
|
2337 |
global $current_user;
|
@@ -2344,7 +2407,7 @@ function mlw_options_tools_tab_content()
|
|
2344 |
}
|
2345 |
else
|
2346 |
{
|
2347 |
-
$
|
2348 |
}
|
2349 |
}
|
2350 |
|
9 |
function mlw_generate_quiz_options()
|
10 |
{
|
11 |
global $wpdb;
|
12 |
+
global $mlwQuizMasterNext;
|
13 |
$quiz_id = $_GET["quiz_id"];
|
14 |
if (isset($_GET["quiz_id"]))
|
15 |
{
|
29 |
wp_enqueue_script( 'jquery-ui-core' );
|
30 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
31 |
wp_enqueue_script( 'jquery-ui-button' );
|
32 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
33 |
wp_enqueue_script( 'jquery-ui-accordion' );
|
34 |
wp_enqueue_script( 'jquery-ui-tooltip' );
|
35 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
80 |
}
|
81 |
$mlw_output = ob_get_contents();
|
82 |
ob_end_clean();
|
83 |
+
$mlwQuizMasterNext->alertManager->showAlerts();
|
84 |
+
echo mlw_qmn_show_adverts();
|
85 |
echo $mlw_output;
|
86 |
?>
|
|
|
|
|
87 |
</div>
|
88 |
</div>
|
89 |
<?php
|
155 |
function mlw_options_questions_tab_content()
|
156 |
{
|
157 |
global $wpdb;
|
158 |
+
global $mlwQuizMasterNext;
|
159 |
$quiz_id = $_GET["quiz_id"];
|
160 |
|
161 |
//Edit question
|
171 |
$edit_question_order = intval($_POST["edit_question_order"]);
|
172 |
$mlw_edit_answer_total = intval($_POST["question_".$mlw_edit_question_id."_answer_total"]);
|
173 |
$mlw_row_settings = $wpdb->get_row( $wpdb->prepare( "SELECT question_settings FROM " . $wpdb->prefix . "mlw_questions" . " WHERE question_id=%d", $mlw_edit_question_id ) );
|
174 |
+
if (is_serialized($mlw_row_settings->question_settings) && is_array(@unserialize($mlw_row_settings->question_settings)))
|
175 |
+
{
|
176 |
+
$mlw_settings = @unserialize($mlw_row_settings->question_settings);
|
177 |
+
}
|
178 |
+
else
|
179 |
{
|
180 |
$mlw_settings = array();
|
181 |
$mlw_settings['required'] = intval($_POST["edit_required"]);
|
209 |
$results = $wpdb->query( $update );
|
210 |
if ($results != false)
|
211 |
{
|
212 |
+
$mlwQuizMasterNext->alertManager->newAlert('The question has been updated successfully.', 'success');
|
213 |
|
214 |
//Insert Action Into Audit Trail
|
215 |
global $current_user;
|
222 |
}
|
223 |
else
|
224 |
{
|
225 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0004.', 'error');
|
226 |
}
|
227 |
}
|
228 |
|
237 |
$results = $wpdb->query( $update );
|
238 |
if ($results != false)
|
239 |
{
|
240 |
+
$mlwQuizMasterNext->alertManager->newAlert('The question has been deleted successfully.', 'success');
|
241 |
|
242 |
//Insert Action Into Audit Trail
|
243 |
global $current_user;
|
250 |
}
|
251 |
else
|
252 |
{
|
253 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0005.', 'error');
|
254 |
}
|
255 |
}
|
256 |
|
319 |
|
320 |
if ($results != false)
|
321 |
{
|
322 |
+
$mlwQuizMasterNext->alertManager->newAlert('The question has been duplicated successfully.', 'success');
|
323 |
|
324 |
//Insert Action Into Audit Trail
|
325 |
global $current_user;
|
332 |
}
|
333 |
else
|
334 |
{
|
335 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0019.', 'error');
|
336 |
}
|
337 |
}
|
338 |
|
375 |
$results = $wpdb->query( $insert );
|
376 |
if ($results != false)
|
377 |
{
|
378 |
+
$mlwQuizMasterNext->alertManager->newAlert('The question has been created successfully.', 'success');
|
379 |
|
380 |
//Insert Action Into Audit Trail
|
381 |
global $current_user;
|
388 |
}
|
389 |
else
|
390 |
{
|
391 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0006.', 'error');
|
392 |
}
|
393 |
}
|
394 |
|
419 |
//Load and prepare answer arrays
|
420 |
$mlw_qmn_answer_arrays = array();
|
421 |
foreach($mlw_question_data as $mlw_question_info) {
|
422 |
+
if (is_serialized($mlw_question_info->answer_array) && is_array(@unserialize($mlw_question_info->answer_array)))
|
423 |
+
{
|
424 |
+
$mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
|
425 |
+
$mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
|
426 |
+
}
|
427 |
+
else
|
428 |
{
|
429 |
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
|
430 |
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
|
436 |
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
|
437 |
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
|
438 |
}
|
|
|
|
|
|
|
|
|
439 |
}
|
440 |
$is_new_quiz = $wpdb->num_rows;
|
441 |
?>
|
554 |
$display = "";
|
555 |
$alternate = "";
|
556 |
foreach($mlw_question_data as $mlw_question_info) {
|
557 |
+
if (is_serialized($mlw_question_info->question_settings) && is_array(@unserialize($mlw_question_info->question_settings)))
|
558 |
+
{
|
559 |
+
$mlw_question_settings = @unserialize($mlw_question_info->question_settings);
|
560 |
+
}
|
561 |
+
else
|
562 |
+
{
|
563 |
$mlw_question_settings = array();
|
564 |
$mlw_question_settings['required'] = 1;
|
565 |
}
|
922 |
function mlw_options_text_tab_content()
|
923 |
{
|
924 |
global $wpdb;
|
925 |
+
global $mlwQuizMasterNext;
|
926 |
$quiz_id = $_GET["quiz_id"];
|
927 |
//Submit saved templates into database
|
928 |
if ( isset($_POST["save_templates"]) && $_POST["save_templates"] == "confirmation")
|
939 |
$mlw_before_comments = htmlspecialchars($_POST["mlw_quiz_before_comments"], ENT_QUOTES);
|
940 |
$mlw_comment_field_text = htmlspecialchars($_POST["mlw_commentText"], ENT_QUOTES);
|
941 |
$mlw_require_log_in_text = htmlspecialchars($_POST["mlw_require_log_in_text"], ENT_QUOTES);
|
942 |
+
$mlw_scheduled_timeframe_text = htmlspecialchars($_POST["mlw_scheduled_timeframe_text"], ENT_QUOTES);
|
943 |
$mlw_limit_total_entries_text = htmlspecialchars($_POST["mlw_limit_total_entries_text"], ENT_QUOTES);
|
944 |
$mlw_qmn_pagination_field = serialize(array( $_POST["pagination_prev_text"], $_POST["pagination_next_text"] ));
|
945 |
$qmn_social_media_text = serialize(array('twitter' => $_POST["mlw_quiz_twitter_text_template"], 'facebook' => $_POST["mlw_quiz_facebook_text_template"]));
|
947 |
$mlw_question_answer_template = htmlspecialchars($_POST["mlw_quiz_question_answer_template"], ENT_QUOTES);
|
948 |
$quiz_id = $_POST["quiz_id"];
|
949 |
|
950 |
+
$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."', total_user_tries_text='".$mlw_user_tries_text."', social_media_text='".$qmn_social_media_text."', pagination_text='".$mlw_qmn_pagination_field."', require_log_in_text='".$mlw_require_log_in_text."', limit_total_entries_text='".$mlw_limit_total_entries_text."', last_activity='".date("Y-m-d H:i:s")."', scheduled_timeframe_text='".$mlw_scheduled_timeframe_text."' WHERE quiz_id=".$quiz_id;
|
951 |
$results = $wpdb->query( $update );
|
952 |
if ($results != false)
|
953 |
{
|
954 |
+
$mlwQuizMasterNext->alertManager->newAlert('The templates has been updated successfully.', 'success');
|
955 |
|
956 |
//Insert Action Into Audit Trail
|
957 |
global $current_user;
|
964 |
}
|
965 |
else
|
966 |
{
|
967 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0007.', 'error');
|
968 |
}
|
969 |
}
|
970 |
|
976 |
|
977 |
//Load Pagination Text
|
978 |
$mlw_qmn_pagination_text = "";
|
979 |
+
if (is_serialized($mlw_quiz_options->pagination_text) && is_array(@unserialize($mlw_quiz_options->pagination_text)))
|
980 |
+
{
|
981 |
+
$mlw_qmn_pagination_text = @unserialize($mlw_quiz_options->pagination_text);
|
982 |
+
}
|
983 |
+
else
|
984 |
+
{
|
985 |
+
$mlw_qmn_pagination_text = array('Previous', $mlw_quiz_options->pagination_text);
|
986 |
}
|
987 |
|
988 |
//Load Social Media Text
|
989 |
$qmn_social_media_text = "";
|
990 |
+
if (is_serialized($mlw_quiz_options->social_media_text) && is_array(@unserialize($mlw_quiz_options->social_media_text)))
|
991 |
+
{
|
992 |
+
$qmn_social_media_text = @unserialize($mlw_quiz_options->social_media_text);
|
993 |
+
}
|
994 |
+
else
|
995 |
+
{
|
996 |
+
$qmn_social_media_text = array(
|
997 |
'twitter' => $mlw_quiz_options->social_media_text,
|
998 |
'facebook' => $mlw_quiz_options->social_media_text
|
999 |
);
|
1116 |
<td><textarea cols="80" rows="15" id="mlw_require_log_in_text" name="mlw_require_log_in_text"><?php echo $mlw_quiz_options->require_log_in_text; ?></textarea>
|
1117 |
</td>
|
1118 |
</tr>
|
1119 |
+
<tr>
|
1120 |
+
<td width="30%">
|
1121 |
+
<strong>Message Displayed If Date Is Outside Scheduled Timeframe</strong>
|
1122 |
+
<br />
|
1123 |
+
<p>Allowed Variables: </p>
|
1124 |
+
<p style="margin: 2px 0">- %QUIZ_NAME%</p>
|
1125 |
+
<p style="margin: 2px 0">- %CURRENT_DATE%</p>
|
1126 |
+
</td>
|
1127 |
+
<td><textarea cols="80" rows="15" id="mlw_scheduled_timeframe_text" name="mlw_scheduled_timeframe_text"><?php echo $mlw_quiz_options->scheduled_timeframe_text; ?></textarea>
|
1128 |
+
</td>
|
1129 |
+
</tr>
|
1130 |
<tr>
|
1131 |
<td width="30%">
|
1132 |
<strong>Message Displayed If The Limit Of Total Entries Has Been Reached</strong>
|
1235 |
function mlw_options_option_tab_content()
|
1236 |
{
|
1237 |
global $wpdb;
|
1238 |
+
global $mlwQuizMasterNext;
|
1239 |
$quiz_id = $_GET["quiz_id"];
|
1240 |
//Submit saved options into database
|
1241 |
if ( isset($_POST["save_options"]) && $_POST["save_options"] == "confirmation")
|
1261 |
$mlw_admin_email = $_POST["adminEmail"];
|
1262 |
$mlw_comment_section = $_POST["commentSection"];
|
1263 |
$mlw_qmn_loggedin_contact = $_POST["loggedin_user_contact"];
|
1264 |
+
$qmn_scheduled_timeframe = serialize(array("start" => $_POST["scheduled_time_start"], "end" => $_POST["scheduled_time_end"]));
|
1265 |
$quiz_id = $_POST["quiz_id"];
|
1266 |
|
1267 |
+
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', loggedin_user_contact='".$mlw_qmn_loggedin_contact."', contact_info_location=".$mlw_contact_location.", user_name='".$mlw_user_name."', user_comp='".$mlw_user_comp."', user_email='".$mlw_user_email."', user_phone='".$mlw_user_phone."', admin_email='".$mlw_admin_email."', comment_section='".$mlw_comment_section."', randomness_order='".$mlw_randomness_order."', question_from_total=".$mlw_qmn_questions_from_total.", total_user_tries=".$mlw_total_user_tries.", social_media=".$mlw_qmn_social_media.", pagination=".$mlw_qmn_pagination.", timer_limit=".$mlw_qmn_timer.", question_numbering=".$mlw_qmn_question_numbering.", require_log_in=".$mlw_require_log_in.", limit_total_entries=".$mlw_limit_total_entries.", last_activity='".date("Y-m-d H:i:s")."', scheduled_timeframe='".$qmn_scheduled_timeframe."' WHERE quiz_id=".$quiz_id;
|
1268 |
$results = $wpdb->query( $update );
|
1269 |
if ($results != false)
|
1270 |
{
|
1271 |
+
$mlwQuizMasterNext->alertManager->newAlert('The options has been updated successfully.', 'success');
|
1272 |
|
1273 |
//Insert Action Into Audit Trail
|
1274 |
global $current_user;
|
1281 |
}
|
1282 |
else
|
1283 |
{
|
1284 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0008.', 'error');
|
1285 |
}
|
1286 |
}
|
1287 |
|
1290 |
$table_name = $wpdb->prefix . "mlw_quizzes";
|
1291 |
$mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
|
1292 |
}
|
1293 |
+
|
1294 |
+
//Load Scheduled Timeframe
|
1295 |
+
$qmn_scheduled_timeframe = "";
|
1296 |
+
if (is_serialized($mlw_quiz_options->scheduled_timeframe) && is_array(@unserialize($mlw_quiz_options->scheduled_timeframe)))
|
1297 |
+
{
|
1298 |
+
$qmn_scheduled_timeframe = @unserialize($mlw_quiz_options->scheduled_timeframe);
|
1299 |
+
}
|
1300 |
+
else
|
1301 |
+
{
|
1302 |
+
$qmn_scheduled_timeframe = array("start" => '', "end" => '');
|
1303 |
+
}
|
1304 |
?>
|
1305 |
<div id="tabs-3" class="mlw_tab_content">
|
1306 |
<script>
|
1307 |
jQuery(function() {
|
1308 |
jQuery( "#system, #require_log_in, #randomness_order, #loggedin_user_contact, #sendUserEmail, #sendAdminEmail, #contact_info_location, #userName, #userComp, #userEmail, #userPhone, #pagination, #commentSection, #social_media, #question_numbering, #comments" ).buttonset();
|
1309 |
+
jQuery( "#scheduled_time_start, #scheduled_time_end" ).datepicker();
|
1310 |
});
|
1311 |
</script>
|
1312 |
<button id="save_options_button" onclick="javascript: document.quiz_options_form.submit();">Save Options</button>
|
1361 |
<input name="question_from_total" type="number" step="1" min="0" id="question_from_total" value="<?php echo $mlw_quiz_options->question_from_total; ?>" class="regular-text" />
|
1362 |
</td>
|
1363 |
</tr>
|
1364 |
+
<tr valign="top">
|
1365 |
+
<th scope="row"><label for="scheduled_time_start">What time-frame should the user be able to access the quiz? (Leave blank if the user can access anytime)</label></th>
|
1366 |
+
<td>
|
1367 |
+
<input name="scheduled_time_start" placeholder="start date" type="text" id="scheduled_time_start" value="<?php echo $qmn_scheduled_timeframe["start"] ?>" class="regular-text" />
|
1368 |
+
</td>
|
1369 |
+
<td>
|
1370 |
+
<input name="scheduled_time_end" type="text" placeholder="end date" id="scheduled_time_end" value="<?php echo $qmn_scheduled_timeframe["end"] ?>" class="regular-text" />
|
1371 |
+
</td>
|
1372 |
+
</tr>
|
1373 |
<tr valign="top">
|
1374 |
<th scope="row"><label for="randomness_order">Are the questions random? (Question Order will not apply if this is yes)</label></th>
|
1375 |
<td><div id="randomness_order">
|
1473 |
function mlw_options_leaderboard_tab_content()
|
1474 |
{
|
1475 |
global $wpdb;
|
1476 |
+
global $mlwQuizMasterNext;
|
1477 |
$quiz_id = $_GET["quiz_id"];
|
1478 |
///Submit saved leaderboard template into database
|
1479 |
if ( isset($_POST["save_leaderboard_options"]) && $_POST["save_leaderboard_options"] == "confirmation")
|
1485 |
$results = $wpdb->query( $update );
|
1486 |
if ($results != false)
|
1487 |
{
|
1488 |
+
$mlwQuizMasterNext->alertManager->newAlert('The leaderboards has been updated successfully.', 'success');
|
1489 |
|
1490 |
//Insert Action Into Audit Trail
|
1491 |
global $current_user;
|
1498 |
}
|
1499 |
else
|
1500 |
{
|
1501 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0009.', 'error');
|
1502 |
}
|
1503 |
}
|
1504 |
|
1577 |
function mlw_options_certificate_tab_content()
|
1578 |
{
|
1579 |
global $wpdb;
|
1580 |
+
global $mlwQuizMasterNext;
|
1581 |
$quiz_id = $_GET["quiz_id"];
|
1582 |
//Saved Certificate Options
|
1583 |
if (isset($_POST["save_certificate_options"]) && $_POST["save_certificate_options"] == "confirmation")
|
1596 |
|
1597 |
if ($mlw_certificate_sql_results != false)
|
1598 |
{
|
1599 |
+
$mlwQuizMasterNext->alertManager->newAlert('The certificate has been updated successfully.', 'success');
|
1600 |
|
1601 |
//Insert Action Into Audit Trail
|
1602 |
global $current_user;
|
1609 |
}
|
1610 |
else
|
1611 |
{
|
1612 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0012.', 'error');
|
1613 |
}
|
1614 |
}
|
1615 |
if (isset($_GET["quiz_id"]))
|
1619 |
}
|
1620 |
|
1621 |
//Load Certificate Options Variables
|
1622 |
+
if (is_serialized($mlw_quiz_options->certificate_template) && is_array(@unserialize($mlw_quiz_options->certificate_template)))
|
1623 |
+
{
|
1624 |
+
$mlw_certificate_options = @unserialize($mlw_quiz_options->certificate_template);
|
1625 |
+
}
|
1626 |
+
else
|
1627 |
+
{
|
1628 |
+
$mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
|
1629 |
+
}
|
1630 |
?>
|
1631 |
<div id="tabs-5" class="mlw_tab_content">
|
1632 |
<script>
|
1702 |
function mlw_options_emails_tab_content()
|
1703 |
{
|
1704 |
global $wpdb;
|
1705 |
+
global $mlwQuizMasterNext;
|
1706 |
$quiz_id = $_GET["quiz_id"];
|
1707 |
//Check to add new user email template
|
1708 |
if (isset($_POST["mlw_add_email_page"]) && $_POST["mlw_add_email_page"] == "confirmation")
|
1712 |
$mlw_qmn_user_email = $wpdb->get_var( $wpdb->prepare( "SELECT user_email_template FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_qmn_add_email_id ) );
|
1713 |
|
1714 |
//Load user email and check if it is array already. If not, turn it into one
|
1715 |
+
if (is_serialized($mlw_qmn_user_email) && is_array(@unserialize($mlw_qmn_user_email)))
|
|
|
1716 |
{
|
1717 |
+
$mlw_qmn_email_array = @unserialize($mlw_qmn_user_email);
|
1718 |
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', 'Quiz Results For %QUIZ_NAME%');
|
1719 |
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
1720 |
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
1731 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_email_array, $mlw_qmn_add_email_id ) );
|
1732 |
if ($mlw_new_email_results != false)
|
1733 |
{
|
1734 |
+
$mlwQuizMasterNext->alertManager->newAlert('The email has been added successfully.', 'success');
|
1735 |
|
1736 |
//Insert Action Into Audit Trail
|
1737 |
global $current_user;
|
1744 |
}
|
1745 |
else
|
1746 |
{
|
1747 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0016.', 'error');
|
1748 |
}
|
1749 |
}
|
1750 |
|
1772 |
$mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', admin_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_new_email_array, $mlw_qmn_admin_email, $mlw_qmn_email_id ) );
|
1773 |
if ($mlw_new_email_results != false)
|
1774 |
{
|
1775 |
+
$mlwQuizMasterNext->alertManager->newAlert('The email has been updated successfully.', 'success');
|
1776 |
|
1777 |
//Insert Action Into Audit Trail
|
1778 |
global $current_user;
|
1785 |
}
|
1786 |
else
|
1787 |
{
|
1788 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0017.', 'error');
|
1789 |
}
|
1790 |
}
|
1791 |
|
1796 |
}
|
1797 |
|
1798 |
//Load Email Templates
|
1799 |
+
if (is_serialized($mlw_quiz_options->user_email_template) && is_array(@unserialize($mlw_quiz_options->user_email_template)))
|
1800 |
+
{
|
1801 |
+
$mlw_qmn_user_email_array = @unserialize($mlw_quiz_options->user_email_template);
|
1802 |
+
}
|
1803 |
+
else
|
1804 |
+
{
|
1805 |
+
$mlw_qmn_user_email_array = array(array(0, 0, $mlw_quiz_options->user_email_template, 'Quiz Results For %QUIZ_NAME%'));
|
1806 |
+
}
|
1807 |
+
|
1808 |
if (!is_array($mlw_qmn_user_email_array)) {
|
1809 |
// something went wrong, initialize to empty array
|
1810 |
+
|
1811 |
}
|
1812 |
?>
|
1813 |
|
1993 |
function mlw_options_results_tab_content()
|
1994 |
{
|
1995 |
global $wpdb;
|
1996 |
+
global $mlwQuizMasterNext;
|
1997 |
$quiz_id = $_GET["quiz_id"];
|
1998 |
//Check to add new results page
|
1999 |
if (isset($_POST["mlw_add_landing_page"]) && $_POST["mlw_add_landing_page"] == "confirmation")
|
2002 |
$mlw_qmn_landing_id = intval($_POST["mlw_add_landing_quiz_id"]);
|
2003 |
$mlw_qmn_message_after = $wpdb->get_var( $wpdb->prepare( "SELECT message_after FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_qmn_landing_id ) );
|
2004 |
//Load message_after and check if it is array already. If not, turn it into one
|
2005 |
+
if (is_serialized($mlw_qmn_message_after) && is_array(@unserialize($mlw_qmn_message_after)))
|
|
|
2006 |
{
|
2007 |
+
$mlw_qmn_landing_array = @unserialize($mlw_qmn_message_after);
|
2008 |
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here');
|
2009 |
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
2010 |
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
2022 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after=%s, last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_landing_array, $mlw_qmn_landing_id ) );
|
2023 |
if ($mlw_new_landing_results != false)
|
2024 |
{
|
2025 |
+
$mlwQuizMasterNext->alertManager->newAlert('The results page has been added successfully.', 'success');
|
2026 |
|
2027 |
//Insert Action Into Audit Trail
|
2028 |
global $current_user;
|
2035 |
}
|
2036 |
else
|
2037 |
{
|
2038 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0013.', 'error');
|
2039 |
}
|
2040 |
}
|
2041 |
|
2062 |
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_new_landing_array, $mlw_qmn_landing_id ) );
|
2063 |
if ($mlw_new_landing_results != false)
|
2064 |
{
|
2065 |
+
$mlwQuizMasterNext->alertManager->newAlert('The results page has been saved successfully.', 'success');
|
2066 |
|
2067 |
//Insert Action Into Audit Trail
|
2068 |
global $current_user;
|
2075 |
}
|
2076 |
else
|
2077 |
{
|
2078 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0014.', 'error');
|
2079 |
}
|
2080 |
}
|
2081 |
|
2086 |
}
|
2087 |
|
2088 |
//Load Landing Pages
|
2089 |
+
if (is_serialized($mlw_quiz_options->message_after) && is_array(@unserialize($mlw_quiz_options->message_after)))
|
2090 |
+
{
|
2091 |
+
$mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
|
2092 |
+
}
|
2093 |
+
else
|
2094 |
+
{
|
2095 |
+
$mlw_message_after_array = array(array(0, 0, $mlw_quiz_options->message_after));
|
2096 |
+
}
|
2097 |
?>
|
2098 |
<div id="tabs-6" class="mlw_tab_content">
|
2099 |
<script>
|
2228 |
function mlw_options_styling_tab_content()
|
2229 |
{
|
2230 |
global $wpdb;
|
2231 |
+
global $mlwQuizMasterNext;
|
2232 |
$quiz_id = $_GET["quiz_id"];
|
2233 |
if (isset($_POST["save_style_options"]) && $_POST["save_style_options"] == "confirmation")
|
2234 |
{
|
2241 |
$mlw_save_stle_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET quiz_stye='%s', theme_selected='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_style, $mlw_qmn_theme, $mlw_qmn_style_id ) );
|
2242 |
if ($mlw_save_stle_results != false)
|
2243 |
{
|
2244 |
+
$mlwQuizMasterNext->alertManager->newAlert('The style has been saved successfully.', 'success');
|
2245 |
|
2246 |
//Insert Action Into Audit Trail
|
2247 |
global $current_user;
|
2254 |
}
|
2255 |
else
|
2256 |
{
|
2257 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0015.', 'error');
|
2258 |
}
|
2259 |
}
|
2260 |
|
2383 |
function mlw_options_tools_tab_content()
|
2384 |
{
|
2385 |
global $wpdb;
|
2386 |
+
global $mlwQuizMasterNext;
|
2387 |
$quiz_id = $_GET["quiz_id"];
|
2388 |
//Update Quiz Table
|
2389 |
if (isset($_POST["mlw_reset_quiz_stats"]) && $_POST["mlw_reset_quiz_stats"] == "confirmation")
|
2394 |
$mlw_reset_sql_results = $wpdb->query( $mlw_reset_update_sql );
|
2395 |
if ($mlw_reset_sql_results != false)
|
2396 |
{
|
2397 |
+
$mlwQuizMasterNext->alertManager->newAlert('The stats has been reset successfully.', 'success');
|
2398 |
|
2399 |
//Insert Action Into Audit Trail
|
2400 |
global $current_user;
|
2407 |
}
|
2408 |
else
|
2409 |
{
|
2410 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0010.', 'error');
|
2411 |
}
|
2412 |
}
|
2413 |
|
includes/mlw_results.php
CHANGED
@@ -9,7 +9,7 @@ Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
|
9 |
function mlw_generate_quiz_results()
|
10 |
{
|
11 |
global $wpdb;
|
12 |
-
global $
|
13 |
|
14 |
///Delete Results Function
|
15 |
if (isset($_POST["delete_results"]) && $_POST["delete_results"] == "confirmation")
|
@@ -22,7 +22,7 @@ function mlw_generate_quiz_results()
|
|
22 |
$mlw_delete_results_results = $wpdb->query( $mlw_delete_results_update_sql );
|
23 |
if ($mlw_delete_results_results != false)
|
24 |
{
|
25 |
-
$
|
26 |
|
27 |
//Insert Action Into Audit Trail
|
28 |
global $current_user;
|
@@ -35,7 +35,7 @@ function mlw_generate_quiz_results()
|
|
35 |
}
|
36 |
else
|
37 |
{
|
38 |
-
$
|
39 |
}
|
40 |
}
|
41 |
|
@@ -139,7 +139,7 @@ function mlw_generate_quiz_results()
|
|
139 |
<div class='mlw_quiz_options'>
|
140 |
<h2>Quiz Results<a id="opener" href="">(?)</a></h2>
|
141 |
<?php
|
142 |
-
$
|
143 |
|
144 |
$quotes_list = "";
|
145 |
$display = "";
|
9 |
function mlw_generate_quiz_results()
|
10 |
{
|
11 |
global $wpdb;
|
12 |
+
global $mlwQuizMasterNext;
|
13 |
|
14 |
///Delete Results Function
|
15 |
if (isset($_POST["delete_results"]) && $_POST["delete_results"] == "confirmation")
|
22 |
$mlw_delete_results_results = $wpdb->query( $mlw_delete_results_update_sql );
|
23 |
if ($mlw_delete_results_results != false)
|
24 |
{
|
25 |
+
$mlwQuizMasterNext->alertManager->newAlert('Your results has been deleted successfully.', 'success');
|
26 |
|
27 |
//Insert Action Into Audit Trail
|
28 |
global $current_user;
|
35 |
}
|
36 |
else
|
37 |
{
|
38 |
+
$mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0021.', 'error');
|
39 |
}
|
40 |
}
|
41 |
|
139 |
<div class='mlw_quiz_options'>
|
140 |
<h2>Quiz Results<a id="opener" href="">(?)</a></h2>
|
141 |
<?php
|
142 |
+
$mlwQuizMasterNext->alertManager->showAlerts();
|
143 |
|
144 |
$quotes_list = "";
|
145 |
$display = "";
|
includes/mlw_update.php
CHANGED
@@ -6,7 +6,7 @@ function mlw_quiz_update()
|
|
6 |
{
|
7 |
|
8 |
//Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
|
9 |
-
$data = "3.
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
@@ -271,7 +271,7 @@ function mlw_quiz_update()
|
|
271 |
}
|
272 |
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries'") != "limit_total_entries")
|
273 |
{
|
274 |
-
$sql = "ALTER TABLE ".$table_name." ADD limit_total_entries INT NOT NULL AFTER
|
275 |
$results = $wpdb->query( $sql );
|
276 |
$update_sql = "UPDATE ".$table_name." SET limit_total_entries='0'";
|
277 |
$results = $wpdb->query( $update_sql );
|
@@ -284,6 +284,22 @@ function mlw_quiz_update()
|
|
284 |
$results = $wpdb->query( $update_sql );
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
|
288 |
global $wpdb;
|
289 |
$table_name = $wpdb->prefix . "mlw_questions";
|
6 |
{
|
7 |
|
8 |
//Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
|
9 |
+
$data = "3.7.1";
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
271 |
}
|
272 |
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries'") != "limit_total_entries")
|
273 |
{
|
274 |
+
$sql = "ALTER TABLE ".$table_name." ADD limit_total_entries INT NOT NULL AFTER require_log_in_text";
|
275 |
$results = $wpdb->query( $sql );
|
276 |
$update_sql = "UPDATE ".$table_name." SET limit_total_entries='0'";
|
277 |
$results = $wpdb->query( $update_sql );
|
284 |
$results = $wpdb->query( $update_sql );
|
285 |
}
|
286 |
|
287 |
+
//Update 3.7.1
|
288 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe'") != "scheduled_timeframe")
|
289 |
+
{
|
290 |
+
$sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe TEXT NOT NULL AFTER limit_total_entries_text";
|
291 |
+
$results = $wpdb->query( $sql );
|
292 |
+
$update_sql = "UPDATE ".$table_name." SET scheduled_timeframe=''";
|
293 |
+
$results = $wpdb->query( $update_sql );
|
294 |
+
}
|
295 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe_text'") != "scheduled_timeframe_text")
|
296 |
+
{
|
297 |
+
$sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe_text TEXT NOT NULL AFTER scheduled_timeframe";
|
298 |
+
$results = $wpdb->query( $sql );
|
299 |
+
$update_sql = "UPDATE ".$table_name." SET scheduled_timeframe_text='Enter Text Here'";
|
300 |
+
$results = $wpdb->query( $update_sql );
|
301 |
+
}
|
302 |
+
|
303 |
|
304 |
global $wpdb;
|
305 |
$table_name = $wpdb->prefix . "mlw_questions";
|
mlw_quizmaster2.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
Plugin Name: Quiz Master Next
|
5 |
Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
|
6 |
-
Version: 3.
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
@@ -29,6 +29,22 @@ You understand that you install, operate, and unistall the plugin at your own di
|
|
29 |
*/
|
30 |
class MLWQuizMasterNext
|
31 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Main Construct Function
|
34 |
*
|
@@ -67,6 +83,15 @@ class MLWQuizMasterNext
|
|
67 |
include("includes/mlw_qmn_credits.php");
|
68 |
include("includes/mlw_template_variables.php");
|
69 |
include("includes/mlw_adverts.php");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
/**
|
@@ -122,6 +147,5 @@ class MLWQuizMasterNext
|
|
122 |
}
|
123 |
|
124 |
$mlwQuizMasterNext = new MLWQuizMasterNext();
|
125 |
-
include("includes/mlw_alerts.php");
|
126 |
register_activation_hook( __FILE__, 'mlw_quiz_activate');
|
127 |
?>
|
3 |
/*
|
4 |
Plugin Name: Quiz Master Next
|
5 |
Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
|
6 |
+
Version: 3.7.1
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
29 |
*/
|
30 |
class MLWQuizMasterNext
|
31 |
{
|
32 |
+
/**
|
33 |
+
* QMN Alert Manager Object
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
* @since 3.7.1
|
37 |
+
*/
|
38 |
+
public $alertManager;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* QMN Quiz Creator Object
|
42 |
+
*
|
43 |
+
* @var object
|
44 |
+
* @since 3.7.1
|
45 |
+
*/
|
46 |
+
public $quizCreator;
|
47 |
+
|
48 |
/**
|
49 |
* Main Construct Function
|
50 |
*
|
83 |
include("includes/mlw_qmn_credits.php");
|
84 |
include("includes/mlw_template_variables.php");
|
85 |
include("includes/mlw_adverts.php");
|
86 |
+
include("includes/mlw_alerts.php");
|
87 |
+
|
88 |
+
$this->alertManager = new MlwQmnAlertManager();
|
89 |
+
|
90 |
+
if (is_admin())
|
91 |
+
{
|
92 |
+
include("includes/mlw_quiz_creator.php");
|
93 |
+
$this->quizCreator = new QMNQuizCreator();
|
94 |
+
}
|
95 |
}
|
96 |
|
97 |
/**
|
147 |
}
|
148 |
|
149 |
$mlwQuizMasterNext = new MLWQuizMasterNext();
|
|
|
150 |
register_activation_hook( __FILE__, 'mlw_quiz_activate');
|
151 |
?>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: fpcorso
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ
|
4 |
Tags: quiz, test, score, exam, survey, contact, form, email, answer, question
|
5 |
Requires at least: 3.8.1
|
6 |
-
Tested up to: 4.0
|
7 |
-
Stable tag: 3.
|
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.
|
@@ -40,6 +40,9 @@ The plugin will **save** the results, the user's answers, the user's comments, a
|
|
40 |
= Math Formulas =
|
41 |
You can use Tex or LaTex in questions, answers, and text fields for your quiz. For assistance with LaTex, review this tutorial: [LaTeX](http://www.andy-roberts.net/writing/latex/mathematics_1)
|
42 |
|
|
|
|
|
|
|
43 |
= Other Useful Features =
|
44 |
|
45 |
* Allow the user to share the results on *social networks*
|
@@ -60,6 +63,10 @@ You can use Tex or LaTex in questions, answers, and text fields for your quiz. F
|
|
60 |
= Make Suggestions Or Contribute =
|
61 |
Quiz Master Next is now on [GitHub](https://github.com/fpcorso/quiz_master_next/)!
|
62 |
|
|
|
|
|
|
|
|
|
63 |
= Quiz Master Next Add-ons =
|
64 |
While Quiz Master Next is fully functional and is packed full of features that will meet the needs of most, we do offer vaious extra features and support available in our [Wordpress Store](http://mylocalwebstop.com/shop/)
|
65 |
|
@@ -109,6 +116,12 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
= 3.6.1 (December 2, 2014) =
|
113 |
* Add Separate Social Network Text Templates
|
114 |
* Added Hours Field To Timer And Completion Time
|
@@ -556,6 +569,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
556 |
|
557 |
== Upgrade Notice ==
|
558 |
|
|
|
|
|
|
|
559 |
= 3.6.1 =
|
560 |
Upgrade for many backend upgrades
|
561 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ
|
4 |
Tags: quiz, test, score, exam, survey, contact, form, email, answer, question
|
5 |
Requires at least: 3.8.1
|
6 |
+
Tested up to: 4.0.1
|
7 |
+
Stable tag: 3.7.1
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
The easiest and most flexible way to add multiple quizzes, tests, and surveys to your website.
|
40 |
= Math Formulas =
|
41 |
You can use Tex or LaTex in questions, answers, and text fields for your quiz. For assistance with LaTex, review this tutorial: [LaTeX](http://www.andy-roberts.net/writing/latex/mathematics_1)
|
42 |
|
43 |
+
= Schedule Time That Quiz Is Active =
|
44 |
+
You can set up the quiz to only be active between two days. Utilize this for quizzes/surveys that are only active until a certain date.
|
45 |
+
|
46 |
= Other Useful Features =
|
47 |
|
48 |
* Allow the user to share the results on *social networks*
|
63 |
= Make Suggestions Or Contribute =
|
64 |
Quiz Master Next is now on [GitHub](https://github.com/fpcorso/quiz_master_next/)!
|
65 |
|
66 |
+
= Demoes! =
|
67 |
+
You can check out the sample quiz with various questions types here: [Sample Quiz](http://mylocalwebstop.com/sample-quiz/)!
|
68 |
+
You can check out the sample survey with pagination here: [Sample Survey](http://mylocalwebstop.com/sample-survey/)!
|
69 |
+
|
70 |
= Quiz Master Next Add-ons =
|
71 |
While Quiz Master Next is fully functional and is packed full of features that will meet the needs of most, we do offer vaious extra features and support available in our [Wordpress Store](http://mylocalwebstop.com/shop/)
|
72 |
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
+
= 3.7.1 (December 10, 2014) =
|
120 |
+
* Added Ability To Schedule A Timeframe That The Quiz Is Active In
|
121 |
+
* Added Labels To Horizontal Radio Type For Better Use
|
122 |
+
* In Code: Moved Alert Class Inside Main Class
|
123 |
+
* In Code: Created New Quiz Creator Class
|
124 |
+
|
125 |
= 3.6.1 (December 2, 2014) =
|
126 |
* Add Separate Social Network Text Templates
|
127 |
* Added Hours Field To Timer And Completion Time
|
569 |
|
570 |
== Upgrade Notice ==
|
571 |
|
572 |
+
= 3.7.1 =
|
573 |
+
Upgrade for ability to schedule when quiz will be active
|
574 |
+
|
575 |
= 3.6.1 =
|
576 |
Upgrade for many backend upgrades
|
577 |
|