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

Version Description

Upgrade for ability for different admin emails based on score. Also, new help page is included. Added new dashboard widget as well.

Download this release

Release Info

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

Code changes from version 3.7.1 to 3.8.1

includes/certificates/index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+
4
+ ?>
includes/mlw_dashboard.php CHANGED
@@ -6,59 +6,20 @@ This page creates the main dashboard for the Quiz Master Next plugin
6
  Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
7
  */
8
 
9
- function mlw_generate_quiz_dashboard(){
10
-
11
- //Support Email Validation Script
12
- echo "
13
- <script>
14
- function mlw_validateForm()
15
- {
16
- var x=document.forms['emailForm']['email'].value;
17
- if (x==null || x=='')
18
- {
19
- document.getElementById('mlw_support_message').innerHTML = '**Email must be filled out!**';
20
- return false;
21
- };
22
- var x=document.forms['emailForm']['username'].value;
23
- if (x==null || x=='')
24
- {
25
- document.getElementById('mlw_support_message').innerHTML = '**Name must be filled out!**';
26
- return false;
27
- };
28
- var x=document.forms['emailForm']['message'].value;
29
- if (x==null || x=='')
30
- {
31
- document.getElementById('mlw_support_message').innerHTML = '**There must be a message to send!**';
32
- return false;
33
- };
34
- var x=document.forms['emailForm']['email'].value;
35
- var atpos=x.indexOf('@');
36
- var dotpos=x.lastIndexOf('.');
37
- if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
38
- {
39
- document.getElementById('mlw_support_message').innerHTML = '**Not a valid e-mail address!**';
40
- return false;
41
- }
42
- }
43
- </script>
44
- ";
45
-
46
  //Page Variables
47
  $mlw_quiz_version = get_option('mlw_quiz_master_version');
48
 
49
-
50
  ///Creates the widgets
51
  add_meta_box("wpss_mrts", 'Quiz Daily Stats - Times Taken', "mlw_dashboard_box", "quiz_wpss");
52
  add_meta_box("wpss_mrts", 'Quiz Total Stats', "mlw_dashboard_box_three", "quiz_wpss3");
53
  add_meta_box("wpss_mrts", 'Quiz Weekly Stats - Times Taken', "mlw_dashboard_box_four", "quiz_wpss4");
54
  add_meta_box("wpss_mrts", 'Quiz Monthly Stats - Times Taken', "mlw_dashboard_box_five", "quiz_wpss5");
55
- add_meta_box("wpss_mrts", 'Support', "mlw_dashboard_box_seven", "quiz_wpss7");
56
  if ( get_option('mlw_advert_shows') == 'true' )
57
  {
58
  add_meta_box("wpss_mrts", 'My Local Webstop Services', "mlw_dashboard_box_six", "quiz_wpss6");
59
- add_meta_box("wpss_mrts", 'Contribution', "mlw_dashboard_box_eight", "quiz_wpss8");
60
  }
61
- add_meta_box("wpss_mrts", 'News From My Local Webstop', "mlw_dashboard_box_nine", "quiz_wpss9");
62
  add_meta_box("wpss_mrts", 'Quizzes Taken Today', "mlw_qmn_daily_percent_taken_widget", "quiz_wpss10");
63
  add_meta_box("wpss_mrts", 'Quizzes Taken Last 7 Days', "mlw_qmn_weekly_percent_taken_widget", "quiz_wpss11");
64
  add_meta_box("wpss_mrts", 'Quizzes Taken Last 30 Days', "mlw_qmn_monthly_percent_taken_widget", "quiz_wpss12");
@@ -70,11 +31,8 @@ function mlw_generate_quiz_dashboard(){
70
  <?php
71
  wp_enqueue_script( 'jquery' );
72
  wp_enqueue_script( 'jquery-ui-core' );
73
- wp_enqueue_script( 'jquery-ui-dialog' );
74
  wp_enqueue_script( 'jquery-ui-button' );
75
  wp_enqueue_script( 'jquery-ui-tooltip' );
76
- wp_enqueue_script( 'jquery-effects-blind' );
77
- wp_enqueue_script( 'jquery-effects-explode' );
78
  ?>
79
  <script type="text/javascript" src="<?php echo plugin_dir_url( __FILE__ ); ?>jquery_sparkline.js"></script>
80
  <script type="text/javascript">
@@ -82,22 +40,6 @@ function mlw_generate_quiz_dashboard(){
82
  // increase the default animation speed to exaggerate the effect
83
  $j.fx.speeds._default = 1000;
84
  $j(function() {
85
- $j('#dialog').dialog({
86
- autoOpen: false,
87
- show: 'blind',
88
- hide: 'explode',
89
- buttons: {
90
- Ok: function() {
91
- $j(this).dialog('close');
92
- }
93
- }
94
- });
95
-
96
- $j('#opener').click(function() {
97
- $j('#dialog').dialog('open');
98
- return false;
99
- });
100
-
101
  $j(function() {
102
  $j( document ).tooltip();
103
  });
@@ -106,45 +48,8 @@ function mlw_generate_quiz_dashboard(){
106
  $j('.inlinesparkline').sparkline('html', {type: 'line', width: '400', height: '200'});
107
  });
108
  </script>
109
- <style type="text/css">
110
- textarea{
111
- border-color:#000000;
112
- color:#3300CC;
113
- cursor:hand;
114
- }
115
- p em {
116
- padding-left: 1em;
117
- color: #555;
118
- font-weight: bold;
119
- }
120
- div.quiz_email_support {
121
- text-align: left;
122
- }
123
- div.quiz_email_support input[type='text'] {
124
- border-color:#000000;
125
- color:#3300CC;
126
- cursor:hand;
127
- }
128
- div.donation {
129
- border-width: 1px;
130
- border-style: solid;
131
- padding: 0 0.6em;
132
- margin: 5px 0 15px;
133
- -moz-border-radius: 3px;
134
- -khtml-border-radius: 3px;
135
- -webkit-border-radius: 3px;
136
- border-radius: 3px;
137
- background-color: #ffffe0;
138
- border-color: #e6db55;
139
- text-align: center;
140
- }
141
- donation.p { margin: 0.5em 0;
142
- line-height: 1;
143
- padding: 2px;
144
- }
145
- </style>
146
  <div class="wrap">
147
- <h2>Quiz Master Next Version <?php echo $mlw_quiz_version; ?> <?php _e("Dashboard", "mlw_qmn_text_domain"); ?><a id="opener" href="">(?)</a></h2>
148
 
149
  <?php echo mlw_qmn_show_adverts(); ?>
150
  <!--Display Widget Boxes-->
@@ -187,36 +92,6 @@ function mlw_generate_quiz_dashboard(){
187
  </div>
188
 
189
  <div style="clear:both">
190
-
191
- <div style="float:left; width:38%;" class="inner-sidebar1">
192
- <?php do_meta_boxes('quiz_wpss9','advanced',''); ?>
193
- </div>
194
-
195
- <div style="float:left; width:38%; " class="inner-sidebar1">
196
- <?php do_meta_boxes('quiz_wpss7','advanced',''); ?>
197
- </div>
198
-
199
- <div style="float:right; width:24%; " class="inner-sidebar1">
200
- <?php if ( get_option('mlw_advert_shows') == 'true' ) {do_meta_boxes('quiz_wpss8','advanced','');} ?>
201
- </div>
202
-
203
- <div style="clear:both">
204
-
205
-
206
- <!--Dialogs-->
207
- <div id="dialog" title="Help" style="display:none;">
208
- <h3><b>Help</b></h3>
209
- <p>This page is the main admin dashboard for the Quiz Master Next. It contains many useful widgets for the admin.</p>
210
- <p>Quiz Daily Stats -> This widget shows the times all quizzes have been taken each day over the last week.</p>
211
- <p>Quiz Weekly Stats -> This widget shows the times all quizzes have been taken each week over the last few weeks.</p>
212
- <p>Quiz Monthly Stats -> This widget shows the times all quizzes have been taken each month over the last few months.</p>
213
- <p>Quiz Total Stats -> This widget shows several different stats that has been collected.</p>
214
- <p>In This Update -> This widget shows what is new in the most recent update of the plugin.</p>
215
- <p>Support -> This widget allows you to send a message to the developer of the plugin.</p>
216
- <p>News From My Local Webstop -> This widget allows you to keep up with the latest news from My Local Webstop, the developer behind Quiz Master Next.</p>
217
- <p>Contribution -> This widget allows you to make a contribution to the developer.</p>
218
- </div>
219
-
220
  </div>
221
  <?php
222
  }
@@ -496,129 +371,6 @@ function mlw_dashboard_box_six()
496
  </div>
497
  <?php
498
  }
499
-
500
- function mlw_dashboard_box_seven()
501
- {
502
- $quiz_master_email_message = "";
503
- $mlw_quiz_version = get_option('mlw_quiz_master_version');
504
- if(isset($_POST["action"]))
505
- {
506
- $quiz_master_email_success = $_POST["action"];
507
- $user_name = $_POST["username"];
508
- $user_email = $_POST["email"];
509
- $user_message = $_POST["message"];
510
- $user_quiz_url = $_POST["quiz_url"];
511
- $current_user = wp_get_current_user();
512
- $mlw_site_name = get_bloginfo('name');
513
- $mlw_site_url = get_bloginfo('url');
514
- $mlw_site_version = get_bloginfo('version');
515
- $mlw_site_info = $mlw_site_name." ".$mlw_site_url." ".$mlw_site_version;
516
- if ($quiz_master_email_success == 'update')
517
- {
518
- $mlw_message = "Message from ".$user_name." at ".$user_email." It says: \n \n ".$user_message."\n Version: ".$mlw_quiz_version."\n Quiz URL Provided: ".$user_quiz_url."\n User ".$current_user->display_name." from ".$current_user->user_email."\n Wordpress Info: ".$mlw_site_info;
519
- wp_mail('fpcorso@mylocalwebstop.com' ,'Support From Quiz Master Next Plugin', $mlw_message);
520
- $quiz_master_email_message = "**Message Sent**";
521
- }
522
- }
523
- ?>
524
- <div class='quiz_email_support'>
525
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>?page=quiz-master-next/mlw_quizmaster2.php" method='post' name='emailForm' onsubmit='return mlw_validateForm()'>
526
- <input type='hidden' name='action' value='update' />
527
- <table>
528
- <tr>
529
- <td>If there is something you would like to suggest to add or even if you just want
530
- to let me know if you like the plugin or not, feel free to use the email form below.</td>
531
- </tr>
532
- <tr>
533
- <td><span name='mlw_support_message' id='mlw_support_message' style="color: red;"><?php echo $quiz_master_email_message; ?></span></td>
534
- </tr>
535
- <tr>
536
- <td align='left'><span style='font-weight:bold;';>Name (Required): </span></td>
537
- </tr>
538
- <tr>
539
- <td><input type='text' name='username' value='' /></td>
540
- </tr>
541
- <tr>
542
- <td align='left'><span style='font-weight:bold;';>Email (Required): </span></td>
543
- </tr>
544
- <tr>
545
- <td><input type='text' name='email' value='' /></td>
546
- </tr>
547
- <tr>
548
- <td align='left'><span style='font-weight:bold;';>URL To Quiz (Not Required): </span></td>
549
- </tr>
550
- <tr>
551
- <td><input type='text' name='quiz_url' value='' /></td>
552
- </tr>
553
- <tr>
554
- <td align='left'><span style='font-weight:bold;';>Message (Required): </span></td>
555
- </tr>
556
- <tr>
557
- <td align='left'><TEXTAREA NAME="message" COLS=40 ROWS=6></TEXTAREA></td>
558
- </tr>
559
- <tr>
560
- <td align='left'><input type='submit' class="button-primary" value='Send Email' /></td>
561
- </tr>
562
- <tr>
563
- <td align='left'></td>
564
- </tr>
565
- </table>
566
- </form>
567
- <p>Disclaimer: In order to better assist you, this form will also send some useful information about your WordPress installation such as version of plugin, version of WordPress, and website url along with your message.</p>
568
- </div>
569
- <?php
570
- }
571
-
572
- function mlw_dashboard_box_eight()
573
- {
574
- ?>
575
- <div>
576
- <table width='100%'>
577
- <tr>
578
- <td align='left'>
579
- Quiz Master Next is and always will be a free plugin. I have spent a lot of time and effort developing and maintaining this plugin. If it has been beneficial to your site, please consider supporting this plugin by making a donation.
580
- </td>
581
- </tr>
582
- <tr>
583
- <td>&nbsp;</td>
584
- </tr>
585
- <tr>
586
- <td></td>
587
- </tr>
588
- <tr>
589
- <td>&nbsp;</td>
590
- </tr>
591
- <tr>
592
- <td>
593
- <div class="donation">
594
- <p>
595
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
596
- <input type="hidden" name="cmd" value="_s-xclick">
597
- <input type="hidden" name="hosted_button_id" value="RTGYAETX36ZQJ">
598
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
599
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
600
- </form>
601
- </p>
602
- </div>
603
- </td>
604
- </tr>
605
- </table>
606
- <p>Thank you to those who have contributed so far!</p>
607
- </div>
608
- <?php
609
- }
610
- function mlw_dashboard_box_nine()
611
- {
612
- ?>
613
- <div>
614
- <table width='100%'>
615
- <tr>
616
- <td align='left'><iframe src="http://www.mylocalwebstop.com/mlw_news.html?cache=<?php echo rand(); ?>" seamless="seamless" style="width: 100%; height: 550px;"></iframe></td>
617
- </tr>
618
- </table>
619
- </div>
620
- <?php
621
- }
622
  function mlw_qmn_weekly_percent_taken_widget()
623
  {
624
  global $wpdb;
@@ -812,4 +564,4 @@ function mlw_qmn_quaterly_percent_taken_widget()
812
  </div>
813
  <?php
814
  }
815
- ?>
6
  Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
7
  */
8
 
9
+ function mlw_generate_quiz_dashboard()
10
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  //Page Variables
12
  $mlw_quiz_version = get_option('mlw_quiz_master_version');
13
 
 
14
  ///Creates the widgets
15
  add_meta_box("wpss_mrts", 'Quiz Daily Stats - Times Taken', "mlw_dashboard_box", "quiz_wpss");
16
  add_meta_box("wpss_mrts", 'Quiz Total Stats', "mlw_dashboard_box_three", "quiz_wpss3");
17
  add_meta_box("wpss_mrts", 'Quiz Weekly Stats - Times Taken', "mlw_dashboard_box_four", "quiz_wpss4");
18
  add_meta_box("wpss_mrts", 'Quiz Monthly Stats - Times Taken', "mlw_dashboard_box_five", "quiz_wpss5");
 
19
  if ( get_option('mlw_advert_shows') == 'true' )
20
  {
21
  add_meta_box("wpss_mrts", 'My Local Webstop Services', "mlw_dashboard_box_six", "quiz_wpss6");
 
22
  }
 
23
  add_meta_box("wpss_mrts", 'Quizzes Taken Today', "mlw_qmn_daily_percent_taken_widget", "quiz_wpss10");
24
  add_meta_box("wpss_mrts", 'Quizzes Taken Last 7 Days', "mlw_qmn_weekly_percent_taken_widget", "quiz_wpss11");
25
  add_meta_box("wpss_mrts", 'Quizzes Taken Last 30 Days', "mlw_qmn_monthly_percent_taken_widget", "quiz_wpss12");
31
  <?php
32
  wp_enqueue_script( 'jquery' );
33
  wp_enqueue_script( 'jquery-ui-core' );
 
34
  wp_enqueue_script( 'jquery-ui-button' );
35
  wp_enqueue_script( 'jquery-ui-tooltip' );
 
 
36
  ?>
37
  <script type="text/javascript" src="<?php echo plugin_dir_url( __FILE__ ); ?>jquery_sparkline.js"></script>
38
  <script type="text/javascript">
40
  // increase the default animation speed to exaggerate the effect
41
  $j.fx.speeds._default = 1000;
42
  $j(function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  $j(function() {
44
  $j( document ).tooltip();
45
  });
48
  $j('.inlinesparkline').sparkline('html', {type: 'line', width: '400', height: '200'});
49
  });
50
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  <div class="wrap">
52
+ <h2>Quiz Master Next Version <?php echo $mlw_quiz_version; ?> Statistics</h2>
53
 
54
  <?php echo mlw_qmn_show_adverts(); ?>
55
  <!--Display Widget Boxes-->
92
  </div>
93
 
94
  <div style="clear:both">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  </div>
96
  <?php
97
  }
371
  </div>
372
  <?php
373
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  function mlw_qmn_weekly_percent_taken_widget()
375
  {
376
  global $wpdb;
564
  </div>
565
  <?php
566
  }
567
+ ?>
includes/mlw_help.php CHANGED
@@ -8,70 +8,202 @@ Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
8
 
9
  function mlw_generate_help_page()
10
  {
 
 
 
 
11
  ?>
12
- <!-- css -->
13
- <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
14
- <!-- jquery scripts -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  <?php
16
- wp_enqueue_script( 'jquery' );
17
- wp_enqueue_script( 'jquery-ui-core' );
18
- wp_enqueue_script( 'jquery-ui-dialog' );
19
- wp_enqueue_script( 'jquery-ui-button' );
20
- wp_enqueue_script( 'jquery-ui-accordion' );
21
- wp_enqueue_script( 'jquery-effects-blind' );
22
- wp_enqueue_script( 'jquery-effects-explode' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  ?>
24
- <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
25
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>-->
26
- <script type="text/javascript">
27
- var $j = jQuery.noConflict();
28
- // increase the default animation speed to exaggerate the effect
29
- $j.fx.speeds._default = 1000;
30
- $j(function() {
31
- $j('#dialog').dialog({
32
- autoOpen: false,
33
- show: 'blind',
34
- hide: 'explode',
35
- buttons: {
36
- Ok: function() {
37
- $j(this).dialog('close');
38
- }
39
- }
40
- });
41
-
42
- $j('#opener').click(function() {
43
- $j('#dialog').dialog('open');
44
  return false;
45
- } );
46
- });
47
- $j(function() {
48
- $j("button").button();
49
- });
50
- </script>
51
- <style>
52
- label {
53
- display: inline-block;
54
- width: 5em;
55
- }
56
- </style>
57
- <style type="text/css">
58
- div.mlw_quiz_options input[type='text'] {
59
- border-color:#000000;
60
- color:#3300CC;
61
- cursor:hand;
 
 
 
 
62
  }
63
- </style>
64
- <div class="wrap">
65
- <div class='mlw_quiz_options'>
66
- <h2>How-To<a id="opener" href="">(?)</a></h2>
67
- Please visit our new <a href="http://mylocalwebstop.com/plugin-documentation/" style="color: blue;">Documentation</a> for using this plugin. It is a work in progress, but we will be deleting this page once it is finished.
68
- <br />
69
- <div id="dialog" title="Help">
70
- <h3><b>Help</b></h3>
71
- <p>This page contains numerous how-to's for using the plugin.</p>
72
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  </div>
74
- </div>
75
- <?php
 
 
 
 
76
  }
77
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  function mlw_generate_help_page()
10
  {
11
+ ///Creates the widgets
12
+ add_meta_box("wpss_mrts", 'Plugin Documentation', "qmn_documentation_meta_box_content", "meta_box_help");
13
+ add_meta_box("wpss_mrts", 'Support', "qmn_support_meta_box_content", "meta_box_support");
14
+ add_meta_box("wpss_mrts", 'System Info', "qmn_system_meta_box_content", "meta_box_sys_info");
15
  ?>
16
+ <div class="wrap">
17
+ <h2>QMN Help</h2>
18
+ <?php echo mlw_qmn_show_adverts(); ?>
19
+
20
+ <!--Display Widget Boxes-->
21
+ <div style="float:left; width:50%;" class="inner-sidebar1">
22
+ <?php do_meta_boxes('meta_box_help','advanced',''); ?>
23
+ </div>
24
+
25
+ <div style="float:left; width:50%;" class="inner-sidebar1">
26
+ <?php do_meta_boxes('meta_box_support','advanced',''); ?>
27
+ </div>
28
+
29
+ <div style="float:left; width:100%;" class="inner-sidebar1">
30
+ <?php do_meta_boxes('meta_box_sys_info','advanced',''); ?>
31
+ </div>
32
+
33
+ </div>
34
+ <?php
35
+ }
36
+
37
+ function qmn_documentation_meta_box_content()
38
+ {
39
+ ?>
40
+ <h3>Need help with the plugin? Try any of the following:</h3>
41
+ <ul>
42
+ <li>Visit our <a href="http://mylocalwebstop.com/plugin-documentation/">Documentation</a> for using this plugin</li>
43
+ <li>Fill out the form in the Support widget to send us an email</li>
44
+ <li>Fill out the form on our <a href="http://mylocalwebstop.com/contact-us/">Contact Us Page</a></li>
45
+ <li>Create a topic in the <a href="https://wordpress.org/support/plugin/quiz-master-next">WordPress Support Forums</a></li>
46
+ </ul>
47
  <?php
48
+ }
49
+
50
+ function qmn_support_meta_box_content()
51
+ {
52
+ $quiz_master_email_message = "";
53
+ $mlw_quiz_version = get_option('mlw_quiz_master_version');
54
+ if(isset($_POST["action"]))
55
+ {
56
+ $quiz_master_email_success = $_POST["action"];
57
+ $user_name = $_POST["username"];
58
+ $user_email = $_POST["email"];
59
+ $user_message = $_POST["message"];
60
+ $user_quiz_url = $_POST["quiz_url"];
61
+ $current_user = wp_get_current_user();
62
+ $mlw_site_info = qmn_get_system_info();
63
+ $mlw_site_info = str_replace("<br />", "\n", $mlw_site_info);
64
+ $mlw_site_info = str_replace("<h3>", "\n", $mlw_site_info);
65
+ $mlw_site_info = str_replace("</h3>", "\n", $mlw_site_info);
66
+ if ($quiz_master_email_success == 'update')
67
+ {
68
+ $mlw_message = "Message from ".$user_name." at ".$user_email." It says: \n \n ".$user_message."\n Version: ".$mlw_quiz_version."\n Quiz URL Provided: ".$user_quiz_url."\n User ".$current_user->display_name." from ".$current_user->user_email."\n Wordpress Info: ".$mlw_site_info;
69
+ wp_mail('fpcorso@mylocalwebstop.com' ,'Support From Quiz Master Next Plugin', $mlw_message);
70
+ $quiz_master_email_message = "**Message Sent**";
71
+ }
72
+ }
73
  ?>
74
+ <script>
75
+ function mlw_validateForm()
76
+ {
77
+ var x=document.forms['emailForm']['email'].value;
78
+ if (x==null || x=='')
79
+ {
80
+ document.getElementById('mlw_support_message').innerHTML = '**Email must be filled out!**';
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  return false;
82
+ };
83
+ var x=document.forms['emailForm']['username'].value;
84
+ if (x==null || x=='')
85
+ {
86
+ document.getElementById('mlw_support_message').innerHTML = '**Name must be filled out!**';
87
+ return false;
88
+ };
89
+ var x=document.forms['emailForm']['message'].value;
90
+ if (x==null || x=='')
91
+ {
92
+ document.getElementById('mlw_support_message').innerHTML = '**There must be a message to send!**';
93
+ return false;
94
+ };
95
+ var x=document.forms['emailForm']['email'].value;
96
+ var atpos=x.indexOf('@');
97
+ var dotpos=x.lastIndexOf('.');
98
+ if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
99
+ {
100
+ document.getElementById('mlw_support_message').innerHTML = '**Not a valid e-mail address!**';
101
+ return false;
102
+ }
103
  }
104
+ </script>
105
+ <div class='quiz_email_support'>
106
+ <form action="<?php echo $_SERVER['PHP_SELF']; ?>?page=mlw_quiz_help" method='post' name='emailForm' onsubmit='return mlw_validateForm()'>
107
+ <input type='hidden' name='action' value='update' />
108
+ <table>
109
+ <tr>
110
+ <td>If there is something you would like to suggest to add or even if you just want
111
+ to let me know if you like the plugin or not, feel free to use the email form below.</td>
112
+ </tr>
113
+ <tr>
114
+ <td><span name='mlw_support_message' id='mlw_support_message' style="color: red;"><?php echo $quiz_master_email_message; ?></span></td>
115
+ </tr>
116
+ <tr>
117
+ <td align='left'><span style='font-weight:bold;';>Name (Required): </span></td>
118
+ </tr>
119
+ <tr>
120
+ <td><input type='text' name='username' value='' /></td>
121
+ </tr>
122
+ <tr>
123
+ <td align='left'><span style='font-weight:bold;';>Email (Required): </span></td>
124
+ </tr>
125
+ <tr>
126
+ <td><input type='text' name='email' value='' /></td>
127
+ </tr>
128
+ <tr>
129
+ <td align='left'><span style='font-weight:bold;';>URL To Quiz (Not Required): </span></td>
130
+ </tr>
131
+ <tr>
132
+ <td><input type='text' name='quiz_url' value='' /></td>
133
+ </tr>
134
+ <tr>
135
+ <td align='left'><span style='font-weight:bold;';>Message (Required): </span></td>
136
+ </tr>
137
+ <tr>
138
+ <td align='left'><TEXTAREA NAME="message" COLS=40 ROWS=6></TEXTAREA></td>
139
+ </tr>
140
+ <tr>
141
+ <td align='left'><input type='submit' class="button-primary" value='Send Email' /></td>
142
+ </tr>
143
+ <tr>
144
+ <td align='left'></td>
145
+ </tr>
146
+ </table>
147
+ </form>
148
+ <p>Disclaimer: In order to better assist you, this form will also send the system info from below with your message.</p>
149
  </div>
150
+ <?php
151
+ }
152
+
153
+ function qmn_system_meta_box_content()
154
+ {
155
+ echo qmn_get_system_info();
156
  }
157
+
158
+ function qmn_get_system_info()
159
+ {
160
+ global $wpdb;
161
+ $qmn_sys_info = "";
162
+
163
+ $theme_data = wp_get_theme();
164
+ $theme = $theme_data->Name . ' ' . $theme_data->Version;
165
+
166
+ $qmn_sys_info .= "<h3>Site Information</h3><br />";
167
+ $qmn_sys_info .= "Site URL: ".site_url()."<br />";
168
+ $qmn_sys_info .= "Home URL: ".home_url()."<br />";
169
+ $qmn_sys_info .= "Multisite: ".( is_multisite() ? 'Yes' : 'No' )."<br />";
170
+
171
+ $qmn_sys_info .= "<h3>WordPress Information</h3><br />";
172
+ $qmn_sys_info .= "Version: ".get_bloginfo( 'version' )."<br />";
173
+ $qmn_sys_info .= "Language: ".( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' )."<br />";
174
+ $qmn_sys_info .= "Active Theme: ".$theme."<br />";
175
+ $qmn_sys_info .= "Debug Mode: ".( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' )."<br />";
176
+ $qmn_sys_info .= "Memory Limit: ".WP_MEMORY_LIMIT."<br />";
177
+
178
+ $qmn_sys_info .= "<h3>Plugins Information</h3><br />";
179
+ $qmn_plugin_mu = get_mu_plugins();
180
+ if( count( $qmn_plugin_mu > 0 ) ) {
181
+ $qmn_sys_info .= "<h4>Must Use</h4><br />";
182
+ foreach( $qmn_plugin_mu as $plugin => $plugin_data ) {
183
+ $qmn_sys_info .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "<br />";
184
+ }
185
+ }
186
+ $qmn_sys_info .= "<h4>Active</h4><br />";
187
+ $plugins = get_plugins();
188
+ $active_plugins = get_option( 'active_plugins', array() );
189
+ foreach( $plugins as $plugin_path => $plugin ) {
190
+ if( !in_array( $plugin_path, $active_plugins ) )
191
+ continue;
192
+ $qmn_sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . "<br />";
193
+ }
194
+ $qmn_sys_info .= "<h4>Inactive</h4><br />";
195
+ foreach( $plugins as $plugin_path => $plugin ) {
196
+ if( in_array( $plugin_path, $active_plugins ) )
197
+ continue;
198
+ $qmn_sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . "<br />";
199
+ }
200
+
201
+ $qmn_sys_info .= "<h3>Server Information</h3><br />";
202
+ $qmn_sys_info .= "PHP : ".PHP_VERSION."<br />";
203
+ $qmn_sys_info .= "MySQL : ".$wpdb->db_version()."<br />";
204
+ $qmn_sys_info .= "Webserver : ".$_SERVER['SERVER_SOFTWARE']."<br />";
205
+
206
+ return $qmn_sys_info;
207
+ }
208
+
209
+ ?>
includes/mlw_qmn_credits.php CHANGED
@@ -10,8 +10,6 @@ function mlw_generate_about_page()
10
  {
11
  //Page Variables
12
  $mlw_quiz_version = get_option('mlw_quiz_master_version');
13
-
14
-
15
  ?>
16
  <!-- css -->
17
  <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
@@ -89,15 +87,24 @@ function mlw_generate_about_page()
89
  <div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
90
  <h2 class="nav-tab-wrapper">
91
  <a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
92
- What&#8217;s New In 3.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>
@@ -109,11 +116,15 @@ 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 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;">
@@ -140,6 +151,13 @@ function mlw_generate_about_page()
140
  <li>Set Default Question Type</li>
141
  <li>Show Pop-Up When Clicking Submit</li>
142
  <li>Conditional Continuation To Next Quiz</li>
 
 
 
 
 
 
 
143
  </ul>
144
  </div>
145
  </div>
10
  {
11
  //Page Variables
12
  $mlw_quiz_version = get_option('mlw_quiz_master_version');
 
 
13
  ?>
14
  <!-- css -->
15
  <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
87
  <div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
88
  <h2 class="nav-tab-wrapper">
89
  <a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
90
+ What&#8217;s New In 3.8</a>
91
  <a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
92
  Changelog For <?php echo $mlw_quiz_version; ?> </a>
93
  <a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
94
  Requested Features</a>
95
  </h2>
96
  <div id="mlw_quiz_what_new">
97
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Ability To Send Different Admin Emails Based On Score</h2>
98
+ <p style="text-align: center;">You can now set up different admin emails based on score similarly to the user emails. You can also now customize the admin email's seubject.</p>
99
+ <br />
100
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Dashboard Widget</h2>
101
+ <p style="text-align: center;">We added a new dashboard widget that shows a snapshot of how your quizzes are doing. Includes daily total, most popular quiz, and more.</p>
102
+ <br />
103
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Help Page</h2>
104
+ <p style="text-align: center;">There is now a new page in the menu titled "Help". This page now has the support widget on it and a link to the documentation. We also added a system info widget on this page to better assist when trying to solve errors.</p>
105
+ <br />
106
+ <h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">For Developers:</h2>
107
+ <p style="text-align: center;">We added 4 new hooks in the Quiz Creator class. You can now hook into when a quiz is created, duplicated, deleted, or its name is changed. We also begun work on a few quiz settings helper functions in the class as well.</p>
108
  <br />
109
  <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>
110
  <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>
116
  <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>
117
  </div>
118
  <div id="mlw_quiz_changelog" style="display: none;">
119
+ <h3><?php echo $mlw_quiz_version; ?> (December 17, 2014)</h3>
120
  <ul>
121
+ <li>* Added Ability To Send Different Admin Emails Based On Score</li>
122
+ <li>* Added Ability To Customize Admin Email Subject</li>
123
+ <li>* Added New Dashboard Widget For Quick Snapshot Of Status</li>
124
+ <li>* Added New Help Page With Link To Documentation</li>
125
+ <li>* Create New System Info Widget On Help Page</li>
126
+ <li>* In Code: Added 4 New Hooks Throughout The Quiz Creator Class</li>
127
+ <li>* In Code: Added 3 New Quiz Settings Helper Functions In Quiz Creator Class</li>
128
  </ul>
129
  </div>
130
  <div id="mlw_quiz_requested" style="display: none;">
151
  <li>Set Default Question Type</li>
152
  <li>Show Pop-Up When Clicking Submit</li>
153
  <li>Conditional Continuation To Next Quiz</li>
154
+ <li>Analyse Level Of Difficulty</li>
155
+ <li>Question Bank</li>
156
+ <li>Global Quiz Settings</li>
157
+ <li>Print Quiz</li>
158
+ <li>Easier Media In Questions</li>
159
+ <li>Easier Media In Answers</li>
160
+ <li>Mark Question To Be Reviewed</li>
161
  </ul>
162
  </div>
163
  </div>
includes/mlw_quiz.php CHANGED
@@ -8,6 +8,8 @@ function mlw_quiz_shortcode($atts)
8
  'quiz' => 0
9
  ), $atts));
10
 
 
 
11
  date_default_timezone_set(get_option('timezone_string'));
12
 
13
  /*
@@ -459,23 +461,24 @@ function mlw_quiz_shortcode($atts)
459
  function mlw_validateForm()
460
  {
461
  mlw_validateResult = true;
462
- if (document.forms['quizForm']['mlwUserEmail'].value != '')
463
- {
464
- var x=document.forms['quizForm']['mlwUserEmail'].value;
465
- var atpos=x.indexOf('@');
466
- var dotpos=x.lastIndexOf('.');
467
- if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
468
- {
469
- document.getElementById('mlw_error_message').innerHTML = '**Not a valid e-mail address!**';
470
- document.getElementById('mlw_error_message_bottom').innerHTML = '**Not a valid e-mail address!**';
471
- mlw_validateResult = false;
472
- }
473
- }
474
 
475
  jQuery('#quizForm *').filter(':input').each(function(){
476
  jQuery(this).css("outline", "");
477
  if (jQuery(this).attr('class'))
478
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  if(jQuery(this).attr('class').indexOf('mlwRequiredNumber') > -1 && this.value == "" && +this.value != NaN)
480
  {
481
  document.getElementById('mlw_error_message').innerHTML = '**This field must be a number!**';
@@ -905,6 +908,10 @@ function mlw_quiz_shortcode($atts)
905
  //Display Completion Screen
906
  else
907
  {
 
 
 
 
908
  ?>
909
  <script type="text/javascript">
910
  window.sessionStorage.setItem('mlw_time_quiz<?php echo $mlw_quiz_id; ?>', 'completed');
@@ -1355,17 +1362,80 @@ EOC;
1355
  $mlw_message = "";
1356
  if ($mlw_quiz_options->send_admin_email == "0")
1357
  {
1358
- $mlw_message = htmlspecialchars_decode($mlw_quiz_options->admin_email_template, ENT_QUOTES);
1359
- $mlw_message = apply_filters( 'mlw_qmn_template_variable_results_page', $mlw_message, $mlw_qmn_result_array);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1360
  if ( get_option('mlw_advert_shows') == 'true' ) {$mlw_message .= "<br>This email was generated by the Quiz Master Next script by Frank Corso";}
1361
- $mlw_message = str_replace( "\n" , "<br>", $mlw_message);
1362
- $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
1363
- $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
1364
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
1365
  $mlw_qmn_admin_emails = explode(",", $mlw_quiz_options->admin_email);
1366
  foreach($mlw_qmn_admin_emails as $admin_email)
1367
  {
1368
- wp_mail($admin_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
1369
  }
1370
  }
1371
 
@@ -1445,10 +1515,10 @@ function mlwDisplayContactInfo($mlw_quiz_options)
1445
  }
1446
  if ($mlw_quiz_options->user_email != 2)
1447
  {
1448
- $mlw_contact_class = "class=\"\"";
1449
  if ($mlw_quiz_options->user_email == 1)
1450
  {
1451
- $mlw_contact_class = "class=\"mlwRequiredText\"";
1452
  }
1453
  $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->email_field_text, ENT_QUOTES)."</span><br />";
1454
  $mlw_contact_display .= "<input type='text' $mlw_contact_class x-webkit-speech name='mlwUserEmail' value='".$current_user->user_email."' />";
@@ -1499,10 +1569,10 @@ function mlwDisplayContactInfo($mlw_quiz_options)
1499
  }
1500
  if ($mlw_quiz_options->user_email != 2)
1501
  {
1502
- $mlw_contact_class = "class=\"\"";
1503
  if ($mlw_quiz_options->user_email == 1)
1504
  {
1505
- $mlw_contact_class = "class=\"mlwRequiredText\"";
1506
  }
1507
  $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->email_field_text, ENT_QUOTES)."</span><br />";
1508
  $mlw_contact_display .= "<input type='text' $mlw_contact_class x-webkit-speech name='mlwUserEmail' value='' />";
8
  'quiz' => 0
9
  ), $atts));
10
 
11
+ global $mlwQuizMasterNext;
12
+ $mlwQuizMasterNext->quizCreator->set_id($quiz);
13
  date_default_timezone_set(get_option('timezone_string'));
14
 
15
  /*
461
  function mlw_validateForm()
462
  {
463
  mlw_validateResult = true;
 
 
 
 
 
 
 
 
 
 
 
 
464
 
465
  jQuery('#quizForm *').filter(':input').each(function(){
466
  jQuery(this).css("outline", "");
467
  if (jQuery(this).attr('class'))
468
  {
469
+ if(jQuery(this).attr('class').indexOf('mlwEmail') > -1 && this.value != "")
470
+ {
471
+ var x=this.value;
472
+ var atpos=x.indexOf('@');
473
+ var dotpos=x.lastIndexOf('.');
474
+ if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
475
+ {
476
+ document.getElementById('mlw_error_message').innerHTML = '**Not a valid e-mail address!**';
477
+ document.getElementById('mlw_error_message_bottom').innerHTML = '**Not a valid e-mail address!**';
478
+ mlw_validateResult = false;
479
+ jQuery(this).css("outline", "2px solid red");
480
+ }
481
+ }
482
  if(jQuery(this).attr('class').indexOf('mlwRequiredNumber') > -1 && this.value == "" && +this.value != NaN)
483
  {
484
  document.getElementById('mlw_error_message').innerHTML = '**This field must be a number!**';
908
  //Display Completion Screen
909
  else
910
  {
911
+ $mlw_display .= "<div id='top_of_results'></div>";
912
+ $mlw_display .= "<script>
913
+ window.location.hash='top_of_results';
914
+ </script>";
915
  ?>
916
  <script type="text/javascript">
917
  window.sessionStorage.setItem('mlw_time_quiz<?php echo $mlw_quiz_id; ?>', 'completed');
1362
  $mlw_message = "";
1363
  if ($mlw_quiz_options->send_admin_email == "0")
1364
  {
1365
+ if ($mlw_quiz_options->admin_email != "")
1366
+ {
1367
+ $mlw_message = "";
1368
+ $mlw_subject = "";
1369
+ if (is_serialized($mlw_quiz_options->admin_email_template) && is_array(@unserialize($mlw_quiz_options->admin_email_template)))
1370
+ {
1371
+ $mlw_admin_email_array = @unserialize($mlw_quiz_options->admin_email_template);
1372
+
1373
+ //Cycle through landing pages
1374
+ foreach($mlw_admin_email_array as $mlw_each)
1375
+ {
1376
+
1377
+ //Generate Email Subject
1378
+ if (!isset($mlw_each["subject"]))
1379
+ {
1380
+ $mlw_each["subject"] = "Quiz Results For %QUIZ_NAME";
1381
+ }
1382
+ $mlw_each["subject"] = apply_filters( 'mlw_qmn_template_variable_results_page', $mlw_each["subject"], $mlw_qmn_result_array);
1383
+
1384
+ //Check to see if default
1385
+ if ($mlw_each["begin_score"] == 0 && $mlw_each["end_score"] == 0)
1386
+ {
1387
+ $mlw_message = htmlspecialchars_decode($mlw_each["message"], ENT_QUOTES);
1388
+ $mlw_message = apply_filters( 'mlw_qmn_template_variable_results_page', $mlw_message, $mlw_qmn_result_array);
1389
+ $mlw_message = str_replace( "\n" , "<br>", $mlw_message);
1390
+ $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
1391
+ $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
1392
+ $mlw_subject = $mlw_each["subject"];
1393
+ break;
1394
+ }
1395
+ else
1396
+ {
1397
+ //Check to see if points fall in correct range
1398
+ if ($mlw_quiz_options->system == 1 && $mlw_points >= $mlw_each["begin_score"] && $mlw_points <= $mlw_each["end_score"])
1399
+ {
1400
+ $mlw_message = htmlspecialchars_decode($mlw_each["message"], ENT_QUOTES);
1401
+ $mlw_message = apply_filters( 'mlw_qmn_template_variable_results_page', $mlw_message, $mlw_qmn_result_array);
1402
+ $mlw_message = str_replace( "\n" , "<br>", $mlw_message);
1403
+ $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
1404
+ $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
1405
+ $mlw_subject = $mlw_each["subject"];
1406
+ break;
1407
+ }
1408
+
1409
+ //Check to see if score fall in correct range
1410
+ if ($mlw_quiz_options->system == 0 && $mlw_total_score >= $mlw_each["begin_score"] && $mlw_total_score <= $mlw_each["end_score"])
1411
+ {
1412
+ $mlw_message = htmlspecialchars_decode($mlw_each["message"], ENT_QUOTES);
1413
+ $mlw_message = apply_filters( 'mlw_qmn_template_variable_results_page', $mlw_message, $mlw_qmn_result_array);
1414
+ $mlw_message = str_replace( "\n" , "<br>", $mlw_message);
1415
+ $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
1416
+ $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
1417
+ $mlw_subject = $mlw_each["subject"];
1418
+ break;
1419
+ }
1420
+ }
1421
+ }
1422
+ }
1423
+ else
1424
+ {
1425
+ $mlw_message = htmlspecialchars_decode($mlw_quiz_options->admin_email_template, ENT_QUOTES);
1426
+ $mlw_message = apply_filters( 'mlw_qmn_template_variable_results_page', $mlw_message, $mlw_qmn_result_array);
1427
+ $mlw_message = str_replace( "\n" , "<br>", $mlw_message);
1428
+ $mlw_message = str_replace( "<br/>" , "<br>", $mlw_message);
1429
+ $mlw_message = str_replace( "<br />" , "<br>", $mlw_message);
1430
+ $mlw_subject = "Quiz Results For ".$mlw_quiz_options->quiz_name;
1431
+ }
1432
+ }
1433
  if ( get_option('mlw_advert_shows') == 'true' ) {$mlw_message .= "<br>This email was generated by the Quiz Master Next script by Frank Corso";}
 
 
 
1434
  $mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
1435
  $mlw_qmn_admin_emails = explode(",", $mlw_quiz_options->admin_email);
1436
  foreach($mlw_qmn_admin_emails as $admin_email)
1437
  {
1438
+ wp_mail($admin_email, $mlw_subject, $mlw_message, $mlw_headers);
1439
  }
1440
  }
1441
 
1515
  }
1516
  if ($mlw_quiz_options->user_email != 2)
1517
  {
1518
+ $mlw_contact_class = "class=\"mlwEmail\"";
1519
  if ($mlw_quiz_options->user_email == 1)
1520
  {
1521
+ $mlw_contact_class = "class=\"mlwEmail mlwRequiredText\"";
1522
  }
1523
  $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->email_field_text, ENT_QUOTES)."</span><br />";
1524
  $mlw_contact_display .= "<input type='text' $mlw_contact_class x-webkit-speech name='mlwUserEmail' value='".$current_user->user_email."' />";
1569
  }
1570
  if ($mlw_quiz_options->user_email != 2)
1571
  {
1572
+ $mlw_contact_class = "class=\"mlwEmail\"";
1573
  if ($mlw_quiz_options->user_email == 1)
1574
  {
1575
+ $mlw_contact_class = "class=\"mlwEmail mlwRequiredText\"";
1576
  }
1577
  $mlw_contact_display .= "<span style='font-weight:bold;';>".htmlspecialchars_decode($mlw_quiz_options->email_field_text, ENT_QUOTES)."</span><br />";
1578
  $mlw_contact_display .= "<input type='text' $mlw_contact_class x-webkit-speech name='mlwUserEmail' value='' />";
includes/mlw_quiz_admin.php CHANGED
@@ -77,8 +77,6 @@ function mlw_generate_quiz_admin()
77
  wp_enqueue_script( 'jquery-effects-blind' );
78
  wp_enqueue_script( 'jquery-effects-explode' );
79
  ?>
80
- <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
81
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>-->
82
  <script type="text/javascript">
83
  var $j = jQuery.noConflict();
84
  // increase the default animation speed to exaggerate the effect
@@ -180,95 +178,101 @@ function mlw_generate_quiz_admin()
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>
186
- <span class="pagination-links">
187
- <?php
188
- $mlw_qmn_previous_page = 0;
189
- $mlw_current_page = $mlw_qmn_quiz_page+1;
190
- $mlw_total_pages = ceil($mlw_qmn_quiz_count/$mlw_qmn_table_limit);
191
- if( $mlw_qmn_quiz_page > 0 )
192
- {
193
- $mlw_qmn_previous_page = $mlw_qmn_quiz_page - 2;
194
- echo "<a class=\"prev-page\" title=\"Go to the previous page\" href=\"?page=mlw_quiz_admin&&mlw_quiz_page=$mlw_qmn_previous_page\"><</a>";
195
- echo "<span class=\"paging-input\">$mlw_current_page of $mlw_total_pages</span>";
196
- if( $mlw_qmn_quiz_left > $mlw_qmn_table_limit )
197
- {
198
- echo "<a class=\"next-page\" title=\"Go to the next page\" href=\"?page=mlw_quiz_admin&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
199
- }
200
- else
201
  {
202
- echo "<a class=\"next-page disabled\" title=\"Go to the next page\" href=\"?page=mlw_quiz_admin&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
203
- }
204
- }
205
- else if( $mlw_qmn_quiz_page == 0 )
206
- {
207
- if( $mlw_qmn_quiz_left > $mlw_qmn_table_limit )
208
- {
209
- echo "<a class=\"prev-page disabled\" title=\"Go to the previous page\" href=\"?page=mlw_quiz_admin&&mlw_quiz_page=$mlw_qmn_previous_page\"><</a>";
210
  echo "<span class=\"paging-input\">$mlw_current_page of $mlw_total_pages</span>";
211
- echo "<a class=\"next-page\" title=\"Go to the next page\" href=\"?page=mlw_quiz_admin&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
212
- }
213
- }
214
- else if( $mlw_qmn_quiz_left < $mlw_qmn_table_limit )
215
- {
216
- $mlw_qmn_previous_page = $mlw_qmn_quiz_page - 2;
217
- echo "<a class=\"prev-page\" title=\"Go to the previous page\" href=\"?page=mlw_quiz_admin&&mlw_quiz_page=$mlw_qmn_previous_page\"><</a>";
218
- echo "<span class=\"paging-input\">$mlw_current_page of $mlw_total_pages</span>";
219
- echo "<a class=\"next-page disabled\" title=\"Go to the next page\" href=\"?page=mlw_quiz_admin&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
220
- }
221
- ?>
222
- </span>
223
- <br class="clear">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  </div>
226
- <?php
227
- $quotes_list = "";
228
- $display = "";
229
- $alternate = "";
230
- foreach($mlw_quiz_data as $mlw_quiz_info) {
231
- if($alternate) $alternate = "";
232
- else $alternate = " class=\"alternate\"";
233
- $quotes_list .= "<tr{$alternate}>";
234
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_id . "</span></td>";
235
- $quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . esc_html($mlw_quiz_info->quiz_name) ." </span><span style='color:green;font-size:12px;'><a onclick=\"editQuizName('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='javascript:();'>(Edit Name)</a></span>";
236
- $quotes_list .= "<div class=\"row-actions\"><a class='linkOptions' href='admin.php?page=mlw_quiz_options&&quiz_id=".$mlw_quiz_info->quiz_id."'>Edit</a> | <a class='linkOptions' href='admin.php?page=mlw_quiz_results&&quiz_id=".$mlw_quiz_info->quiz_id."'>Results</a> | <a href='javascript:();' class='linkOptions' onclick=\"duplicateQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\">Duplicate</a> | <a class='linkOptions linkDelete' onclick=\"deleteQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='javascript:();'>Delete</a></div></td>";
237
- $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
238
- $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster_leaderboard mlw_quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
239
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_views . "</span></td>";
240
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_taken ."</span></td>";
241
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->last_activity ."</span></td>";
242
- $quotes_list .= "</tr>";
243
- }
244
-
245
-
246
-
247
- $display .= "<br />";
248
-
249
- $display .= "<table class=\"widefat\">";
250
- $display .= "<thead><tr>
251
- <th>Quiz ID</th>
252
- <th>Quiz Name</th>
253
- <th>Quiz Shortcode</th>
254
- <th>Leaderboard Shortcode</th>
255
- <th>Quiz Views</th>
256
- <th>Quiz Taken</th>
257
- <th>Last Modified</th>
258
- </tr></thead>";
259
- $display .= "<tbody id=\"the-list\">{$quotes_list}</tbody>";
260
- $display .= "<tfoot><tr>
261
- <th>Quiz ID</th>
262
- <th>Quiz Name</th>
263
- <th>Quiz Shortcode</th>
264
- <th>Leaderboard Shortcode</th>
265
- <th>Quiz Views</th>
266
- <th>Quiz Taken</th>
267
- <th>Last Modified</th>
268
- </tr></tfoot>";
269
- $display .= "</table>";
270
- echo $display;
271
- ?>
272
  <?php echo mlw_qmn_show_adverts(); ?>
273
  <!--Dialogs-->
274
 
77
  wp_enqueue_script( 'jquery-effects-blind' );
78
  wp_enqueue_script( 'jquery-effects-explode' );
79
  ?>
 
 
80
  <script type="text/javascript">
81
  var $j = jQuery.noConflict();
82
  // increase the default animation speed to exaggerate the effect
178
  <div class='mlw_quiz_options'>
179
  <h2>Quizzes<a id="new_quiz_button" href="javascript:();" class="add-new-h2">Add New</a></h2>
180
  <?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
181
+ <div style="width: 85%; float: left;">
182
+ <div class="tablenav top">
183
+ <div class="tablenav-pages">
184
+ <span class="displaying-num"><?php echo $mlw_qmn_quiz_count; ?> quizzes</span>
185
+ <span class="pagination-links">
186
+ <?php
187
+ $mlw_qmn_previous_page = 0;
188
+ $mlw_current_page = $mlw_qmn_quiz_page+1;
189
+ $mlw_total_pages = ceil($mlw_qmn_quiz_count/$mlw_qmn_table_limit);
190
+ if( $mlw_qmn_quiz_page > 0 )
 
 
 
 
 
 
 
 
191
  {
192
+ $mlw_qmn_previous_page = $mlw_qmn_quiz_page - 2;
193
+ echo "<a class=\"prev-page\" title=\"Go to the previous page\" href=\"?page=quiz-master-next/mlw_quizmaster2.php&&mlw_quiz_page=$mlw_qmn_previous_page\"><</a>";
 
 
 
 
 
 
194
  echo "<span class=\"paging-input\">$mlw_current_page of $mlw_total_pages</span>";
195
+ if( $mlw_qmn_quiz_left > $mlw_qmn_table_limit )
196
+ {
197
+ echo "<a class=\"next-page\" title=\"Go to the next page\" href=\"?page=quiz-master-next/mlw_quizmaster2.php&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
198
+ }
199
+ else
200
+ {
201
+ echo "<a class=\"next-page disabled\" title=\"Go to the next page\" href=\"?page=quiz-master-next/mlw_quizmaster2.php&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
202
+ }
203
+ }
204
+ else if( $mlw_qmn_quiz_page == 0 )
205
+ {
206
+ if( $mlw_qmn_quiz_left > $mlw_qmn_table_limit )
207
+ {
208
+ echo "<a class=\"prev-page disabled\" title=\"Go to the previous page\" href=\"?page=quiz-master-next/mlw_quizmaster2.php&&mlw_quiz_page=$mlw_qmn_previous_page\"><</a>";
209
+ echo "<span class=\"paging-input\">$mlw_current_page of $mlw_total_pages</span>";
210
+ echo "<a class=\"next-page\" title=\"Go to the next page\" href=\"?page=quiz-master-next/mlw_quizmaster2.php&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
211
+ }
212
+ }
213
+ else if( $mlw_qmn_quiz_left < $mlw_qmn_table_limit )
214
+ {
215
+ $mlw_qmn_previous_page = $mlw_qmn_quiz_page - 2;
216
+ echo "<a class=\"prev-page\" title=\"Go to the previous page\" href=\"?page=quiz-master-next/mlw_quizmaster2.php&&mlw_quiz_page=$mlw_qmn_previous_page\"><</a>";
217
+ echo "<span class=\"paging-input\">$mlw_current_page of $mlw_total_pages</span>";
218
+ echo "<a class=\"next-page disabled\" title=\"Go to the next page\" href=\"?page=quiz-master-next/mlw_quizmaster2.php&&mlw_quiz_page=$mlw_qmn_quiz_page\">></a>";
219
+ }
220
+ ?>
221
+ </span>
222
+ <br class="clear">
223
+ </div>
224
  </div>
225
+ <table class="widefat">
226
+ <thead>
227
+ <tr>
228
+ <th>Quiz ID</th>
229
+ <th>Quiz Name</th>
230
+ <th>Quiz Shortcode</th>
231
+ <th>Leaderboard Shortcode</th>
232
+ <th>Quiz Views</th>
233
+ <th>Quiz Taken</th>
234
+ <th>Last Modified</th>
235
+ </tr>
236
+ </thead>
237
+ <tbody id="the-list">
238
+ <?php
239
+ $quotes_list = "";
240
+ $display = "";
241
+ $alternate = "";
242
+ foreach($mlw_quiz_data as $mlw_quiz_info) {
243
+ if($alternate) $alternate = "";
244
+ else $alternate = " class=\"alternate\"";
245
+ $quotes_list .= "<tr{$alternate}>";
246
+ $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_id . "</span></td>";
247
+ $quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . esc_html($mlw_quiz_info->quiz_name) ." </span><span style='color:green;font-size:12px;'><a onclick=\"editQuizName('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='javascript:();'>(Edit Name)</a></span>";
248
+ $quotes_list .= "<div class=\"row-actions\"><a class='linkOptions' href='admin.php?page=mlw_quiz_options&&quiz_id=".$mlw_quiz_info->quiz_id."'>Edit</a> | <a class='linkOptions' href='admin.php?page=mlw_quiz_results&&quiz_id=".$mlw_quiz_info->quiz_id."'>Results</a> | <a href='javascript:();' class='linkOptions' onclick=\"duplicateQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\">Duplicate</a> | <a class='linkOptions linkDelete' onclick=\"deleteQuiz('".$mlw_quiz_info->quiz_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='javascript:();'>Delete</a></div></td>";
249
+ $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
250
+ $quotes_list .= "<td><span style='font-size:16px;'>[mlw_quizmaster_leaderboard mlw_quiz=".$mlw_quiz_info->quiz_id."]</span></td>";
251
+ $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_views . "</span></td>";
252
+ $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_taken ."</span></td>";
253
+ $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->last_activity ."</span></td>";
254
+ $quotes_list .= "</tr>";
255
+ }
256
+ echo $quotes_list; ?>
257
+ </tbody>
258
+ <tfoot>
259
+ <tr>
260
+ <th>Quiz ID</th>
261
+ <th>Quiz Name</th>
262
+ <th>Quiz Shortcode</th>
263
+ <th>Leaderboard Shortcode</th>
264
+ <th>Quiz Views</th>
265
+ <th>Quiz Taken</th>
266
+ <th>Last Modified</th>
267
+ </tr>
268
+ </tfoot>
269
+ </table>
270
  </div>
271
+ <div style="width: 15%; float:right;">
272
+ <h3 style="text-align: center;">My Local Webstop News</h3>
273
+ <iframe src="http://www.mylocalwebstop.com/mlw_news.html?cache=<?php echo rand(); ?>" seamless="seamless" style="width: 100%; height: 550px;"></iframe>
274
+ </div>
275
+ <div style="clear: both;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  <?php echo mlw_qmn_show_adverts(); ?>
277
  <!--Dialogs-->
278
 
includes/mlw_quiz_creator.php CHANGED
@@ -31,6 +31,120 @@ class QMNQuizCreator
31
  }
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  /**
35
  * Creates a new quiz with the default settings
36
  *
@@ -218,6 +332,7 @@ class QMNQuizCreator
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
  /**
@@ -270,6 +385,7 @@ class QMNQuizCreator
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
  /**
@@ -311,6 +427,7 @@ class QMNQuizCreator
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
  /**
@@ -521,6 +638,7 @@ class QMNQuizCreator
521
  }
522
  }
523
  }
 
524
  }
525
  }
526
  ?>
31
  }
32
  }
33
 
34
+ /**
35
+ * Sets quiz ID
36
+ *
37
+ * @since 3.8.1
38
+ * @access public
39
+ * @return void
40
+ */
41
+ public function set_id($quiz_id)
42
+ {
43
+ $this->quiz_id = intval($quiz_id);
44
+ }
45
+
46
+ /**
47
+ * Retrieves setting store in quiz_settings
48
+ *
49
+ * @since 3.8.1
50
+ * @access public
51
+ * @return string The value of the setting
52
+ */
53
+ public function get_setting($setting_name)
54
+ {
55
+ global $wpdb;
56
+ $qmn_settings_array = '';
57
+ $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id ) );
58
+ if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings)))
59
+ {
60
+ $qmn_settings_array = @unserialize($qmn_quiz_settings);
61
+ }
62
+ if (is_array($qmn_settings_array) && isset($qmn_settings_array[$setting_name]))
63
+ {
64
+ return $qmn_settings_array[$setting_name];
65
+ }
66
+ else
67
+ {
68
+ return '';
69
+ }
70
+
71
+ }
72
+
73
+ /**
74
+ * Updates setting stored in quiz_settings
75
+ *
76
+ * @since 3.8.1
77
+ * @access public
78
+ * @return bool True if update was successful
79
+ */
80
+ public function update_setting($setting_name, $setting_value)
81
+ {
82
+ global $wpdb;
83
+ $qmn_settings_array = array();
84
+ $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id ) );
85
+ if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings)))
86
+ {
87
+ $qmn_settings_array = @unserialize($qmn_quiz_settings);
88
+ }
89
+ $qmn_settings_array[$setting_name] = $setting_value;
90
+ $qmn_serialized_array = serialize($qmn_settings_array);
91
+ $results = $wpdb->update(
92
+ $wpdb->prefix . "mlw_quizzes",
93
+ array(
94
+ 'quiz_settings' => $qmn_serialized_array
95
+ ),
96
+ array( 'quiz_id' => $this->quiz_id ),
97
+ array(
98
+ '%s'
99
+ ),
100
+ array( '%d' )
101
+ );
102
+ if ($results != false)
103
+ {
104
+ return true;
105
+ }
106
+ else
107
+ {
108
+ return false;
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Deletes setting stored in quiz_settings
114
+ *
115
+ * @since 3.8.1
116
+ * @access public
117
+ * @return void
118
+ */
119
+ public function delete_setting($setting_name)
120
+ {
121
+ global $wpdb;
122
+ $qmn_settings_array = array();
123
+ $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id ) );
124
+ if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings)))
125
+ {
126
+ $qmn_settings_array = @unserialize($qmn_quiz_settings);
127
+ }
128
+ if (is_array($qmn_settings_array) && isset($qmn_settings_array[$setting_name]))
129
+ {
130
+ unset($qmn_settings_array[$setting_name]);
131
+ }
132
+ $qmn_serialized_array = serialize($qmn_settings_array);
133
+ $results = $wpdb->update(
134
+ $wpdb->prefix . "mlw_quizzes",
135
+ array(
136
+ 'quiz_settings' => $qmn_serialized_array
137
+ ),
138
+ array( 'quiz_id' => $this->quiz_id ),
139
+ array(
140
+ '%s'
141
+ ),
142
+ array( '%d' )
143
+ );
144
+ }
145
+
146
+
147
+
148
  /**
149
  * Creates a new quiz with the default settings
150
  *
332
  {
333
  $mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0001.', 'error');
334
  }
335
+ do_action('qmn_quiz_created', $wpdb->insert_id);
336
  }
337
 
338
  /**
385
  {
386
  $mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0002.', 'error');
387
  }
388
+ do_action('qmn_quiz_deleted', $quiz_id);
389
  }
390
 
391
  /**
427
  {
428
  $mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0003.', 'error');
429
  }
430
+ do_action('qmn_quiz_name_edited', $quiz_id);
431
  }
432
 
433
  /**
638
  }
639
  }
640
  }
641
+ do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
642
  }
643
  }
644
  ?>
includes/mlw_quiz_options.php CHANGED
@@ -1727,7 +1727,7 @@ function mlw_options_emails_tab_content()
1727
  array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
1728
  $mlw_qmn_email_array = serialize($mlw_qmn_email_array);
1729
  }
1730
- //Update message_after with new array then check to see if worked
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
  {
@@ -1748,13 +1748,72 @@ function mlw_options_emails_tab_content()
1748
  }
1749
  }
1750
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1751
  //Check to save email templates
1752
  if (isset($_POST["mlw_save_email_template"]) && $_POST["mlw_save_email_template"] == "confirmation")
1753
  {
1754
  //Function Variables
1755
  $mlw_qmn_email_id = intval($_POST["mlw_email_quiz_id"]);
1756
  $mlw_qmn_email_template_total = intval($_POST["mlw_email_template_total"]);
1757
- $mlw_qmn_admin_email = htmlspecialchars(stripslashes($_POST["mlw_quiz_admin_email_template"]), ENT_QUOTES);
1758
 
1759
  //Create new array
1760
  $i = 1;
@@ -1768,8 +1827,27 @@ function mlw_options_emails_tab_content()
1768
  }
1769
  $i++;
1770
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1771
  $mlw_qmn_new_email_array = serialize($mlw_qmn_new_email_array);
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');
@@ -1795,7 +1873,7 @@ function mlw_options_emails_tab_content()
1795
  $mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
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);
@@ -1804,17 +1882,27 @@ function mlw_options_emails_tab_content()
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
 
1814
  <div id="tabs-9" class="mlw_tab_content">
1815
  <script>
1816
  $j(function() {
1817
- $j("#new_email_button_top, #new_email_button_bottom").button();
1818
  });
1819
  jQuery(function() {
1820
  jQuery("#email_accordion").accordion({
@@ -1826,6 +1914,11 @@ function mlw_options_emails_tab_content()
1826
  document.getElementById('user_email_'+id).value = "Delete";
1827
  document.mlw_quiz_save_email_form.submit();
1828
  }
 
 
 
 
 
1829
  </script>
1830
  <h3>Template Variables</h3>
1831
  <table class="form-table">
@@ -1867,6 +1960,10 @@ function mlw_options_emails_tab_content()
1867
  <input type='hidden' name='mlw_add_email_page' value='confirmation' />
1868
  <input type='hidden' name='mlw_add_email_quiz_id' value='<?php echo $quiz_id; ?>' />
1869
  </form>
 
 
 
 
1870
  <button id="save_email_button" onclick="javascript: document.mlw_quiz_save_email_form.submit();">Save Email Templates</button>
1871
  <form method="post" action="" name="mlw_quiz_save_email_form">
1872
  <div id="email_accordion">
@@ -1957,31 +2054,86 @@ function mlw_options_emails_tab_content()
1957
  </div>
1958
  <h3><a href="#">Email Sent To Admin</a></h3>
1959
  <div>
1960
- <table class="form-table">
1961
- <tr>
1962
- <td width="30%">
1963
- <strong>Email sent to admin after completion (If turned on in options)</strong>
1964
- <br />
1965
- <p>Allowed Variables: </p>
1966
- <p style="margin: 2px 0">- %POINT_SCORE%</p>
1967
- <p style="margin: 2px 0">- %AVERAGE_POINT%</p>
1968
- <p style="margin: 2px 0">- %AMOUNT_CORRECT%</p>
1969
- <p style="margin: 2px 0">- %TOTAL_QUESTIONS%</p>
1970
- <p style="margin: 2px 0">- %CORRECT_SCORE%</p>
1971
- <p style="margin: 2px 0">- %USER_NAME%</p>
1972
- <p style="margin: 2px 0">- %USER_BUSINESS%</p>
1973
- <p style="margin: 2px 0">- %USER_PHONE%</p>
1974
- <p style="margin: 2px 0">- %USER_EMAIL%</p>
1975
- <p style="margin: 2px 0">- %QUIZ_NAME%</p>
1976
- <p style="margin: 2px 0">- %COMMENT_SECTION%</p>
1977
- <p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
1978
- <p style="margin: 2px 0">- %TIMER%</p>
1979
- <p style="margin: 2px 0">- %CURRENT_DATE%</p>
1980
- </td>
1981
- <td><textarea cols="80" rows="15" id="mlw_quiz_admin_email_template" name="mlw_quiz_admin_email_template"><?php echo $mlw_quiz_options->admin_email_template; ?></textarea>
1982
- </td>
1983
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1984
  </table>
 
 
1985
  </div>
1986
  </div>
1987
  </form>
1727
  array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
1728
  $mlw_qmn_email_array = serialize($mlw_qmn_email_array);
1729
  }
1730
+ //Update email template with new array then check to see if worked
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
  {
1748
  }
1749
  }
1750
 
1751
+ //Check to add new admin email template
1752
+ if (isset($_POST["mlw_add_admin_email_page"]) && $_POST["mlw_add_admin_email_page"] == "confirmation")
1753
+ {
1754
+ //Function variables
1755
+ $mlw_qmn_add_email_id = intval($_POST["mlw_add_admin_email_quiz_id"]);
1756
+ $mlw_qmn_admin_email = $wpdb->get_var( $wpdb->prepare( "SELECT admin_email_template FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_qmn_add_email_id ) );
1757
+
1758
+ //Load user email and check if it is array already. If not, turn it into one
1759
+ if (is_serialized($mlw_qmn_admin_email) && is_array(@unserialize($mlw_qmn_admin_email)))
1760
+ {
1761
+ $mlw_qmn_email_array = @unserialize($mlw_qmn_admin_email);
1762
+ $mlw_new_landing_array = array(
1763
+ "begin_score" => 0,
1764
+ "end_score" => 100,
1765
+ "message" => 'Enter Your Text Here',
1766
+ "subject" => 'Quiz Results For %QUIZ_NAME%'
1767
+ );
1768
+ array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
1769
+ $mlw_qmn_email_array = serialize($mlw_qmn_email_array);
1770
+
1771
+ }
1772
+ else
1773
+ {
1774
+ $mlw_qmn_email_array = array(array(
1775
+ "begin_score" => 0,
1776
+ "end_score" => 0,
1777
+ "message" => $mlw_qmn_admin_email,
1778
+ "subject" => 'Quiz Results For %QUIZ_NAME%'
1779
+ ));
1780
+ $mlw_new_landing_array = array(
1781
+ "begin_score" => 0,
1782
+ "end_score" => 100,
1783
+ "message" => 'Enter Your Text Here',
1784
+ "subject" => 'Quiz Results For %QUIZ_NAME%'
1785
+ );
1786
+ array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
1787
+ $mlw_qmn_email_array = serialize($mlw_qmn_email_array);
1788
+ }
1789
+ //Update email template with new array then check to see if worked
1790
+ $mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET admin_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 ) );
1791
+ if ($mlw_new_email_results != false)
1792
+ {
1793
+ $mlwQuizMasterNext->alertManager->newAlert('The email has been added successfully.', 'success');
1794
+
1795
+ //Insert Action Into Audit Trail
1796
+ global $current_user;
1797
+ get_currentuserinfo();
1798
+ $table_name = $wpdb->prefix . "mlw_qm_audit_trail";
1799
+ $insert = "INSERT INTO " . $table_name .
1800
+ "(trail_id, action_user, action, time) " .
1801
+ "VALUES (NULL , '" . $current_user->display_name . "' , 'New Admin Email Has Been Created For Quiz Number ".$mlw_qmn_add_email_id."' , '" . date("h:i:s A m/d/Y") . "')";
1802
+ $results = $wpdb->query( $insert );
1803
+ }
1804
+ else
1805
+ {
1806
+ $mlwQuizMasterNext->alertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0016.', 'error');
1807
+ }
1808
+ }
1809
+
1810
  //Check to save email templates
1811
  if (isset($_POST["mlw_save_email_template"]) && $_POST["mlw_save_email_template"] == "confirmation")
1812
  {
1813
  //Function Variables
1814
  $mlw_qmn_email_id = intval($_POST["mlw_email_quiz_id"]);
1815
  $mlw_qmn_email_template_total = intval($_POST["mlw_email_template_total"]);
1816
+ $mlw_qmn_email_admin_total = intval($_POST["mlw_email_admin_total"]);
1817
 
1818
  //Create new array
1819
  $i = 1;
1827
  }
1828
  $i++;
1829
  }
1830
+
1831
+ //Create new array
1832
+ $i = 1;
1833
+ $mlw_qmn_new_admin_array = array();
1834
+ while ($i <= $mlw_qmn_email_admin_total)
1835
+ {
1836
+ if ($_POST["admin_email_".$i] != "Delete")
1837
+ {
1838
+ $mlw_qmn_email_each = array(
1839
+ "begin_score" => intval($_POST["admin_email_begin_".$i]),
1840
+ "end_score" => intval($_POST["admin_email_end_".$i]),
1841
+ "message" => htmlspecialchars(stripslashes($_POST["admin_email_".$i]), ENT_QUOTES),
1842
+ "subject" => htmlspecialchars(stripslashes($_POST["admin_email_subject_".$i]), ENT_QUOTES)
1843
+ );
1844
+ $mlw_qmn_new_admin_array[] = $mlw_qmn_email_each;
1845
+ }
1846
+ $i++;
1847
+ }
1848
  $mlw_qmn_new_email_array = serialize($mlw_qmn_new_email_array);
1849
+ $mlw_qmn_new_admin_array = serialize($mlw_qmn_new_admin_array);
1850
+ $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_new_admin_array, $mlw_qmn_email_id ) );
1851
  if ($mlw_new_email_results != false)
1852
  {
1853
  $mlwQuizMasterNext->alertManager->newAlert('The email has been updated successfully.', 'success');
1873
  $mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
1874
  }
1875
 
1876
+ //Load User Email Templates
1877
  if (is_serialized($mlw_quiz_options->user_email_template) && is_array(@unserialize($mlw_quiz_options->user_email_template)))
1878
  {
1879
  $mlw_qmn_user_email_array = @unserialize($mlw_quiz_options->user_email_template);
1882
  {
1883
  $mlw_qmn_user_email_array = array(array(0, 0, $mlw_quiz_options->user_email_template, 'Quiz Results For %QUIZ_NAME%'));
1884
  }
1885
+
1886
+ //Load Admin Email Templates
1887
+ if (is_serialized($mlw_quiz_options->admin_email_template) && is_array(@unserialize($mlw_quiz_options->admin_email_template)))
1888
+ {
1889
+ $mlw_qmn_admin_email_array = @unserialize($mlw_quiz_options->admin_email_template);
1890
+ }
1891
+ else
1892
+ {
1893
+ $mlw_qmn_admin_email_array = array(array(
1894
+ "begin_score" => 0,
1895
+ "end_score" => 0,
1896
+ "message" => $mlw_quiz_options->admin_email_template,
1897
+ "subject" => 'Quiz Results For %QUIZ_NAME%'
1898
+ ));
1899
+ }
1900
  ?>
1901
 
1902
  <div id="tabs-9" class="mlw_tab_content">
1903
  <script>
1904
  $j(function() {
1905
+ $j("#new_email_button_top, #new_email_button_bottom, #new_admin_email_button_top, #new_admin_email_button_bottom").button();
1906
  });
1907
  jQuery(function() {
1908
  jQuery("#email_accordion").accordion({
1914
  document.getElementById('user_email_'+id).value = "Delete";
1915
  document.mlw_quiz_save_email_form.submit();
1916
  }
1917
+ function delete_admin_email(id)
1918
+ {
1919
+ document.getElementById('admin_email_'+id).value = "Delete";
1920
+ document.mlw_quiz_save_email_form.submit();
1921
+ }
1922
  </script>
1923
  <h3>Template Variables</h3>
1924
  <table class="form-table">
1960
  <input type='hidden' name='mlw_add_email_page' value='confirmation' />
1961
  <input type='hidden' name='mlw_add_email_quiz_id' value='<?php echo $quiz_id; ?>' />
1962
  </form>
1963
+ <form method="post" action="" name="mlw_quiz_add_admin_email_form">
1964
+ <input type='hidden' name='mlw_add_admin_email_page' value='confirmation' />
1965
+ <input type='hidden' name='mlw_add_admin_email_quiz_id' value='<?php echo $quiz_id; ?>' />
1966
+ </form>
1967
  <button id="save_email_button" onclick="javascript: document.mlw_quiz_save_email_form.submit();">Save Email Templates</button>
1968
  <form method="post" action="" name="mlw_quiz_save_email_form">
1969
  <div id="email_accordion">
2054
  </div>
2055
  <h3><a href="#">Email Sent To Admin</a></h3>
2056
  <div>
2057
+ <a id="new_admin_email_button_top" href="#" onclick="javascript: document.mlw_quiz_add_admin_email_form.submit();">Add New Email</a>
2058
+ <table class="widefat">
2059
+ <thead>
2060
+ <tr>
2061
+ <th>ID</th>
2062
+ <th>Score Greater Than Or Equal To</th>
2063
+ <th>Score Less Than Or Equal To</th>
2064
+ <th>Subject</th>
2065
+ <th>Email To Send</th>
2066
+ </tr>
2067
+ </thead>
2068
+ <tbody>
2069
+ <?php
2070
+ $mlw_admin_count = 0;
2071
+ $alternate = "";
2072
+ foreach($mlw_qmn_admin_email_array as $mlw_each)
2073
+ {
2074
+ if($alternate) $alternate = "";
2075
+ else $alternate = " class=\"alternate\"";
2076
+ $mlw_admin_count += 1;
2077
+ if (!isset($mlw_each["subject"]))
2078
+ {
2079
+ $mlw_each[3] = "Quiz Results For %QUIZ_NAME%";
2080
+ }
2081
+ if ($mlw_each["begin_score"] == 0 && $mlw_each["end_score"] == 0)
2082
+ {
2083
+ echo "<tr{$alternate}>";
2084
+ echo "<td>";
2085
+ echo "Default";
2086
+ echo "</td>";
2087
+ echo "<td>";
2088
+ echo "<input type='hidden' id='admin_email_begin_".$mlw_admin_count."' name='admin_email_begin_".$mlw_admin_count."' value='0'/>-";
2089
+ echo "</td>";
2090
+ echo "<td>";
2091
+ echo "<input type='hidden' id='admin_email_end_".$mlw_admin_count."' name='admin_email_end_".$mlw_admin_count."' value='0'/>-";
2092
+ echo "</td>";
2093
+ echo "<td>";
2094
+ echo "<input type='text' id='admin_email_subject_".$mlw_admin_count."' name='admin_email_subject_".$mlw_admin_count."' value='".$mlw_each["subject"]."' />";
2095
+ echo "</td>";
2096
+ echo "<td>";
2097
+ echo "<textarea cols='80' rows='15' id='admin_email_".$mlw_admin_count."' name='admin_email_".$mlw_admin_count."'>".$mlw_each["message"]."</textarea>";
2098
+ echo "</td>";
2099
+ echo "</tr>";
2100
+ break;
2101
+ }
2102
+ else
2103
+ {
2104
+ echo "<tr{$alternate}>";
2105
+ echo "<td>";
2106
+ echo $mlw_admin_count."<div><span style='color:green;font-size:12px;'><a onclick=\"\$j('#trying_delete_admin_email_".$mlw_admin_count."').show();\">Delete</a></span></div><div style=\"display: none;\" id='trying_delete_admin_email_".$mlw_admin_count."'>Are you sure?<br /><a onclick=\"delete_admin_email(".$mlw_admin_count.")\">Yes</a>|<a onclick=\"\$j('#trying_delete_admin_email_".$mlw_admin_count."').hide();\">No</a></div>";
2107
+ echo "</td>";
2108
+ echo "<td>";
2109
+ echo "<input type='text' id='admin_email_begin_".$mlw_admin_count."' name='admin_email_begin_".$mlw_admin_count."' title='What score must the user score better than to see this page' value='".$mlw_each["begin_score"]."'/>";
2110
+ echo "</td>";
2111
+ echo "<td>";
2112
+ echo "<input type='text' id='admin_email_end_".$mlw_admin_count."' name='admin_email_end_".$mlw_admin_count."' title='What score must the user score worse than to see this page' value='".$mlw_each["end_score"]."' />";
2113
+ echo "</td>";
2114
+ echo "<td>";
2115
+ echo "<input type='text' id='admin_email_subject_".$mlw_admin_count."' name='admin_email_subject_".$mlw_admin_count."' value='".$mlw_each["subject"]."' />";
2116
+ echo "</td>";
2117
+ echo "<td>";
2118
+ echo "<textarea cols='80' rows='15' id='admin_email_".$mlw_admin_count."' title='What email will the user be sent' name='admin_email_".$mlw_admin_count."'>".$mlw_each["message"]."</textarea>";
2119
+ echo "</td>";
2120
+ echo "</tr>";
2121
+ }
2122
+ }
2123
+ ?>
2124
+ </tbody>
2125
+ <tfoot>
2126
+ <tr>
2127
+ <th>ID</th>
2128
+ <th>Score Greater Than Or Equal To</th>
2129
+ <th>Score Less Than Or Equal To</th>
2130
+ <th>Subject</th>
2131
+ <th>Email To Send</th>
2132
+ </tr>
2133
+ </tfoot>
2134
  </table>
2135
+ <a id="new_admin_email_button_bottom" href="#" onclick="javascript: document.mlw_quiz_add_admin_email_form.submit();">Add New Email</a>
2136
+ <input type='hidden' name='mlw_email_admin_total' value='<?php echo $mlw_admin_count; ?>' />
2137
  </div>
2138
  </div>
2139
  </form>
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.7.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
+ $data = "3.8.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
includes/qmn_dashboard_widgets.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function qmn_add_dashboard_widget()
3
+ {
4
+ wp_add_dashboard_widget(
5
+ 'qmn_snapshot_widget',
6
+ 'Quiz Master Next Snapshot',
7
+ 'qmn_snapshot_dashboard_widget'
8
+ );
9
+ }
10
+
11
+ add_action( 'wp_dashboard_setup', 'qmn_add_dashboard_widget' );
12
+
13
+
14
+ function qmn_snapshot_dashboard_widget()
15
+ {
16
+ global $wpdb;
17
+ $mlw_qmn_today_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".date("Y-m-d")." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
18
+ $mlw_last_week = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
19
+ $mlw_last_week = date("Y-m-d", $mlw_last_week);
20
+ $mlw_qmn_last_weekday_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0");
21
+ if ($mlw_qmn_last_weekday_taken != 0)
22
+ {
23
+ $mlw_qmn_analyze_today = round((($mlw_qmn_today_taken - $mlw_qmn_last_weekday_taken) / $mlw_qmn_last_weekday_taken) * 100, 2);
24
+ }
25
+ else
26
+ {
27
+ $mlw_qmn_analyze_today = $mlw_qmn_today_taken * 100;
28
+ }
29
+
30
+ $mlw_stat_total_active_quiz = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0 LIMIT 1" );
31
+ $mlw_stat_total_questions = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_questions WHERE deleted=0 LIMIT 1" );
32
+
33
+ $mlw_stat_most_popular_quiz = $wpdb->get_row( "SELECT quiz_name FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0 ORDER BY quiz_taken Desc LIMIT 1" );
34
+ $mlw_stat_least_popular_quiz = $wpdb->get_row( "SELECT quiz_name FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0 ORDER BY quiz_taken ASC LIMIT 1" );
35
+ ?>
36
+ <style>
37
+ .qmn_dashboard_list
38
+ {
39
+ overflow: hidden;
40
+ margin: 0;
41
+ }
42
+ .qmn_dashboard_list li:first-child
43
+ {
44
+ border-top: 0;
45
+ width: 100%;
46
+ }
47
+ .qmn_dashboard_element
48
+ {
49
+ width: 50%;
50
+ float: left;
51
+ padding: 0;
52
+ -webkit-box-sizing: border-box;
53
+ -moz-box-sizing: border-box;
54
+ box-sizing: border-box;
55
+ margin: 0;
56
+ border-top: 1px solid #ececec;
57
+ color: #aaa;
58
+ }
59
+ .qmn_dashboard_inside
60
+ {
61
+ display: block;
62
+ color: #aaa;
63
+ padding: 9px 12px;
64
+ -webkit-transition: all ease .5s;
65
+ position: relative;
66
+ font-size: 12px;
67
+ }
68
+ .qmn_dashboard_inside strong
69
+ {
70
+ font-size: 18px;
71
+ line-height: 1.2em;
72
+ font-weight: 400;
73
+ display: block;
74
+ color: #21759b;
75
+ }
76
+ .qmn_dashboard_graph
77
+ {
78
+ width: 25%;
79
+ height: 10px;
80
+ display: block;
81
+ float: right;
82
+ position: absolute;
83
+ right: 0;
84
+ top: 50%;
85
+ margin-right: 12px;
86
+ margin-top: -1.25em;
87
+ font-size: 18px
88
+ }
89
+ .qmn_dashboard_graph img
90
+ {
91
+ width: 15px;
92
+ height: 15px;
93
+ }
94
+ </style>
95
+ <ul class="qmn_dashboard_list">
96
+ <li class="qmn_dashboard_element">
97
+ <div class="qmn_dashboard_inside">
98
+ <strong><?php echo $mlw_qmn_today_taken; ?></strong>
99
+ quizzes taken today
100
+ <span class="qmn_dashboard_graph">
101
+ <?php
102
+ echo $mlw_qmn_analyze_today."% ";
103
+ if ($mlw_qmn_analyze_today >= 0)
104
+ {
105
+ echo "<img src='".plugin_dir_url( __FILE__ )."images/green_triangle.png'/>";
106
+ }
107
+ else
108
+ {
109
+ echo "<img src='".plugin_dir_url( __FILE__ )."images/red_triangle.png'/>";
110
+ }
111
+ ?>
112
+ </span>
113
+ </div>
114
+ </li>
115
+ <li class="qmn_dashboard_element">
116
+ <div class="qmn_dashboard_inside">
117
+ <strong><?php echo $mlw_stat_total_active_quiz; ?></strong>
118
+ total active quizzes
119
+ </div>
120
+ </li>
121
+ <li class="qmn_dashboard_element">
122
+ <div class="qmn_dashboard_inside">
123
+ <strong><?php echo $mlw_stat_total_questions; ?></strong>
124
+ total active questions
125
+ </div>
126
+ </li>
127
+ <li class="qmn_dashboard_element">
128
+ <div class="qmn_dashboard_inside">
129
+ <strong><?php echo $mlw_stat_most_popular_quiz->quiz_name; ?></strong>
130
+ most popular quiz
131
+ </div>
132
+ </li>
133
+ <li class="qmn_dashboard_element">
134
+ <div class="qmn_dashboard_inside">
135
+ <strong><?php echo $mlw_stat_least_popular_quiz->quiz_name; ?></strong>
136
+ least popular quiz
137
+ </div>
138
+ </li>
139
+ </ul>
140
+ <?php
141
+ }
142
+ ?>
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.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
@@ -83,15 +83,14 @@ class MLWQuizMasterNext
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
  /**
@@ -124,12 +123,13 @@ class MLWQuizMasterNext
124
  {
125
  if (function_exists('add_menu_page'))
126
  {
127
- add_menu_page('Quiz Master Next', 'Quiz Dashboard', 'moderate_comments', __FILE__, 'mlw_generate_quiz_dashboard', 'dashicons-feedback');
128
- add_submenu_page(__FILE__, 'Quizzes', 'Quizzes', 'moderate_comments', 'mlw_quiz_admin', 'mlw_generate_quiz_admin');
129
  add_submenu_page(__FILE__, 'Quiz Settings', 'Quiz Settings', 'moderate_comments', 'mlw_quiz_options', 'mlw_generate_quiz_options');
130
  add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 'moderate_comments', 'mlw_quiz_results', 'mlw_generate_quiz_results');
131
  add_submenu_page(__FILE__, 'Quiz Result Details', 'Quiz Result Details', 'moderate_comments', 'mlw_quiz_result_details', 'mlw_generate_result_details');
132
- add_submenu_page(__FILE__, 'Tools', 'Tools', 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools');
 
 
133
  add_submenu_page(__FILE__, 'QMN About', 'QMN About', 'manage_options', 'mlw_qmn_about', 'mlw_generate_about_page');
134
  }
135
  }
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.8.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
83
  include("includes/mlw_qmn_credits.php");
84
  include("includes/mlw_template_variables.php");
85
  include("includes/mlw_adverts.php");
86
+ include("includes/mlw_help.php");
87
+ include("includes/qmn_dashboard_widgets.php");
88
 
89
+ include("includes/mlw_alerts.php");
90
  $this->alertManager = new MlwQmnAlertManager();
91
 
92
+ include("includes/mlw_quiz_creator.php");
93
+ $this->quizCreator = new QMNQuizCreator();
 
 
 
94
  }
95
 
96
  /**
123
  {
124
  if (function_exists('add_menu_page'))
125
  {
126
+ add_menu_page('Quiz Master Next', 'Quizzes', 'moderate_comments', __FILE__, 'mlw_generate_quiz_admin', 'dashicons-feedback');
 
127
  add_submenu_page(__FILE__, 'Quiz Settings', 'Quiz Settings', 'moderate_comments', 'mlw_quiz_options', 'mlw_generate_quiz_options');
128
  add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 'moderate_comments', 'mlw_quiz_results', 'mlw_generate_quiz_results');
129
  add_submenu_page(__FILE__, 'Quiz Result Details', 'Quiz Result Details', 'moderate_comments', 'mlw_quiz_result_details', 'mlw_generate_result_details');
130
+ add_submenu_page(__FILE__, 'QMN Stats', 'QMN Stats', 'moderate_comments', 'mlw_quiz_stats', 'mlw_generate_quiz_dashboard');
131
+ add_submenu_page(__FILE__, 'QMN Tools', 'QMN Tools', 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools');
132
+ add_submenu_page(__FILE__, 'QMN Help', 'QMN Help', 'moderate_comments', 'mlw_quiz_help', 'mlw_generate_help_page');
133
  add_submenu_page(__FILE__, 'QMN About', 'QMN About', 'manage_options', 'mlw_qmn_about', 'mlw_generate_about_page');
134
  }
135
  }
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.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.
@@ -101,7 +101,7 @@ We now offer a premium support plan that offers priority response, priority feat
101
  We now offer an installation service that includes 1-on-1 training as well as a premium support that offers 1-on-1 training. For details, visit our [Wordpress Store](http://mylocalwebstop.com/shop/)
102
 
103
  = I have an idea, how do I contact you? =
104
- Feel free to use the widget on the quiz dashboard within the plugin or from the contact page at mylocalwebstop.com.
105
 
106
  == Screenshots ==
107
 
@@ -116,6 +116,15 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
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
@@ -569,6 +578,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
569
 
570
  == Upgrade Notice ==
571
 
 
 
 
572
  = 3.7.1 =
573
  Upgrade for ability to schedule when quiz will be active
574
 
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.1
7
+ Stable tag: 3.8.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.
101
  We now offer an installation service that includes 1-on-1 training as well as a premium support that offers 1-on-1 training. For details, visit our [Wordpress Store](http://mylocalwebstop.com/shop/)
102
 
103
  = I have an idea, how do I contact you? =
104
+ Feel free to use the widget on the help page within the plugin or from the contact page at mylocalwebstop.com.
105
 
106
  == Screenshots ==
107
 
116
 
117
  == Changelog ==
118
 
119
+ = 3.8.1 (December 17, 2014) =
120
+ * Added Ability To Send Different Admin Emails Based On Score
121
+ * Added Ability To Customize Admin Email Subject
122
+ * Added New Dashboard Widget For Quick Snapshot Of Status
123
+ * Added New Help Page With Link To Documentation
124
+ * Create New System Info Widget On Help Page
125
+ * In Code: Added 4 New Hooks Throughout The Quiz Creator Class
126
+ * In Code: Added 3 New Quiz Settings Helper Functions In Quiz Creator Class
127
+
128
  = 3.7.1 (December 10, 2014) =
129
  * Added Ability To Schedule A Timeframe That The Quiz Is Active In
130
  * Added Labels To Horizontal Radio Type For Better Use
578
 
579
  == Upgrade Notice ==
580
 
581
+ = 3.8.1 =
582
+ Upgrade for ability for different admin emails based on score. Also, new help page is included. Added new dashboard widget as well.
583
+
584
  = 3.7.1 =
585
  Upgrade for ability to schedule when quiz will be active
586