Version Description
(March 7, 2015) = * Added Fill In The Blank Questions (GitHub Issue #132) * Created New Template Variables For Social Sharing (GitHub Issue #121) * Added Ability To Redirect To Other Page Upon Completion (GitHub Issue #35) * Added Several Translations: da_DK, es_ES, nl_NL, pt_BR, and th * Bug Fix: Duplicate Quizzes Not Having URL (GitHub Issue #144) * Bug Fix: Message Sent Text (GitHub Issue #142) * Bug Fix: Missing Footer Column (GitHub Issue #145)
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 4.2.0 |
Comparing to | |
See all releases |
Code changes from version 4.1.0 to 4.2.0
- assets/index.php +4 -0
- includes/certificates/index.php +1 -1
- includes/css/index.php +4 -0
- includes/fpdf/index.php +4 -0
- includes/images/index.php +4 -0
- includes/index.php +4 -0
- includes/js/index.php +4 -0
- includes/qmn_addons.php +5 -0
- includes/qmn_adverts.php +3 -3
- includes/qmn_alerts.php +1 -0
- includes/qmn_credits.php +33 -43
- includes/qmn_dashboard.php +1 -0
- includes/qmn_dashboard_widgets.php +1 -0
- includes/qmn_global_settings.php +1 -0
- includes/qmn_help.php +1 -0
- includes/qmn_helper.php +1 -0
- includes/qmn_leaderboard.php +6 -5
- includes/qmn_options_certificate_tab.php +1 -0
- includes/qmn_options_email_tab.php +1 -0
- includes/qmn_options_leaderboard_tab.php +1 -0
- includes/qmn_options_option_tab.php +2 -1
- includes/qmn_options_preview_tab.php +1 -0
- includes/qmn_options_questions_tab.php +6 -3
- includes/qmn_options_results_page_tab.php +19 -4
- includes/qmn_options_style_tab.php +1 -0
- includes/qmn_options_text_tab.php +1 -0
- includes/qmn_options_tools_tab.php +1 -0
- includes/qmn_question_types.php +59 -1
- includes/qmn_quiz.php +119 -1
- includes/qmn_quiz_admin.php +6 -0
- includes/qmn_quiz_creator.php +14 -2
- includes/qmn_quiz_install.php +1 -0
- includes/qmn_quiz_options.php +5 -0
- includes/qmn_results.php +5 -1
- includes/qmn_results_details.php +5 -0
- includes/qmn_template_variables.php +74 -5
- includes/qmn_tools.php +5 -0
- includes/qmn_update.php +5 -0
- includes/qmn_usage_tracking.php +1 -3
- includes/qmn_widgets.php +1 -0
- index.php +4 -0
- languages/index.php +1 -2
- languages/quiz-master-next-da_DK.mo +0 -0
- languages/quiz-master-next-da_DK.po +1508 -0
- languages/quiz-master-next-es_ES.mo +0 -0
- languages/quiz-master-next-es_ES.po +1575 -0
- languages/quiz-master-next-nl_NL.mo +0 -0
- languages/quiz-master-next-pt_BR.mo +0 -0
- languages/quiz-master-next-pt_BR.po +3306 -0
- languages/quiz-master-next-th.mo +0 -0
- languages/quiz-master-next-th.po +1440 -0
- languages/quiz-master-next.pot +464 -433
- mlw_quizmaster2.php +4 -4
- readme.txt +25 -5
assets/index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
+
?>
|
includes/certificates/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
?>
|
includes/css/index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
+
?>
|
includes/fpdf/index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
+
?>
|
includes/images/index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
+
?>
|
includes/index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
+
?>
|
includes/js/index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
+
?>
|
includes/qmn_addons.php
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_addons_page()
|
3 |
{
|
|
|
|
|
|
|
|
|
4 |
global $mlwQuizMasterNext;
|
5 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'featured-addons';
|
6 |
$tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_addons_page()
|
4 |
{
|
5 |
+
if ( !current_user_can('moderate_comments') )
|
6 |
+
{
|
7 |
+
return;
|
8 |
+
}
|
9 |
global $mlwQuizMasterNext;
|
10 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'featured-addons';
|
11 |
$tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
|
includes/qmn_adverts.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
function mlw_qmn_show_adverts()
|
4 |
{
|
5 |
$mlw_advert = "";
|
@@ -55,13 +55,13 @@ function mlw_qmn_show_adverts()
|
|
55 |
div.help_decide a
|
56 |
{
|
57 |
color: yellow;
|
58 |
-
}
|
59 |
</style>";
|
60 |
$mlw_advert .= "
|
61 |
<div class=\"help_decide\">
|
62 |
<p>$mlw_advert_text</p>
|
63 |
</div>";
|
64 |
}
|
65 |
-
return $mlw_advert;
|
66 |
}
|
67 |
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function mlw_qmn_show_adverts()
|
4 |
{
|
5 |
$mlw_advert = "";
|
55 |
div.help_decide a
|
56 |
{
|
57 |
color: yellow;
|
58 |
+
}
|
59 |
</style>";
|
60 |
$mlw_advert .= "
|
61 |
<div class=\"help_decide\">
|
62 |
<p>$mlw_advert_text</p>
|
63 |
</div>";
|
64 |
}
|
65 |
+
return $mlw_advert;
|
66 |
}
|
67 |
?>
|
includes/qmn_alerts.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
class MlwQmnAlertManager {
|
3 |
|
4 |
public $alerts = array();
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
class MlwQmnAlertManager {
|
4 |
|
5 |
public $alerts = array();
|
includes/qmn_credits.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This page shows the about page
|
4 |
*/
|
@@ -94,51 +95,41 @@ function mlw_generate_about_page()
|
|
94 |
<?php _e('Requested Features', 'quiz-master-next'); ?></a>
|
95 |
</h2>
|
96 |
<div id="mlw_quiz_what_new">
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
<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>
|
122 |
-
<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>
|
123 |
-
<br />
|
124 |
</div>
|
125 |
<div id="mlw_quiz_changelog" style="display: none;">
|
126 |
-
<h3><?php echo $mlw_quiz_version; ?> (
|
127 |
<ul>
|
128 |
-
<li>* Added
|
129 |
-
<li>*
|
130 |
-
<li>*
|
131 |
-
<li>* Added
|
132 |
-
<li>*
|
133 |
-
<li>*
|
134 |
-
<li>*
|
135 |
-
<li>* In Code: Certificate On Admin Results Now Hooked Into New Template Variable System</li>
|
136 |
-
<li>* In Code: Converted Support Widget To Remote Post <a href="https://github.com/fpcorso/quiz_master_next/issues/114" target="_blank">GitHub Issue #114</a></li>
|
137 |
-
<li>* In Code: Added Uninstall File Direct Access Check</li>
|
138 |
-
<li>* Bug Fix: Fixed Dashboard Widget No Quiz Bug <a href="https://github.com/fpcorso/quiz_master_next/issues/119" target="_blank">GitHub Issue #119</a></li>
|
139 |
-
<li>* Bug Fix: Fixed Shortcode No Quiz Bug <a href="https://github.com/fpcorso/quiz_master_next/issues/120" target="_blank">GitHub Issue #120</a></li>
|
140 |
-
<li>* Bug Fix: Fixed Required Contact User Bug <a href="https://github.com/fpcorso/quiz_master_next/issues/123" target="_blank">GitHub Issue #123</a></li>
|
141 |
-
<li>* Bug Fix: Fixed Text Template Bug <a href="https://github.com/fpcorso/quiz_master_next/issues/117" target="_blank">GitHub Issue #117</a></li>
|
142 |
</ul>
|
143 |
</div>
|
144 |
<div id="mlw_quiz_requested" style="display: none;">
|
@@ -154,7 +145,6 @@ function mlw_generate_about_page()
|
|
154 |
<li>Show Question Amount On Pagination</li>
|
155 |
<li>Allow Quiz To Not Show Start Page</li>
|
156 |
<li>Progress Bar For Timer</li>
|
157 |
-
<li>Ability To Redirect User Instead Of Showing Results Page</li>
|
158 |
<li>Graphical Click Aware Questions</li>
|
159 |
<li>Results Bar Graph For Users Taking Polls</li>
|
160 |
<li>Head To Head Comparison Questions</li>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This page shows the about page
|
5 |
*/
|
95 |
<?php _e('Requested Features', 'quiz-master-next'); ?></a>
|
96 |
</h2>
|
97 |
<div id="mlw_quiz_what_new">
|
98 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Fill In The Blank Questions</h2>
|
99 |
+
<p style="text-align: center;">You can now use the new fill in the blank question type. By placing the variable %BLANK% in your question, you will be able to designate where to show the text box so users can fill in their answer.</p>
|
100 |
+
<br />
|
101 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Social Media Template Variables</h2>
|
102 |
+
<p style="text-align: center;">Using the new social media template variables, you can choose where on your results page to display the social media buttons.</p>
|
103 |
+
<br />
|
104 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Redirect User Upon Completion</h2>
|
105 |
+
<p style="text-align: center;">If you decide to do so, you can have the user be redirected to a new page instead of being shown the results.</p>
|
106 |
+
<br />
|
107 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">5 New Translations</h2>
|
108 |
+
<p style="text-align: center;">Thanks to the generosity of some of our users, we now have translations for Portuguese, Spanish, Thai, Danish, and Dutch.</p>
|
109 |
+
<br />
|
110 |
+
<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>
|
111 |
+
<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 March 31st, 2015 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>
|
112 |
+
<br />
|
113 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">This Plugin Is Now Translation Ready!</h2>
|
114 |
+
<p style="text-align: center;">For those who wish to assist in translating, you can find the POT in the languages folder. If you do not know what that is, feel free to contact me and I will assist you with it.</p>
|
115 |
+
<br />
|
116 |
+
<hr />
|
117 |
+
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">For Developers:</h2>
|
118 |
+
<br />
|
119 |
+
<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>
|
120 |
+
<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>
|
121 |
+
<br />
|
|
|
|
|
|
|
122 |
</div>
|
123 |
<div id="mlw_quiz_changelog" style="display: none;">
|
124 |
+
<h3><?php echo $mlw_quiz_version; ?> (March 7, 2015)</h3>
|
125 |
<ul>
|
126 |
+
<li>* Added Fill In The Blank Questions <a href="https://github.com/fpcorso/quiz_master_next/issues/132" target="_blank">GitHub Issue #132</a></li>
|
127 |
+
<li>* Created New Template Variables For Social Sharing <a href="https://github.com/fpcorso/quiz_master_next/issues/121" target="_blank">GitHub Issue #121</a></li>
|
128 |
+
<li>* Added Ability To Redirect To Other Page Upon Completion <a href="https://github.com/fpcorso/quiz_master_next/issues/35" target="_blank">GitHub Issue #35</a></li>
|
129 |
+
<li>* Added Several Translations: da_DK, es_ES, nl_NL, pt_BR, and th</li>
|
130 |
+
<li>* Bug Fix: Duplicate Quizzes Not Having URL <a href="https://github.com/fpcorso/quiz_master_next/issues/144" target="_blank">GitHub Issue #144</a></li>
|
131 |
+
<li>* Bug Fix: Message Sent Text <a href="https://github.com/fpcorso/quiz_master_next/issues/142" target="_blank">GitHub Issue #142</a></li>
|
132 |
+
<li>* Bug Fix: Missing Footer Column <a href="https://github.com/fpcorso/quiz_master_next/issues/145" target="_blank">GitHub Issue #145</a></li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
</ul>
|
134 |
</div>
|
135 |
<div id="mlw_quiz_requested" style="display: none;">
|
145 |
<li>Show Question Amount On Pagination</li>
|
146 |
<li>Allow Quiz To Not Show Start Page</li>
|
147 |
<li>Progress Bar For Timer</li>
|
|
|
148 |
<li>Graphical Click Aware Questions</li>
|
149 |
<li>Results Bar Graph For Users Taking Polls</li>
|
150 |
<li>Head To Head Comparison Questions</li>
|
includes/qmn_dashboard.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This page creates the main dashboard for the Quiz Master Next plugin
|
4 |
*/
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This page creates the main dashboard for the Quiz Master Next plugin
|
5 |
*/
|
includes/qmn_dashboard_widgets.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_add_dashboard_widget()
|
3 |
{
|
4 |
if ( current_user_can( 'publish_posts' ) )
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_add_dashboard_widget()
|
4 |
{
|
5 |
if ( current_user_can( 'publish_posts' ) )
|
includes/qmn_global_settings.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Generates The Settings Page For The Plugin
|
4 |
*
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/**
|
4 |
* Generates The Settings Page For The Plugin
|
5 |
*
|
includes/qmn_help.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This page shows the user how-to's for using the plugin
|
4 |
*/
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This page shows the user how-to's for using the plugin
|
5 |
*/
|
includes/qmn_helper.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* This class is a helper class to be used for extending the plugin
|
4 |
*
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/**
|
4 |
* This class is a helper class to be used for extending the plugin
|
5 |
*
|
includes/qmn_leaderboard.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This function creates the leaderboard from the shortcode.
|
4 |
*/
|
@@ -9,8 +10,8 @@ function mlw_quiz_leaderboard_shortcode($atts)
|
|
9 |
), $atts));
|
10 |
$mlw_quiz_id = $mlw_quiz;
|
11 |
$mlw_quiz_leaderboard_display = "";
|
12 |
-
|
13 |
-
|
14 |
global $wpdb;
|
15 |
$sql = "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
|
16 |
$mlw_quiz_options = $wpdb->get_results($sql);
|
@@ -29,10 +30,10 @@ function mlw_quiz_leaderboard_shortcode($atts)
|
|
29 |
}
|
30 |
$sql .= " LIMIT 10";
|
31 |
$mlw_result_data = $wpdb->get_results($sql);
|
32 |
-
|
33 |
$mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
|
34 |
$mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_quiz_leaderboard_display);
|
35 |
-
|
36 |
$leader_count = 0;
|
37 |
foreach($mlw_result_data as $mlw_eaches) {
|
38 |
$leader_count++;
|
@@ -69,7 +70,7 @@ function mlw_quiz_leaderboard_shortcode($atts)
|
|
69 |
$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
70 |
$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
71 |
$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
72 |
-
|
73 |
return $mlw_quiz_leaderboard_display;
|
74 |
}
|
75 |
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This function creates the leaderboard from the shortcode.
|
5 |
*/
|
10 |
), $atts));
|
11 |
$mlw_quiz_id = $mlw_quiz;
|
12 |
$mlw_quiz_leaderboard_display = "";
|
13 |
+
|
14 |
+
|
15 |
global $wpdb;
|
16 |
$sql = "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0'";
|
17 |
$mlw_quiz_options = $wpdb->get_results($sql);
|
30 |
}
|
31 |
$sql .= " LIMIT 10";
|
32 |
$mlw_result_data = $wpdb->get_results($sql);
|
33 |
+
|
34 |
$mlw_quiz_leaderboard_display = $mlw_quiz_options->leaderboard_template;
|
35 |
$mlw_quiz_leaderboard_display = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_quiz_leaderboard_display);
|
36 |
+
|
37 |
$leader_count = 0;
|
38 |
foreach($mlw_result_data as $mlw_eaches) {
|
39 |
$leader_count++;
|
70 |
$mlw_quiz_leaderboard_display = str_replace( "%THIRD_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
71 |
$mlw_quiz_leaderboard_display = str_replace( "%FOURTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
72 |
$mlw_quiz_leaderboard_display = str_replace( "%FIFTH_PLACE_SCORE%" , " ", $mlw_quiz_leaderboard_display);
|
73 |
+
|
74 |
return $mlw_quiz_leaderboard_display;
|
75 |
}
|
76 |
?>
|
includes/qmn_options_certificate_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_certificate_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_certificate_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
includes/qmn_options_email_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_email_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_email_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
includes/qmn_options_leaderboard_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_leaderboard_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_leaderboard_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
includes/qmn_options_option_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_options_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
@@ -210,7 +211,7 @@ function mlw_options_option_tab_content()
|
|
210 |
</div></td>
|
211 |
</tr>
|
212 |
<tr valign="top">
|
213 |
-
<th scope="row"><label for="social_media"><?php _e('Show social media sharing buttons? (Twitter & Facebook)', 'quiz-master-next'); ?></label></th>
|
214 |
<td><div id="social_media">
|
215 |
<input type="radio" id="social_media_radio2" name="social_media" <?php if ($mlw_quiz_options->social_media == 1) {echo 'checked="checked"';} ?> value='1' /><label for="social_media_radio2"><?php _e('Yes', 'quiz-master-next'); ?></label>
|
216 |
<input type="radio" id="social_media_radio" name="social_media" <?php if ($mlw_quiz_options->social_media == 0) {echo 'checked="checked"';} ?> value='0' /><label for="social_media_radio"><?php _e('No', 'quiz-master-next'); ?></label>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_options_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
211 |
</div></td>
|
212 |
</tr>
|
213 |
<tr valign="top">
|
214 |
+
<th scope="row"><label for="social_media"><?php _e('Show social media sharing buttons? (Twitter & Facebook)', 'quiz-master-next'); _e('This option is for here only for users of older versions. Please use the new template variables %FACEBOOK_SHARE% %TWITTER_SHARE% on your results pages instead of using this option!', 'quiz-master-next'); ?></label></th>
|
215 |
<td><div id="social_media">
|
216 |
<input type="radio" id="social_media_radio2" name="social_media" <?php if ($mlw_quiz_options->social_media == 1) {echo 'checked="checked"';} ?> value='1' /><label for="social_media_radio2"><?php _e('Yes', 'quiz-master-next'); ?></label>
|
217 |
<input type="radio" id="social_media_radio" name="social_media" <?php if ($mlw_quiz_options->social_media == 0) {echo 'checked="checked"';} ?> value='0' /><label for="social_media_radio"><?php _e('No', 'quiz-master-next'); ?></label>
|
includes/qmn_options_preview_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_preview_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_preview_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
includes/qmn_options_questions_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_questions_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
@@ -93,7 +94,7 @@ function mlw_options_questions_tab_content()
|
|
93 |
'%d',
|
94 |
'%s',
|
95 |
'%d',
|
96 |
-
'%
|
97 |
'%s',
|
98 |
'%s'
|
99 |
),
|
@@ -203,7 +204,7 @@ function mlw_options_questions_tab_content()
|
|
203 |
'%d',
|
204 |
'%s',
|
205 |
'%d',
|
206 |
-
'%
|
207 |
'%s',
|
208 |
'%s',
|
209 |
'%d'
|
@@ -297,7 +298,7 @@ function mlw_options_questions_tab_content()
|
|
297 |
'%d',
|
298 |
'%s',
|
299 |
'%d',
|
300 |
-
'%
|
301 |
'%s',
|
302 |
'%s',
|
303 |
'%d'
|
@@ -564,6 +565,7 @@ function mlw_options_questions_tab_content()
|
|
564 |
<input type='hidden' name='edit_question' value='confirmation' />
|
565 |
<input type='hidden' id='edit_question_id' name='edit_question_id' value='<?php echo $mlw_question_info->question_id; ?>' />
|
566 |
<input type='hidden' name='quiz_id' value='<?php echo $quiz_id; ?>' />
|
|
|
567 |
<table class="wide" style="text-align: left; white-space: nowrap;" id="question_<?php echo $mlw_question_info->question_id; ?>_answers" name="question_<?php echo $mlw_question_info->question_id; ?>_answers">
|
568 |
<tr>
|
569 |
<td><span style='font-weight:bold;'><?php _e('Question', 'quiz-master-next'); ?></span></td>
|
@@ -732,6 +734,7 @@ function mlw_options_questions_tab_content()
|
|
732 |
echo "<input type='hidden' name='create_question' value='confirmation' />";
|
733 |
echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
|
734 |
?>
|
|
|
735 |
<table class="wide" style="text-align: left; white-space: nowrap;" id="new_question_answers" name="new_question_answers">
|
736 |
<tr>
|
737 |
<td><span style='font-weight:bold;'><?php _e('Question', 'quiz-master-next'); ?></span></td>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_questions_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
94 |
'%d',
|
95 |
'%s',
|
96 |
'%d',
|
97 |
+
'%s',
|
98 |
'%s',
|
99 |
'%s'
|
100 |
),
|
204 |
'%d',
|
205 |
'%s',
|
206 |
'%d',
|
207 |
+
'%s',
|
208 |
'%s',
|
209 |
'%s',
|
210 |
'%d'
|
298 |
'%d',
|
299 |
'%s',
|
300 |
'%d',
|
301 |
+
'%s',
|
302 |
'%s',
|
303 |
'%s',
|
304 |
'%d'
|
565 |
<input type='hidden' name='edit_question' value='confirmation' />
|
566 |
<input type='hidden' id='edit_question_id' name='edit_question_id' value='<?php echo $mlw_question_info->question_id; ?>' />
|
567 |
<input type='hidden' name='quiz_id' value='<?php echo $quiz_id; ?>' />
|
568 |
+
<p><?php _e('For fill in the blank types, use %BLANK% to represent where to put the text box in your text.', 'quiz-master-next'); ?></p>
|
569 |
<table class="wide" style="text-align: left; white-space: nowrap;" id="question_<?php echo $mlw_question_info->question_id; ?>_answers" name="question_<?php echo $mlw_question_info->question_id; ?>_answers">
|
570 |
<tr>
|
571 |
<td><span style='font-weight:bold;'><?php _e('Question', 'quiz-master-next'); ?></span></td>
|
734 |
echo "<input type='hidden' name='create_question' value='confirmation' />";
|
735 |
echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
|
736 |
?>
|
737 |
+
<p><?php _e('For fill in the blank types, use %BLANK% to represent where to put the text box in your text.', 'quiz-master-next'); ?></p>
|
738 |
<table class="wide" style="text-align: left; white-space: nowrap;" id="new_question_answers" name="new_question_answers">
|
739 |
<tr>
|
740 |
<td><span style='font-weight:bold;'><?php _e('Question', 'quiz-master-next'); ?></span></td>
|
includes/qmn_options_results_page_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_results_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
@@ -20,7 +21,7 @@ function mlw_options_results_tab_content()
|
|
20 |
if (is_serialized($mlw_qmn_message_after) && is_array(@unserialize($mlw_qmn_message_after)))
|
21 |
{
|
22 |
$mlw_qmn_landing_array = @unserialize($mlw_qmn_message_after);
|
23 |
-
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here');
|
24 |
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
25 |
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
26 |
|
@@ -28,7 +29,7 @@ function mlw_options_results_tab_content()
|
|
28 |
else
|
29 |
{
|
30 |
$mlw_qmn_landing_array = array(array(0, 0, $mlw_qmn_message_after));
|
31 |
-
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here');
|
32 |
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
33 |
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
34 |
}
|
@@ -68,7 +69,7 @@ function mlw_options_results_tab_content()
|
|
68 |
{
|
69 |
if ($_POST["message_after_".$i] != "Delete")
|
70 |
{
|
71 |
-
$mlw_qmn_landing_each = array(intval($_POST["message_after_begin_".$i]), intval($_POST["message_after_end_".$i]), htmlspecialchars(stripslashes($_POST["message_after_".$i]), ENT_QUOTES));
|
72 |
$mlw_qmn_new_landing_array[] = $mlw_qmn_landing_each;
|
73 |
}
|
74 |
$i++;
|
@@ -107,7 +108,7 @@ function mlw_options_results_tab_content()
|
|
107 |
}
|
108 |
else
|
109 |
{
|
110 |
-
$mlw_message_after_array = array(array(0, 0, $mlw_quiz_options->message_after));
|
111 |
}
|
112 |
wp_enqueue_style( 'qmn_admin_style', plugins_url( 'css/qmn_admin.css' , __FILE__ ) );
|
113 |
?>
|
@@ -186,6 +187,12 @@ function mlw_options_results_tab_content()
|
|
186 |
<div class="template_variable">
|
187 |
<span class="template_name">%CATEGORY_AVERAGE_SCORE%</span> - <?php _e('The average score from all categories.', 'quiz-master-next'); ?>
|
188 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
<?php do_action('qmn_template_variable_list'); ?>
|
190 |
</div>
|
191 |
<div style="clear:both;"></div>
|
@@ -199,6 +206,7 @@ function mlw_options_results_tab_content()
|
|
199 |
<th><?php _e('Score Greater Than Or Equal To', 'quiz-master-next'); ?></th>
|
200 |
<th><?php _e('Score Less Than Or Equal To', 'quiz-master-next'); ?></th>
|
201 |
<th><?php _e('Results Page Shown', 'quiz-master-next'); ?></th>
|
|
|
202 |
</tr>
|
203 |
</thead>
|
204 |
<tbody>
|
@@ -226,6 +234,9 @@ function mlw_options_results_tab_content()
|
|
226 |
wp_editor( htmlspecialchars_decode($mlw_each[2], ENT_QUOTES), "message_after_".$mlw_each_count );
|
227 |
//echo "<textarea cols='80' rows='15' id='message_after_".$mlw_each_count."' name='message_after_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
228 |
echo "</td>";
|
|
|
|
|
|
|
229 |
echo "</tr>";
|
230 |
break;
|
231 |
}
|
@@ -245,6 +256,9 @@ function mlw_options_results_tab_content()
|
|
245 |
wp_editor( htmlspecialchars_decode($mlw_each[2], ENT_QUOTES), "message_after_".$mlw_each_count );
|
246 |
//echo "<textarea cols='80' rows='15' id='message_after_".$mlw_each_count."' title='What text will the user see when reaching this page' name='message_after_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
247 |
echo "</td>";
|
|
|
|
|
|
|
248 |
echo "</tr>";
|
249 |
}
|
250 |
}
|
@@ -256,6 +270,7 @@ function mlw_options_results_tab_content()
|
|
256 |
<th><?php _e('Score Greater Than Or Equal To', 'quiz-master-next'); ?></th>
|
257 |
<th><?php _e('Score Less Than Or Equal To', 'quiz-master-next'); ?></th>
|
258 |
<th><?php _e('Results Page Shown', 'quiz-master-next'); ?></th>
|
|
|
259 |
</tr>
|
260 |
</tfoot>
|
261 |
</table>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_results_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
21 |
if (is_serialized($mlw_qmn_message_after) && is_array(@unserialize($mlw_qmn_message_after)))
|
22 |
{
|
23 |
$mlw_qmn_landing_array = @unserialize($mlw_qmn_message_after);
|
24 |
+
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', "redirect_url" => '');
|
25 |
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
26 |
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
27 |
|
29 |
else
|
30 |
{
|
31 |
$mlw_qmn_landing_array = array(array(0, 0, $mlw_qmn_message_after));
|
32 |
+
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', "redirect_url" => '');
|
33 |
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
34 |
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
35 |
}
|
69 |
{
|
70 |
if ($_POST["message_after_".$i] != "Delete")
|
71 |
{
|
72 |
+
$mlw_qmn_landing_each = array(intval($_POST["message_after_begin_".$i]), intval($_POST["message_after_end_".$i]), htmlspecialchars(stripslashes($_POST["message_after_".$i]), ENT_QUOTES), "redirect_url" => esc_url_raw($_POST["redirect_".$i]));
|
73 |
$mlw_qmn_new_landing_array[] = $mlw_qmn_landing_each;
|
74 |
}
|
75 |
$i++;
|
108 |
}
|
109 |
else
|
110 |
{
|
111 |
+
$mlw_message_after_array = array(array(0, 0, $mlw_quiz_options->message_after, "redirect_url" => ''));
|
112 |
}
|
113 |
wp_enqueue_style( 'qmn_admin_style', plugins_url( 'css/qmn_admin.css' , __FILE__ ) );
|
114 |
?>
|
187 |
<div class="template_variable">
|
188 |
<span class="template_name">%CATEGORY_AVERAGE_SCORE%</span> - <?php _e('The average score from all categories.', 'quiz-master-next'); ?>
|
189 |
</div>
|
190 |
+
<div class="template_variable">
|
191 |
+
<span class="template_name">%FACEBOOK_SHARE%</span> - <?php _e('Displays button to share on Facebook.', 'quiz-master-next'); ?>
|
192 |
+
</div>
|
193 |
+
<div class="template_variable">
|
194 |
+
<span class="template_name">%TWITTER_SHARE%</span> - <?php _e('Displays button to share on Twitter.', 'quiz-master-next'); ?>
|
195 |
+
</div>
|
196 |
<?php do_action('qmn_template_variable_list'); ?>
|
197 |
</div>
|
198 |
<div style="clear:both;"></div>
|
206 |
<th><?php _e('Score Greater Than Or Equal To', 'quiz-master-next'); ?></th>
|
207 |
<th><?php _e('Score Less Than Or Equal To', 'quiz-master-next'); ?></th>
|
208 |
<th><?php _e('Results Page Shown', 'quiz-master-next'); ?></th>
|
209 |
+
<th><?php _e('Redirect URL', 'quiz-master-next'); ?></th>
|
210 |
</tr>
|
211 |
</thead>
|
212 |
<tbody>
|
234 |
wp_editor( htmlspecialchars_decode($mlw_each[2], ENT_QUOTES), "message_after_".$mlw_each_count );
|
235 |
//echo "<textarea cols='80' rows='15' id='message_after_".$mlw_each_count."' name='message_after_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
236 |
echo "</td>";
|
237 |
+
echo "<td>";
|
238 |
+
echo "<input type='text' id='redirect_".$mlw_each_count."' name='redirect_".$mlw_each_count."' value='".esc_url($mlw_each["redirect_url"])."'/>";
|
239 |
+
echo "</td>";
|
240 |
echo "</tr>";
|
241 |
break;
|
242 |
}
|
256 |
wp_editor( htmlspecialchars_decode($mlw_each[2], ENT_QUOTES), "message_after_".$mlw_each_count );
|
257 |
//echo "<textarea cols='80' rows='15' id='message_after_".$mlw_each_count."' title='What text will the user see when reaching this page' name='message_after_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
258 |
echo "</td>";
|
259 |
+
echo "<td>";
|
260 |
+
echo "<input type='text' id='redirect_".$mlw_each_count."' name='redirect_".$mlw_each_count."' value='".esc_url($mlw_each["redirect_url"])."'/>";
|
261 |
+
echo "</td>";
|
262 |
echo "</tr>";
|
263 |
}
|
264 |
}
|
270 |
<th><?php _e('Score Greater Than Or Equal To', 'quiz-master-next'); ?></th>
|
271 |
<th><?php _e('Score Less Than Or Equal To', 'quiz-master-next'); ?></th>
|
272 |
<th><?php _e('Results Page Shown', 'quiz-master-next'); ?></th>
|
273 |
+
<th><?php _e('Redirect URL', 'quiz-master-next'); ?></th>
|
274 |
</tr>
|
275 |
</tfoot>
|
276 |
</table>
|
includes/qmn_options_style_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_style_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_style_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
includes/qmn_options_text_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_text_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_text_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
includes/qmn_options_tools_tab.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
function qmn_settings_tools_tab()
|
3 |
{
|
4 |
global $mlwQuizMasterNext;
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function qmn_settings_tools_tab()
|
4 |
{
|
5 |
global $mlwQuizMasterNext;
|
includes/qmn_question_types.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
add_action("plugins_loaded", 'qmn_question_type_multiple_choice');
|
4 |
function qmn_question_type_multiple_choice()
|
5 |
{
|
@@ -571,4 +571,62 @@ function qmn_horizontal_multiple_response_review($id, $question, $answers)
|
|
571 |
}
|
572 |
return $return_array;
|
573 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
add_action("plugins_loaded", 'qmn_question_type_multiple_choice');
|
4 |
function qmn_question_type_multiple_choice()
|
5 |
{
|
571 |
}
|
572 |
return $return_array;
|
573 |
}
|
574 |
+
|
575 |
+
add_action("plugins_loaded", 'qmn_question_type_fill_blank');
|
576 |
+
function qmn_question_type_fill_blank()
|
577 |
+
{
|
578 |
+
global $mlwQuizMasterNext;
|
579 |
+
$mlwQuizMasterNext->pluginHelper->register_question_type(__("Fill In The Blank", 'quiz-master-next'), 'qmn_fill_blank_display', true, 'qmn_fill_blank_review');
|
580 |
+
}
|
581 |
+
|
582 |
+
function qmn_fill_blank_display($id, $question, $answers)
|
583 |
+
{
|
584 |
+
$question_display = '';
|
585 |
+
global $mlwQuizMasterNext;
|
586 |
+
$required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
|
587 |
+
if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
|
588 |
+
$input_text = "<input type='text' class='qmn_fill_blank $mlw_requireClass' name='question".$id."' />";
|
589 |
+
if (strpos($question, '%BLANK%') !== false)
|
590 |
+
{
|
591 |
+
$question = str_replace( "%BLANK%", $input_text, htmlspecialchars_decode($question, ENT_QUOTES));
|
592 |
+
}
|
593 |
+
$question_display = "<span class='mlw_qmn_question'>$question</span><br />";
|
594 |
+
|
595 |
+
$question_display .= "<br />";
|
596 |
+
return $question_display;
|
597 |
+
}
|
598 |
+
|
599 |
+
function qmn_fill_blank_review($id, $question, $answers)
|
600 |
+
{
|
601 |
+
$return_array = array(
|
602 |
+
'points' => 0,
|
603 |
+
'correct' => 'incorrect',
|
604 |
+
'user_text' => '',
|
605 |
+
'correct_text' => ''
|
606 |
+
);
|
607 |
+
if (strpos($question, '%BLANK%') !== false)
|
608 |
+
{
|
609 |
+
$return_array['question_text'] = str_replace( "%BLANK%", "__________", htmlspecialchars_decode($question, ENT_QUOTES));
|
610 |
+
}
|
611 |
+
if (isset($_POST["question".$id]))
|
612 |
+
{
|
613 |
+
$mlw_user_answer = $_POST["question".$id];
|
614 |
+
}
|
615 |
+
else
|
616 |
+
{
|
617 |
+
$mlw_user_answer = " ";
|
618 |
+
}
|
619 |
+
$return_array['user_text'] = strval(stripslashes(htmlspecialchars_decode($mlw_user_answer, ENT_QUOTES)));
|
620 |
+
foreach($answers as $answer)
|
621 |
+
{
|
622 |
+
$return_array['correct_text'] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
|
623 |
+
if (strtoupper($return_array['user_text']) == strtoupper($return_array['correct_text']))
|
624 |
+
{
|
625 |
+
$return_array['correct'] = "correct";
|
626 |
+
$return_array['points'] = $answer[1];
|
627 |
+
break;
|
628 |
+
}
|
629 |
+
}
|
630 |
+
return $return_array;
|
631 |
+
}
|
632 |
?>
|
includes/qmn_quiz.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* This class generates the contents of the quiz shortcode
|
4 |
*
|
@@ -31,6 +32,117 @@ class QMNQuizManager
|
|
31 |
public function add_hooks()
|
32 |
{
|
33 |
add_shortcode('mlw_quizmaster', array($this, 'display_shortcode'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
@@ -248,6 +360,7 @@ class QMNQuizManager
|
|
248 |
$quiz_display .= $this->display_end_section($qmn_quiz_options, $qmn_array_for_variables);
|
249 |
$quiz_display .= "<input type='hidden' name='total_questions' id='total_questions' value='".$qmn_total_questions."'/>";
|
250 |
$quiz_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
|
|
|
251 |
$quiz_display .= "<input type='hidden' name='complete_quiz' value='confirmation' />";
|
252 |
$quiz_display = apply_filters('qmn_end_quiz_form', $quiz_display, $qmn_quiz_options, $qmn_array_for_variables);
|
253 |
$quiz_display .= "</form>";
|
@@ -599,7 +712,12 @@ class QMNQuizManager
|
|
599 |
{
|
600 |
$mlw_qm_question_comment = "";
|
601 |
}
|
602 |
-
$
|
|
|
|
|
|
|
|
|
|
|
603 |
}
|
604 |
break;
|
605 |
}
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/**
|
4 |
* This class generates the contents of the quiz shortcode
|
5 |
*
|
32 |
public function add_hooks()
|
33 |
{
|
34 |
add_shortcode('mlw_quizmaster', array($this, 'display_shortcode'));
|
35 |
+
add_action('init', array($this, 'redirect_init'));
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Redirects To Other Page
|
40 |
+
*
|
41 |
+
* Redirects users to admin defined pages if admin has entered pages
|
42 |
+
*
|
43 |
+
* @since 4.2.0
|
44 |
+
* @return void
|
45 |
+
* @uses QMNQuizManager::load_quiz_options
|
46 |
+
* @uses QMNQuizManager::load_questions
|
47 |
+
*/
|
48 |
+
public function redirect_init()
|
49 |
+
{
|
50 |
+
if (isset($_POST["complete_quiz"]) && $_POST["complete_quiz"] == "confirmation")
|
51 |
+
{
|
52 |
+
$quiz_id = intval($_POST["qmn_quiz_id"]);
|
53 |
+
$qmn_options = $this->load_quiz_options($quiz_id);
|
54 |
+
$qmn_quiz_questions = $this->load_questions($quiz_id, $qmn_options, false);
|
55 |
+
if (is_serialized($qmn_options->message_after) && is_array(@unserialize($qmn_options->message_after)))
|
56 |
+
{
|
57 |
+
$mlw_message_after_array = @unserialize($qmn_options->message_after);
|
58 |
+
|
59 |
+
$mlw_points = 0;
|
60 |
+
$mlw_correct = 0;
|
61 |
+
$mlw_total_score = 0;
|
62 |
+
$mlw_question_answers = "";
|
63 |
+
global $mlwQuizMasterNext;
|
64 |
+
isset($_POST["total_questions"]) ? $mlw_total_questions = intval($_POST["total_questions"]) : $mlw_total_questions = 0;
|
65 |
+
isset($_POST["qmn_question_list"]) ? $question_list = explode('Q',$_POST["qmn_question_list"]) : $question_list = array();
|
66 |
+
$qmn_answer_points = 0;
|
67 |
+
$mlw_qmn_answer_array = array();
|
68 |
+
foreach($qmn_quiz_questions as $mlw_question)
|
69 |
+
{
|
70 |
+
foreach($question_list as $question_id)
|
71 |
+
{
|
72 |
+
if ($mlw_question->question_id == $question_id)
|
73 |
+
{
|
74 |
+
$mlw_user_text = "";
|
75 |
+
$mlw_correct_text = "";
|
76 |
+
$qmn_correct = "incorrect";
|
77 |
+
$qmn_answer_points = 0;
|
78 |
+
|
79 |
+
$results_array = $mlwQuizMasterNext->pluginHelper->display_review($mlw_question->question_type_new, $mlw_question->question_id);
|
80 |
+
if (!isset($results_array["null_review"]))
|
81 |
+
{
|
82 |
+
$mlw_points += $results_array["points"];
|
83 |
+
$qmn_answer_points += $results_array["points"];
|
84 |
+
if ($results_array["correct"] == "correct")
|
85 |
+
{
|
86 |
+
$mlw_correct += 1;
|
87 |
+
$qmn_correct = "correct";
|
88 |
+
}
|
89 |
+
}
|
90 |
+
break;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
//Calculate Total Percent Score And Average Points Only If Total Questions Doesn't Equal Zero To Avoid Division By Zero Error
|
96 |
+
if ($mlw_total_questions != 0)
|
97 |
+
{
|
98 |
+
$mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
|
99 |
+
$mlw_average_points = round(($mlw_points/$mlw_total_questions), 2);
|
100 |
+
}
|
101 |
+
else
|
102 |
+
{
|
103 |
+
$mlw_total_score = 0;
|
104 |
+
$mlw_average_points = 0;
|
105 |
+
}
|
106 |
+
|
107 |
+
//Cycle through landing pages
|
108 |
+
foreach($mlw_message_after_array as $mlw_each)
|
109 |
+
{
|
110 |
+
//Check to see if not default
|
111 |
+
if ($mlw_each[0] != 0 || $mlw_each[1] != 0)
|
112 |
+
{
|
113 |
+
//Check to see if points fall in correct range
|
114 |
+
if ($qmn_options->system == 1 && $mlw_points >= $mlw_each[0] && $mlw_points <= $mlw_each[1])
|
115 |
+
{
|
116 |
+
if (esc_url($mlw_each["redirect_url"]) != '')
|
117 |
+
{
|
118 |
+
wp_redirect( esc_url($mlw_each["redirect_url"]) );
|
119 |
+
exit;
|
120 |
+
}
|
121 |
+
break;
|
122 |
+
}
|
123 |
+
//Check to see if score fall in correct range
|
124 |
+
if ($qmn_options->system == 0 && $mlw_total_score >= $mlw_each[0] && $mlw_total_score <= $mlw_each[1])
|
125 |
+
{
|
126 |
+
if (esc_url($mlw_each["redirect_url"]) != '')
|
127 |
+
{
|
128 |
+
wp_redirect( esc_url($mlw_each["redirect_url"]) );
|
129 |
+
exit;
|
130 |
+
}
|
131 |
+
break;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
else
|
135 |
+
{
|
136 |
+
if (esc_url($mlw_each["redirect_url"]) != '')
|
137 |
+
{
|
138 |
+
wp_redirect( esc_url($mlw_each["redirect_url"]) );
|
139 |
+
exit;
|
140 |
+
}
|
141 |
+
break;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
}
|
147 |
|
148 |
/**
|
360 |
$quiz_display .= $this->display_end_section($qmn_quiz_options, $qmn_array_for_variables);
|
361 |
$quiz_display .= "<input type='hidden' name='total_questions' id='total_questions' value='".$qmn_total_questions."'/>";
|
362 |
$quiz_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
|
363 |
+
$quiz_display .= "<input type='hidden' name='qmn_quiz_id' id='qmn_quiz_id' value='".$qmn_array_for_variables["quiz_id"]."'/>";
|
364 |
$quiz_display .= "<input type='hidden' name='complete_quiz' value='confirmation' />";
|
365 |
$quiz_display = apply_filters('qmn_end_quiz_form', $quiz_display, $qmn_quiz_options, $qmn_array_for_variables);
|
366 |
$quiz_display .= "</form>";
|
712 |
{
|
713 |
$mlw_qm_question_comment = "";
|
714 |
}
|
715 |
+
$question_text = $mlw_question->question_name;
|
716 |
+
if (isset($results_array["question_text"]))
|
717 |
+
{
|
718 |
+
$question_text = $results_array["question_text"];
|
719 |
+
}
|
720 |
+
$mlw_qmn_answer_array[] = apply_filters('qmn_answer_array', array($question_text, htmlspecialchars($mlw_user_text, ENT_QUOTES), htmlspecialchars($mlw_correct_text, ENT_QUOTES), htmlspecialchars(stripslashes($mlw_qm_question_comment), ENT_QUOTES), "correct" => $qmn_correct, "id" => $mlw_question->question_id, "points" => $qmn_answer_points, "category" => $mlw_question->category), $qmn_quiz_options, $qmn_array_for_variables);
|
721 |
}
|
722 |
break;
|
723 |
}
|
includes/qmn_quiz_admin.php
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
function mlw_generate_quiz_admin()
|
3 |
{
|
|
|
|
|
|
|
|
|
4 |
global $wpdb;
|
5 |
global $mlwQuizMasterNext;
|
6 |
$table_name = $wpdb->prefix . "mlw_quizzes";
|
@@ -288,6 +293,7 @@ function mlw_generate_quiz_admin()
|
|
288 |
<tr>
|
289 |
<th>Quiz ID</th>
|
290 |
<th><?php _e('Quiz Name', 'quiz-master-next'); ?></th>
|
|
|
291 |
<th><?php _e('Quiz Shortcode', 'quiz-master-next'); ?></th>
|
292 |
<th><?php _e('Leaderboard Shortcode', 'quiz-master-next'); ?></th>
|
293 |
<th><?php _e('Quiz Views', 'quiz-master-next'); ?></th>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function mlw_generate_quiz_admin()
|
4 |
{
|
5 |
+
if ( !current_user_can('moderate_comments') )
|
6 |
+
{
|
7 |
+
return;
|
8 |
+
}
|
9 |
global $wpdb;
|
10 |
global $mlwQuizMasterNext;
|
11 |
$table_name = $wpdb->prefix . "mlw_quizzes";
|
293 |
<tr>
|
294 |
<th>Quiz ID</th>
|
295 |
<th><?php _e('Quiz Name', 'quiz-master-next'); ?></th>
|
296 |
+
<th><?php _e('URL', 'quiz-master-next'); ?></th>
|
297 |
<th><?php _e('Quiz Shortcode', 'quiz-master-next'); ?></th>
|
298 |
<th><?php _e('Leaderboard Shortcode', 'quiz-master-next'); ?></th>
|
299 |
<th><?php _e('Quiz Views', 'quiz-master-next'); ?></th>
|
includes/qmn_quiz_creator.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* QMN Quiz Creator Class
|
4 |
*
|
@@ -619,6 +620,17 @@ class QMNQuizCreator
|
|
619 |
$mlw_new_id = $wpdb->insert_id;
|
620 |
if ($results != false)
|
621 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been duplicated successfully.', 'quiz-master-next'), 'success');
|
623 |
|
624 |
//Insert Action Into Audit Trail
|
@@ -629,6 +641,7 @@ class QMNQuizCreator
|
|
629 |
"(trail_id, action_user, action, time) " .
|
630 |
"VALUES (NULL , '" . $current_user->display_name . "' , 'New Quiz Has Been Created: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
631 |
$results = $wpdb->query( $insert );
|
|
|
632 |
}
|
633 |
else
|
634 |
{
|
@@ -689,7 +702,7 @@ class QMNQuizCreator
|
|
689 |
'%d',
|
690 |
'%s',
|
691 |
'%d',
|
692 |
-
'%
|
693 |
'%s',
|
694 |
'%s',
|
695 |
'%d'
|
@@ -701,7 +714,6 @@ class QMNQuizCreator
|
|
701 |
}
|
702 |
}
|
703 |
}
|
704 |
-
do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
|
705 |
}
|
706 |
}
|
707 |
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/**
|
4 |
* QMN Quiz Creator Class
|
5 |
*
|
620 |
$mlw_new_id = $wpdb->insert_id;
|
621 |
if ($results != false)
|
622 |
{
|
623 |
+
global $current_user;
|
624 |
+
get_currentuserinfo();
|
625 |
+
$quiz_post = array(
|
626 |
+
'post_title' => $quiz_name,
|
627 |
+
'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
|
628 |
+
'post_status' => 'publish',
|
629 |
+
'post_author' => $current_user->ID,
|
630 |
+
'post_type' => 'quiz'
|
631 |
+
);
|
632 |
+
$quiz_post_id = wp_insert_post( $quiz_post );
|
633 |
+
add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
|
634 |
$mlwQuizMasterNext->alertManager->newAlert(__('Your quiz has been duplicated successfully.', 'quiz-master-next'), 'success');
|
635 |
|
636 |
//Insert Action Into Audit Trail
|
641 |
"(trail_id, action_user, action, time) " .
|
642 |
"VALUES (NULL , '" . $current_user->display_name . "' , 'New Quiz Has Been Created: ".$quiz_name."' , '" . date("h:i:s A m/d/Y") . "')";
|
643 |
$results = $wpdb->query( $insert );
|
644 |
+
do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
|
645 |
}
|
646 |
else
|
647 |
{
|
702 |
'%d',
|
703 |
'%s',
|
704 |
'%d',
|
705 |
+
'%s',
|
706 |
'%s',
|
707 |
'%s',
|
708 |
'%d'
|
714 |
}
|
715 |
}
|
716 |
}
|
|
|
717 |
}
|
718 |
}
|
719 |
?>
|
includes/qmn_quiz_install.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
These functions are used for installing and uninstalling all necessary databases, options, page, etc.. for the plugin to work properly.
|
4 |
*/
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
These functions are used for installing and uninstalling all necessary databases, options, page, etc.. for the plugin to work properly.
|
5 |
*/
|
includes/qmn_quiz_options.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This page allows for the editing of quizzes selected from the quiz admin page.
|
4 |
*/
|
@@ -8,6 +9,10 @@ Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
|
8 |
|
9 |
function mlw_generate_quiz_options()
|
10 |
{
|
|
|
|
|
|
|
|
|
11 |
global $wpdb;
|
12 |
global $mlwQuizMasterNext;
|
13 |
$tab_array = $mlwQuizMasterNext->pluginHelper->get_settings_tabs();
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This page allows for the editing of quizzes selected from the quiz admin page.
|
5 |
*/
|
9 |
|
10 |
function mlw_generate_quiz_options()
|
11 |
{
|
12 |
+
if ( !current_user_can('moderate_comments') )
|
13 |
+
{
|
14 |
+
return;
|
15 |
+
}
|
16 |
global $wpdb;
|
17 |
global $mlwQuizMasterNext;
|
18 |
$tab_array = $mlwQuizMasterNext->pluginHelper->get_settings_tabs();
|
includes/qmn_results.php
CHANGED
@@ -1,7 +1,11 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
function mlw_generate_quiz_results()
|
4 |
{
|
|
|
|
|
|
|
|
|
5 |
global $wpdb;
|
6 |
global $mlwQuizMasterNext;
|
7 |
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
function mlw_generate_quiz_results()
|
4 |
{
|
5 |
+
if ( !current_user_can('moderate_comments') )
|
6 |
+
{
|
7 |
+
return;
|
8 |
+
}
|
9 |
global $wpdb;
|
10 |
global $mlwQuizMasterNext;
|
11 |
|
includes/qmn_results_details.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This page allows for the viewing of the quiz results.
|
4 |
*/
|
@@ -8,6 +9,10 @@ Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
|
8 |
|
9 |
function mlw_generate_result_details()
|
10 |
{
|
|
|
|
|
|
|
|
|
11 |
global $mlwQuizMasterNext;
|
12 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'results';
|
13 |
$tab_array = $mlwQuizMasterNext->pluginHelper->get_results_tabs();
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This page allows for the viewing of the quiz results.
|
5 |
*/
|
9 |
|
10 |
function mlw_generate_result_details()
|
11 |
{
|
12 |
+
if ( !current_user_can('moderate_comments') )
|
13 |
+
{
|
14 |
+
return;
|
15 |
+
}
|
16 |
global $mlwQuizMasterNext;
|
17 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'results';
|
18 |
$tab_array = $mlwQuizMasterNext->pluginHelper->get_results_tabs();
|
includes/qmn_template_variables.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
|
4 |
Results Array For Reference:
|
@@ -43,10 +44,78 @@ add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_comments'
|
|
43 |
add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer',10,2);
|
44 |
add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date',10,2);
|
45 |
add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_certificate_link',10,2);
|
|
|
|
|
46 |
|
47 |
add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
|
48 |
add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_date',10,2);
|
49 |
add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user',10,2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
function mlw_qmn_variable_point_score($content, $mlw_quiz_array)
|
51 |
{
|
52 |
$content = str_replace( "%POINT_SCORE%" , $mlw_quiz_array["total_points"], $content);
|
@@ -113,7 +182,7 @@ function mlw_qmn_variable_user_email($content, $mlw_quiz_array)
|
|
113 |
}
|
114 |
function mlw_qmn_variable_question_answers($content, $mlw_quiz_array)
|
115 |
{
|
116 |
-
while (strpos($content, '%QUESTIONS_ANSWERS%')
|
117 |
{
|
118 |
global $wpdb;
|
119 |
$display = '';
|
@@ -176,7 +245,7 @@ function mlw_qmn_variable_certificate_link($content, $mlw_quiz_array)
|
|
176 |
function qmn_variable_category_points($content, $mlw_quiz_array)
|
177 |
{
|
178 |
$return_points = 0;
|
179 |
-
while (strpos($content, '%CATEGORY_POINTS%')
|
180 |
{
|
181 |
$return_points = 0;
|
182 |
preg_match("~%CATEGORY_POINTS%(.*?)%/CATEGORY_POINTS%~i",$content,$answer_text);
|
@@ -207,7 +276,7 @@ function qmn_variable_category_score($content, $mlw_quiz_array)
|
|
207 |
$return_score = 0;
|
208 |
$total_questions = 0;
|
209 |
$amount_correct = 0;
|
210 |
-
while (strpos($content, '%CATEGORY_SCORE%')
|
211 |
{
|
212 |
$return_score = 0;
|
213 |
$total_questions = 0;
|
@@ -254,7 +323,7 @@ function qmn_variable_category_average_score($content, $mlw_quiz_array)
|
|
254 |
$total_categories = 0;
|
255 |
$total_score = 0;
|
256 |
$category_scores = array();
|
257 |
-
while (strpos($content, '%CATEGORY_AVERAGE_SCORE%')
|
258 |
{
|
259 |
foreach ($mlw_quiz_array['question_answers_array'] as $answer)
|
260 |
{
|
@@ -306,7 +375,7 @@ function qmn_variable_category_average_points($content, $mlw_quiz_array)
|
|
306 |
$total_categories = 0;
|
307 |
$total_points = 0;
|
308 |
$category_scores = array();
|
309 |
-
while (strpos($content, '%CATEGORY_AVERAGE_POINTS%')
|
310 |
{
|
311 |
foreach ($mlw_quiz_array['question_answers_array'] as $answer)
|
312 |
{
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
|
5 |
Results Array For Reference:
|
44 |
add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer',10,2);
|
45 |
add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date',10,2);
|
46 |
add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_certificate_link',10,2);
|
47 |
+
add_filter('mlw_qmn_template_variable_results_page', 'qmn_variable_facebook_share',10,2);
|
48 |
+
add_filter('mlw_qmn_template_variable_results_page', 'qmn_variable_twitter_share',10,2);
|
49 |
|
50 |
add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
|
51 |
add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_date',10,2);
|
52 |
add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user',10,2);
|
53 |
+
|
54 |
+
function qmn_variable_facebook_share($content, $mlw_quiz_array)
|
55 |
+
{
|
56 |
+
while (strpos($content, '%FACEBOOK_SHARE%') !== false)
|
57 |
+
{
|
58 |
+
wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( 'js/qmn_social_share.js' , __FILE__ ) );
|
59 |
+
$settings = (array) get_option( 'qmn-settings' );
|
60 |
+
$facebook_app_id = '483815031724529';
|
61 |
+
if (isset($settings['facebook_app_id']))
|
62 |
+
{
|
63 |
+
$facebook_app_id = esc_js( $settings['facebook_app_id'] );
|
64 |
+
}
|
65 |
+
|
66 |
+
global $wpdb;
|
67 |
+
$qmn_quiz_options = $wpdb->get_row($wpdb->prepare('SELECT social_media_text FROM '.$wpdb->prefix.'mlw_quizzes WHERE quiz_id=%d AND deleted=0', $mlw_quiz_array['quiz_id']));
|
68 |
+
|
69 |
+
//Load Social Media Text
|
70 |
+
$qmn_social_media_text = "";
|
71 |
+
if (is_serialized($qmn_quiz_options->social_media_text) && is_array(@unserialize($qmn_quiz_options->social_media_text)))
|
72 |
+
{
|
73 |
+
$qmn_social_media_text = @unserialize($qmn_quiz_options->social_media_text);
|
74 |
+
}
|
75 |
+
else
|
76 |
+
{
|
77 |
+
$qmn_social_media_text = array(
|
78 |
+
'twitter' => $qmn_quiz_options->social_media_text,
|
79 |
+
'facebook' => $qmn_quiz_options->social_media_text
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
$qmn_social_media_text["facebook"] = apply_filters( 'mlw_qmn_template_variable_results_page', $qmn_social_media_text["facebook"], $mlw_quiz_array);
|
84 |
+
$social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"mlw_qmn_share('facebook', '".esc_js($qmn_social_media_text["facebook"])."', '".esc_js($mlw_quiz_array["quiz_name"])."', '$facebook_app_id');\">Facebook</a>";
|
85 |
+
$content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
|
86 |
+
}
|
87 |
+
return $content;
|
88 |
+
}
|
89 |
+
|
90 |
+
function qmn_variable_twitter_share($content, $mlw_quiz_array)
|
91 |
+
{
|
92 |
+
while (strpos($content, '%TWITTER_SHARE%') !== false)
|
93 |
+
{
|
94 |
+
wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( 'js/qmn_social_share.js' , __FILE__ ) );
|
95 |
+
|
96 |
+
global $wpdb;
|
97 |
+
$qmn_quiz_options = $wpdb->get_row($wpdb->prepare('SELECT social_media_text FROM '.$wpdb->prefix.'mlw_quizzes WHERE quiz_id=%d AND deleted=0', $mlw_quiz_array['quiz_id']));
|
98 |
+
|
99 |
+
//Load Social Media Text
|
100 |
+
$qmn_social_media_text = "";
|
101 |
+
if (is_serialized($qmn_quiz_options->social_media_text) && is_array(@unserialize($qmn_quiz_options->social_media_text)))
|
102 |
+
{
|
103 |
+
$qmn_social_media_text = @unserialize($qmn_quiz_options->social_media_text);
|
104 |
+
}
|
105 |
+
else
|
106 |
+
{
|
107 |
+
$qmn_social_media_text = array(
|
108 |
+
'twitter' => $qmn_quiz_options->social_media_text,
|
109 |
+
'facebook' => $qmn_quiz_options->social_media_text
|
110 |
+
);
|
111 |
+
}
|
112 |
+
|
113 |
+
$qmn_social_media_text["twitter"] = apply_filters( 'mlw_qmn_template_variable_results_page', $qmn_social_media_text["twitter"], $mlw_quiz_array);
|
114 |
+
$social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"mlw_qmn_share('twitter', '".esc_js($qmn_social_media_text["twitter"])."', '".esc_js($mlw_quiz_array["quiz_name"])."');\">Twitter</a>";
|
115 |
+
$content = str_replace( "%TWITTER_SHARE%" , $social_display, $content);
|
116 |
+
}
|
117 |
+
return $content;
|
118 |
+
}
|
119 |
function mlw_qmn_variable_point_score($content, $mlw_quiz_array)
|
120 |
{
|
121 |
$content = str_replace( "%POINT_SCORE%" , $mlw_quiz_array["total_points"], $content);
|
182 |
}
|
183 |
function mlw_qmn_variable_question_answers($content, $mlw_quiz_array)
|
184 |
{
|
185 |
+
while (strpos($content, '%QUESTIONS_ANSWERS%') !== false)
|
186 |
{
|
187 |
global $wpdb;
|
188 |
$display = '';
|
245 |
function qmn_variable_category_points($content, $mlw_quiz_array)
|
246 |
{
|
247 |
$return_points = 0;
|
248 |
+
while (strpos($content, '%CATEGORY_POINTS%') !== false)
|
249 |
{
|
250 |
$return_points = 0;
|
251 |
preg_match("~%CATEGORY_POINTS%(.*?)%/CATEGORY_POINTS%~i",$content,$answer_text);
|
276 |
$return_score = 0;
|
277 |
$total_questions = 0;
|
278 |
$amount_correct = 0;
|
279 |
+
while (strpos($content, '%CATEGORY_SCORE%') !== false)
|
280 |
{
|
281 |
$return_score = 0;
|
282 |
$total_questions = 0;
|
323 |
$total_categories = 0;
|
324 |
$total_score = 0;
|
325 |
$category_scores = array();
|
326 |
+
while (strpos($content, '%CATEGORY_AVERAGE_SCORE%') !== false)
|
327 |
{
|
328 |
foreach ($mlw_quiz_array['question_answers_array'] as $answer)
|
329 |
{
|
375 |
$total_categories = 0;
|
376 |
$total_points = 0;
|
377 |
$category_scores = array();
|
378 |
+
while (strpos($content, '%CATEGORY_AVERAGE_POINTS%') !== false)
|
379 |
{
|
380 |
foreach ($mlw_quiz_array['question_answers_array'] as $answer)
|
381 |
{
|
includes/qmn_tools.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This page creates the main dashboard for the Quiz Master Next plugin
|
4 |
*/
|
@@ -8,6 +9,10 @@ Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
|
|
8 |
|
9 |
function mlw_generate_quiz_tools()
|
10 |
{
|
|
|
|
|
|
|
|
|
11 |
add_meta_box("qmn_restore_box", 'Restore Quiz', "qmn_restore_function", "quiz_wpss");
|
12 |
add_meta_box("qmn_audit_box", 'Audit Trail', "mlw_tools_box", "quiz_wpss");
|
13 |
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This page creates the main dashboard for the Quiz Master Next plugin
|
5 |
*/
|
9 |
|
10 |
function mlw_generate_quiz_tools()
|
11 |
{
|
12 |
+
if ( !current_user_can('moderate_comments') )
|
13 |
+
{
|
14 |
+
return;
|
15 |
+
}
|
16 |
add_meta_box("qmn_restore_box", 'Restore Quiz', "qmn_restore_function", "quiz_wpss");
|
17 |
add_meta_box("qmn_audit_box", 'Audit Trail', "mlw_tools_box", "quiz_wpss");
|
18 |
?>
|
includes/qmn_update.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This is the update function for the plugin. When the plugin gets updated, the database changes are done here. This function is placed in the init of wordpress.
|
4 |
*/
|
@@ -6,6 +7,10 @@ function mlw_quiz_update()
|
|
6 |
{
|
7 |
global $mlwQuizMasterNext;
|
8 |
$data = $mlwQuizMasterNext->version;
|
|
|
|
|
|
|
|
|
9 |
if ( ! get_option('mlw_quiz_master_version'))
|
10 |
{
|
11 |
add_option('mlw_quiz_master_version' , $data);
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This is the update function for the plugin. When the plugin gets updated, the database changes are done here. This function is placed in the init of wordpress.
|
5 |
*/
|
7 |
{
|
8 |
global $mlwQuizMasterNext;
|
9 |
$data = $mlwQuizMasterNext->version;
|
10 |
+
if ( ! get_option('qmn_original_version'))
|
11 |
+
{
|
12 |
+
add_option('qmn_original_version' , $data);
|
13 |
+
}
|
14 |
if ( ! get_option('mlw_quiz_master_version'))
|
15 |
{
|
16 |
add_option('mlw_quiz_master_version' , $data);
|
includes/qmn_usage_tracking.php
CHANGED
@@ -105,9 +105,7 @@ class QMNTracking
|
|
105 |
) );
|
106 |
if ( is_wp_error( $response ) ) {
|
107 |
$error_message = $response->get_error_message();
|
108 |
-
echo "Something went wrong: $error_message";
|
109 |
-
} else {
|
110 |
-
echo "**Message Sent**";
|
111 |
}
|
112 |
}
|
113 |
|
105 |
) );
|
106 |
if ( is_wp_error( $response ) ) {
|
107 |
$error_message = $response->get_error_message();
|
108 |
+
echo "Something went wrong with QMN Usage Tracker: $error_message";
|
|
|
|
|
109 |
}
|
110 |
}
|
111 |
|
includes/qmn_widgets.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
This is the file that contains all the widgets for the plugin
|
4 |
*/
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
/*
|
4 |
This is the file that contains all the widgets for the plugin
|
5 |
*/
|
index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
die("Error: Unauthorized Access");
|
4 |
+
?>
|
languages/index.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
die("Error: Unauthorized Access");
|
|
|
4 |
?>
|
languages/quiz-master-next-da_DK.mo
ADDED
Binary file
|
languages/quiz-master-next-da_DK.po
ADDED
@@ -0,0 +1,1508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|