Version Description
(January 31, 2019) = * Closed Enhancement: Create new alert system on quiz options page (Issue #754) * Closed Bug: No access allowed when clicking "Support" from plugins page (Issue #753) * Closed Bug: To many redirects (Issue #745) * Closed User Request: Allow default email to be deleted or turned off (Issue #735) * Closed Enhancement: Rewrite emails to allow for different conditions (Issue #379) * Closed Enhancement: Rewrite results pages to allow for different conditions (Issue #378)
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 6.2.0 |
Comparing to | |
See all releases |
Code changes from version 6.1.2 to 6.2.0
- CHANGELOG.md +23 -0
- css/qsm-admin.css +154 -0
- js/admin.js +52 -20
- js/qsm-admin-emails.js +133 -0
- js/qsm-admin-question.js +17 -35
- js/qsm-admin-results.js +133 -0
- js/qsm-admin.js +13 -13
- js/qsm-quiz.js +1 -1
- mlw_quizmaster2.php +9 -14
- php/admin/about-page.php +23 -17
- php/admin/admin-results-page.php +1 -1
- php/admin/help-page.php +63 -61
- php/admin/options-page-email-tab.php +93 -473
- php/admin/options-page-option-tab.php +17 -16
- php/admin/options-page-preview-tab.php +25 -23
- php/admin/options-page-questions-tab.php +1 -9
- php/admin/options-page-results-page-tab.php +98 -207
- php/admin/options-page-style-tab.php +42 -44
- php/admin/quiz-options-page.php +81 -59
- php/admin/quizzes-page.php +23 -21
- php/admin/settings-page.php +37 -1
- php/admin/stats-page.php +1 -1
- php/admin/tools-page.php +130 -150
- php/adverts-generate.php +37 -41
- php/classes/class-qmn-quiz-manager.php +48 -135
- php/classes/class-qsm-emails.php +468 -0
- php/classes/class-qsm-install.php +5 -12
- php/classes/class-qsm-results-pages.php +350 -0
- php/classes/class-qsm-settings.php +30 -19
- php/rest-api.php +120 -0
- readme.txt +9 -24
CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 5.3.2 (June 7, 2018) =
|
2 |
* Closed Plugin Compatibility: Conflict with Divi Builder ([Issue #686](https://github.com/fpcorso/quiz_master_next/issues/686))
|
3 |
|
1 |
+
= 6.0.4 (October 2, 2018) =
|
2 |
+
* Changes links from old documentation to newer documentation
|
3 |
+
|
4 |
+
= 6.0.3 (August 20, 2018) =
|
5 |
+
* Closed Bug: User gets 'trapped' if timer runs out on required question when questions are paginated ([Issue #583](https://github.com/fpcorso/quiz_master_next/issues/583))
|
6 |
+
* Closed Bug: If user refreshes quiz page when timer is at 0, cannot submit ([Issue #501](https://github.com/fpcorso/quiz_master_next/issues/501))
|
7 |
+
* Closed Bug: Saving quiz name when editing results in error if no changes are made ([Issue #391](https://github.com/fpcorso/quiz_master_next/issues/391))
|
8 |
+
* Adds deprecated notice to the quiz setting functions found in the quizCreator object
|
9 |
+
* Adds hook after results are stored in the database
|
10 |
+
|
11 |
+
= 6.0.2 (July 18, 2018) =
|
12 |
+
* Closed Bug: PHP warning thrown on Help page ([Issue #711](https://github.com/fpcorso/quiz_master_next/issues/711))
|
13 |
+
* Closed Bug: Timer not working on certain sites when using questions per page option ([Issue #709](https://github.com/fpcorso/quiz_master_next/issues/709))
|
14 |
+
* Closed Bug: Blank page shown when contact fields and message fields are empty ([Issue #707](https://github.com/fpcorso/quiz_master_next/issues/707))
|
15 |
+
|
16 |
+
= 6.0.1 (July 11, 2018) =
|
17 |
+
* Closed Bug: Quiz comment box shows HTML in label when using newer pagination system ([Issue #704](https://github.com/fpcorso/quiz_master_next/issues/704))
|
18 |
+
|
19 |
+
= 6.0.0 (June 20, 2018) =
|
20 |
+
* Closed Enhancement: Remove Tools tab ([Issue #689](https://github.com/fpcorso/quiz_master_next/issues/689))
|
21 |
+
* Closed Enhancement: Bump Minimum PHP Version To 5.4 ([Issue #607](https://github.com/fpcorso/quiz_master_next/issues/607))
|
22 |
+
* Closed Enhancement: Move Leaderboards to free addon ([Issue #380](https://github.com/fpcorso/quiz_master_next/issues/380))
|
23 |
+
|
24 |
= 5.3.2 (June 7, 2018) =
|
25 |
* Closed Plugin Compatibility: Conflict with Divi Builder ([Issue #686](https://github.com/fpcorso/quiz_master_next/issues/686))
|
26 |
|
css/qsm-admin.css
CHANGED
@@ -87,6 +87,142 @@ Options Page
|
|
87 |
font-weight: bold;
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
/********************
|
91 |
Quiz Styles Tab
|
92 |
*********************/
|
@@ -255,6 +391,18 @@ Help Page
|
|
255 |
Misc.
|
256 |
*********************/
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
/* Info Bar */
|
260 |
.qsm-info-box {
|
@@ -290,6 +438,12 @@ Misc.
|
|
290 |
transform: scale(1.1);
|
291 |
}
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
/* Popup */
|
294 |
|
295 |
.qsm-popup {
|
87 |
font-weight: bold;
|
88 |
}
|
89 |
|
90 |
+
/********************
|
91 |
+
Results Pages & Emails Tab
|
92 |
+
*********************/
|
93 |
+
.results-page,
|
94 |
+
.email {
|
95 |
+
width: 100%;
|
96 |
+
background-color: #0d97d8;
|
97 |
+
margin: 20px 0;
|
98 |
+
padding-bottom: 15px;
|
99 |
+
box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.4)
|
100 |
+
}
|
101 |
+
|
102 |
+
.results-page-header,
|
103 |
+
.email-header {
|
104 |
+
display: flex;
|
105 |
+
align-items: center;
|
106 |
+
justify-content: flex-end;
|
107 |
+
background-color: #fff;
|
108 |
+
padding: 10px 35px;
|
109 |
+
border-bottom: 5px solid #1DD969;
|
110 |
+
}
|
111 |
+
|
112 |
+
.delete-page-button,
|
113 |
+
.delete-email-button {
|
114 |
+
background: none;
|
115 |
+
border: none;
|
116 |
+
color: #1DD969;
|
117 |
+
cursor: pointer;
|
118 |
+
transition-duration: 200ms;
|
119 |
+
}
|
120 |
+
|
121 |
+
.delete-page-button:hover,
|
122 |
+
.delete-email-button:hover {
|
123 |
+
transform: scale(1.2);
|
124 |
+
}
|
125 |
+
|
126 |
+
.results-page-content,
|
127 |
+
.email-content {
|
128 |
+
display: flex;
|
129 |
+
flex-direction: column;
|
130 |
+
}
|
131 |
+
|
132 |
+
.results-page-when,
|
133 |
+
.results-page-show,
|
134 |
+
.email-when,
|
135 |
+
.email-show {
|
136 |
+
padding: 10px;
|
137 |
+
background-color: #fff;
|
138 |
+
border: 5px solid #1DD969;
|
139 |
+
margin: 15px 0;
|
140 |
+
min-width: 60%;
|
141 |
+
}
|
142 |
+
|
143 |
+
.results-page-content-header,
|
144 |
+
.email-content-header {
|
145 |
+
margin-bottom: 10px;
|
146 |
+
}
|
147 |
+
|
148 |
+
.results-page-content-header h4,
|
149 |
+
.results-page-content-header p,
|
150 |
+
.email-content-header h4,
|
151 |
+
.email-content-header p {
|
152 |
+
margin: 0;
|
153 |
+
}
|
154 |
+
|
155 |
+
.results-page-condition,
|
156 |
+
.email-condition {
|
157 |
+
display: flex;
|
158 |
+
flex-direction: column;
|
159 |
+
margin-bottom: 15px;
|
160 |
+
justify-content: space-around;
|
161 |
+
}
|
162 |
+
|
163 |
+
.results-page-condition > select,
|
164 |
+
.results-page-condition > input,
|
165 |
+
.email-condition > select,
|
166 |
+
.email-condition > input {
|
167 |
+
max-width: 100%;
|
168 |
+
}
|
169 |
+
|
170 |
+
.delete-condition-button {
|
171 |
+
background: none;
|
172 |
+
border: 1px solid #1DD969;
|
173 |
+
color: #1DD969;
|
174 |
+
cursor: pointer;
|
175 |
+
transition-duration: 200ms;
|
176 |
+
padding: 6px;
|
177 |
+
}
|
178 |
+
|
179 |
+
.delete-condition-button:hover {
|
180 |
+
transform: scale(1.1);
|
181 |
+
}
|
182 |
+
|
183 |
+
.email-show .label {
|
184 |
+
display: block;
|
185 |
+
}
|
186 |
+
|
187 |
+
.results-page-show textarea,
|
188 |
+
.to-email,
|
189 |
+
.subject,
|
190 |
+
.email-template {
|
191 |
+
width: 100%;
|
192 |
+
margin-bottom: 10px;
|
193 |
+
}
|
194 |
+
|
195 |
+
@media screen and (min-width: 760px) {
|
196 |
+
.results-page-content,
|
197 |
+
.email-content {
|
198 |
+
flex-direction: row;
|
199 |
+
justify-content: space-around;
|
200 |
+
}
|
201 |
+
|
202 |
+
.results-page-when,
|
203 |
+
.results-page-show,
|
204 |
+
.email-when,
|
205 |
+
.email-show {
|
206 |
+
min-width: 35%;
|
207 |
+
}
|
208 |
+
|
209 |
+
.results-page-condition,
|
210 |
+
.email-condition {
|
211 |
+
align-items: center;
|
212 |
+
flex-direction: row;
|
213 |
+
}
|
214 |
+
.results-page-condition > select,
|
215 |
+
.results-page-condition > input,
|
216 |
+
.email-condition > select,
|
217 |
+
.email-condition > input {
|
218 |
+
max-width: 30%;
|
219 |
+
}
|
220 |
+
|
221 |
+
.delete-condition-button {
|
222 |
+
border: none;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
/********************
|
227 |
Quiz Styles Tab
|
228 |
*********************/
|
391 |
Misc.
|
392 |
*********************/
|
393 |
|
394 |
+
/* Ads */
|
395 |
+
.help-decide {
|
396 |
+
display: block;
|
397 |
+
text-align:center;
|
398 |
+
background: #fff;
|
399 |
+
border: 5px solid #1DD969;
|
400 |
+
color: #000;
|
401 |
+
font-weight: bold;
|
402 |
+
}
|
403 |
+
.help-decide p {
|
404 |
+
font-size: 14px;
|
405 |
+
}
|
406 |
|
407 |
/* Info Bar */
|
408 |
.qsm-info-box {
|
438 |
transform: scale(1.1);
|
439 |
}
|
440 |
|
441 |
+
/* Options tabs */
|
442 |
+
.qsm_tab_content,
|
443 |
+
.mlw_tab_content {
|
444 |
+
padding: 10px 10px 10px 10px;
|
445 |
+
}
|
446 |
+
|
447 |
/* Popup */
|
448 |
|
449 |
.qsm-popup {
|
js/admin.js
CHANGED
@@ -1,24 +1,56 @@
|
|
1 |
-
|
|
|
|
|
2 |
var QSMAdmin;
|
3 |
(function ($) {
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
});
|
|
|
|
1 |
+
/**
|
2 |
+
* Main admin file for functions to be used across many QSM admin pages.
|
3 |
+
*/
|
4 |
var QSMAdmin;
|
5 |
(function ($) {
|
6 |
|
7 |
+
QSMAdmin = {
|
8 |
+
/**
|
9 |
+
* Catches an error from a jQuery function (i.e. $.ajax())
|
10 |
+
*/
|
11 |
+
displayjQueryError: function( jqXHR, textStatus, errorThrown ) {
|
12 |
+
QSMAdmin.displayAlert( 'Error: ' + errorThrown + '! Please try again.', 'error' );
|
13 |
+
},
|
14 |
+
/**
|
15 |
+
* Catches an error from a BackBone function (i.e. model.save())
|
16 |
+
*/
|
17 |
+
displayError: function( jqXHR, textStatus, errorThrown ) {
|
18 |
+
QSMAdmin.displayAlert( 'Error: ' + errorThrown.errorThrown + '! Please try again.', 'error' );
|
19 |
+
},
|
20 |
+
/**
|
21 |
+
* Displays an alert within the "Quiz Settings" page
|
22 |
+
*
|
23 |
+
* @param string message The message of the alert
|
24 |
+
* @param string type The type of alert. Choose from 'error', 'info', 'success', and 'warning'
|
25 |
+
*/
|
26 |
+
displayAlert: function( message, type ) {
|
27 |
+
QSMAdmin.clearAlerts();
|
28 |
+
var template = wp.template( 'notice' );
|
29 |
+
var data = {
|
30 |
+
message: message,
|
31 |
+
type: type
|
32 |
+
};
|
33 |
+
$( '.qsm-alerts' ).append( template( data ) );
|
34 |
+
},
|
35 |
+
clearAlerts: function() {
|
36 |
+
$( '.qsm-alerts' ).empty();
|
37 |
+
},
|
38 |
+
selectTab: function( tab ) {
|
39 |
+
$( '.qsm-tab' ).removeClass( 'nav-tab-active' );
|
40 |
+
$( '.qsm-tab-content' ).hide();
|
41 |
+
tab.addClass( 'nav-tab-active' );
|
42 |
+
tabID = tab.data( 'tab' );
|
43 |
+
$( '.tab-' + tabID ).show();
|
44 |
+
}
|
45 |
+
};
|
46 |
+
$(function() {
|
47 |
+
$( '.qsm-tab' ).on( 'click', function( event ) {
|
48 |
+
event.preventDefault();
|
49 |
+
QSMAdmin.selectTab( $( this ) );
|
50 |
+
});
|
51 |
|
52 |
+
$( '#qmn_check_all' ).change( function() {
|
53 |
+
$( '.qmn_delete_checkbox' ).prop( 'checked', jQuery( '#qmn_check_all' ).prop( 'checked' ) );
|
54 |
+
});
|
55 |
+
});
|
56 |
+
}(jQuery));
|
js/qsm-admin-emails.js
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* QSM - Admin emails
|
3 |
+
*/
|
4 |
+
|
5 |
+
var QSMAdminEmails;
|
6 |
+
(function ($) {
|
7 |
+
QSMAdminEmails = {
|
8 |
+
total: 0,
|
9 |
+
saveEmails: function() {
|
10 |
+
QSMAdmin.displayAlert( 'Saving emails...', 'info' );
|
11 |
+
var emails = [];
|
12 |
+
var email = {};
|
13 |
+
$( '.email' ).each( function() {
|
14 |
+
email = {
|
15 |
+
'conditions': [],
|
16 |
+
'to': $( this ).find( '.to-email' ).val(),
|
17 |
+
'subject': $( this ).find( '.subject' ).val(),
|
18 |
+
'content': wp.editor.getContent( $( this ).find( '.email-template' ).attr( 'id' ) ),
|
19 |
+
'replyTo': $( this ).find( '.reply-to' ).prop( 'checked' ),
|
20 |
+
};
|
21 |
+
$( this ).find( '.email-condition' ).each( function() {
|
22 |
+
email.conditions.push({
|
23 |
+
'criteria': $( this ).children( '.email-condition-criteria' ).val(),
|
24 |
+
'operator': $( this ).children( '.email-condition-operator' ).val(),
|
25 |
+
'value': $( this ).children( '.email-condition-value' ).val()
|
26 |
+
});
|
27 |
+
});
|
28 |
+
emails.push( email );
|
29 |
+
});
|
30 |
+
var data = {
|
31 |
+
'emails': emails
|
32 |
+
}
|
33 |
+
$.ajax({
|
34 |
+
url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmEmailsObject.quizID + '/emails',
|
35 |
+
method: 'POST',
|
36 |
+
data: data,
|
37 |
+
headers: { 'X-WP-Nonce': qsmEmailsObject.nonce },
|
38 |
+
})
|
39 |
+
.done(function( results ) {
|
40 |
+
if ( results.status ) {
|
41 |
+
QSMAdmin.displayAlert( 'Emails were saved!', 'success' );
|
42 |
+
} else {
|
43 |
+
QSMAdmin.displayAlert( 'There was an error when saving the emails. Please try again.', 'error' );
|
44 |
+
}
|
45 |
+
})
|
46 |
+
.fail(QSMAdmin.displayjQueryError);
|
47 |
+
},
|
48 |
+
loadEmails: function() {
|
49 |
+
QSMAdmin.displayAlert( 'Loading emails...', 'info' );
|
50 |
+
$.ajax({
|
51 |
+
url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmEmailsObject.quizID + '/emails',
|
52 |
+
headers: { 'X-WP-Nonce': qsmEmailsObject.nonce },
|
53 |
+
})
|
54 |
+
.done(function( emails ) {
|
55 |
+
emails.forEach( function( email, i, emails ) {
|
56 |
+
QSMAdminEmails.addEmail( email.conditions, email.to, email.subject, email.content, email.replyTo );
|
57 |
+
});
|
58 |
+
QSMAdmin.clearAlerts();
|
59 |
+
})
|
60 |
+
.fail(QSMAdmin.displayjQueryError);
|
61 |
+
},
|
62 |
+
addCondition: function( $email, criteria, operator, value ) {
|
63 |
+
var template = wp.template( 'email-condition' );
|
64 |
+
$email.find( '.email-when-conditions' ).append( template({
|
65 |
+
'criteria': criteria,
|
66 |
+
'operator': operator,
|
67 |
+
'value': value
|
68 |
+
}));
|
69 |
+
},
|
70 |
+
newCondition: function( $email ) {
|
71 |
+
QSMAdminEmails.addCondition( $email, 'score', 'equal', 0 );
|
72 |
+
},
|
73 |
+
addEmail: function( conditions, to, subject, content, replyTo ) {
|
74 |
+
QSMAdminEmails.total += 1;
|
75 |
+
var template = wp.template( 'email' );
|
76 |
+
$( '#emails' ).append( template( { id: QSMAdminEmails.total, to: to, subject: subject, content: content, replyTo: replyTo } ) );
|
77 |
+
conditions.forEach( function( condition, i, conditions) {
|
78 |
+
QSMAdminEmails.addCondition(
|
79 |
+
$( '.email:last-child' ),
|
80 |
+
condition.criteria,
|
81 |
+
condition.operator,
|
82 |
+
condition.value
|
83 |
+
);
|
84 |
+
});
|
85 |
+
var settings = {
|
86 |
+
mediaButtons: true,
|
87 |
+
tinymce: {
|
88 |
+
forced_root_block : '',
|
89 |
+
toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo'
|
90 |
+
},
|
91 |
+
quicktags: true,
|
92 |
+
};
|
93 |
+
wp.editor.initialize( 'email-template-' + QSMAdminEmails.total, settings );
|
94 |
+
},
|
95 |
+
newEmail: function() {
|
96 |
+
var conditions = [{
|
97 |
+
'criteria': 'score',
|
98 |
+
'operator': 'greater',
|
99 |
+
'value': '0'
|
100 |
+
}];
|
101 |
+
var to = '%USER_EMAIL%';
|
102 |
+
var subject = 'Quiz Results For %QUIZ_NAME%';
|
103 |
+
var content = '%QUESTIONS_ANSWERS%';
|
104 |
+
var replyTo = false;
|
105 |
+
QSMAdminEmails.addEmail( conditions, to, subject, content, replyTo );
|
106 |
+
}
|
107 |
+
};
|
108 |
+
$(function() {
|
109 |
+
QSMAdminEmails.loadEmails();
|
110 |
+
|
111 |
+
$( '.add-new-email' ).on( 'click', function( event ) {
|
112 |
+
event.preventDefault();
|
113 |
+
QSMAdminEmails.newEmail();
|
114 |
+
});
|
115 |
+
$( '.save-emails' ).on( 'click', function( event ) {
|
116 |
+
event.preventDefault();
|
117 |
+
QSMAdminEmails.saveEmails();
|
118 |
+
});
|
119 |
+
$( '#emails' ).on( 'click', '.new-condition', function( event ) {
|
120 |
+
event.preventDefault();
|
121 |
+
$page = $( this ).closest( '.email' );
|
122 |
+
QSMAdminEmails.newCondition( $page );
|
123 |
+
});
|
124 |
+
$( '#emails' ).on( 'click', '.delete-email-button', function( event ) {
|
125 |
+
event.preventDefault();
|
126 |
+
$( this ).closest( '.email' ).remove();
|
127 |
+
});
|
128 |
+
$( '#emails' ).on( 'click', '.delete-condition-button', function( event ) {
|
129 |
+
event.preventDefault();
|
130 |
+
$( this ).closest( '.email-condition' ).remove();
|
131 |
+
});
|
132 |
+
});
|
133 |
+
}(jQuery));
|
js/qsm-admin-question.js
CHANGED
@@ -76,19 +76,19 @@ var QSMQuestion;
|
|
76 |
},
|
77 |
addQuestionFromQuestionBank: function( questionID ) {
|
78 |
MicroModal.close( 'modal-2' );
|
79 |
-
|
80 |
var model = new QSMQuestion.question( { id: questionID } );
|
81 |
model.fetch({
|
82 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
83 |
url: wpApiSettings.root + 'quiz-survey-master/v1/questions/' + questionID,
|
84 |
success: QSMQuestion.questionBankSuccess,
|
85 |
-
error:
|
86 |
});
|
87 |
},
|
88 |
questionBankSuccess: function( model ) {
|
89 |
var page = parseInt( $( '#add-question-bank-page' ).val(), 10 );
|
90 |
model.set( 'page', page );
|
91 |
-
|
92 |
QSMQuestion.questions.add( model );
|
93 |
QSMQuestion.addQuestionToPage( model );
|
94 |
},
|
@@ -112,16 +112,16 @@ var QSMQuestion;
|
|
112 |
$( '#categories' ).prepend( template( { category: category } ) );
|
113 |
},
|
114 |
loadQuestions: function() {
|
115 |
-
|
116 |
QSMQuestion.questions.fetch({
|
117 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
118 |
data: { quizID: qsmQuestionSettings.quizID },
|
119 |
success: QSMQuestion.loadSuccess,
|
120 |
-
error:
|
121 |
});
|
122 |
},
|
123 |
loadSuccess: function() {
|
124 |
-
|
125 |
var question;
|
126 |
if ( qsmQuestionSettings.pages.length > 0 ) {
|
127 |
for ( var i = 0; i < qsmQuestionSettings.pages.length; i++ ) {
|
@@ -136,7 +136,7 @@ var QSMQuestion;
|
|
136 |
QSMQuestion.countTotal();
|
137 |
},
|
138 |
savePages: function() {
|
139 |
-
|
140 |
var pages = [];
|
141 |
|
142 |
// Cycles through each page and add page + questions to pages variable
|
@@ -163,11 +163,11 @@ var QSMQuestion;
|
|
163 |
data: data,
|
164 |
method: 'POST',
|
165 |
success: QSMQuestion.savePagesSuccess,
|
166 |
-
error:
|
167 |
});
|
168 |
},
|
169 |
savePagesSuccess: function() {
|
170 |
-
|
171 |
},
|
172 |
addNewPage: function() {
|
173 |
var template = wp.template( 'page' );
|
@@ -182,7 +182,7 @@ var QSMQuestion;
|
|
182 |
setTimeout( QSMQuestion.removeNew, 250 );
|
183 |
},
|
184 |
addNewQuestion: function( model ) {
|
185 |
-
|
186 |
QSMQuestion.addQuestionToPage( model );
|
187 |
QSMQuestion.openEditPopup( model.id );
|
188 |
QSMQuestion.countTotal();
|
@@ -206,7 +206,7 @@ var QSMQuestion;
|
|
206 |
setTimeout( QSMQuestion.removeNew, 250 );
|
207 |
},
|
208 |
createQuestion: function( page ) {
|
209 |
-
|
210 |
QSMQuestion.questions.create(
|
211 |
{
|
212 |
quizID: qsmQuestionSettings.quizID,
|
@@ -215,12 +215,12 @@ var QSMQuestion;
|
|
215 |
{
|
216 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
217 |
success: QSMQuestion.addNewQuestion,
|
218 |
-
error:
|
219 |
}
|
220 |
);
|
221 |
},
|
222 |
duplicateQuestion: function( questionID ) {
|
223 |
-
|
224 |
var model = QSMQuestion.questions.get( questionID );
|
225 |
var newModel = _.clone(model.attributes);
|
226 |
newModel.id = null;
|
@@ -229,12 +229,12 @@ var QSMQuestion;
|
|
229 |
{
|
230 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
231 |
success: QSMQuestion.addNewQuestion,
|
232 |
-
error:
|
233 |
}
|
234 |
);
|
235 |
},
|
236 |
saveQuestion: function( questionID ) {
|
237 |
-
|
238 |
var model = QSMQuestion.questions.get( questionID );
|
239 |
var hint = $( '#hint' ).val();
|
240 |
var name = wp.editor.getContent( 'question-text' );
|
@@ -275,14 +275,14 @@ var QSMQuestion;
|
|
275 |
{
|
276 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
277 |
success: QSMQuestion.saveSuccess,
|
278 |
-
error:
|
279 |
type: 'POST'
|
280 |
}
|
281 |
);
|
282 |
MicroModal.close('modal-1');
|
283 |
},
|
284 |
saveSuccess: function( model ) {
|
285 |
-
|
286 |
var template = wp.template( 'question' );
|
287 |
var page = model.get( 'page' ) + 1;
|
288 |
$( '.question[data-question-id=' + model.id + ']' ).replaceWith( template( { id: model.id, type : model.get('type'), category : model.get('category'), question: model.get('name') } ) );
|
@@ -323,24 +323,6 @@ var QSMQuestion;
|
|
323 |
}
|
324 |
MicroModal.show( 'modal-1' );
|
325 |
},
|
326 |
-
displayjQueryError: function( jqXHR, textStatus, errorThrown ) {
|
327 |
-
QSMQuestion.displayAlert( 'Error: ' + errorThrown + '! Please try again.', 'error' );
|
328 |
-
},
|
329 |
-
displayError: function( jqXHR, textStatus, errorThrown ) {
|
330 |
-
QSMQuestion.displayAlert( 'Error: ' + errorThrown.errorThrown + '! Please try again.', 'error' );
|
331 |
-
},
|
332 |
-
displayAlert: function( message, type ) {
|
333 |
-
QSMQuestion.clearAlerts();
|
334 |
-
var template = wp.template( 'notice' );
|
335 |
-
var data = {
|
336 |
-
message: message,
|
337 |
-
type: type
|
338 |
-
};
|
339 |
-
$( '.questions-messages' ).append( template( data ) );
|
340 |
-
},
|
341 |
-
clearAlerts: function() {
|
342 |
-
$( '.questions-messages' ).empty();
|
343 |
-
},
|
344 |
removeNew: function() {
|
345 |
$( '.page-new' ).removeClass( 'page-new' );
|
346 |
$( '.question-new' ).removeClass( 'question-new' );
|
76 |
},
|
77 |
addQuestionFromQuestionBank: function( questionID ) {
|
78 |
MicroModal.close( 'modal-2' );
|
79 |
+
QSMAdmin.displayAlert( 'Adding question...', 'info' );
|
80 |
var model = new QSMQuestion.question( { id: questionID } );
|
81 |
model.fetch({
|
82 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
83 |
url: wpApiSettings.root + 'quiz-survey-master/v1/questions/' + questionID,
|
84 |
success: QSMQuestion.questionBankSuccess,
|
85 |
+
error: QSMAdmin.displayError
|
86 |
});
|
87 |
},
|
88 |
questionBankSuccess: function( model ) {
|
89 |
var page = parseInt( $( '#add-question-bank-page' ).val(), 10 );
|
90 |
model.set( 'page', page );
|
91 |
+
QSMAdmin.displayAlert( 'Question added!', 'success' );
|
92 |
QSMQuestion.questions.add( model );
|
93 |
QSMQuestion.addQuestionToPage( model );
|
94 |
},
|
112 |
$( '#categories' ).prepend( template( { category: category } ) );
|
113 |
},
|
114 |
loadQuestions: function() {
|
115 |
+
QSMAdmin.displayAlert( 'Loading questions...', 'info' );
|
116 |
QSMQuestion.questions.fetch({
|
117 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
118 |
data: { quizID: qsmQuestionSettings.quizID },
|
119 |
success: QSMQuestion.loadSuccess,
|
120 |
+
error: QSMAdmin.displayError
|
121 |
});
|
122 |
},
|
123 |
loadSuccess: function() {
|
124 |
+
QSMAdmin.clearAlerts();
|
125 |
var question;
|
126 |
if ( qsmQuestionSettings.pages.length > 0 ) {
|
127 |
for ( var i = 0; i < qsmQuestionSettings.pages.length; i++ ) {
|
136 |
QSMQuestion.countTotal();
|
137 |
},
|
138 |
savePages: function() {
|
139 |
+
QSMAdmin.displayAlert( 'Saving pages and questions...', 'info' );
|
140 |
var pages = [];
|
141 |
|
142 |
// Cycles through each page and add page + questions to pages variable
|
163 |
data: data,
|
164 |
method: 'POST',
|
165 |
success: QSMQuestion.savePagesSuccess,
|
166 |
+
error: QSMAdmin.displayjQueryError
|
167 |
});
|
168 |
},
|
169 |
savePagesSuccess: function() {
|
170 |
+
QSMAdmin.displayAlert( 'Questions and pages were saved!', 'success' );
|
171 |
},
|
172 |
addNewPage: function() {
|
173 |
var template = wp.template( 'page' );
|
182 |
setTimeout( QSMQuestion.removeNew, 250 );
|
183 |
},
|
184 |
addNewQuestion: function( model ) {
|
185 |
+
QSMAdmin.displayAlert( 'Question created!', 'success' );
|
186 |
QSMQuestion.addQuestionToPage( model );
|
187 |
QSMQuestion.openEditPopup( model.id );
|
188 |
QSMQuestion.countTotal();
|
206 |
setTimeout( QSMQuestion.removeNew, 250 );
|
207 |
},
|
208 |
createQuestion: function( page ) {
|
209 |
+
QSMAdmin.displayAlert( 'Creating question...', 'info' );
|
210 |
QSMQuestion.questions.create(
|
211 |
{
|
212 |
quizID: qsmQuestionSettings.quizID,
|
215 |
{
|
216 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
217 |
success: QSMQuestion.addNewQuestion,
|
218 |
+
error: QSMAdmin.displayError
|
219 |
}
|
220 |
);
|
221 |
},
|
222 |
duplicateQuestion: function( questionID ) {
|
223 |
+
QSMAdmin.displayAlert( 'Duplicating question...', 'info' );
|
224 |
var model = QSMQuestion.questions.get( questionID );
|
225 |
var newModel = _.clone(model.attributes);
|
226 |
newModel.id = null;
|
229 |
{
|
230 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
231 |
success: QSMQuestion.addNewQuestion,
|
232 |
+
error: QSMAdmin.displayError
|
233 |
}
|
234 |
);
|
235 |
},
|
236 |
saveQuestion: function( questionID ) {
|
237 |
+
QSMAdmin.displayAlert( 'Saving question...', 'info' );
|
238 |
var model = QSMQuestion.questions.get( questionID );
|
239 |
var hint = $( '#hint' ).val();
|
240 |
var name = wp.editor.getContent( 'question-text' );
|
275 |
{
|
276 |
headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
|
277 |
success: QSMQuestion.saveSuccess,
|
278 |
+
error: QSMAdmin.displayError,
|
279 |
type: 'POST'
|
280 |
}
|
281 |
);
|
282 |
MicroModal.close('modal-1');
|
283 |
},
|
284 |
saveSuccess: function( model ) {
|
285 |
+
QSMAdmin.displayAlert( 'Question was saved!', 'success' );
|
286 |
var template = wp.template( 'question' );
|
287 |
var page = model.get( 'page' ) + 1;
|
288 |
$( '.question[data-question-id=' + model.id + ']' ).replaceWith( template( { id: model.id, type : model.get('type'), category : model.get('category'), question: model.get('name') } ) );
|
323 |
}
|
324 |
MicroModal.show( 'modal-1' );
|
325 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
removeNew: function() {
|
327 |
$( '.page-new' ).removeClass( 'page-new' );
|
328 |
$( '.question-new' ).removeClass( 'question-new' );
|
js/qsm-admin-results.js
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* QSM - Admin results pages
|
3 |
+
*/
|
4 |
+
|
5 |
+
var QSMAdminResults;
|
6 |
+
(function ($) {
|
7 |
+
QSMAdminResults = {
|
8 |
+
total: 0,
|
9 |
+
saveResults: function() {
|
10 |
+
QSMAdmin.displayAlert( 'Saving results pages...', 'info' );
|
11 |
+
var pages = [];
|
12 |
+
var page = {};
|
13 |
+
var redirect_value = '';
|
14 |
+
$( '.results-page' ).each( function() {
|
15 |
+
page = {
|
16 |
+
'conditions': [],
|
17 |
+
'page': wp.editor.getContent( $( this ).find( '.results-page-template' ).attr( 'id' ) ),
|
18 |
+
'redirect': false,
|
19 |
+
};
|
20 |
+
redirect_value = $( this ).find( '.results-page-redirect' ).val();
|
21 |
+
if ( '' != redirect_value ) {
|
22 |
+
page.redirect = redirect_value;
|
23 |
+
}
|
24 |
+
$( this ).find( '.results-page-condition' ).each( function() {
|
25 |
+
page.conditions.push({
|
26 |
+
'criteria': $( this ).children( '.results-page-condition-criteria' ).val(),
|
27 |
+
'operator': $( this ).children( '.results-page-condition-operator' ).val(),
|
28 |
+
'value': $( this ).children( '.results-page-condition-value' ).val()
|
29 |
+
});
|
30 |
+
});
|
31 |
+
pages.push( page );
|
32 |
+
});
|
33 |
+
var data = {
|
34 |
+
'pages': pages
|
35 |
+
}
|
36 |
+
$.ajax({
|
37 |
+
url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmResultsObject.quizID + '/results',
|
38 |
+
method: 'POST',
|
39 |
+
data: data,
|
40 |
+
headers: { 'X-WP-Nonce': qsmResultsObject.nonce },
|
41 |
+
})
|
42 |
+
.done(function( results ) {
|
43 |
+
if ( results.status ) {
|
44 |
+
QSMAdmin.displayAlert( 'Results pages were saved!', 'success' );
|
45 |
+
} else {
|
46 |
+
QSMAdmin.displayAlert( 'There was an error when saving the results pages. Please try again.', 'error' );
|
47 |
+
}
|
48 |
+
})
|
49 |
+
.fail(QSMAdmin.displayjQueryError);
|
50 |
+
},
|
51 |
+
loadResults: function() {
|
52 |
+
QSMAdmin.displayAlert( 'Loading results pages...', 'info' );
|
53 |
+
$.ajax({
|
54 |
+
url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmResultsObject.quizID + '/results',
|
55 |
+
headers: { 'X-WP-Nonce': qsmResultsObject.nonce },
|
56 |
+
})
|
57 |
+
.done(function( pages ) {
|
58 |
+
pages.forEach( function( page, i, pages ) {
|
59 |
+
QSMAdminResults.addResultsPage( page.conditions, page.page, page.redirect );
|
60 |
+
});
|
61 |
+
QSMAdmin.clearAlerts();
|
62 |
+
})
|
63 |
+
.fail(QSMAdmin.displayjQueryError);
|
64 |
+
},
|
65 |
+
addCondition: function( $page, criteria, operator, value ) {
|
66 |
+
var template = wp.template( 'results-page-condition' );
|
67 |
+
$page.find( '.results-page-when-conditions' ).append( template({
|
68 |
+
'criteria': criteria,
|
69 |
+
'operator': operator,
|
70 |
+
'value': value
|
71 |
+
}));
|
72 |
+
},
|
73 |
+
newCondition: function( $page ) {
|
74 |
+
QSMAdminResults.addCondition( $page, 'score', 'equal', 0 );
|
75 |
+
},
|
76 |
+
addResultsPage: function( conditions, page, redirect ) {
|
77 |
+
QSMAdminResults.total += 1;
|
78 |
+
var template = wp.template( 'results-page' );
|
79 |
+
$( '#results-pages' ).append( template( { id: QSMAdminResults.total, page: page, redirect: redirect } ) );
|
80 |
+
conditions.forEach( function( condition, i, conditions) {
|
81 |
+
QSMAdminResults.addCondition(
|
82 |
+
$( '.results-page:last-child' ),
|
83 |
+
condition.criteria,
|
84 |
+
condition.operator,
|
85 |
+
condition.value
|
86 |
+
);
|
87 |
+
});
|
88 |
+
var settings = {
|
89 |
+
mediaButtons: true,
|
90 |
+
tinymce: {
|
91 |
+
forced_root_block : '',
|
92 |
+
toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo'
|
93 |
+
},
|
94 |
+
quicktags: true,
|
95 |
+
};
|
96 |
+
wp.editor.initialize( 'results-page-' + QSMAdminResults.total, settings );
|
97 |
+
},
|
98 |
+
newResultsPage: function() {
|
99 |
+
var conditions = [{
|
100 |
+
'criteria': 'score',
|
101 |
+
'operator': 'greater',
|
102 |
+
'value': '0'
|
103 |
+
}];
|
104 |
+
var page = '%QUESTIONS_ANSWERS%';
|
105 |
+
QSMAdminResults.addResultsPage( conditions, page );
|
106 |
+
}
|
107 |
+
};
|
108 |
+
$(function() {
|
109 |
+
QSMAdminResults.loadResults();
|
110 |
+
|
111 |
+
$( '.add-new-page' ).on( 'click', function( event ) {
|
112 |
+
event.preventDefault();
|
113 |
+
QSMAdminResults.newResultsPage();
|
114 |
+
});
|
115 |
+
$( '.save-pages' ).on( 'click', function( event ) {
|
116 |
+
event.preventDefault();
|
117 |
+
QSMAdminResults.saveResults();
|
118 |
+
});
|
119 |
+
$( '#results-pages' ).on( 'click', '.new-condition', function( event ) {
|
120 |
+
event.preventDefault();
|
121 |
+
$page = $( this ).closest( '.results-page' );
|
122 |
+
QSMAdminResults.newCondition( $page );
|
123 |
+
});
|
124 |
+
$( '#results-pages' ).on( 'click', '.delete-page-button', function( event ) {
|
125 |
+
event.preventDefault();
|
126 |
+
$( this ).closest( '.results-page' ).remove();
|
127 |
+
});
|
128 |
+
$( '#results-pages' ).on( 'click', '.delete-condition-button', function( event ) {
|
129 |
+
event.preventDefault();
|
130 |
+
$( this ).closest( '.results-page-condition' ).remove();
|
131 |
+
});
|
132 |
+
});
|
133 |
+
}(jQuery));
|
js/qsm-admin.js
CHANGED
@@ -4,19 +4,19 @@
|
|
4 |
|
5 |
var QSMQuizzesSurveys;
|
6 |
(function ($) {
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
addQuizRow: function( quizData ) {
|
21 |
var template = wp.template( 'quiz-row' );
|
22 |
var values = {
|
4 |
|
5 |
var QSMQuizzesSurveys;
|
6 |
(function ($) {
|
7 |
+
QSMQuizzesSurveys = {
|
8 |
+
load: function() {
|
9 |
+
if ( 0 !== qsmQuizObject.length ) {
|
10 |
+
$.each( qsmQuizObject, function( i, val ) {
|
11 |
+
QSMQuizzesSurveys.addQuizRow( val );
|
12 |
+
});
|
13 |
+
$( '#the-list tr' ).filter( ':even' ).addClass( 'alternate' );
|
14 |
+
} else {
|
15 |
+
var template = wp.template( 'no-quiz' );
|
16 |
+
$( '.qsm-quizzes-page-content' ).hide();
|
17 |
+
$( '#new_quiz_button' ).parent().after( template() );
|
18 |
+
}
|
19 |
+
},
|
20 |
addQuizRow: function( quizData ) {
|
21 |
var template = wp.template( 'quiz-row' );
|
22 |
var values = {
|
js/qsm-quiz.js
CHANGED
@@ -479,7 +479,7 @@ function qsmDisplayLoading( $container ) {
|
|
479 |
function qmnDisplayResults( results, quiz_form_id, $container ) {
|
480 |
$container.empty();
|
481 |
if ( results.redirect ) {
|
482 |
-
window.location.replace( results.
|
483 |
} else {
|
484 |
$container.append( '<div class="qmn_results_page"></div>' );
|
485 |
$container.find( '.qmn_results_page' ).html( results.display );
|
479 |
function qmnDisplayResults( results, quiz_form_id, $container ) {
|
480 |
$container.empty();
|
481 |
if ( results.redirect ) {
|
482 |
+
window.location.replace( results.redirect );
|
483 |
} else {
|
484 |
$container.append( '<div class="qmn_results_page"></div>' );
|
485 |
$container.find( '.qmn_results_page' ).html( results.display );
|
mlw_quizmaster2.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
-
* Version: 6.
|
6 |
* Author: Frank Corso
|
7 |
* Author URI: https://www.quizandsurveymaster.com/
|
8 |
* Plugin URI: https://www.quizandsurveymaster.com/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author Frank Corso
|
12 |
-
* @version 6.
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
@@ -18,6 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
18 |
}
|
19 |
|
20 |
define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
|
|
21 |
/**
|
22 |
* This class is the main class of the plugin
|
23 |
*
|
@@ -33,7 +34,7 @@ class MLWQuizMasterNext {
|
|
33 |
* @var string
|
34 |
* @since 4.0.0
|
35 |
*/
|
36 |
-
public $version = '6.
|
37 |
|
38 |
/**
|
39 |
* QSM Alert Manager Object
|
@@ -142,6 +143,8 @@ class MLWQuizMasterNext {
|
|
142 |
}
|
143 |
include 'php/classes/class-qsm-questions.php';
|
144 |
include 'php/classes/class-qsm-contact-manager.php';
|
|
|
|
|
145 |
include 'php/classes/class-qmn-quiz-manager.php';
|
146 |
|
147 |
include 'php/template-variables.php';
|
@@ -270,18 +273,11 @@ class MLWQuizMasterNext {
|
|
270 |
add_submenu_page( __FILE__, __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );
|
271 |
add_submenu_page( __FILE__, __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_result_details', 'qsm_generate_result_details' );
|
272 |
add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
|
273 |
-
add_submenu_page( __FILE__, __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', '
|
274 |
add_submenu_page( __FILE__, __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
|
275 |
add_submenu_page( __FILE__, __( 'Addon Settings', 'quiz-master-next' ), __( 'Addon Settings', 'quiz-master-next' ), 'moderate_comments', 'qmn_addons', 'qmn_addons_page' );
|
276 |
-
add_submenu_page( __FILE__, __( '
|
277 |
-
|
278 |
-
add_dashboard_page(
|
279 |
-
__( 'QSM About', 'quiz-master-next' ),
|
280 |
-
__( 'QSM About', 'quiz-master-next' ),
|
281 |
-
'manage_options',
|
282 |
-
'qsm_about',
|
283 |
-
'mlw_generate_about_page'
|
284 |
-
);
|
285 |
}
|
286 |
}
|
287 |
|
@@ -294,7 +290,6 @@ class MLWQuizMasterNext {
|
|
294 |
* @return void
|
295 |
*/
|
296 |
public function admin_head() {
|
297 |
-
remove_submenu_page( 'index.php', 'qsm_about' );
|
298 |
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'mlw_quiz_options' );
|
299 |
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'qsm_quiz_result_details' );
|
300 |
}
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
+
* Version: 6.2.0
|
6 |
* Author: Frank Corso
|
7 |
* Author URI: https://www.quizandsurveymaster.com/
|
8 |
* Plugin URI: https://www.quizandsurveymaster.com/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author Frank Corso
|
12 |
+
* @version 6.2.0
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
18 |
}
|
19 |
|
20 |
define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
21 |
+
|
22 |
/**
|
23 |
* This class is the main class of the plugin
|
24 |
*
|
34 |
* @var string
|
35 |
* @since 4.0.0
|
36 |
*/
|
37 |
+
public $version = '6.2.0';
|
38 |
|
39 |
/**
|
40 |
* QSM Alert Manager Object
|
143 |
}
|
144 |
include 'php/classes/class-qsm-questions.php';
|
145 |
include 'php/classes/class-qsm-contact-manager.php';
|
146 |
+
include 'php/classes/class-qsm-results-pages.php';
|
147 |
+
include 'php/classes/class-qsm-emails.php';
|
148 |
include 'php/classes/class-qmn-quiz-manager.php';
|
149 |
|
150 |
include 'php/template-variables.php';
|
273 |
add_submenu_page( __FILE__, __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );
|
274 |
add_submenu_page( __FILE__, __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_result_details', 'qsm_generate_result_details' );
|
275 |
add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
|
276 |
+
add_submenu_page( __FILE__, __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'qsm_quiz_tools', 'qsm_generate_quiz_tools' );
|
277 |
add_submenu_page( __FILE__, __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
|
278 |
add_submenu_page( __FILE__, __( 'Addon Settings', 'quiz-master-next' ), __( 'Addon Settings', 'quiz-master-next' ), 'moderate_comments', 'qmn_addons', 'qmn_addons_page' );
|
279 |
+
add_submenu_page( __FILE__, __( 'QSM About', 'quiz-master-next' ), __( 'QSM About', 'quiz-master-next' ), 'moderate_comments', 'qsm_about_page', 'qsm_generate_about_page' );
|
280 |
+
add_submenu_page( __FILE__, __( 'Help', 'quiz-master-next' ), __( 'Help', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_help', 'qsm_generate_help_page' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
}
|
282 |
}
|
283 |
|
290 |
* @return void
|
291 |
*/
|
292 |
public function admin_head() {
|
|
|
293 |
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'mlw_quiz_options' );
|
294 |
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'qsm_quiz_result_details' );
|
295 |
}
|
php/admin/about-page.php
CHANGED
@@ -1,18 +1,24 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* This function shows the about page. It also shows the changelog information.
|
6 |
*
|
7 |
* @return void
|
8 |
-
* @since
|
9 |
*/
|
10 |
-
function
|
11 |
|
12 |
global $mlwQuizMasterNext;
|
13 |
$version = $mlwQuizMasterNext->version;
|
14 |
-
wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css'
|
15 |
-
wp_enqueue_script( 'qsm_admin_js', plugins_url( '../../js/admin.js'
|
16 |
?>
|
17 |
<style>
|
18 |
div.qsm_icon_wrap {
|
@@ -20,33 +26,33 @@ function mlw_generate_about_page() {
|
|
20 |
}
|
21 |
</style>
|
22 |
<div class="wrap about-wrap">
|
23 |
-
<h1><?php
|
24 |
-
<div class="about-text"><?php
|
25 |
-
<div class="qsm_icon_wrap"><?php echo $version; ?></div>
|
26 |
<h2 class="nav-tab-wrapper">
|
27 |
<a href="#" data-tab='1' class="nav-tab nav-tab-active qsm-tab">
|
28 |
-
<?php
|
29 |
<a href="#" data-tab='2' class="nav-tab qsm-tab">
|
30 |
-
<?php
|
31 |
<a href="#" data-tab='3' class="nav-tab qsm-tab">
|
32 |
-
<?php
|
33 |
</h2>
|
34 |
<div class="qsm-tab-content tab-1">
|
35 |
<div class="feature">
|
36 |
-
<h2 class="feature-headline">Welcome to QSM 6.
|
37 |
</div>
|
38 |
<div class="feature">
|
39 |
-
<h2 class="feature-headline">New
|
40 |
-
<p class="feature-text">
|
41 |
</div>
|
42 |
<div class="feature">
|
43 |
-
<h2 class="feature-headline">
|
44 |
-
<p class="feature-text">
|
45 |
</div>
|
46 |
</div>
|
47 |
<div class="qsm-tab-content tab-2" style="display: none;">
|
48 |
<h2>Changelog</h2>
|
49 |
-
<?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next',
|
50 |
</div>
|
51 |
<div class="qsm-tab-content tab-3" style="display:none;">
|
52 |
<h2>GitHub Contributors</h2>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Generates the content for the about page.
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit;
|
8 |
+
}
|
9 |
|
10 |
/**
|
11 |
* This function shows the about page. It also shows the changelog information.
|
12 |
*
|
13 |
* @return void
|
14 |
+
* @since 6.2.0
|
15 |
*/
|
16 |
+
function qsm_generate_about_page() {
|
17 |
|
18 |
global $mlwQuizMasterNext;
|
19 |
$version = $mlwQuizMasterNext->version;
|
20 |
+
wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $version );
|
21 |
+
wp_enqueue_script( 'qsm_admin_js', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $version );
|
22 |
?>
|
23 |
<style>
|
24 |
div.qsm_icon_wrap {
|
26 |
}
|
27 |
</style>
|
28 |
<div class="wrap about-wrap">
|
29 |
+
<h1><?php esc_html_e( 'Welcome To Quiz And Survey Master (Formerly Quiz Master Next)', 'quiz-master-next' ); ?></h1>
|
30 |
+
<div class="about-text"><?php esc_html_e( 'Thank you for updating!', 'quiz-master-next' ); ?></div>
|
31 |
+
<div class="qsm_icon_wrap"><?php echo esc_html( $version ); ?></div>
|
32 |
<h2 class="nav-tab-wrapper">
|
33 |
<a href="#" data-tab='1' class="nav-tab nav-tab-active qsm-tab">
|
34 |
+
<?php esc_html_e( "What's New!", 'quiz-master-next' ); ?></a>
|
35 |
<a href="#" data-tab='2' class="nav-tab qsm-tab">
|
36 |
+
<?php esc_html_e( 'Changelog', 'quiz-master-next' ); ?></a>
|
37 |
<a href="#" data-tab='3' class="nav-tab qsm-tab">
|
38 |
+
<?php esc_html_e( 'People Who Make QSM Possible', 'quiz-master-next' ); ?></a>
|
39 |
</h2>
|
40 |
<div class="qsm-tab-content tab-1">
|
41 |
<div class="feature">
|
42 |
+
<h2 class="feature-headline">Welcome to QSM 6.2!</h2>
|
43 |
</div>
|
44 |
<div class="feature">
|
45 |
+
<h2 class="feature-headline">New Email System</h2>
|
46 |
+
<p class="feature-text">All of the email system has been entirely re-written. The newer system is much more intuitive and allows for more granular conditions allowing us to add in more conditions types in future versions.</p>
|
47 |
</div>
|
48 |
<div class="feature">
|
49 |
+
<h2 class="feature-headline">New Results Page System</h2>
|
50 |
+
<p class="feature-text">All of the results page has been entirely re-written. The newer system is much more intuitive and allows for more granular conditions allowing us to add in more conditions types in future versions.</p>
|
51 |
</div>
|
52 |
</div>
|
53 |
<div class="qsm-tab-content tab-2" style="display: none;">
|
54 |
<h2>Changelog</h2>
|
55 |
+
<?php QSM_Changelog_Generator::get_changelog_list( 'fpcorso/quiz_master_next', 56 ); ?>
|
56 |
</div>
|
57 |
<div class="qsm-tab-content tab-3" style="display:none;">
|
58 |
<h2>GitHub Contributors</h2>
|
php/admin/admin-results-page.php
CHANGED
@@ -23,7 +23,7 @@ function qsm_generate_admin_results_page() {
|
|
23 |
<div class="wrap">
|
24 |
<h2><?php _e('Quiz Results', 'quiz-master-next'); ?></h2>
|
25 |
<?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
|
26 |
-
<?php
|
27 |
<h2 class="nav-tab-wrapper">
|
28 |
<?php
|
29 |
// Cycles through the tabs and creates the navigation
|
23 |
<div class="wrap">
|
24 |
<h2><?php _e('Quiz Results', 'quiz-master-next'); ?></h2>
|
25 |
<?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
|
26 |
+
<?php qsm_show_adverts(); ?>
|
27 |
<h2 class="nav-tab-wrapper">
|
28 |
<?php
|
29 |
// Cycles through the tabs and creates the navigation
|
php/admin/help-page.php
CHANGED
@@ -13,9 +13,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
* This function generates the help page.
|
14 |
*
|
15 |
* @return void
|
16 |
-
* @since
|
17 |
*/
|
18 |
-
function
|
19 |
if ( ! current_user_can( 'moderate_comments' ) ) {
|
20 |
return;
|
21 |
}
|
@@ -27,17 +27,17 @@ function mlw_generate_help_page() {
|
|
27 |
add_meta_box( 'wpss_mrts', __( 'System Info', 'quiz-master-next' ), 'qsm_system_meta_box_content', 'meta_box_sys_info' );
|
28 |
?>
|
29 |
<div class="wrap">
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
|
42 |
</div>
|
43 |
<?php
|
@@ -79,83 +79,85 @@ function qsm_get_system_info() {
|
|
79 |
global $wpdb;
|
80 |
global $mlwQuizMasterNext;
|
81 |
|
82 |
-
$sys_info =
|
83 |
|
84 |
-
$theme_data
|
85 |
-
$theme
|
86 |
$parent_theme = $theme_data->Template;
|
87 |
if ( ! empty( $parent_theme ) ) {
|
88 |
$parent_theme_data = wp_get_theme( $parent_theme );
|
89 |
$parent_theme = $parent_theme_data->Name . ' ' . $parent_theme_data->Version;
|
90 |
}
|
91 |
|
92 |
-
$sys_info .=
|
93 |
-
$sys_info .=
|
94 |
-
$sys_info .=
|
95 |
-
$sys_info .=
|
96 |
|
97 |
-
$sys_info .=
|
98 |
-
$sys_info .=
|
99 |
-
$sys_info .=
|
100 |
$sys_info .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . '<br>';
|
101 |
-
$sys_info .= "Active Theme:
|
102 |
$sys_info .= "Parent Theme: {$parent_theme}<br>";
|
103 |
-
$sys_info .=
|
104 |
-
$sys_info .=
|
105 |
|
106 |
-
$sys_info .=
|
107 |
$plugin_mu = get_mu_plugins();
|
108 |
if ( count( $plugin_mu ) > 0 ) {
|
109 |
-
$sys_info .=
|
110 |
foreach ( $plugin_mu as $plugin => $plugin_data ) {
|
111 |
$sys_info .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "<br />";
|
112 |
}
|
113 |
}
|
114 |
-
$sys_info
|
115 |
-
$plugins
|
116 |
$active_plugins = get_option( 'active_plugins', array() );
|
117 |
-
foreach( $plugins as $plugin_path => $plugin ) {
|
118 |
-
if( !in_array( $plugin_path, $active_plugins ) )
|
119 |
continue;
|
120 |
-
|
|
|
121 |
}
|
122 |
-
$sys_info .=
|
123 |
-
foreach( $plugins as $plugin_path => $plugin ) {
|
124 |
-
if( in_array( $plugin_path, $active_plugins ) )
|
125 |
continue;
|
126 |
-
|
|
|
127 |
}
|
128 |
|
129 |
-
$sys_info .=
|
130 |
-
$sys_info .=
|
131 |
-
$sys_info .=
|
132 |
-
$sys_info .=
|
133 |
-
|
134 |
-
$
|
135 |
-
$
|
136 |
-
$
|
137 |
-
$
|
138 |
-
$total_results
|
139 |
-
$total_active_results
|
140 |
-
|
141 |
-
$sys_info .=
|
142 |
-
$sys_info .=
|
143 |
-
$sys_info .=
|
144 |
-
$sys_info .= "Total Quizzes :
|
145 |
-
$sys_info .= "Total Active Quizzes :
|
146 |
-
$sys_info .= "Total Questions :
|
147 |
-
$sys_info .= "Total Active Questions :
|
148 |
-
$sys_info .= "Total Results :
|
149 |
-
$sys_info .= "Total Active Results :
|
150 |
-
|
151 |
-
$sys_info
|
152 |
$recent_errors = $mlwQuizMasterNext->log_manager->get_logs();
|
153 |
if ( $recent_errors ) {
|
154 |
-
foreach( $recent_errors as $error ) {
|
155 |
-
$sys_info .= "Log created at
|
156 |
}
|
157 |
} else {
|
158 |
-
$sys_info .=
|
159 |
}
|
160 |
|
161 |
return $sys_info;
|
13 |
* This function generates the help page.
|
14 |
*
|
15 |
* @return void
|
16 |
+
* @since 6.2.0
|
17 |
*/
|
18 |
+
function qsm_generate_help_page() {
|
19 |
if ( ! current_user_can( 'moderate_comments' ) ) {
|
20 |
return;
|
21 |
}
|
27 |
add_meta_box( 'wpss_mrts', __( 'System Info', 'quiz-master-next' ), 'qsm_system_meta_box_content', 'meta_box_sys_info' );
|
28 |
?>
|
29 |
<div class="wrap">
|
30 |
+
<h2><?php esc_html_e( 'Help Page', 'quiz-master-next' ); ?></h2>
|
31 |
+
<?php qsm_show_adverts(); ?>
|
32 |
|
33 |
+
<!--Display Widget Boxes-->
|
34 |
+
<div style="width:100%;" class="inner-sidebar1">
|
35 |
+
<?php do_meta_boxes( 'meta_box_help', 'advanced', '' ); ?>
|
36 |
+
</div>
|
37 |
|
38 |
+
<div style="width:100%;" class="inner-sidebar1">
|
39 |
+
<?php do_meta_boxes( 'meta_box_sys_info', 'advanced', '' ); ?>
|
40 |
+
</div>
|
41 |
|
42 |
</div>
|
43 |
<?php
|
79 |
global $wpdb;
|
80 |
global $mlwQuizMasterNext;
|
81 |
|
82 |
+
$sys_info = '';
|
83 |
|
84 |
+
$theme_data = wp_get_theme();
|
85 |
+
$theme = $theme_data->Name . ' ' . $theme_data->Version;
|
86 |
$parent_theme = $theme_data->Template;
|
87 |
if ( ! empty( $parent_theme ) ) {
|
88 |
$parent_theme_data = wp_get_theme( $parent_theme );
|
89 |
$parent_theme = $parent_theme_data->Name . ' ' . $parent_theme_data->Version;
|
90 |
}
|
91 |
|
92 |
+
$sys_info .= '<h3>Site Information</h3><br />';
|
93 |
+
$sys_info .= 'Site URL: ' . site_url() . '<br />';
|
94 |
+
$sys_info .= 'Home URL: ' . home_url() . '<br />';
|
95 |
+
$sys_info .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . '<br />';
|
96 |
|
97 |
+
$sys_info .= '<h3>WordPress Information</h3><br />';
|
98 |
+
$sys_info .= 'Version: ' . get_bloginfo( 'version' ) . '<br />';
|
99 |
+
$sys_info .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . '<br />';
|
100 |
$sys_info .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . '<br>';
|
101 |
+
$sys_info .= "Active Theme: {$theme}<br />";
|
102 |
$sys_info .= "Parent Theme: {$parent_theme}<br>";
|
103 |
+
$sys_info .= 'Debug Mode: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . '<br />';
|
104 |
+
$sys_info .= 'Memory Limit: ' . WP_MEMORY_LIMIT . '<br />';
|
105 |
|
106 |
+
$sys_info .= '<h3>Plugins Information</h3><br />';
|
107 |
$plugin_mu = get_mu_plugins();
|
108 |
if ( count( $plugin_mu ) > 0 ) {
|
109 |
+
$sys_info .= '<h4>Must Use</h4><br />';
|
110 |
foreach ( $plugin_mu as $plugin => $plugin_data ) {
|
111 |
$sys_info .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "<br />";
|
112 |
}
|
113 |
}
|
114 |
+
$sys_info .= '<h4>Active</h4><br />';
|
115 |
+
$plugins = get_plugins();
|
116 |
$active_plugins = get_option( 'active_plugins', array() );
|
117 |
+
foreach ( $plugins as $plugin_path => $plugin ) {
|
118 |
+
if ( ! in_array( $plugin_path, $active_plugins ) ) {
|
119 |
continue;
|
120 |
+
}
|
121 |
+
$sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
|
122 |
}
|
123 |
+
$sys_info .= '<h4>Inactive</h4><br />';
|
124 |
+
foreach ( $plugins as $plugin_path => $plugin ) {
|
125 |
+
if ( in_array( $plugin_path, $active_plugins ) ) {
|
126 |
continue;
|
127 |
+
}
|
128 |
+
$sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
|
129 |
}
|
130 |
|
131 |
+
$sys_info .= '<h3>Server Information</h3><br />';
|
132 |
+
$sys_info .= 'PHP : ' . PHP_VERSION . '<br />';
|
133 |
+
$sys_info .= 'MySQL : ' . $wpdb->db_version() . '<br />';
|
134 |
+
$sys_info .= 'Webserver : ' . $_SERVER['SERVER_SOFTWARE'] . '<br />';
|
135 |
+
|
136 |
+
$total_quizzes = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_quizzes LIMIT 1" );
|
137 |
+
$total_active_quizzes = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0 LIMIT 1" );
|
138 |
+
$total_questions = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_questions LIMIT 1" );
|
139 |
+
$total_active_questions = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_questions WHERE deleted = 0 LIMIT 1" );
|
140 |
+
$total_results = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_results LIMIT 1" );
|
141 |
+
$total_active_results = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_results WHERE deleted = 0 LIMIT 1" );
|
142 |
+
|
143 |
+
$sys_info .= '<h3>QSM Information</h3><br />';
|
144 |
+
$sys_info .= 'Initial Version : ' . get_option( 'qmn_original_version' ) . '<br />';
|
145 |
+
$sys_info .= 'Current Version : ' . $mlwQuizMasterNext->version . '<br />';
|
146 |
+
$sys_info .= "Total Quizzes : {$total_quizzes}<br />";
|
147 |
+
$sys_info .= "Total Active Quizzes : {$total_active_quizzes}<br />";
|
148 |
+
$sys_info .= "Total Questions : {$total_questions}<br />";
|
149 |
+
$sys_info .= "Total Active Questions : {$total_active_questions}<br />";
|
150 |
+
$sys_info .= "Total Results : {$total_results}<br />";
|
151 |
+
$sys_info .= "Total Active Results : {$total_active_results}<br />";
|
152 |
+
|
153 |
+
$sys_info .= '<h3>QSM Recent Logs</h3><br />';
|
154 |
$recent_errors = $mlwQuizMasterNext->log_manager->get_logs();
|
155 |
if ( $recent_errors ) {
|
156 |
+
foreach ( $recent_errors as $error ) {
|
157 |
+
$sys_info .= "Log created at {$error->post_date}: {$error->post_title} - {$error->post_content}<br />";
|
158 |
}
|
159 |
} else {
|
160 |
+
$sys_info .= 'No recent logs<br />';
|
161 |
}
|
162 |
|
163 |
return $sys_info;
|
php/admin/options-page-email-tab.php
CHANGED
@@ -1,17 +1,25 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Creates the email tab in the Quiz Settings Page
|
6 |
*
|
7 |
* @return void
|
8 |
-
* @since
|
9 |
*/
|
10 |
-
function
|
11 |
global $mlwQuizMasterNext;
|
12 |
-
$mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Emails', 'quiz-master-next'), 'qsm_options_emails_tab_content' );
|
13 |
}
|
14 |
-
add_action( 'plugins_loaded', '
|
15 |
|
16 |
/**
|
17 |
* Creates the email content that is displayed on the email tab.
|
@@ -22,255 +30,22 @@ add_action( 'plugins_loaded', 'qmn_settings_email_tab', 5 );
|
|
22 |
function qsm_options_emails_tab_content() {
|
23 |
global $wpdb;
|
24 |
global $mlwQuizMasterNext;
|
25 |
-
$quiz_id = $_GET['quiz_id'];
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$mlw_qmn_email_array = @unserialize($mlw_qmn_user_email);
|
35 |
-
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', 'Quiz Results For %QUIZ_NAME%');
|
36 |
-
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
37 |
-
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
38 |
-
|
39 |
-
} else {
|
40 |
-
$mlw_qmn_email_array = array(array(0, 0, $mlw_qmn_user_email, 'Quiz Results For %QUIZ_NAME%'));
|
41 |
-
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', 'Quiz Results For %QUIZ_NAME%');
|
42 |
-
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
43 |
-
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
44 |
-
}
|
45 |
-
// Update email template with new array then check to see if worked.
|
46 |
-
$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 ) );
|
47 |
-
if ( false !== $mlw_new_email_results ) {
|
48 |
-
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
49 |
-
$mlwQuizMasterNext->audit_manager->new_audit( "New User Email Has Been Created For Quiz Number $mlw_qmn_add_email_id" );
|
50 |
-
} else {
|
51 |
-
$error = $wpdb->last_error;
|
52 |
-
if ( empty( $error ) ) {
|
53 |
-
$error = __( 'Unknown error', 'quiz-master-next' );
|
54 |
-
}
|
55 |
-
$mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please try again. Error from WordPress: %s', 'quiz-master-next'), $error ), 'error' );
|
56 |
-
$mlwQuizMasterNext->log_manager->add( 'Error creating new user email', "Tried {$wpdb->last_query} but got $error.", 0, 'error');
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
// Checks to add new admin email template.
|
61 |
-
if (isset($_POST["mlw_add_admin_email_page"]) && $_POST["mlw_add_admin_email_page"] == "confirmation")
|
62 |
-
{
|
63 |
-
//Function variables
|
64 |
-
$mlw_qmn_add_email_id = intval($_POST["mlw_add_admin_email_quiz_id"]);
|
65 |
-
$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 ) );
|
66 |
-
|
67 |
-
//Load user email and check if it is array already. If not, turn it into one
|
68 |
-
if (is_serialized($mlw_qmn_admin_email) && is_array(@unserialize($mlw_qmn_admin_email)))
|
69 |
-
{
|
70 |
-
$mlw_qmn_email_array = @unserialize($mlw_qmn_admin_email);
|
71 |
-
$mlw_new_landing_array = array(
|
72 |
-
"begin_score" => 0,
|
73 |
-
"end_score" => 100,
|
74 |
-
"message" => __('Enter text here', 'quiz-master-next'),
|
75 |
-
"subject" => 'Quiz Results For %QUIZ_NAME%'
|
76 |
-
);
|
77 |
-
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
78 |
-
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
79 |
-
|
80 |
-
}
|
81 |
-
else
|
82 |
-
{
|
83 |
-
$mlw_qmn_email_array = array(array(
|
84 |
-
"begin_score" => 0,
|
85 |
-
"end_score" => 0,
|
86 |
-
"message" => $mlw_qmn_admin_email,
|
87 |
-
"subject" => 'Quiz Results For %QUIZ_NAME%'
|
88 |
-
));
|
89 |
-
$mlw_new_landing_array = array(
|
90 |
-
"begin_score" => 0,
|
91 |
-
"end_score" => 100,
|
92 |
-
"message" => __('Enter text here', 'quiz-master-next'),
|
93 |
-
"subject" => 'Quiz Results For %QUIZ_NAME%'
|
94 |
-
);
|
95 |
-
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
96 |
-
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
97 |
-
}
|
98 |
-
//Update email template with new array then check to see if worked
|
99 |
-
$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 ) );
|
100 |
-
if ( false != $mlw_new_email_results ) {
|
101 |
-
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
102 |
-
$mlwQuizMasterNext->audit_manager->new_audit( "New Admin Email Has Been Created For Quiz Number $mlw_qmn_add_email_id" );
|
103 |
-
}
|
104 |
-
else
|
105 |
-
{
|
106 |
-
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0016'), 'error');
|
107 |
-
$mlwQuizMasterNext->log_manager->add("Error 0016", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
//Check to save email templates
|
112 |
-
if (isset($_POST["mlw_save_email_template"]) && $_POST["mlw_save_email_template"] == "confirmation")
|
113 |
-
{
|
114 |
-
//Function Variables
|
115 |
-
$mlw_qmn_email_id = intval($_POST["mlw_email_quiz_id"]);
|
116 |
-
$mlw_qmn_email_template_total = intval($_POST["mlw_email_template_total"]);
|
117 |
-
$mlw_qmn_email_admin_total = intval($_POST["mlw_email_admin_total"]);
|
118 |
-
$mlw_send_user_email = intval( $_POST["sendUserEmail"] );
|
119 |
-
$mlw_send_admin_email = intval( $_POST["sendAdminEmail"] );
|
120 |
-
$mlw_admin_email = sanitize_text_field( $_POST["adminEmail"] );
|
121 |
-
$mlw_email_from_text = sanitize_text_field( $_POST["emailFromText"] );
|
122 |
-
$from_address = sanitize_text_field( $_POST["emailFromAddress"] );
|
123 |
-
$reply_to_user = sanitize_text_field( $_POST["replyToUser"] );
|
124 |
-
|
125 |
-
//from email array
|
126 |
-
$from_email_array = array(
|
127 |
-
'from_name' => $mlw_email_from_text,
|
128 |
-
'from_email' => $from_address,
|
129 |
-
'reply_to' => $reply_to_user
|
130 |
-
);
|
131 |
-
|
132 |
-
//Create new array
|
133 |
-
$i = 1;
|
134 |
-
$mlw_qmn_new_email_array = array();
|
135 |
-
while ( $i <= $mlw_qmn_email_template_total ) {
|
136 |
-
if ( $_POST["user_email_".$i] != "Delete" ) {
|
137 |
-
$mlw_qmn_email_each = array(intval($_POST["user_email_begin_".$i]), intval($_POST["user_email_end_".$i]), htmlspecialchars(stripslashes($_POST["user_email_".$i]), ENT_QUOTES), htmlspecialchars(stripslashes($_POST["user_email_subject_".$i]), ENT_QUOTES));
|
138 |
-
$mlw_qmn_new_email_array[] = $mlw_qmn_email_each;
|
139 |
-
}
|
140 |
-
$i++;
|
141 |
-
}
|
142 |
-
|
143 |
-
//Create new array
|
144 |
-
$i = 1;
|
145 |
-
$mlw_qmn_new_admin_array = array();
|
146 |
-
while ($i <= $mlw_qmn_email_admin_total)
|
147 |
-
{
|
148 |
-
if ($_POST["admin_email_".$i] != "Delete")
|
149 |
-
{
|
150 |
-
$mlw_qmn_email_each = array(
|
151 |
-
"begin_score" => intval($_POST["admin_email_begin_".$i]),
|
152 |
-
"end_score" => intval($_POST["admin_email_end_".$i]),
|
153 |
-
"message" => htmlspecialchars(stripslashes($_POST["admin_email_".$i]), ENT_QUOTES),
|
154 |
-
"subject" => htmlspecialchars(stripslashes($_POST["admin_email_subject_".$i]), ENT_QUOTES)
|
155 |
-
);
|
156 |
-
$mlw_qmn_new_admin_array[] = $mlw_qmn_email_each;
|
157 |
-
}
|
158 |
-
$i++;
|
159 |
-
}
|
160 |
-
|
161 |
-
$from_email_array = serialize( $from_email_array );
|
162 |
-
$mlw_qmn_new_email_array = serialize($mlw_qmn_new_email_array);
|
163 |
-
$mlw_qmn_new_admin_array = serialize($mlw_qmn_new_admin_array);
|
164 |
-
|
165 |
-
$mlw_new_email_results = $wpdb->update(
|
166 |
-
$wpdb->prefix . "mlw_quizzes",
|
167 |
-
array(
|
168 |
-
'send_user_email' => $mlw_send_user_email,
|
169 |
-
'send_admin_email' => $mlw_send_admin_email,
|
170 |
-
'admin_email' => $mlw_admin_email,
|
171 |
-
'email_from_text' => $from_email_array,
|
172 |
-
'user_email_template' => $mlw_qmn_new_email_array,
|
173 |
-
'admin_email_template' => $mlw_qmn_new_admin_array,
|
174 |
-
'last_activity' => date("Y-m-d H:i:s")
|
175 |
-
),
|
176 |
-
array( 'quiz_id' => $mlw_qmn_email_id ),
|
177 |
-
array(
|
178 |
-
'%s',
|
179 |
-
'%s',
|
180 |
-
'%s',
|
181 |
-
'%s',
|
182 |
-
'%s',
|
183 |
-
'%s',
|
184 |
-
'%s'
|
185 |
-
),
|
186 |
-
array( '%d' )
|
187 |
-
);
|
188 |
-
if ( false != $mlw_new_email_results ) {
|
189 |
-
$mlwQuizMasterNext->alertManager->newAlert( __( 'The email has been updated successfully.', 'quiz-master-next' ), 'success' );
|
190 |
-
$mlwQuizMasterNext->audit_manager->new_audit( "Email Templates Have Been Saved For Quiz Number $mlw_qmn_email_id" );
|
191 |
-
}
|
192 |
-
else
|
193 |
-
{
|
194 |
-
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0017'), 'error');
|
195 |
-
$mlwQuizMasterNext->log_manager->add("Error 0017", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
if (isset($_GET["quiz_id"]))
|
200 |
-
{
|
201 |
-
$table_name = $wpdb->prefix . "mlw_quizzes";
|
202 |
-
$mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
|
203 |
-
}
|
204 |
-
|
205 |
-
//Load from email array
|
206 |
-
$from_email_array = maybe_unserialize( $mlw_quiz_options->email_from_text );
|
207 |
-
if ( ! isset( $from_email_array["from_email"] ) ) {
|
208 |
-
$from_email_array = array(
|
209 |
-
'from_name' => $mlw_quiz_options->email_from_text,
|
210 |
-
'from_email' => $mlw_quiz_options->admin_email,
|
211 |
-
'reply_to' => 1
|
212 |
-
);
|
213 |
-
}
|
214 |
-
|
215 |
-
//Load User Email Templates
|
216 |
-
if (is_serialized($mlw_quiz_options->user_email_template) && is_array(@unserialize($mlw_quiz_options->user_email_template)))
|
217 |
-
{
|
218 |
-
$mlw_qmn_user_email_array = @unserialize($mlw_quiz_options->user_email_template);
|
219 |
-
}
|
220 |
-
else
|
221 |
-
{
|
222 |
-
$mlw_qmn_user_email_array = array(array(0, 0, $mlw_quiz_options->user_email_template, 'Quiz Results For %QUIZ_NAME%'));
|
223 |
-
}
|
224 |
-
|
225 |
-
//Load Admin Email Templates
|
226 |
-
if (is_serialized($mlw_quiz_options->admin_email_template) && is_array(@unserialize($mlw_quiz_options->admin_email_template)))
|
227 |
-
{
|
228 |
-
$mlw_qmn_admin_email_array = @unserialize($mlw_quiz_options->admin_email_template);
|
229 |
-
}
|
230 |
-
else
|
231 |
-
{
|
232 |
-
$mlw_qmn_admin_email_array = array(array(
|
233 |
-
"begin_score" => 0,
|
234 |
-
"end_score" => 0,
|
235 |
-
"message" => $mlw_quiz_options->admin_email_template,
|
236 |
-
"subject" => 'Quiz Results For %QUIZ_NAME%'
|
237 |
-
));
|
238 |
-
}
|
239 |
-
wp_enqueue_style( 'qmn_admin_style', plugins_url( '../../css/qsm-admin.css' , __FILE__ ) );
|
240 |
?>
|
241 |
-
<
|
242 |
-
|
243 |
-
// increase the default animation speed to exaggerate the effect
|
244 |
-
$j.fx.speeds._default = 1000;
|
245 |
-
</script>
|
246 |
-
<script>
|
247 |
-
/**
|
248 |
-
* This deletes the user email from the list of emails.
|
249 |
-
*
|
250 |
-
* @return id This variable contains the ID of the email so the correct one is deleted.
|
251 |
-
* @since 4.4.0
|
252 |
-
*/
|
253 |
-
function delete_email(id)
|
254 |
-
{
|
255 |
-
document.getElementById('user_email_'+id).value = "Delete";
|
256 |
-
document.mlw_quiz_save_email_form.submit();
|
257 |
-
}
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
* @return id This variable contains the ID of the email so the right one is deleted.
|
263 |
-
* @since 4.4.0
|
264 |
-
*/
|
265 |
-
function delete_admin_email(id)
|
266 |
-
{
|
267 |
-
document.getElementById('admin_email_'+id).value = "Delete";
|
268 |
-
document.mlw_quiz_save_email_form.submit();
|
269 |
-
}
|
270 |
-
</script>
|
271 |
-
<h2><?php esc_html_e( 'Emails', 'quiz-master-next'); ?></h2>
|
272 |
-
<p>Need assistance with this tab? <a href="https://docs.quizandsurveymaster.com/article/17-sending-emails" target="_blank">Check out the documentation</a> for this tab!</p>
|
273 |
-
<h3 style="text-align: center;"><?php _e('Template Variables', 'quiz-master-next'); ?></h3>
|
274 |
<div class="template_list_holder">
|
275 |
<div class="template_variable">
|
276 |
<span class="template_name">%CONTACT_X%</span> - <?php _e( 'Value user entered into contact field. X is # of contact field. For example, first contact field would be %CONTACT_1%', 'quiz-master-next' ); ?>
|
@@ -341,227 +116,72 @@ function qsm_options_emails_tab_content() {
|
|
341 |
<?php do_action('qmn_template_variable_list'); ?>
|
342 |
</div>
|
343 |
<div style="clear:both;"></div>
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
<
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
<
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
<
|
393 |
-
<
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
</
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
{
|
411 |
-
if($alternate) $alternate = "";
|
412 |
-
else $alternate = " class=\"alternate\"";
|
413 |
-
$mlw_each_count += 1;
|
414 |
-
if (!isset($mlw_each[3]))
|
415 |
-
{
|
416 |
-
$mlw_each[3] = "Quiz Results For %QUIZ_NAME%";
|
417 |
-
}
|
418 |
-
if ($mlw_each[0] == 0 && $mlw_each[1] == 0)
|
419 |
-
{
|
420 |
-
echo "<tr{$alternate}>";
|
421 |
-
echo "<td>";
|
422 |
-
echo "Default";
|
423 |
-
echo "</td>";
|
424 |
-
echo "<td>";
|
425 |
-
echo "<input type='hidden' id='user_email_begin_".$mlw_each_count."' name='user_email_begin_".$mlw_each_count."' value='0'/>-";
|
426 |
-
echo "</td>";
|
427 |
-
echo "<td>";
|
428 |
-
echo "<input type='hidden' id='user_email_end_".$mlw_each_count."' name='user_email_end_".$mlw_each_count."' value='0'/>-";
|
429 |
-
echo "</td>";
|
430 |
-
echo "<td>";
|
431 |
-
echo "<input type='text' id='user_email_subject_".$mlw_each_count."' name='user_email_subject_".$mlw_each_count."' value='".$mlw_each[3]."' />";
|
432 |
-
echo "</td>";
|
433 |
-
echo "<td>";
|
434 |
-
echo "<textarea cols='80' rows='15' id='user_email_".$mlw_each_count."' name='user_email_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
435 |
-
echo "</td>";
|
436 |
-
echo "</tr>";
|
437 |
-
break;
|
438 |
-
}
|
439 |
-
else
|
440 |
-
{
|
441 |
-
echo "<tr{$alternate}>";
|
442 |
-
echo "<td>";
|
443 |
-
echo $mlw_each_count."<div><span style='color:green;font-size:12px;'><a onclick=\"\$j('#trying_delete_email_".$mlw_each_count."').show();\">Delete</a></span></div><div style=\"display: none;\" id='trying_delete_email_".$mlw_each_count."'>Are you sure?<br /><a onclick=\"delete_email(".$mlw_each_count.")\">Yes</a>|<a onclick=\"\$j('#trying_delete_email_".$mlw_each_count."').hide();\">No</a></div>";
|
444 |
-
echo "</td>";
|
445 |
-
echo "<td>";
|
446 |
-
echo "<input type='text' id='user_email_begin_".$mlw_each_count."' name='user_email_begin_".$mlw_each_count."' title='What score must the user score better than to see this page' value='".$mlw_each[0]."'/>";
|
447 |
-
echo "</td>";
|
448 |
-
echo "<td>";
|
449 |
-
echo "<input type='text' id='user_email_end_".$mlw_each_count."' name='user_email_end_".$mlw_each_count."' title='What score must the user score worse than to see this page' value='".$mlw_each[1]."' />";
|
450 |
-
echo "</td>";
|
451 |
-
echo "<td>";
|
452 |
-
echo "<input type='text' id='user_email_subject_".$mlw_each_count."' name='user_email_subject_".$mlw_each_count."' value='".$mlw_each[3]."' />";
|
453 |
-
echo "</td>";
|
454 |
-
echo "<td>";
|
455 |
-
echo "<textarea cols='80' rows='15' id='user_email_".$mlw_each_count."' title='What email will the user be sent' name='user_email_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
456 |
-
echo "</td>";
|
457 |
-
echo "</tr>";
|
458 |
-
}
|
459 |
-
}
|
460 |
-
?>
|
461 |
-
</tbody>
|
462 |
-
<tfoot>
|
463 |
-
<tr>
|
464 |
-
<th>ID</th>
|
465 |
-
<th><?php _e('Score Greater Than Or Equal To', 'quiz-master-next'); ?></th>
|
466 |
-
<th><?php _e('Score Less Than Or Equal To', 'quiz-master-next'); ?></th>
|
467 |
-
<th><?php _e('Subject', 'quiz-master-next'); ?></th>
|
468 |
-
<th><?php _e('Email To Send', 'quiz-master-next'); ?></th>
|
469 |
-
</tr>
|
470 |
-
</tfoot>
|
471 |
-
</table>
|
472 |
-
<a id="new_email_button_bottom" class="button" href="#" onclick="javascript: document.mlw_quiz_add_email_form.submit();"><?php _e('Add New User Email', 'quiz-master-next'); ?></a>
|
473 |
-
<input type='hidden' name='mlw_save_email_template' value='confirmation' />
|
474 |
-
<input type='hidden' name='mlw_email_quiz_id' value='<?php echo $quiz_id; ?>' />
|
475 |
-
<input type='hidden' name='mlw_email_template_total' value='<?php echo $mlw_each_count; ?>' />
|
476 |
-
<br />
|
477 |
-
<br />
|
478 |
-
<br />
|
479 |
-
<br />
|
480 |
-
<h3><?php _e('Email Sent To Admin', 'quiz-master-next'); ?></h3>
|
481 |
-
<a id="new_admin_email_button_top" class="button" href="#" onclick="javascript: document.mlw_quiz_add_admin_email_form.submit();"><?php _e('Add New Admin Email', 'quiz-master-next'); ?></a>
|
482 |
-
<table class="widefat">
|
483 |
-
<thead>
|
484 |
-
<tr>
|
485 |
-
<th>ID</th>
|
486 |
-
<th><?php _e('Score Greater Than Or Equal To', 'quiz-master-next'); ?></th>
|
487 |
-
<th><?php _e('Score Less Than Or Equal To', 'quiz-master-next'); ?></th>
|
488 |
-
<th><?php _e('Subject', 'quiz-master-next'); ?></th>
|
489 |
-
<th><?php _e('Email To Send', 'quiz-master-next'); ?></th>
|
490 |
-
</tr>
|
491 |
-
</thead>
|
492 |
-
<tbody>
|
493 |
-
<?php
|
494 |
-
$mlw_admin_count = 0;
|
495 |
-
$alternate = "";
|
496 |
-
foreach($mlw_qmn_admin_email_array as $mlw_each)
|
497 |
-
{
|
498 |
-
if($alternate) $alternate = "";
|
499 |
-
else $alternate = " class=\"alternate\"";
|
500 |
-
$mlw_admin_count += 1;
|
501 |
-
if (!isset($mlw_each["subject"]))
|
502 |
-
{
|
503 |
-
$mlw_each[3] = "Quiz Results For %QUIZ_NAME%";
|
504 |
-
}
|
505 |
-
if ($mlw_each["begin_score"] == 0 && $mlw_each["end_score"] == 0)
|
506 |
-
{
|
507 |
-
echo "<tr{$alternate}>";
|
508 |
-
echo "<td>";
|
509 |
-
echo "Default";
|
510 |
-
echo "</td>";
|
511 |
-
echo "<td>";
|
512 |
-
echo "<input type='hidden' id='admin_email_begin_".$mlw_admin_count."' name='admin_email_begin_".$mlw_admin_count."' value='0'/>-";
|
513 |
-
echo "</td>";
|
514 |
-
echo "<td>";
|
515 |
-
echo "<input type='hidden' id='admin_email_end_".$mlw_admin_count."' name='admin_email_end_".$mlw_admin_count."' value='0'/>-";
|
516 |
-
echo "</td>";
|
517 |
-
echo "<td>";
|
518 |
-
echo "<input type='text' id='admin_email_subject_".$mlw_admin_count."' name='admin_email_subject_".$mlw_admin_count."' value='".$mlw_each["subject"]."' />";
|
519 |
-
echo "</td>";
|
520 |
-
echo "<td>";
|
521 |
-
echo "<textarea cols='80' rows='15' id='admin_email_".$mlw_admin_count."' name='admin_email_".$mlw_admin_count."'>".$mlw_each["message"]."</textarea>";
|
522 |
-
echo "</td>";
|
523 |
-
echo "</tr>";
|
524 |
-
break;
|
525 |
-
}
|
526 |
-
else
|
527 |
-
{
|
528 |
-
echo "<tr{$alternate}>";
|
529 |
-
echo "<td>";
|
530 |
-
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>";
|
531 |
-
echo "</td>";
|
532 |
-
echo "<td>";
|
533 |
-
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"]."'/>";
|
534 |
-
echo "</td>";
|
535 |
-
echo "<td>";
|
536 |
-
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"]."' />";
|
537 |
-
echo "</td>";
|
538 |
-
echo "<td>";
|
539 |
-
echo "<input type='text' id='admin_email_subject_".$mlw_admin_count."' name='admin_email_subject_".$mlw_admin_count."' value='".$mlw_each["subject"]."' />";
|
540 |
-
echo "</td>";
|
541 |
-
echo "<td>";
|
542 |
-
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>";
|
543 |
-
echo "</td>";
|
544 |
-
echo "</tr>";
|
545 |
-
}
|
546 |
-
}
|
547 |
-
?>
|
548 |
-
</tbody>
|
549 |
-
<tfoot>
|
550 |
-
<tr>
|
551 |
-
<th>ID</th>
|
552 |
-
<th><?php _e('Score Greater Than Or Equal To', 'quiz-master-next'); ?></th>
|
553 |
-
<th><?php _e('Score Less Than Or Equal To', 'quiz-master-next'); ?></th>
|
554 |
-
<th><?php _e('Subject', 'quiz-master-next'); ?></th>
|
555 |
-
<th><?php _e('Email To Send', 'quiz-master-next'); ?></th>
|
556 |
-
</tr>
|
557 |
-
</tfoot>
|
558 |
-
</table>
|
559 |
-
<a id="new_admin_email_button_bottom" class="button" href="#" onclick="javascript: document.mlw_quiz_add_admin_email_form.submit();"><?php _e('Add New Admin Email', 'quiz-master-next'); ?></a>
|
560 |
-
<input type='hidden' name='mlw_email_admin_total' value='<?php echo $mlw_admin_count; ?>' />
|
561 |
-
</form>
|
562 |
-
<br />
|
563 |
-
<br />
|
564 |
-
<button id="save_email_button" class="button-primary" onclick="javascript: document.mlw_quiz_save_email_form.submit();"><?php _e('Save Email Templates And Settings', 'quiz-master-next'); ?></button>
|
565 |
<?php
|
566 |
}
|
567 |
?>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Creates the emails page tab when editing quizzes.
|
4 |
+
*
|
5 |
+
* @package QSM
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
|
12 |
/**
|
13 |
* Creates the email tab in the Quiz Settings Page
|
14 |
*
|
15 |
* @return void
|
16 |
+
* @since 6.1.0
|
17 |
*/
|
18 |
+
function qsm_settings_email_tab() {
|
19 |
global $mlwQuizMasterNext;
|
20 |
+
$mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Emails', 'quiz-master-next' ), 'qsm_options_emails_tab_content' );
|
21 |
}
|
22 |
+
add_action( 'plugins_loaded', 'qsm_settings_email_tab', 5 );
|
23 |
|
24 |
/**
|
25 |
* Creates the email content that is displayed on the email tab.
|
30 |
function qsm_options_emails_tab_content() {
|
31 |
global $wpdb;
|
32 |
global $mlwQuizMasterNext;
|
33 |
+
$quiz_id = intval( $_GET['quiz_id'] );
|
34 |
+
$js_data = array(
|
35 |
+
'quizID' => $quiz_id,
|
36 |
+
'nonce' => wp_create_nonce( 'wp_rest' ),
|
37 |
+
);
|
38 |
+
wp_enqueue_script( 'qsm_emails_admin_script', plugins_url( '../../js/qsm-admin-emails.js', __FILE__ ), array( 'jquery-ui-sortable', 'qmn_admin_js' ), $mlwQuizMasterNext->version );
|
39 |
+
wp_localize_script( 'qsm_emails_admin_script', 'qsmEmailsObject', $js_data );
|
40 |
+
wp_enqueue_editor();
|
41 |
+
wp_enqueue_media();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
?>
|
43 |
+
<h2><?php esc_html_e( 'Emails', 'quiz-master-next' ); ?></h2>
|
44 |
+
<p>Need assistance with this tab? <a href="https://docs.quizandsurveymaster.com/article/17-sending-emails" target="_blank">Check out the documentation</a> for this tab!</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
<!-- Template Variable Section -->
|
47 |
+
<section>
|
48 |
+
<h3 style="text-align: center;"><?php esc_html_e( 'Template Variables', 'quiz-master-next' ); ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
<div class="template_list_holder">
|
50 |
<div class="template_variable">
|
51 |
<span class="template_name">%CONTACT_X%</span> - <?php _e( 'Value user entered into contact field. X is # of contact field. For example, first contact field would be %CONTACT_1%', 'quiz-master-next' ); ?>
|
116 |
<?php do_action('qmn_template_variable_list'); ?>
|
117 |
</div>
|
118 |
<div style="clear:both;"></div>
|
119 |
+
</section>
|
120 |
+
|
121 |
+
<!-- Emails Section -->
|
122 |
+
<section>
|
123 |
+
<h3>Your Emails</h3>
|
124 |
+
<button class="save-emails button-primary"><?php esc_html_e( 'Save Emails', 'quiz-master-next' ); ?></button>
|
125 |
+
<button class="add-new-email button"><?php esc_html_e( 'Add New Email', 'quiz-master-next' ); ?></button>
|
126 |
+
<div id="emails"></div>
|
127 |
+
<button class="save-emails button-primary"><?php esc_html_e( 'Save Emails', 'quiz-master-next' ); ?></button>
|
128 |
+
<button class="add-new-email button"><?php esc_html_e( 'Add New Email', 'quiz-master-next' ); ?></button>
|
129 |
+
</section>
|
130 |
+
|
131 |
+
<!-- Templates -->
|
132 |
+
<script type="text/template" id="tmpl-email">
|
133 |
+
<div class="email">
|
134 |
+
<header class="email-header">
|
135 |
+
<div><button class="delete-email-button"><span class="dashicons dashicons-trash"></span></button></div>
|
136 |
+
</header>
|
137 |
+
<main class="email-content">
|
138 |
+
<div class="email-when">
|
139 |
+
<div class="email-content-header">
|
140 |
+
<h4>When...</h4>
|
141 |
+
<p>Set conditions for when this email should be sent. Leave empty to set this as an email that is always sent.</p>
|
142 |
+
</div>
|
143 |
+
<div class="email-when-conditions">
|
144 |
+
<!-- Conditions go here. Review template below. -->
|
145 |
+
</div>
|
146 |
+
<button class="new-condition button"><?php esc_html_e( 'Add additional condition', 'quiz-master-next' ); ?></button>
|
147 |
+
</div>
|
148 |
+
<div class="email-show">
|
149 |
+
<div class="email-content-header">
|
150 |
+
<h4>...Send</h4>
|
151 |
+
<p>Create the email that should be sent when the conditions are met.</p>
|
152 |
+
</div>
|
153 |
+
<label>Who to send the email to? Put %USER_EMAIL% to send to user</label>
|
154 |
+
<input type="email" class="to-email" value="{{ data.to }}">
|
155 |
|