Version Description
(August 05, 2020) = * Enhancement: Added option to set items per page while adding questions from question bank. * Enhancement: Hide question description by default or when empty. * Enhancement: Fixed the question number position while displaying questions. * Enhancement: Added new option to skip validations when timer expires. * Enhancement: Redesigned addons setting page. * Enhancement: Renamed the question type for better understanding Read Documentation. * Bug: Fixed issue with storing results when questions are more than 100. * Bug: Fixed issue with force submit option after timer expiry. * Bug: Fixed incorrect data issue in email when using %QUESTIONS_ANSWERS%. * Bug: Fixed broken layout when editing or adding question. * Bug: Fixed security vulnerability (discovered by Wordfence).
Release Info
Developer | expresstech |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 7.0.1 |
Comparing to | |
See all releases |
Code changes from version 7.0.0 to 7.0.1
- README.md +1 -1
- css/admin-dashboard.css +2 -0
- css/common.css +23 -3
- css/qsm-admin-question.css +19 -2
- css/qsm-admin.css +159 -9
- js/admin.js +10 -0
- js/qsm-admin-question.js +27 -3
- js/qsm-quiz.js +86 -79
- mlw_quizmaster2.php +3 -3
- php/admin/addons-page.php +172 -60
- php/admin/admin-dashboard.php +18 -9
- php/admin/functions.php +30 -1
- php/admin/help-page.php +35 -35
- php/admin/options-page-email-tab.php +16 -16
- php/admin/options-page-questions-tab.php +24 -21
- php/admin/options-page-results-page-tab.php +14 -14
- php/admin/options-page-text-tab.php +1 -1
- php/admin/quizzes-page.php +2 -2
- php/admin/settings-page.php +18 -0
- php/admin/stats-page.php +4 -4
- php/admin/tools-page.php +1 -1
- php/classes/class-qmn-quiz-manager.php +124 -82
- php/classes/class-qsm-install.php +19 -1
- php/classes/class-qsm-settings.php +1 -1
- php/question-types.php +6 -5
- php/rest-api.php +14 -9
- php/shortcodes.php +1 -1
- php/template-variables.php +53 -46
- readme.txt +15 -2
- templates/qmn_primary.css +0 -13
- uninstall.php +1 -0
@@ -19,4 +19,4 @@ See [the list of contributors](https://github.com/QuizandSurveyMaster/quiz_maste
|
|
19 |
This project is licensed under the GPLv2 License - see the [LICENSE.md file](https://github.com/QuizandSurveyMaster/quiz_master_next/blob/master/LICENSE.md) for details.
|
20 |
|
21 |
## Support ##
|
22 |
-
This is a developer's portal for Quiz And Survey Master and should _not_ be used for support. Please create a support ticket [here](
|
19 |
This project is licensed under the GPLv2 License - see the [LICENSE.md file](https://github.com/QuizandSurveyMaster/quiz_master_next/blob/master/LICENSE.md) for details.
|
20 |
|
21 |
## Support ##
|
22 |
+
This is a developer's portal for Quiz And Survey Master and should _not_ be used for support. Please create a support ticket [here](https://quizandsurveymaster.com/contact-support/).
|
@@ -3,6 +3,8 @@
|
|
3 |
color: #606a73;
|
4 |
font-size: 23px;
|
5 |
margin-right: 5px;
|
|
|
|
|
6 |
}
|
7 |
.welcome-panel .qsm-welcome-panel-close{
|
8 |
position: absolute;
|
3 |
color: #606a73;
|
4 |
font-size: 23px;
|
5 |
margin-right: 5px;
|
6 |
+
position: relative;
|
7 |
+
top: -3px;
|
8 |
}
|
9 |
.welcome-panel .qsm-welcome-panel-close{
|
10 |
position: absolute;
|
@@ -13,7 +13,11 @@
|
|
13 |
.MJXc-display{
|
14 |
display: inline-block !important;
|
15 |
}
|
16 |
-
.mlw_qmn_question{
|
|
|
|
|
|
|
|
|
17 |
display: block;
|
18 |
}
|
19 |
|
@@ -126,12 +130,14 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover{
|
|
126 |
}
|
127 |
.quiz_section .mlw_qmn_new_question{
|
128 |
font-weight: bold;
|
129 |
-
display: block;
|
130 |
-
width:
|
131 |
margin-bottom: 10px;
|
132 |
}
|
133 |
.quiz_section .mlw_qmn_question.qsm_remove_bold{
|
134 |
font-weight: normal;
|
|
|
|
|
135 |
}
|
136 |
.quiz_section iframe{
|
137 |
width: 100% !important;
|
@@ -147,6 +153,20 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover{
|
|
147 |
font-weight: bold;
|
148 |
color: rgb(52, 152, 219);
|
149 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
@media screen and (max-width: 767px){
|
151 |
.question-type-polar-s .left-polar-title,
|
152 |
.question-type-polar-s .slider-main-wrapper,
|
13 |
.MJXc-display{
|
14 |
display: inline-block !important;
|
15 |
}
|
16 |
+
body .quiz_section .mlw_qmn_question{
|
17 |
+
display: inline-block;
|
18 |
+
}
|
19 |
+
|
20 |
+
body .quiz_section .qsm_contact_div .mlw_qmn_question{
|
21 |
display: block;
|
22 |
}
|
23 |
|
130 |
}
|
131 |
.quiz_section .mlw_qmn_new_question{
|
132 |
font-weight: bold;
|
133 |
+
display: inline-block;
|
134 |
+
width: auto;
|
135 |
margin-bottom: 10px;
|
136 |
}
|
137 |
.quiz_section .mlw_qmn_question.qsm_remove_bold{
|
138 |
font-weight: normal;
|
139 |
+
display: block;
|
140 |
+
margin-bottom: 10px;
|
141 |
}
|
142 |
.quiz_section iframe{
|
143 |
width: 100% !important;
|
153 |
font-weight: bold;
|
154 |
color: rgb(52, 152, 219);
|
155 |
}
|
156 |
+
.quiz_section .mlw-file-upload-error-msg{
|
157 |
+
color: red;
|
158 |
+
display: block;
|
159 |
+
}
|
160 |
+
|
161 |
+
.quiz_section .remove-uploaded-file{
|
162 |
+
color: red;
|
163 |
+
border: 1px solid red;
|
164 |
+
width: 31px;
|
165 |
+
padding: 5px 5px 0px 5px;
|
166 |
+
display: inline-block;
|
167 |
+
cursor: pointer;
|
168 |
+
}
|
169 |
+
|
170 |
@media screen and (max-width: 767px){
|
171 |
.question-type-polar-s .left-polar-title,
|
172 |
.question-type-polar-s .slider-main-wrapper,
|
@@ -195,12 +195,16 @@
|
|
195 |
}
|
196 |
|
197 |
.qsm-row {
|
198 |
-
display:
|
199 |
width: 100%;
|
200 |
margin-bottom: 13px;
|
201 |
font-size: 16px;
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
204 |
#post-body-content .qsm-row{
|
205 |
margin-bottom: 20px;
|
206 |
}
|
@@ -596,7 +600,13 @@ a.import-button.button.disable_import::before {
|
|
596 |
font-size: 15px;
|
597 |
line-height: 21px;
|
598 |
text-align: center;
|
599 |
-
margin: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
600 |
}
|
601 |
|
602 |
#delete-action .deletion{
|
@@ -626,6 +636,13 @@ a#qsm-category-add-toggle {
|
|
626 |
#qsm-question-id{
|
627 |
float: right;
|
628 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
@media screen and (max-width: 575px){
|
630 |
.qsm-popup__container{
|
631 |
min-width: auto;
|
195 |
}
|
196 |
|
197 |
.qsm-row {
|
198 |
+
display: block;
|
199 |
width: 100%;
|
200 |
margin-bottom: 13px;
|
201 |
font-size: 16px;
|
202 |
}
|
203 |
|
204 |
+
div#correct_answer_info_area {
|
205 |
+
float: left;
|
206 |
+
}
|
207 |
+
|
208 |
#post-body-content .qsm-row{
|
209 |
margin-bottom: 20px;
|
210 |
}
|
600 |
font-size: 15px;
|
601 |
line-height: 21px;
|
602 |
text-align: center;
|
603 |
+
margin: 0 0 20px 0;
|
604 |
+
}
|
605 |
+
|
606 |
+
.qsm-show-question-desc-box{
|
607 |
+
display: inline-block;
|
608 |
+
margin-bottom: 10px !important;
|
609 |
+
font-size: 15px;
|
610 |
}
|
611 |
|
612 |
#delete-action .deletion{
|
636 |
#qsm-question-id{
|
637 |
float: right;
|
638 |
}
|
639 |
+
|
640 |
+
.qsm-show-question-desc-box{
|
641 |
+
background: #fff;
|
642 |
+
}
|
643 |
+
.qsm-show-question-desc-box span.dashicons{
|
644 |
+
line-height: 29px;
|
645 |
+
}
|
646 |
@media screen and (max-width: 575px){
|
647 |
.qsm-popup__container{
|
648 |
min-width: auto;
|
@@ -125,6 +125,152 @@ span.qsm-quiz-name {
|
|
125 |
float: left;
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
.quizzes-surveys_page_qmn_addons .qsm-news-ads{
|
129 |
width: 15%;
|
130 |
float: right;
|
@@ -249,6 +395,11 @@ Results Pages & Emails Tab
|
|
249 |
margin-bottom: 10px;
|
250 |
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
252 |
.results-page-content-header h4,
|
253 |
.results-page-content-header p,
|
254 |
.email-content-header h4,
|
@@ -274,7 +425,7 @@ Results Pages & Emails Tab
|
|
274 |
.delete-condition-button {
|
275 |
background: none;
|
276 |
border: 1px solid #1DD969;
|
277 |
-
color: #
|
278 |
cursor: pointer;
|
279 |
transition-duration: 200ms;
|
280 |
padding: 6px;
|
@@ -512,21 +663,20 @@ Misc.
|
|
512 |
/* Info Bar */
|
513 |
.qsm-info-box {
|
514 |
display: block;
|
515 |
-
text-align:center;
|
516 |
-
background: #
|
517 |
-
border:
|
518 |
-
color: #000;
|
519 |
font-weight: bold;
|
520 |
-
font-size: 14px;
|
|
|
|
|
521 |
}
|
522 |
|
523 |
.qsm-info-box p {
|
524 |
font-size: 14px;
|
525 |
}
|
526 |
|
527 |
-
.qsm-info-box a {
|
528 |
-
color: yellow;
|
529 |
-
}
|
530 |
|
531 |
/* Info Widget */
|
532 |
.qsm-quiz-page-addon .qsm-info-widget {
|
125 |
float: left;
|
126 |
}
|
127 |
|
128 |
+
.qsm-addon-browse-addons{
|
129 |
+
background: #fff;
|
130 |
+
padding: 15px 25px;
|
131 |
+
width: 100%;
|
132 |
+
display: inline-block;
|
133 |
+
box-sizing: border-box;
|
134 |
+
}
|
135 |
+
.qsm-addon-browse-addons .qsm-addon-anchor-left{
|
136 |
+
float: left;
|
137 |
+
}
|
138 |
+
.qsm-addon-browse-addons .qsm-addon-list-right{
|
139 |
+
float: right;
|
140 |
+
}
|
141 |
+
.qsm-addon-browse-addons .qsm-addon-list-right > span{
|
142 |
+
margin-right: 10px;
|
143 |
+
font-size: 16px;
|
144 |
+
}
|
145 |
+
.qsm-addon-browse-addons .qsm-addon-anchor-left a.active{
|
146 |
+
font-weight: bold;
|
147 |
+
}
|
148 |
+
.qsm-addon-browse-addons .qsm-addon-anchor-left a{
|
149 |
+
display: inline-block;
|
150 |
+
font-size: 16px;
|
151 |
+
color: #474444;
|
152 |
+
text-decoration: none;
|
153 |
+
margin-top: 5px;
|
154 |
+
margin-right: 30px;
|
155 |
+
}
|
156 |
+
.qsm_popular_addons div.popuar-addon-ul{
|
157 |
+
width: 100%;
|
158 |
+
display: inline-block;
|
159 |
+
}
|
160 |
+
.qsm_popular_addons div.popuar-addon-ul > div{
|
161 |
+
background: #fff;
|
162 |
+
padding: 5px;
|
163 |
+
width: 30%;
|
164 |
+
margin-right: 2%;
|
165 |
+
float: left;
|
166 |
+
margin-bottom: 30px;
|
167 |
+
}
|
168 |
+
.qsm_popular_addons div.popuar-addon-ul > div:nth-child(3n+4){
|
169 |
+
clear: both;
|
170 |
+
}
|
171 |
+
.qsm_popular_addons div.popuar-addon-ul > div .description-wrap{
|
172 |
+
padding: 20px;
|
173 |
+
}
|
174 |
+
.qsm_popular_addons div.popuar-addon-ul > div .description-wrap .description{
|
175 |
+
display: block;
|
176 |
+
width: 100%;
|
177 |
+
margin-bottom: 15px;
|
178 |
+
font-size: 14px;
|
179 |
+
font-style: normal;
|
180 |
+
}
|
181 |
+
.qsm_popular_addons div.popuar-addon-ul > div img{
|
182 |
+
max-width: 100%;
|
183 |
+
}
|
184 |
+
.qsm-quiz-page-addon.qsm-addon-page-list{
|
185 |
+
width: 75%;
|
186 |
+
float: left;
|
187 |
+
margin-top: 40px;
|
188 |
+
}
|
189 |
+
.qsm-addon-news-ads{
|
190 |
+
width: 25%;
|
191 |
+
float: right;
|
192 |
+
background: #fff;
|
193 |
+
padding: 7px;
|
194 |
+
box-sizing: border-box;
|
195 |
+
margin-top: 40px;
|
196 |
+
}
|
197 |
+
.qsm-addon-news-ads .qsm-news-ads-title{
|
198 |
+
border-bottom: 0;
|
199 |
+
margin-top: 25px;
|
200 |
+
}
|
201 |
+
.qsm-addon-news-ads .qsm-info-widget{
|
202 |
+
text-align: left;
|
203 |
+
padding: 30px;
|
204 |
+
}
|
205 |
+
.qsm-addon-news-ads .qsm-info-widget h3{
|
206 |
+
color: #fff;
|
207 |
+
}
|
208 |
+
.qsm-addon-news-ads .qsm-info-widget a.button-primary{
|
209 |
+
margin-top: 0;
|
210 |
+
background: #fff;
|
211 |
+
color: #444;
|
212 |
+
}
|
213 |
+
.qsm-addon-news-ads .qsm-info-widget .button.button-default{
|
214 |
+
background: #fff;
|
215 |
+
color: #444;
|
216 |
+
}
|
217 |
+
.qsm-addon-news-ads .qsm-info-widget{
|
218 |
+
transform: none !important;
|
219 |
+
max-width: 100%;
|
220 |
+
}
|
221 |
+
.qsm-addon-news-ads .qsm-info-widget:nth-child(2){
|
222 |
+
background: #00BB57;
|
223 |
+
color: #fff;
|
224 |
+
}
|
225 |
+
.qsm-addon-news-ads .qsm-info-widget:nth-child(3){
|
226 |
+
background: #0073AF;
|
227 |
+
color: #fff;
|
228 |
+
}
|
229 |
+
.qsm-active-addons .installed_title{
|
230 |
+
background: #fff;
|
231 |
+
margin: 0;
|
232 |
+
padding: 15px;
|
233 |
+
border: 1px solid #ccd0d4;
|
234 |
+
color: #007cba;
|
235 |
+
font-size: 16px;
|
236 |
+
}
|
237 |
+
.qsm-active-addons .installed_addons_wrapper,
|
238 |
+
.qsm-active-addons .no_addons_installed{
|
239 |
+
border: 1px solid #ccd0d4;
|
240 |
+
border-top: medium none;
|
241 |
+
}
|
242 |
+
.qsm-active-addons .no_addons_installed{
|
243 |
+
padding: 30px 25%;
|
244 |
+
background: #fff;
|
245 |
+
text-align: center;
|
246 |
+
font-style: italic;
|
247 |
+
font-size: 16px;
|
248 |
+
line-height: 22px;
|
249 |
+
}
|
250 |
+
.qsm-active-addons .installed_addons_wrapper .installed_addon{
|
251 |
+
padding: 15px 15px 27px 15px;
|
252 |
+
background: #FAFAFA;
|
253 |
+
}
|
254 |
+
.qsm-active-addons .installed_addons_wrapper .installed_addon:nth-child(2n){
|
255 |
+
background: #fff;
|
256 |
+
}
|
257 |
+
.qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_name{
|
258 |
+
font-size: 14px;
|
259 |
+
font-weight: bold;
|
260 |
+
position: relative;
|
261 |
+
top: 5px;
|
262 |
+
}
|
263 |
+
.qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link{
|
264 |
+
float: right;
|
265 |
+
}
|
266 |
+
.qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link span.dashicons{
|
267 |
+
margin-top: 4px;
|
268 |
+
}
|
269 |
+
.qsm-active-addons{
|
270 |
+
width: 100%;
|
271 |
+
box-sizing: border-box;
|
272 |
+
margin-bottom: 30px;
|
273 |
+
}
|
274 |
.quizzes-surveys_page_qmn_addons .qsm-news-ads{
|
275 |
width: 15%;
|
276 |
float: right;
|
395 |
margin-bottom: 10px;
|
396 |
}
|
397 |
|
398 |
+
.email-show label{
|
399 |
+
margin-bottom: 5px;
|
400 |
+
display: block;
|
401 |
+
}
|
402 |
+
|
403 |
.results-page-content-header h4,
|
404 |
.results-page-content-header p,
|
405 |
.email-content-header h4,
|
425 |
.delete-condition-button {
|
426 |
background: none;
|
427 |
border: 1px solid #1DD969;
|
428 |
+
color: #dc3232;
|
429 |
cursor: pointer;
|
430 |
transition-duration: 200ms;
|
431 |
padding: 6px;
|
663 |
/* Info Bar */
|
664 |
.qsm-info-box {
|
665 |
display: block;
|
666 |
+
text-align: center;
|
667 |
+
background: #fff;
|
668 |
+
border: 1px solid #dfd4d4;
|
669 |
+
/* color: #000; */
|
670 |
font-weight: bold;
|
671 |
+
/* font-size: 14px; */
|
672 |
+
margin-bottom: 20px;
|
673 |
+
margin-top: 10px;
|
674 |
}
|
675 |
|
676 |
.qsm-info-box p {
|
677 |
font-size: 14px;
|
678 |
}
|
679 |
|
|
|
|
|
|
|
680 |
|
681 |
/* Info Widget */
|
682 |
.qsm-quiz-page-addon .qsm-info-widget {
|
@@ -140,6 +140,7 @@ var QSMAdmin;
|
|
140 |
icons: icons,
|
141 |
heightStyle: "content"
|
142 |
});
|
|
|
143 |
jQuery('.template-list .template-list-inner:first-child').trigger('click');
|
144 |
}
|
145 |
});
|
@@ -160,6 +161,7 @@ var QSMAdmin;
|
|
160 |
jQuery('#recomm_addons_wrapper').html('');
|
161 |
jQuery('#recomm_addons_wrapper').html(diff_html[1]);
|
162 |
jQuery( "#accordion" ).accordion();
|
|
|
163 |
$( '#quiz_settings_wrapper select' ).each(function(){
|
164 |
var name = $(this).attr('name');
|
165 |
var value = $(this).val();
|
@@ -306,5 +308,13 @@ var QSMAdmin;
|
|
306 |
this_par.text('').text(button_txt);
|
307 |
}, 1000);
|
308 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
});
|
310 |
}(jQuery));
|
140 |
icons: icons,
|
141 |
heightStyle: "content"
|
142 |
});
|
143 |
+
jQuery('#accordion h3.ui-accordion-header').next().slideDown();
|
144 |
jQuery('.template-list .template-list-inner:first-child').trigger('click');
|
145 |
}
|
146 |
});
|
161 |
jQuery('#recomm_addons_wrapper').html('');
|
162 |
jQuery('#recomm_addons_wrapper').html(diff_html[1]);
|
163 |
jQuery( "#accordion" ).accordion();
|
164 |
+
jQuery('#accordion h3.ui-accordion-header').next().slideDown();
|
165 |
$( '#quiz_settings_wrapper select' ).each(function(){
|
166 |
var name = $(this).attr('name');
|
167 |
var value = $(this).val();
|
308 |
this_par.text('').text(button_txt);
|
309 |
}, 1000);
|
310 |
});
|
311 |
+
$(document).on('click', '.qsm-addon-anchor-left > a', function(e){
|
312 |
+
e.preventDefault();
|
313 |
+
var href = $(this).attr('href');
|
314 |
+
$('.qsm-addon-anchor-left').find('a').removeClass('active');
|
315 |
+
$(this).addClass('active');
|
316 |
+
$('.qsm-quiz-page-addon > .qsm_popular_addons').hide();
|
317 |
+
$( href ).show();
|
318 |
+
});
|
319 |
});
|
320 |
}(jQuery));
|
@@ -15,7 +15,7 @@ var import_button;
|
|
15 |
quizID: 1,
|
16 |
type: '0',
|
17 |
name: '',
|
18 |
-
question_title: '
|
19 |
answerInfo: '',
|
20 |
comments: '1',
|
21 |
hint: '',
|
@@ -315,7 +315,11 @@ var import_button;
|
|
315 |
//Do nothing
|
316 |
}else{
|
317 |
questionName = new_question_title;
|
318 |
-
}
|
|
|
|
|
|
|
|
|
319 |
$( '.page:nth-child(' + page + ')' ).append( template( { id: model.id, category : model.get('category'), question: questionName } ) );
|
320 |
setTimeout( QSMQuestion.removeNew, 250 );
|
321 |
},
|
@@ -511,7 +515,11 @@ var import_button;
|
|
511 |
wp.editor.remove( question_content );
|
512 |
QSMQuestion.prepareEditor();
|
513 |
question_editor = tinyMCE.get( 'question-text' );
|
514 |
-
}
|
|
|
|
|
|
|
|
|
515 |
if ($('#wp-question-text-wrap').hasClass('html-active')) {
|
516 |
jQuery( "#question-text" ).val( questionText );
|
517 |
} else if ( question_editor ) {
|
@@ -868,6 +876,22 @@ var import_button;
|
|
868 |
$( '#qsm-category-add' ).slideDown('slow');
|
869 |
}
|
870 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
871 |
});
|
872 |
var decodeEntities = (function () {
|
873 |
//create a new html document (doesn't execute script tags in child elements)
|
15 |
quizID: 1,
|
16 |
type: '0',
|
17 |
name: '',
|
18 |
+
question_title: '',
|
19 |
answerInfo: '',
|
20 |
comments: '1',
|
21 |
hint: '',
|
315 |
//Do nothing
|
316 |
}else{
|
317 |
questionName = new_question_title;
|
318 |
+
}
|
319 |
+
|
320 |
+
if( questionName == '' )
|
321 |
+
questionName = 'Your new question!';
|
322 |
+
|
323 |
$( '.page:nth-child(' + page + ')' ).append( template( { id: model.id, category : model.get('category'), question: questionName } ) );
|
324 |
setTimeout( QSMQuestion.removeNew, 250 );
|
325 |
},
|
515 |
wp.editor.remove( question_content );
|
516 |
QSMQuestion.prepareEditor();
|
517 |
question_editor = tinyMCE.get( 'question-text' );
|
518 |
+
}
|
519 |
+
if( questionText != '' && questionText != null ){
|
520 |
+
jQuery('.qsm-show-question-desc-box').hide();
|
521 |
+
jQuery('.qsm-show-question-desc-box').next('.qsm-row').show();
|
522 |
+
}
|
523 |
if ($('#wp-question-text-wrap').hasClass('html-active')) {
|
524 |
jQuery( "#question-text" ).val( questionText );
|
525 |
} else if ( question_editor ) {
|
876 |
$( '#qsm-category-add' ).slideDown('slow');
|
877 |
}
|
878 |
});
|
879 |
+
|
880 |
+
//Hide/show quesion description
|
881 |
+
$( document ).on('click', '.qsm-show-question-desc-box', function(e){
|
882 |
+
e.preventDefault();
|
883 |
+
if( $(this).next('.qsm-row').is(':visible') ){
|
884 |
+
$(this).html('').html('<span class="dashicons dashicons-plus-alt2"></span> ' + qsmQuestionSettings.show_desc_text);
|
885 |
+
$(this).next('.qsm-row').slideUp();
|
886 |
+
}else{
|
887 |
+
$(this).hide();
|
888 |
+
var question_description = wp.editor.getContent( 'question-text' );
|
889 |
+
if( question_description == '' || question_description == null ){
|
890 |
+
tinyMCE.get( 'question-text' ).setContent( 'Add description here!' );
|
891 |
+
}
|
892 |
+
$(this).next('.qsm-row').slideDown();
|
893 |
+
}
|
894 |
+
});
|
895 |
});
|
896 |
var decodeEntities = (function () {
|
897 |
//create a new html document (doesn't execute script tags in child elements)
|
@@ -1,9 +1,9 @@
|
|
1 |
/**************************
|
2 |
-
* Quiz And Survey Master
|
3 |
*************************/
|
4 |
|
5 |
/**************************
|
6 |
-
* This object contains the newer functions. All global functions under are slowly
|
7 |
* being deprecated and replaced with rewritten newer functions
|
8 |
**************************/
|
9 |
|
@@ -17,7 +17,7 @@ var QSMPageTimer;
|
|
17 |
init: function() {
|
18 |
// Makes sure we have quizzes on this page
|
19 |
if ( typeof qmn_quiz_data != 'undefined' && qmn_quiz_data) {
|
20 |
-
// hide the recaptcha by default
|
21 |
$( '.g-recaptcha' ).hide();
|
22 |
// Cycle through all quizzes
|
23 |
_.each( qmn_quiz_data, function( quiz ) {
|
@@ -35,7 +35,7 @@ var QSMPageTimer;
|
|
35 |
|
36 |
/**
|
37 |
* Sets up timer for a quiz
|
38 |
-
*
|
39 |
* @param int quizID The ID of the quiz
|
40 |
*/
|
41 |
initTimer: function( quizID ) {
|
@@ -64,10 +64,10 @@ var QSMPageTimer;
|
|
64 |
QSM.activateTimer(quizID);
|
65 |
$('#quizForm' + quizID).closest('.qmn_quiz_container').find('.stoptimer-p').show();
|
66 |
}
|
67 |
-
}
|
68 |
});
|
69 |
// ...else, activate the timer on page load.
|
70 |
-
} else {
|
71 |
QSM.activateTimer(quizID);
|
72 |
$('#quizForm' + quizID).closest('.qmn_quiz_container').find('.stoptimer-p').show();
|
73 |
}
|
@@ -102,7 +102,7 @@ var QSMPageTimer;
|
|
102 |
* @param int quizID The ID of the quiz.
|
103 |
*/
|
104 |
activateTimer: function( quizID ) {
|
105 |
-
|
106 |
// Gets our form.
|
107 |
var $timer = QSM.getTimer( quizID );
|
108 |
|
@@ -119,10 +119,10 @@ var QSMPageTimer;
|
|
119 |
seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
120 |
}
|
121 |
qmn_quiz_data[ quizID ].timerRemaning = seconds;
|
122 |
-
|
123 |
//hidden timer
|
124 |
jQuery(".hiddentimer").html(seconds);
|
125 |
-
|
126 |
// Makes the timer appear.
|
127 |
$timer.show();
|
128 |
$timer.text( QSM.secondsToTimer( seconds ) );
|
@@ -151,8 +151,8 @@ var QSMPageTimer;
|
|
151 |
var $timer = QSM.getTimer( quizID );
|
152 |
$timer.text( display );
|
153 |
document.title = display + ' ' + qsmTitleText;
|
154 |
-
|
155 |
-
/*CUSTOM TIMER*/
|
156 |
if(qmn_quiz_data[quizID].hasOwnProperty('advanced_timer') && qmn_quiz_data[quizID].advanced_timer.timer_design == 'big_timer'){
|
157 |
$(".second.circle").parent('.mlw_quiz_form').addClass('qsm_big_timer');
|
158 |
$(".second.circle").show();
|
@@ -165,14 +165,14 @@ var QSMPageTimer;
|
|
165 |
fill: {gradient: ["#00bb40", "#00511c"]}
|
166 |
});
|
167 |
}
|
168 |
-
|
169 |
var $quizForm = QSM.getQuizForm( quizID );
|
170 |
var total_seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
171 |
var ninety_sec = total_seconds - ( total_seconds * 90 / 100 );
|
172 |
if(ninety_sec == secondsRemaining){
|
173 |
$quizForm.closest( '.qmn_quiz_container' ).find('.qsm_ninety_warning').fadeIn();
|
174 |
}
|
175 |
-
|
176 |
// If timer is run out, disable fields.
|
177 |
if ( 0 >= secondsRemaining ) {
|
178 |
clearInterval( qmn_quiz_data[ quizID ].timerInterval );
|
@@ -182,12 +182,12 @@ var QSMPageTimer;
|
|
182 |
$( ".mlw_qmn_question_comment" ).attr( 'disabled', true );
|
183 |
$( ".mlw_answer_open_text" ).attr( 'disabled', true );
|
184 |
$( ".mlw_answer_number" ).attr( 'disabled', true );
|
185 |
-
|
186 |
$quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
|
187 |
$quizForm.closest( '.qmn_quiz_container' ).prepend('<p style="color: red;">Quiz time is over</p>');
|
188 |
//$( ".qsm-submit-btn" ).remove();
|
189 |
if(qmn_ajax_object.enable_result_after_timer_end == 1){
|
190 |
-
$quizForm.closest( '.qmn_quiz_container' ).find('
|
191 |
}else{
|
192 |
MicroModal.show( 'modal-3' );
|
193 |
}
|
@@ -258,7 +258,7 @@ var QSMPageTimer;
|
|
258 |
},
|
259 |
/**
|
260 |
* Sets up pagination for a quiz
|
261 |
-
*
|
262 |
* @param int quizID The ID of the quiz.
|
263 |
*/
|
264 |
initPagination: function( quizID ) {
|
@@ -266,7 +266,7 @@ var QSMPageTimer;
|
|
266 |
if ( 0 < $quizForm.children( '.qsm-page' ).length ) {
|
267 |
$quizForm.children( '.qsm-page' ).hide();
|
268 |
template = wp.template( 'qsm-pagination' );
|
269 |
-
$quizForm.append( template() );
|
270 |
if( $quizForm.find( '.qsm-pagination > .current_page_hidden' ).length == 0){
|
271 |
$quizForm.find( '.qsm-pagination' ).append( '<input type="hidden" value="0" name="current_page" class="current_page_hidden" />');
|
272 |
}
|
@@ -314,7 +314,7 @@ var QSMPageTimer;
|
|
314 |
var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
|
315 |
qsmScrollTo( $container );
|
316 |
});
|
317 |
-
}
|
318 |
},
|
319 |
/**
|
320 |
* Navigates quiz to specific page
|
@@ -351,20 +351,20 @@ var QSMPageTimer;
|
|
351 |
$quizForm.find( '.qsm-previous' ).hide();
|
352 |
}
|
353 |
if ( '1' == qmn_quiz_data[ quizID ].progress_bar ) {
|
354 |
-
var current_page = jQuery('#quizForm' + quizID).find('.current_page_hidden').val();
|
355 |
-
var total_page_length = $pages.length - 1;
|
356 |
if( qmn_quiz_data[ quizID ].contact_info_location == 0 ){
|
357 |
//Do nothing.
|
358 |
}else if( qmn_quiz_data[ quizID ].contact_info_location == 1 ){
|
359 |
if($quizForm.children( '.qsm-page' ).find('.qsm_contact_div ').length > 0){
|
360 |
//total_page_length = total_page_length - 1;
|
361 |
}
|
362 |
-
}
|
363 |
var animate_value = current_page / total_page_length;
|
364 |
if( animate_value <= 1){
|
365 |
qmn_quiz_data[ quizID ].bar.animate( animate_value );
|
366 |
var old_text = jQuery( '#quizForm' + quizID ).find( '.progressbar-text' ).text().replace(' %', '');
|
367 |
-
var new_text = Math.round(animate_value * 100);
|
368 |
jQuery({
|
369 |
Counter: old_text
|
370 |
}).animate({
|
@@ -375,7 +375,7 @@ var QSMPageTimer;
|
|
375 |
step: function () {
|
376 |
jQuery( '#quizForm' + quizID ).find( '.progressbar-text' ).text(Math.round(this.Counter) + ' %');
|
377 |
}
|
378 |
-
});
|
379 |
}
|
380 |
}
|
381 |
QSM.savePage( quizID, pageNumber );
|
@@ -394,7 +394,7 @@ var QSMPageTimer;
|
|
394 |
nextPage: function( quizID ) {
|
395 |
if ( qmnValidatePage( 'quizForm' + quizID ) ) {
|
396 |
QSM.changePage( quizID, 1 );
|
397 |
-
}
|
398 |
},
|
399 |
prevPage: function( quizID ) {
|
400 |
QSM.changePage( quizID, -1 );
|
@@ -415,10 +415,10 @@ var QSMPageTimer;
|
|
415 |
* @param jQueryObject The jQuery version of an element. i.e. $('#quizForm3')
|
416 |
*/
|
417 |
scrollTo: function( $element ) {
|
418 |
-
jQuery( 'html, body' ).animate(
|
419 |
-
{
|
420 |
scrollTop: $element.offset().top - 150
|
421 |
-
},
|
422 |
1000 );
|
423 |
},
|
424 |
/**
|
@@ -426,7 +426,7 @@ var QSMPageTimer;
|
|
426 |
*/
|
427 |
getQuizForm: function( quizID ) {
|
428 |
return $( '#quizForm' + quizID );
|
429 |
-
}
|
430 |
};
|
431 |
|
432 |
QSMPageTimer = {
|
@@ -578,9 +578,9 @@ var QSMPageTimer;
|
|
578 |
qmnInit();
|
579 |
|
580 |
// Call main initialization.
|
581 |
-
QSM.init();
|
582 |
});
|
583 |
-
|
584 |
jQuery("input[name='timer_ms']").each(function(){
|
585 |
var timems = qsmTimeInMS();
|
586 |
jQuery(this).val(timems);
|
@@ -592,7 +592,7 @@ var qsmTitleText = document.title;
|
|
592 |
|
593 |
/**
|
594 |
* Validates an email ID.
|
595 |
-
*
|
596 |
* @param email The Email Id to validate.
|
597 |
* @returns Boolean
|
598 |
*/
|
@@ -611,7 +611,7 @@ function isEmail( email ) {
|
|
611 |
* @returns {undefined}
|
612 |
*/
|
613 |
function qsmCheckMR(event, limit){
|
614 |
-
var checked = jQuery(event).parents('.quiz_section').find(':checkbox:checked').length;
|
615 |
if (checked > limit) {
|
616 |
event.checked = false;
|
617 |
}
|
@@ -665,7 +665,7 @@ function qmnValidation( element, quiz_form_id ) {
|
|
665 |
var number_error = qmn_quiz_data[ quiz_id ].error_messages.number;
|
666 |
var empty_error = qmn_quiz_data[ quiz_id ].error_messages.empty;
|
667 |
var incorrect_error = qmn_quiz_data[ quiz_id ].error_messages.incorrect;
|
668 |
-
qmnResetError( quiz_form_id );
|
669 |
jQuery( element ).each(function(){
|
670 |
if ( jQuery( this ).attr( 'class' )) {
|
671 |
if( jQuery( this ).attr( 'class' ).indexOf( 'mlwEmail' ) !== -1 && this.value !== "" ) {
|
@@ -676,13 +676,18 @@ function qmnValidation( element, quiz_form_id ) {
|
|
676 |
result = false;
|
677 |
}
|
678 |
}
|
679 |
-
|
|
|
|
|
|
|
|
|
|
|
680 |
|
681 |
if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredNumber' ) > -1 && this.value === "" && +this.value != NaN ) {
|
682 |
qmnDisplayError( number_error, jQuery( this ), quiz_form_id );
|
683 |
result = false;
|
684 |
}
|
685 |
-
|
686 |
if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredText' ) > -1 && this.value === "" ) {
|
687 |
qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
|
688 |
result = false;
|
@@ -710,7 +715,7 @@ function qmnValidation( element, quiz_form_id ) {
|
|
710 |
}
|
711 |
}
|
712 |
if( jQuery( this ).attr( 'class' ).indexOf( 'qsmRequiredSelect' ) > -1 ) {
|
713 |
-
check_val = jQuery( this ).val();
|
714 |
if ( check_val == "No Answer Provided" ) {
|
715 |
qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
|
716 |
result = false;
|
@@ -727,7 +732,7 @@ function qmnValidation( element, quiz_form_id ) {
|
|
727 |
if(grecaptcha.getResponse() == "") {
|
728 |
alert('ReCaptcha is missing');
|
729 |
result = false;
|
730 |
-
}
|
731 |
}
|
732 |
}
|
733 |
}
|
@@ -764,7 +769,7 @@ function qmnFormSubmit( quiz_form_id ) {
|
|
764 |
jQuery( '.mlw_qmn_quiz select' ).attr( 'disabled', false );
|
765 |
jQuery( '.mlw_qmn_question_comment' ).attr( 'disabled', false );
|
766 |
jQuery( '.mlw_answer_open_text' ).attr( 'disabled', false );
|
767 |
-
|
768 |
//Convert serialize data into index array
|
769 |
var unindexed_array = jQuery( '#' + quiz_form_id ).serializeArray();
|
770 |
var fd = new FormData();
|
@@ -772,8 +777,8 @@ function qmnFormSubmit( quiz_form_id ) {
|
|
772 |
fd.append(input.name,input.value);
|
773 |
});
|
774 |
fd.append("action", 'qmn_process_quiz');
|
775 |
-
|
776 |
-
|
777 |
qsmEndTimeTakenTimer();
|
778 |
if (qmn_quiz_data[quizID].hasOwnProperty('advanced_timer')) {
|
779 |
QSMPageTimer.endPageTimer(quiz_id);
|
@@ -794,7 +799,7 @@ function qmnFormSubmit( quiz_form_id ) {
|
|
794 |
qmnDisplayResults( JSON.parse( response ), quiz_form_id, $container );
|
795 |
}
|
796 |
});
|
797 |
-
|
798 |
return false;
|
799 |
}
|
800 |
|
@@ -922,12 +927,12 @@ function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
|
|
922 |
page_number = parseInt(hiddem_page_number) + 1;
|
923 |
}
|
924 |
var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
|
925 |
-
var total_page_number = Math.ceil(total_questions / pagination);
|
926 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
927 |
-
if(page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
|
928 |
if( page_number <= total_page_number ){
|
929 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
930 |
-
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
931 |
}else{
|
932 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
933 |
}
|
@@ -946,7 +951,7 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
|
|
946 |
|
947 |
jQuery( quiz_form_id + " .quiz_section" ).hide();
|
948 |
jQuery( quiz_form_id + " .g-recaptcha" ).hide();
|
949 |
-
|
950 |
for (var i = 0; i < pagination; i++) {
|
951 |
if (i === 0 && previous === 0) {
|
952 |
slide_number = slide_number - pagination;
|
@@ -991,7 +996,7 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
|
|
991 |
var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
|
992 |
var page_number = parseInt(hiddem_page_number) - 1;
|
993 |
var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
|
994 |
-
var total_page_number = Math.ceil(total_questions / pagination);
|
995 |
if(hiddem_page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
|
996 |
if( page_number <= total_page_number ){
|
997 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
@@ -999,12 +1004,12 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
|
|
999 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
1000 |
}else{
|
1001 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
1002 |
-
}
|
1003 |
}else{
|
1004 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
1005 |
}
|
1006 |
}
|
1007 |
-
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
1008 |
qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number);
|
1009 |
}
|
1010 |
|
@@ -1018,13 +1023,13 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
|
|
1018 |
function qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number){
|
1019 |
if ( '1' == qmn_quiz_data[ quiz_id ].progress_bar ) {
|
1020 |
var total_questions = jQuery( '#quizForm' + quiz_id ).closest( '.qmn_quiz_container' ).find('.quiz_section').length - 1;
|
1021 |
-
var pagination = qmn_quiz_data[quiz_id].pagination.amount;
|
1022 |
-
total_page_number = Math.ceil(total_questions / pagination);
|
1023 |
if(pagination === 1){
|
1024 |
total_page_number = total_page_number - 1;
|
1025 |
-
}
|
1026 |
-
var animate_value = page_number / total_page_number;
|
1027 |
-
if( animate_value <= 1){
|
1028 |
qmn_quiz_data[ quiz_id ].bar.animate( animate_value );
|
1029 |
var old_text = jQuery( '#qsm_progress_bar_' + quiz_id ).find( '.progressbar-text' ).text().replace(' %', '');
|
1030 |
var new_text = Math.round(animate_value * 100);
|
@@ -1074,7 +1079,7 @@ function qmnInitPagination( quiz_id ) {
|
|
1074 |
.append( '<div class="qmn_page_counter_message"></div>' )
|
1075 |
.append( '<div class="qsm-progress-bar" id="qsm_progress_bar_'+ quiz_id +'" style="display:none;"><div class="progressbar-text"></div></div>' )
|
1076 |
.append( '<a class="qmn_btn mlw_qmn_quiz_link mlw_next" href="#">' + qmn_quiz_data[quiz_id].pagination.next_text + '</a>' );
|
1077 |
-
|
1078 |
if ( '1' == qmn_quiz_data[ quiz_id ].progress_bar ) {
|
1079 |
jQuery('#quizForm' + quiz_id).closest( '.qmn_quiz_container' ).find('.qsm-progress-bar').show();
|
1080 |
qmn_quiz_data[ quiz_id ].bar = new ProgressBar.Line('#qsm_progress_bar_' + quiz_id, {
|
@@ -1101,11 +1106,11 @@ function qmnInitPagination( quiz_id ) {
|
|
1101 |
},
|
1102 |
from: {color: '#3498db'},
|
1103 |
to: {color: '#ED6A5A'},
|
1104 |
-
step: function(state, bar) {
|
1105 |
}
|
1106 |
});
|
1107 |
}
|
1108 |
-
|
1109 |
jQuery(".mlw_next").click(function(event) {
|
1110 |
event.preventDefault();
|
1111 |
var quiz_id = +jQuery( this ).closest( '.qmn_quiz_container' ).find( '.qmn_quiz_id' ).val();
|
@@ -1113,19 +1118,19 @@ function qmnInitPagination( quiz_id ) {
|
|
1113 |
qmnNextSlide( qmn_quiz_data[quiz_id].pagination.amount, 1, '#quizForm' + quiz_id );
|
1114 |
}
|
1115 |
});
|
1116 |
-
|
1117 |
jQuery(".mlw_previous").click(function(event) {
|
1118 |
event.preventDefault();
|
1119 |
var quiz_id = +jQuery( this ).closest( '.qmn_quiz_container' ).find( '.qmn_quiz_id' ).val();
|
1120 |
qmnPrevSlide( qmn_quiz_data[quiz_id].pagination.amount, 1, '#quizForm' + quiz_id );
|
1121 |
});
|
1122 |
-
|
1123 |
if ( qmn_quiz_data[quiz_id].first_page ) {
|
1124 |
qmnNextSlide( 1, 0, '#quizForm' + quiz_id );
|
1125 |
} else {
|
1126 |
qmnNextSlide( qmn_quiz_data[quiz_id].pagination.amount, 0, '#quizForm' + quiz_id );
|
1127 |
}
|
1128 |
-
|
1129 |
}
|
1130 |
|
1131 |
function qmnSocialShare( network, mlw_qmn_social_text, mlw_qmn_title, facebook_id, share_url ) {
|
@@ -1149,20 +1154,20 @@ function qmnSocialShare( network, mlw_qmn_social_text, mlw_qmn_title, facebook_i
|
|
1149 |
|
1150 |
jQuery(function() {
|
1151 |
jQuery( '.qmn_quiz_container' ).tooltip();
|
1152 |
-
|
1153 |
jQuery( '.qmn_quiz_container input' ).on( 'keypress', function ( e ) {
|
1154 |
if ( e.which === 13 ) {
|
1155 |
e.preventDefault();
|
1156 |
}
|
1157 |
});
|
1158 |
-
|
1159 |
// jQuery( '.qmn_quiz_form' ).on( "submit", function( event ) {
|
1160 |
jQuery(document).on( 'click', ".qsm-submit-btn", function( event ) {
|
1161 |
event.preventDefault();
|
1162 |
var form = jQuery(this).closest('form')[0];
|
1163 |
qmnFormSubmit( form.id );
|
1164 |
});
|
1165 |
-
|
1166 |
jQuery(document).on('click','.btn-reload-quiz',function(e){
|
1167 |
e.preventDefault();
|
1168 |
var quiz_id = jQuery(this).data('quiz_id');
|
@@ -1172,17 +1177,17 @@ jQuery(function() {
|
|
1172 |
type: 'POST',
|
1173 |
url: qmn_ajax_object.ajaxurl,
|
1174 |
data: {
|
1175 |
-
action: "qsm_get_quiz_to_reload",
|
1176 |
quiz_id: quiz_id,
|
1177 |
},
|
1178 |
-
success: function (response) {
|
1179 |
parent_div.replaceWith(response);
|
1180 |
// Restart the timer for retake quiz.
|
1181 |
setInterval( qmnTimeTakenTimer, 1000 );
|
1182 |
-
|
1183 |
// Reset the timer clock on retake quiz.
|
1184 |
QSM.initTimer( quiz_id );
|
1185 |
-
|
1186 |
QSM.initPagination( quiz_id );
|
1187 |
},
|
1188 |
error: function (errorThrown) {
|
@@ -1191,18 +1196,18 @@ jQuery(function() {
|
|
1191 |
}
|
1192 |
});
|
1193 |
});
|
1194 |
-
|
1195 |
jQuery(document).on('change','.qmn_radio_answers input',function(e){
|
1196 |
if(qmn_ajax_object.enable_quick_result_mc == 1){
|
1197 |
-
var question_id = jQuery(this).attr('name').split('question')[1],
|
1198 |
value = jQuery(this).val(),
|
1199 |
$this = jQuery(this).parents('.quiz_section');
|
1200 |
-
|
1201 |
jQuery.ajax({
|
1202 |
type: 'POST',
|
1203 |
url: qmn_ajax_object.ajaxurl,
|
1204 |
data: {
|
1205 |
-
action: "qsm_get_question_quick_result",
|
1206 |
question_id: question_id,
|
1207 |
answer: value,
|
1208 |
},
|
@@ -1212,7 +1217,7 @@ jQuery(function() {
|
|
1212 |
$this.append('<p style="color: green" class="quick-question-res-p">' + qmn_ajax_object.quick_result_correct_text + '</p>')
|
1213 |
}else if(response == 'incorrect'){
|
1214 |
$this.append('<p style="color: red" class="quick-question-res-p">' + qmn_ajax_object.quick_result_wrong_text + '</p>')
|
1215 |
-
}
|
1216 |
},
|
1217 |
error: function (errorThrown) {
|
1218 |
alert(errorThrown);
|
@@ -1220,9 +1225,9 @@ jQuery(function() {
|
|
1220 |
});
|
1221 |
}
|
1222 |
});
|
1223 |
-
|
1224 |
/*jQuery('.qmn_radio_answers > .qmn_mc_answer_wrap').on('click',function(event){
|
1225 |
-
var radButton = jQuery(this).find('input[type=radio]');
|
1226 |
if(event.target.className == 'qmn_quiz_radio'){
|
1227 |
return true;
|
1228 |
}
|
@@ -1242,6 +1247,7 @@ jQuery(function() {
|
|
1242 |
form_data.append('action', 'qsm_upload_image_fd_question');
|
1243 |
var question_id = $this.parent('.quiz_section').find('.mlw_file_upload_hidden_value').attr("name").replace('question','');
|
1244 |
form_data.append('question_id', question_id);
|
|
|
1245 |
jQuery.ajax({
|
1246 |
url: qmn_ajax_object.ajaxurl,
|
1247 |
type: 'POST',
|
@@ -1251,9 +1257,10 @@ jQuery(function() {
|
|
1251 |
processData: false,
|
1252 |
success: function (response) {
|
1253 |
var obj = jQuery.parseJSON(response);
|
|
|
1254 |
if(obj.type == 'success'){
|
1255 |
-
$this.next('.remove-uploaded-file').show();
|
1256 |
-
$this.next().next('.mlw_file_upload_hidden_value').val(obj.file_url);
|
1257 |
$this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val(obj.file_path);
|
1258 |
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide();
|
1259 |
}else{
|
@@ -1265,14 +1272,14 @@ jQuery(function() {
|
|
1265 |
});
|
1266 |
return false;
|
1267 |
});
|
1268 |
-
|
1269 |
//Ajax remove file code
|
1270 |
jQuery('.quiz_section .remove-uploaded-file').on('click', function(){
|
1271 |
var $this = jQuery(this);
|
1272 |
var file_data = jQuery(this).parent('.quiz_section').find('.mlw_file_upload_hidden_path').val();
|
1273 |
var form_data = new FormData();
|
1274 |
form_data.append('action', 'qsm_remove_file_fd_question');
|
1275 |
-
form_data.append('file_url', file_data);
|
1276 |
jQuery.ajax({
|
1277 |
url: qmn_ajax_object.ajaxurl,
|
1278 |
type: 'POST',
|
@@ -1296,13 +1303,13 @@ jQuery(function() {
|
|
1296 |
});
|
1297 |
return false;
|
1298 |
});
|
1299 |
-
|
1300 |
//Deselect all answer on select
|
1301 |
jQuery('.qsm-deselect-answer').click(function(e){
|
1302 |
e.preventDefault();
|
1303 |
jQuery(this).parents('.quiz_section').find('input[type="radio"]').prop('checked', false);
|
1304 |
});
|
1305 |
-
|
1306 |
//Submit the form on popup click
|
1307 |
jQuery(document).on( 'click', '.submit-the-form', function(e) {
|
1308 |
e.preventDefault();
|
1 |
/**************************
|
2 |
+
* Quiz And Survey Master
|
3 |
*************************/
|
4 |
|
5 |
/**************************
|
6 |
+
* This object contains the newer functions. All global functions under are slowly
|
7 |
* being deprecated and replaced with rewritten newer functions
|
8 |
**************************/
|
9 |
|
17 |
init: function() {
|
18 |
// Makes sure we have quizzes on this page
|
19 |
if ( typeof qmn_quiz_data != 'undefined' && qmn_quiz_data) {
|
20 |
+
// hide the recaptcha by default
|
21 |
$( '.g-recaptcha' ).hide();
|
22 |
// Cycle through all quizzes
|
23 |
_.each( qmn_quiz_data, function( quiz ) {
|
35 |
|
36 |
/**
|
37 |
* Sets up timer for a quiz
|
38 |
+
*
|
39 |
* @param int quizID The ID of the quiz
|
40 |
*/
|
41 |
initTimer: function( quizID ) {
|
64 |
QSM.activateTimer(quizID);
|
65 |
$('#quizForm' + quizID).closest('.qmn_quiz_container').find('.stoptimer-p').show();
|
66 |
}
|
67 |
+
}
|
68 |
});
|
69 |
// ...else, activate the timer on page load.
|
70 |
+
} else {
|
71 |
QSM.activateTimer(quizID);
|
72 |
$('#quizForm' + quizID).closest('.qmn_quiz_container').find('.stoptimer-p').show();
|
73 |
}
|
102 |
* @param int quizID The ID of the quiz.
|
103 |
*/
|
104 |
activateTimer: function( quizID ) {
|
105 |
+
|
106 |
// Gets our form.
|
107 |
var $timer = QSM.getTimer( quizID );
|
108 |
|
119 |
seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
120 |
}
|
121 |
qmn_quiz_data[ quizID ].timerRemaning = seconds;
|
122 |
+
|
123 |
//hidden timer
|
124 |
jQuery(".hiddentimer").html(seconds);
|
125 |
+
|
126 |
// Makes the timer appear.
|
127 |
$timer.show();
|
128 |
$timer.text( QSM.secondsToTimer( seconds ) );
|
151 |
var $timer = QSM.getTimer( quizID );
|
152 |
$timer.text( display );
|
153 |
document.title = display + ' ' + qsmTitleText;
|
154 |
+
|
155 |
+
/*CUSTOM TIMER*/
|
156 |
if(qmn_quiz_data[quizID].hasOwnProperty('advanced_timer') && qmn_quiz_data[quizID].advanced_timer.timer_design == 'big_timer'){
|
157 |
$(".second.circle").parent('.mlw_quiz_form').addClass('qsm_big_timer');
|
158 |
$(".second.circle").show();
|
165 |
fill: {gradient: ["#00bb40", "#00511c"]}
|
166 |
});
|
167 |
}
|
168 |
+
|
169 |
var $quizForm = QSM.getQuizForm( quizID );
|
170 |
var total_seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
171 |
var ninety_sec = total_seconds - ( total_seconds * 90 / 100 );
|
172 |
if(ninety_sec == secondsRemaining){
|
173 |
$quizForm.closest( '.qmn_quiz_container' ).find('.qsm_ninety_warning').fadeIn();
|
174 |
}
|
175 |
+
|
176 |
// If timer is run out, disable fields.
|
177 |
if ( 0 >= secondsRemaining ) {
|
178 |
clearInterval( qmn_quiz_data[ quizID ].timerInterval );
|
182 |
$( ".mlw_qmn_question_comment" ).attr( 'disabled', true );
|
183 |
$( ".mlw_answer_open_text" ).attr( 'disabled', true );
|
184 |
$( ".mlw_answer_number" ).attr( 'disabled', true );
|
185 |
+
|
186 |
$quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
|
187 |
$quizForm.closest( '.qmn_quiz_container' ).prepend('<p style="color: red;">Quiz time is over</p>');
|
188 |
//$( ".qsm-submit-btn" ).remove();
|
189 |
if(qmn_ajax_object.enable_result_after_timer_end == 1){
|
190 |
+
$quizForm.closest( '.qmn_quiz_container' ).find('.qsm-submit-btn').trigger('click');
|
191 |
}else{
|
192 |
MicroModal.show( 'modal-3' );
|
193 |
}
|
258 |
},
|
259 |
/**
|
260 |
* Sets up pagination for a quiz
|
261 |
+
*
|
262 |
* @param int quizID The ID of the quiz.
|
263 |
*/
|
264 |
initPagination: function( quizID ) {
|
266 |
if ( 0 < $quizForm.children( '.qsm-page' ).length ) {
|
267 |
$quizForm.children( '.qsm-page' ).hide();
|
268 |
template = wp.template( 'qsm-pagination' );
|
269 |
+
$quizForm.append( template() );
|
270 |
if( $quizForm.find( '.qsm-pagination > .current_page_hidden' ).length == 0){
|
271 |
$quizForm.find( '.qsm-pagination' ).append( '<input type="hidden" value="0" name="current_page" class="current_page_hidden" />');
|
272 |
}
|
314 |
var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
|
315 |
qsmScrollTo( $container );
|
316 |
});
|
317 |
+
}
|
318 |
},
|
319 |
/**
|
320 |
* Navigates quiz to specific page
|
351 |
$quizForm.find( '.qsm-previous' ).hide();
|
352 |
}
|
353 |
if ( '1' == qmn_quiz_data[ quizID ].progress_bar ) {
|
354 |
+
var current_page = jQuery('#quizForm' + quizID).find('.current_page_hidden').val();
|
355 |
+
var total_page_length = $pages.length - 1;
|
356 |
if( qmn_quiz_data[ quizID ].contact_info_location == 0 ){
|
357 |
//Do nothing.
|
358 |
}else if( qmn_quiz_data[ quizID ].contact_info_location == 1 ){
|
359 |
if($quizForm.children( '.qsm-page' ).find('.qsm_contact_div ').length > 0){
|
360 |
//total_page_length = total_page_length - 1;
|
361 |
}
|
362 |
+
}
|
363 |
var animate_value = current_page / total_page_length;
|
364 |
if( animate_value <= 1){
|
365 |
qmn_quiz_data[ quizID ].bar.animate( animate_value );
|
366 |
var old_text = jQuery( '#quizForm' + quizID ).find( '.progressbar-text' ).text().replace(' %', '');
|
367 |
+
var new_text = Math.round(animate_value * 100);
|
368 |
jQuery({
|
369 |
Counter: old_text
|
370 |
}).animate({
|
375 |
step: function () {
|
376 |
jQuery( '#quizForm' + quizID ).find( '.progressbar-text' ).text(Math.round(this.Counter) + ' %');
|
377 |
}
|
378 |
+
});
|
379 |
}
|
380 |
}
|
381 |
QSM.savePage( quizID, pageNumber );
|
394 |
nextPage: function( quizID ) {
|
395 |
if ( qmnValidatePage( 'quizForm' + quizID ) ) {
|
396 |
QSM.changePage( quizID, 1 );
|
397 |
+
}
|
398 |
},
|
399 |
prevPage: function( quizID ) {
|
400 |
QSM.changePage( quizID, -1 );
|
415 |
* @param jQueryObject The jQuery version of an element. i.e. $('#quizForm3')
|
416 |
*/
|
417 |
scrollTo: function( $element ) {
|
418 |
+
jQuery( 'html, body' ).animate(
|
419 |
+
{
|
420 |
scrollTop: $element.offset().top - 150
|
421 |
+
},
|
422 |
1000 );
|
423 |
},
|
424 |
/**
|
426 |
*/
|
427 |
getQuizForm: function( quizID ) {
|
428 |
return $( '#quizForm' + quizID );
|
429 |
+
}
|
430 |
};
|
431 |
|
432 |
QSMPageTimer = {
|
578 |
qmnInit();
|
579 |
|
580 |
// Call main initialization.
|
581 |
+
QSM.init();
|
582 |
});
|
583 |
+
|
584 |
jQuery("input[name='timer_ms']").each(function(){
|
585 |
var timems = qsmTimeInMS();
|
586 |
jQuery(this).val(timems);
|
592 |
|
593 |
/**
|
594 |
* Validates an email ID.
|
595 |
+
*
|
596 |
* @param email The Email Id to validate.
|
597 |
* @returns Boolean
|
598 |
*/
|
611 |
* @returns {undefined}
|
612 |
*/
|
613 |
function qsmCheckMR(event, limit){
|
614 |
+
var checked = jQuery(event).parents('.quiz_section').find(':checkbox:checked').length;
|
615 |
if (checked > limit) {
|
616 |
event.checked = false;
|
617 |
}
|
665 |
var number_error = qmn_quiz_data[ quiz_id ].error_messages.number;
|
666 |
var empty_error = qmn_quiz_data[ quiz_id ].error_messages.empty;
|
667 |
var incorrect_error = qmn_quiz_data[ quiz_id ].error_messages.incorrect;
|
668 |
+
qmnResetError( quiz_form_id );
|
669 |
jQuery( element ).each(function(){
|
670 |
if ( jQuery( this ).attr( 'class' )) {
|
671 |
if( jQuery( this ).attr( 'class' ).indexOf( 'mlwEmail' ) !== -1 && this.value !== "" ) {
|
676 |
result = false;
|
677 |
}
|
678 |
}
|
679 |
+
var by_pass = true;
|
680 |
+
if( qmn_quiz_data[quiz_id].hasOwnProperty('skip_validation_time_expire') && qmn_quiz_data[quiz_id].skip_validation_time_expire == 0 ){
|
681 |
+
by_pass = false;
|
682 |
+
}
|
683 |
+
|
684 |
+
if ( localStorage.getItem( 'mlw_time_quiz' + quiz_id ) === null || localStorage.getItem( 'mlw_time_quiz'+quiz_id ) > 0.08 || by_pass === false ) {
|
685 |
|
686 |
if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredNumber' ) > -1 && this.value === "" && +this.value != NaN ) {
|
687 |
qmnDisplayError( number_error, jQuery( this ), quiz_form_id );
|
688 |
result = false;
|
689 |
}
|
690 |
+
|
691 |
if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredText' ) > -1 && this.value === "" ) {
|
692 |
qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
|
693 |
result = false;
|
715 |
}
|
716 |
}
|
717 |
if( jQuery( this ).attr( 'class' ).indexOf( 'qsmRequiredSelect' ) > -1 ) {
|
718 |
+
check_val = jQuery( this ).val();
|
719 |
if ( check_val == "No Answer Provided" ) {
|
720 |
qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
|
721 |
result = false;
|
732 |
if(grecaptcha.getResponse() == "") {
|
733 |
alert('ReCaptcha is missing');
|
734 |
result = false;
|
735 |
+
}
|
736 |
}
|
737 |
}
|
738 |
}
|
769 |
jQuery( '.mlw_qmn_quiz select' ).attr( 'disabled', false );
|
770 |
jQuery( '.mlw_qmn_question_comment' ).attr( 'disabled', false );
|
771 |
jQuery( '.mlw_answer_open_text' ).attr( 'disabled', false );
|
772 |
+
|
773 |
//Convert serialize data into index array
|
774 |
var unindexed_array = jQuery( '#' + quiz_form_id ).serializeArray();
|
775 |
var fd = new FormData();
|
777 |
fd.append(input.name,input.value);
|
778 |
});
|
779 |
fd.append("action", 'qmn_process_quiz');
|
780 |
+
|
781 |
+
|
782 |
qsmEndTimeTakenTimer();
|
783 |
if (qmn_quiz_data[quizID].hasOwnProperty('advanced_timer')) {
|
784 |
QSMPageTimer.endPageTimer(quiz_id);
|
799 |
qmnDisplayResults( JSON.parse( response ), quiz_form_id, $container );
|
800 |
}
|
801 |
});
|
802 |
+
|
803 |
return false;
|
804 |
}
|
805 |
|
927 |
page_number = parseInt(hiddem_page_number) + 1;
|
928 |
}
|
929 |
var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
|
930 |
+
var total_page_number = Math.ceil(total_questions / pagination);
|
931 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
932 |
+
if(page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
|
933 |
if( page_number <= total_page_number ){
|
934 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
935 |
+
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
936 |
}else{
|
937 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
938 |
}
|
951 |
|
952 |
jQuery( quiz_form_id + " .quiz_section" ).hide();
|
953 |
jQuery( quiz_form_id + " .g-recaptcha" ).hide();
|
954 |
+
|
955 |
for (var i = 0; i < pagination; i++) {
|
956 |
if (i === 0 && previous === 0) {
|
957 |
slide_number = slide_number - pagination;
|
996 |
var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
|
997 |
var page_number = parseInt(hiddem_page_number) - 1;
|
998 |
var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
|
999 |
+
var total_page_number = Math.ceil(total_questions / pagination);
|
1000 |
if(hiddem_page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
|
1001 |
if( page_number <= total_page_number ){
|
1002 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
1004 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
1005 |
}else{
|
1006 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
1007 |
+
}
|
1008 |
}else{
|
1009 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
1010 |
}
|
1011 |
}
|
1012 |
+
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
1013 |
qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number);
|
1014 |
}
|
1015 |
|
1023 |
function qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number){
|
1024 |
if ( '1' == qmn_quiz_data[ quiz_id ].progress_bar ) {
|
1025 |
var total_questions = jQuery( '#quizForm' + quiz_id ).closest( '.qmn_quiz_container' ).find('.quiz_section').length - 1;
|
1026 |
+
var pagination = qmn_quiz_data[quiz_id].pagination.amount;
|
1027 |
+
total_page_number = Math.ceil(total_questions / pagination);
|
1028 |
if(pagination === 1){
|
1029 |
total_page_number = total_page_number - 1;
|
1030 |
+
}
|
1031 |
+
var animate_value = page_number / total_page_number;
|
1032 |
+
if( animate_value <= 1){
|
1033 |
qmn_quiz_data[ quiz_id ].bar.animate( animate_value );
|
1034 |
var old_text = jQuery( '#qsm_progress_bar_' + quiz_id ).find( '.progressbar-text' ).text().replace(' %', '');
|
1035 |
var new_text = Math.round(animate_value * 100);
|
1079 |
.append( '<div class="qmn_page_counter_message"></div>' )
|
1080 |
.append( '<div class="qsm-progress-bar" id="qsm_progress_bar_'+ quiz_id +'" style="display:none;"><div class="progressbar-text"></div></div>' )
|
1081 |
.append( '<a class="qmn_btn mlw_qmn_quiz_link mlw_next" href="#">' + qmn_quiz_data[quiz_id].pagination.next_text + '</a>' );
|
1082 |
+
|
1083 |
if ( '1' == qmn_quiz_data[ quiz_id ].progress_bar ) {
|
1084 |
jQuery('#quizForm' + quiz_id).closest( '.qmn_quiz_container' ).find('.qsm-progress-bar').show();
|
1085 |
qmn_quiz_data[ quiz_id ].bar = new ProgressBar.Line('#qsm_progress_bar_' + quiz_id, {
|
1106 |
},
|
1107 |
from: {color: '#3498db'},
|
1108 |
to: {color: '#ED6A5A'},
|
1109 |
+
step: function(state, bar) {
|
1110 |
}
|
1111 |
});
|
1112 |
}
|
1113 |
+
|
1114 |
jQuery(".mlw_next").click(function(event) {
|
1115 |
event.preventDefault();
|
1116 |
var quiz_id = +jQuery( this ).closest( '.qmn_quiz_container' ).find( '.qmn_quiz_id' ).val();
|
1118 |
qmnNextSlide( qmn_quiz_data[quiz_id].pagination.amount, 1, '#quizForm' + quiz_id );
|
1119 |
}
|
1120 |
});
|
1121 |
+
|
1122 |
jQuery(".mlw_previous").click(function(event) {
|
1123 |
event.preventDefault();
|
1124 |
var quiz_id = +jQuery( this ).closest( '.qmn_quiz_container' ).find( '.qmn_quiz_id' ).val();
|
1125 |
qmnPrevSlide( qmn_quiz_data[quiz_id].pagination.amount, 1, '#quizForm' + quiz_id );
|
1126 |
});
|
1127 |
+
|
1128 |
if ( qmn_quiz_data[quiz_id].first_page ) {
|
1129 |
qmnNextSlide( 1, 0, '#quizForm' + quiz_id );
|
1130 |
} else {
|
1131 |
qmnNextSlide( qmn_quiz_data[quiz_id].pagination.amount, 0, '#quizForm' + quiz_id );
|
1132 |
}
|
1133 |
+
|
1134 |
}
|
1135 |
|
1136 |
function qmnSocialShare( network, mlw_qmn_social_text, mlw_qmn_title, facebook_id, share_url ) {
|
1154 |
|
1155 |
jQuery(function() {
|
1156 |
jQuery( '.qmn_quiz_container' ).tooltip();
|
1157 |
+
|
1158 |
jQuery( '.qmn_quiz_container input' ).on( 'keypress', function ( e ) {
|
1159 |
if ( e.which === 13 ) {
|
1160 |
e.preventDefault();
|
1161 |
}
|
1162 |
});
|
1163 |
+
|
1164 |
// jQuery( '.qmn_quiz_form' ).on( "submit", function( event ) {
|
1165 |
jQuery(document).on( 'click', ".qsm-submit-btn", function( event ) {
|
1166 |
event.preventDefault();
|
1167 |
var form = jQuery(this).closest('form')[0];
|
1168 |
qmnFormSubmit( form.id );
|
1169 |
});
|
1170 |
+
|
1171 |
jQuery(document).on('click','.btn-reload-quiz',function(e){
|
1172 |
e.preventDefault();
|
1173 |
var quiz_id = jQuery(this).data('quiz_id');
|
1177 |
type: 'POST',
|
1178 |
url: qmn_ajax_object.ajaxurl,
|
1179 |
data: {
|
1180 |
+
action: "qsm_get_quiz_to_reload",
|
1181 |
quiz_id: quiz_id,
|
1182 |
},
|
1183 |
+
success: function (response) {
|
1184 |
parent_div.replaceWith(response);
|
1185 |
// Restart the timer for retake quiz.
|
1186 |
setInterval( qmnTimeTakenTimer, 1000 );
|
1187 |
+
|
1188 |
// Reset the timer clock on retake quiz.
|
1189 |
QSM.initTimer( quiz_id );
|
1190 |
+
|
1191 |
QSM.initPagination( quiz_id );
|
1192 |
},
|
1193 |
error: function (errorThrown) {
|
1196 |
}
|
1197 |
});
|
1198 |
});
|
1199 |
+
|
1200 |
jQuery(document).on('change','.qmn_radio_answers input',function(e){
|
1201 |
if(qmn_ajax_object.enable_quick_result_mc == 1){
|
1202 |
+
var question_id = jQuery(this).attr('name').split('question')[1],
|
1203 |
value = jQuery(this).val(),
|
1204 |
$this = jQuery(this).parents('.quiz_section');
|
1205 |
+
|
1206 |
jQuery.ajax({
|
1207 |
type: 'POST',
|
1208 |
url: qmn_ajax_object.ajaxurl,
|
1209 |
data: {
|
1210 |
+
action: "qsm_get_question_quick_result",
|
1211 |
question_id: question_id,
|
1212 |
answer: value,
|
1213 |
},
|
1217 |
$this.append('<p style="color: green" class="quick-question-res-p">' + qmn_ajax_object.quick_result_correct_text + '</p>')
|
1218 |
}else if(response == 'incorrect'){
|
1219 |
$this.append('<p style="color: red" class="quick-question-res-p">' + qmn_ajax_object.quick_result_wrong_text + '</p>')
|
1220 |
+
}
|
1221 |
},
|
1222 |
error: function (errorThrown) {
|
1223 |
alert(errorThrown);
|
1225 |
});
|
1226 |
}
|
1227 |
});
|
1228 |
+
|
1229 |
/*jQuery('.qmn_radio_answers > .qmn_mc_answer_wrap').on('click',function(event){
|
1230 |
+
var radButton = jQuery(this).find('input[type=radio]');
|
1231 |
if(event.target.className == 'qmn_quiz_radio'){
|
1232 |
return true;
|
1233 |
}
|
1247 |
form_data.append('action', 'qsm_upload_image_fd_question');
|
1248 |
var question_id = $this.parent('.quiz_section').find('.mlw_file_upload_hidden_value').attr("name").replace('question','');
|
1249 |
form_data.append('question_id', question_id);
|
1250 |
+
$this.next('.loading-uploaded-file').show();
|
1251 |
jQuery.ajax({
|
1252 |
url: qmn_ajax_object.ajaxurl,
|
1253 |
type: 'POST',
|
1257 |
processData: false,
|
1258 |
success: function (response) {
|
1259 |
var obj = jQuery.parseJSON(response);
|
1260 |
+
$this.next('.loading-uploaded-file').hide();
|
1261 |
if(obj.type == 'success'){
|
1262 |
+
$this.next().next('.remove-uploaded-file').show();
|
1263 |
+
$this.next().next().next('.mlw_file_upload_hidden_value').val(obj.file_url);
|
1264 |
$this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val(obj.file_path);
|
1265 |
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide();
|
1266 |
}else{
|
1272 |
});
|
1273 |
return false;
|
1274 |
});
|
1275 |
+
|
1276 |
//Ajax remove file code
|
1277 |
jQuery('.quiz_section .remove-uploaded-file').on('click', function(){
|
1278 |
var $this = jQuery(this);
|
1279 |
var file_data = jQuery(this).parent('.quiz_section').find('.mlw_file_upload_hidden_path').val();
|
1280 |
var form_data = new FormData();
|
1281 |
form_data.append('action', 'qsm_remove_file_fd_question');
|
1282 |
+
form_data.append('file_url', file_data);
|
1283 |
jQuery.ajax({
|
1284 |
url: qmn_ajax_object.ajaxurl,
|
1285 |
type: 'POST',
|
1303 |
});
|
1304 |
return false;
|
1305 |
});
|
1306 |
+
|
1307 |
//Deselect all answer on select
|
1308 |
jQuery('.qsm-deselect-answer').click(function(e){
|
1309 |
e.preventDefault();
|
1310 |
jQuery(this).parents('.quiz_section').find('input[type="radio"]').prop('checked', false);
|
1311 |
});
|
1312 |
+
|
1313 |
//Submit the form on popup click
|
1314 |
jQuery(document).on( 'click', '.submit-the-form', function(e) {
|
1315 |
e.preventDefault();
|
@@ -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: 7.0.
|
6 |
* Author: ExpressTech
|
7 |
* Author URI: https://quizandsurveymaster.com/
|
8 |
* Plugin URI: https://expresstech.io/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author QSM Team
|
12 |
-
* @version 7.0.
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
@@ -37,7 +37,7 @@ class MLWQuizMasterNext {
|
|
37 |
* @var string
|
38 |
* @since 4.0.0
|
39 |
*/
|
40 |
-
public $version = '7.0.
|
41 |
|
42 |
/**
|
43 |
* QSM Alert Manager Object
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
+
* Version: 7.0.1
|
6 |
* Author: ExpressTech
|
7 |
* Author URI: https://quizandsurveymaster.com/
|
8 |
* Plugin URI: https://expresstech.io/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author QSM Team
|
12 |
+
* @version 7.0.1
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
37 |
* @var string
|
38 |
* @since 4.0.0
|
39 |
*/
|
40 |
+
public $version = '7.0.1';
|
41 |
|
42 |
/**
|
43 |
* QSM Alert Manager Object
|
@@ -20,8 +20,16 @@ function qmn_addons_page() {
|
|
20 |
wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
|
21 |
?>
|
22 |
<div class="wrap qsm-addon-setting-wrap">
|
23 |
-
<h2
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<?php
|
26 |
foreach ($tab_array as $tab) {
|
27 |
$active_class = '';
|
@@ -52,64 +60,168 @@ function qmn_addons_page() {
|
|
52 |
* @since 4.4.0
|
53 |
*/
|
54 |
function qsm_generate_featured_addons() {
|
55 |
-
|
|
|
|
|
56 |
?>
|
57 |
-
<
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<?php
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
-
$cateory_arr[$category_addon][] = $value;
|
71 |
-
}
|
72 |
-
}
|
73 |
-
if ($cateory_arr) {
|
74 |
-
foreach ($cateory_arr as $cat_name => $cat_value) {
|
75 |
?>
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
-
|
88 |
-
|
89 |
</div>
|
90 |
-
<a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-bottom&utm_campaign=qsm_plugin" target="_blank" class="button-primary" style="margin-top: 20px !important;"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
|
91 |
</div>
|
92 |
-
<div class="qsm-news-ads">
|
93 |
-
<h3 class="qsm-news-ads-title">QSM Bundle</h3>
|
94 |
<?php
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
?>
|
97 |
-
<div class="qsm-info-widget">
|
98 |
-
<h3><?php echo $xml->qsm_bundle->starter_bundle->name; ?></h3>
|
99 |
-
<p><?php echo $xml->qsm_bundle->starter_bundle->desc; ?></p>
|
100 |
-
<button class="button button-default">$<?php echo $xml->qsm_bundle->starter_bundle->price; ?></button>
|
101 |
-
<a target="_blank" href="<?php echo $xml->qsm_bundle->starter_bundle->link; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary">Get Now</a>
|
102 |
-
</div>
|
103 |
-
<div class="qsm-info-widget">
|
104 |
-
<h3><?php echo $xml->qsm_bundle->premium_bundle->name; ?></h3>
|
105 |
-
<p><?php echo $xml->qsm_bundle->premium_bundle->desc; ?></p>
|
106 |
-
<button class="button button-default">$<?php echo $xml->qsm_bundle->premium_bundle->price; ?></button>
|
107 |
-
<a target="_blank" href="<?php echo $xml->qsm_bundle->premium_bundle->link; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary">Get Now</a>
|
108 |
-
</div>
|
109 |
-
<?php } ?>
|
110 |
-
<!-- <div class="remove-ads-adv-link">
|
111 |
-
<a target="_blank" href="https://quizandsurveymaster.com/downloads/advertisement-gone/"><span class="dashicons dashicons-no-alt"></span> Remove Ads</a>
|
112 |
-
</div> -->
|
113 |
</div>
|
114 |
<?php
|
115 |
}
|
@@ -149,9 +261,9 @@ function qsm_display_optin_page() {
|
|
149 |
<div class="about-body">
|
150 |
<img src="" alt="Improved Custom Fields">
|
151 |
</div>
|
152 |
-
</div> -->
|
153 |
</div>
|
154 |
-
|
155 |
<p><?php echo sprintf(__('Getting your addon is dead simple: just subscribe to our newsletter and then you will get the free addon by e-mail. We will not spam you. We usually send out newsletters to talk about new features in <b>Quiz and Survey Master</b>, let you know when new or updated addons are being released and provide informative articles that show you how to use <b>Quiz and Survey Master</b> to its full potential. <a href="%s" %s>View our privacy policy</a>', 'quiz-master-next'), 'https://quizandsurveymaster.com/privacy-policy/', 'target="_blank"'); ?></p>
|
156 |
|
157 |
<div id="wpas-mailchimp-signup-form-wrapper">
|
@@ -209,7 +321,7 @@ function qsm_display_optin_page() {
|
|
209 |
/>
|
210 |
</svg>
|
211 |
<span class="sib-form-message-panel__inner-text">
|
212 |
-
Your subscription could not be saved. Please try again.
|
213 |
</span>
|
214 |
</div>
|
215 |
</div>
|
@@ -221,20 +333,20 @@ function qsm_display_optin_page() {
|
|
221 |
/>
|
222 |
</svg>
|
223 |
<span class="sib-form-message-panel__inner-text">
|
224 |
-
|
225 |
</span>
|
226 |
</div>
|
227 |
</div>
|
228 |
<div></div>
|
229 |
<div id="sib-container" class="sib-container--large sib-container--vertical" style="text-align:center; background-color:rgba(255,255,255,1); max-width:540px; border-radius:3px; border-width:1px; border-color:#C0CCD9; border-style:solid;">
|
230 |
<form id="sib-form" method="POST" action="https://cddf18fd.sibforms.com/serve/MUIEAO9t8eOB2GOqY73EWqFatPi328RiosfYMKieZ_8IxVL2jyEazmQ9LlkDj6pYrTlvB7JBsx3su8WdK5A4l445X0P-0r0Qf82LWXLSFa3yK0YZuypiIxy8hZfBXClZMANBeEVpBkswLw0RxDt2uWrN7B7zHTFXWY0W4mftpWo3Nqen7SQW1L9DYnXrex6lyw5EfHvZ3ZwsU6Xp"
|
231 |
-
data-type="subscription">
|
232 |
<div style="padding: 16px 0;">
|
233 |
<div class="sib-input sib-form-block">
|
234 |
<div class="form__entry entry_block">
|
235 |
<div class="form__label-row ">
|
236 |
<label class="entry__label" style="font-size:16px; text-align:left; font-weight:700; font-family:Helvetica, sans-serif; color:#3c4858; border-width:px;" for="EMAIL" data-required="*">
|
237 |
-
Enter your email address to subscribe
|
238 |
</label>
|
239 |
|
240 |
<div class="entry__field">
|
@@ -245,7 +357,7 @@ function qsm_display_optin_page() {
|
|
245 |
<label class="entry__error entry__error--primary" style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#661d1d; background-color:#ffeded; border-radius:3px; border-width:px; border-color:#ff4949;">
|
246 |
</label>
|
247 |
<label class="entry__specification" style="font-size:12px; text-align:left; font-family:Helvetica, sans-serif; color:#8390A4; border-width:px;">
|
248 |
-
|
249 |
</label>
|
250 |
</div>
|
251 |
</div>
|
@@ -258,7 +370,7 @@ function qsm_display_optin_page() {
|
|
258 |
<path d="M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z"
|
259 |
/>
|
260 |
</svg>
|
261 |
-
SUBSCRIBE
|
262 |
</button>
|
263 |
</div>
|
264 |
</div>
|
@@ -266,7 +378,7 @@ function qsm_display_optin_page() {
|
|
266 |
<div class="sib-form-block" style="font-size:14px; text-align:center; font-family:Helvetica, sans-serif; color:#333; background-color:transparent; border-width:px;">
|
267 |
<div class="sib-text-form-block">
|
268 |
<p>
|
269 |
-
<a href="https://sendinblue.com" target="_blank"
|
270 |
</p>
|
271 |
</div>
|
272 |
</div>
|
@@ -306,7 +418,7 @@ function qsm_display_optin_page() {
|
|
306 |
</script>
|
307 |
<script src="https://www.google.com/recaptcha/api.js?hl=en"></script>
|
308 |
<!-- END - We recommend to place the above code in footer or bottom of your website html -->
|
309 |
-
<!-- End Sendinblue Form -->
|
310 |
</div>
|
311 |
</div>
|
312 |
|
20 |
wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
|
21 |
?>
|
22 |
<div class="wrap qsm-addon-setting-wrap">
|
23 |
+
<h2 style="margin-bottom: 20px;">
|
24 |
+
<?php _e('QSM Addon Settings', 'quiz-master-next'); ?>
|
25 |
+
<?php
|
26 |
+
if( isset( $_GET['tab'] ) && $_GET['tab'] != '' ){ ?>
|
27 |
+
<a class="button button-default" href="?page=qmn_addons"><span style="margin-top: 4px;" class="dashicons dashicons-arrow-left-alt"></span> <?php _e('Back to list', 'quiz-master-next'); ?></a>
|
28 |
+
<?php
|
29 |
+
}
|
30 |
+
?>
|
31 |
+
</h2>
|
32 |
+
<h2 class="nav-tab-wrapper" style="display: none;">
|
33 |
<?php
|
34 |
foreach ($tab_array as $tab) {
|
35 |
$active_class = '';
|
60 |
* @since 4.4.0
|
61 |
*/
|
62 |
function qsm_generate_featured_addons() {
|
63 |
+
global $mlwQuizMasterNext;
|
64 |
+
wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
|
65 |
+
$tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
|
66 |
?>
|
67 |
+
<div class="qsm-active-addons">
|
68 |
+
<h2 class="installed_title"><?php _e('Installed Addons', 'quiz-master-next'); ?></h2>
|
69 |
+
<?php
|
70 |
+
if( $tab_array && count( $tab_array ) > 1 ){ ?>
|
71 |
+
<div class="installed_addons_wrapper">
|
72 |
+
<?php
|
73 |
+
foreach ($tab_array as $tab) {
|
74 |
+
if( trim( $tab['title'] ) == 'Featured Addons' ){
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
?>
|
78 |
+
<div class="installed_addon">
|
79 |
+
<span class="installed_addon_name"><?php echo $tab['title']; ?></span>
|
80 |
+
<span class="installed_addon_link">
|
81 |
+
<a class="button button-default" href="?page=qmn_addons&tab=<?php echo $tab['slug']; ?>"><span class="dashicons dashicons-admin-generic"></span> <?php _e('Settings', 'quiz-master-next'); ?></a>
|
82 |
+
</span>
|
83 |
+
</div>
|
84 |
+
<?php } ?>
|
85 |
+
</div>
|
86 |
<?php
|
87 |
+
} else { ?>
|
88 |
+
<div class="no_addons_installed">
|
89 |
+
<?php
|
90 |
+
_e('You have currently not installed any addons. Explore our addons repository with 40+ addons to make your quiz even better.', 'quiz-master-next');
|
91 |
+
?>
|
92 |
+
</div>
|
93 |
+
<?php }
|
94 |
+
?>
|
95 |
+
</div>
|
96 |
+
<div class="qsm-addon-browse-addons">
|
97 |
+
<div class="qsm-addon-anchor-left">
|
98 |
+
<a class="active" href="#qsm_popular_addons"><?php _e('Popular Addons', 'quiz-master-next'); ?></a>
|
99 |
+
<a href="#qsm_onsale_addons"><?php _e('On Sale Addons', 'quiz-master-next'); ?></a>
|
100 |
+
<a href="#qsm_new_addons"><?php _e('Recently Updated Addons', 'quiz-master-next'); ?></a>
|
101 |
+
</div>
|
102 |
+
<div class="qsm-addon-list-right">
|
103 |
+
<span><?php _e('40+ addons available', 'quiz-master-next'); ?></span>
|
104 |
+
<a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
<div class="qsm-quiz-page-addon qsm-addon-page-list">
|
108 |
+
<?php
|
109 |
+
$popular_addons = qsm_get_widget_data('popular_products');
|
110 |
+
if( empty( $popular_addons ) ){
|
111 |
+
$qsm_admin_dd = qsm_fetch_data_from_script();
|
112 |
+
$popular_addons = isset( $qsm_admin_dd['popular_products'] ) ? $qsm_admin_dd['popular_products'] : array();
|
113 |
+
}
|
114 |
+
?>
|
115 |
+
<div class="qsm_popular_addons" id="qsm_popular_addons">
|
116 |
+
<div class="popuar-addon-ul">
|
117 |
+
<?php
|
118 |
+
if ( $popular_addons ) {
|
119 |
+
foreach ( $popular_addons as $key => $single_arr ) {
|
120 |
+
?>
|
121 |
+
<div>
|
122 |
+
<a href="<?php echo $single_arr['link']; ?>" target="_blank">
|
123 |
+
<img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
|
124 |
+
</a>
|
125 |
+
<div class="description-wrap">
|
126 |
+
<span class="description"><?php echo $single_arr['description']; ?></span>
|
127 |
+
<button class="button button-primary">$<?php echo array_values($single_arr['price'])[0]; ?></button>
|
128 |
+
<a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button button-primary"><?php _e('Get This Addon', 'quiz-master-next'); ?></a>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
<?php
|
132 |
+
}
|
133 |
}
|
|
|
|
|
|
|
|
|
|
|
134 |
?>
|
135 |
+
</div>
|
136 |
+
</div>
|
137 |
+
<div class="qsm_popular_addons" id="qsm_onsale_addons" style="display: none;">
|
138 |
+
<?php
|
139 |
+
$qsm_onsale_addons = qsm_get_widget_data('on_sale_products');
|
140 |
+
if( empty( $qsm_onsale_addons ) ){
|
141 |
+
$qsm_admin_dd = qsm_fetch_data_from_script();
|
142 |
+
$qsm_onsale_addons = isset( $qsm_admin_dd['on_sale_products'] ) ? $qsm_admin_dd['on_sale_products'] : array();
|
143 |
+
}
|
144 |
+
?>
|
145 |
+
<div class="popuar-addon-ul">
|
146 |
<?php
|
147 |
+
if ( $qsm_onsale_addons ) {
|
148 |
+
foreach ( $qsm_onsale_addons as $key => $single_arr ) {
|
149 |
+
?>
|
150 |
+
<div>
|
151 |
+
<a href="<?php echo $single_arr['link']; ?>" target="_blank">
|
152 |
+
<img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
|
153 |
+
</a>
|
154 |
+
<div class="description-wrap">
|
155 |
+
<span class="description"><?php echo $single_arr['description']; ?></span>
|
156 |
+
<button class="button button-primary">$<?php echo array_values($single_arr['price'])[0]; ?></button>
|
157 |
+
<a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button button-primary"><?php _e('Get This Addon', 'quiz-master-next'); ?></a>
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
<?php
|
161 |
+
}
|
162 |
+
}
|
163 |
+
?>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
<div class="qsm_popular_addons" id="qsm_new_addons" style="display: none;">
|
167 |
+
<?php
|
168 |
+
$new_addons = qsm_get_widget_data('new_addons');
|
169 |
+
if( empty( $popular_addons ) ){
|
170 |
+
$qsm_admin_dd = qsm_fetch_data_from_script();
|
171 |
+
$new_addons = isset( $qsm_admin_dd['new_addons'] ) ? $qsm_admin_dd['new_addons'] : array();
|
172 |
+
}
|
173 |
+
?>
|
174 |
+
<div class="popuar-addon-ul">
|
175 |
+
<?php
|
176 |
+
if ( $new_addons ) {
|
177 |
+
foreach ( $new_addons as $key => $single_arr ) {
|
178 |
+
if( trim( $single_arr['name'] ) == 'Starter Bundle' || trim( $single_arr['name'] ) == 'Premium Bundle' ){
|
179 |
+
continue;
|
180 |
+
}
|
181 |
+
?>
|
182 |
+
<div>
|
183 |
+
<a href="<?php echo $single_arr['link']; ?>" target="_blank">
|
184 |
+
<img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
|
185 |
+
</a>
|
186 |
+
<div class="description-wrap">
|
187 |
+
<?php if( isset($single_arr['description']) && $single_arr['description'] != '' ){ ?>
|
188 |
+
<span class="description"><?php echo $single_arr['description']; ?></span>
|
189 |
+
<?php } ?>
|
190 |
+
<button class="button button-primary">$<?php echo array_values($single_arr['price'])[0]; ?></button>
|
191 |
+
<a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button button-primary"><?php _e('Get This Addon', 'quiz-master-next'); ?></a>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
<?php
|
195 |
+
}
|
196 |
}
|
197 |
+
?>
|
198 |
+
</div>
|
199 |
</div>
|
|
|
200 |
</div>
|
201 |
+
<div class="qsm-addon-news-ads">
|
|
|
202 |
<?php
|
203 |
+
$bundles = qsm_get_widget_data('bundles');
|
204 |
+
if( empty( $bundles ) ){
|
205 |
+
$qsm_admin_dd = qsm_fetch_data_from_script();
|
206 |
+
$bundles = isset( $qsm_admin_dd['bundles'] ) ? $qsm_admin_dd['bundles'] : array();
|
207 |
+
}
|
208 |
+
?>
|
209 |
+
<?php
|
210 |
+
if( $bundles ){
|
211 |
+
?>
|
212 |
+
<h3 class="qsm-news-ads-title"><?php _e('SAVE WITH OUR BUNDLES', 'quiz-master-next'); ?></h3>
|
213 |
+
<?php
|
214 |
+
foreach ($bundles as $key => $bundles_arr) { ?>
|
215 |
+
<div class="qsm-info-widget" style="background-color: <?php echo $bundles_arr['background']; ?>">
|
216 |
+
<h3><?php echo $bundles_arr['name']; ?></h3>
|
217 |
+
<p><?php echo $bundles_arr['desc']; ?></p>
|
218 |
+
<button class="button button-default">$<?php echo array_values($bundles_arr['price'])[0]; ?></button>
|
219 |
+
<a target="_blank" href="<?php echo $bundles_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary"><?php _e('Get Now', 'quiz-master-next'); ?></a>
|
220 |
+
</div>
|
221 |
+
<?php
|
222 |
+
}
|
223 |
+
}
|
224 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
</div>
|
226 |
<?php
|
227 |
}
|
261 |
<div class="about-body">
|
262 |
<img src="" alt="Improved Custom Fields">
|
263 |
</div>
|
264 |
+
</div> -->
|
265 |
</div>
|
266 |
+
|
267 |
<p><?php echo sprintf(__('Getting your addon is dead simple: just subscribe to our newsletter and then you will get the free addon by e-mail. We will not spam you. We usually send out newsletters to talk about new features in <b>Quiz and Survey Master</b>, let you know when new or updated addons are being released and provide informative articles that show you how to use <b>Quiz and Survey Master</b> to its full potential. <a href="%s" %s>View our privacy policy</a>', 'quiz-master-next'), 'https://quizandsurveymaster.com/privacy-policy/', 'target="_blank"'); ?></p>
|
268 |
|
269 |
<div id="wpas-mailchimp-signup-form-wrapper">
|
321 |
/>
|
322 |
</svg>
|
323 |
<span class="sib-form-message-panel__inner-text">
|
324 |
+
<?php _e('Your subscription could not be saved. Please try again.', 'quiz-master-next'); ?>
|
325 |
</span>
|
326 |
</div>
|
327 |
</div>
|
333 |
/>
|
334 |
</svg>
|
335 |
<span class="sib-form-message-panel__inner-text">
|
336 |
+
<?php _e('Your subscription has been successful.', 'quiz-master-next'); ?>
|
337 |
</span>
|
338 |
</div>
|
339 |
</div>
|
340 |
<div></div>
|
341 |
<div id="sib-container" class="sib-container--large sib-container--vertical" style="text-align:center; background-color:rgba(255,255,255,1); max-width:540px; border-radius:3px; border-width:1px; border-color:#C0CCD9; border-style:solid;">
|
342 |
<form id="sib-form" method="POST" action="https://cddf18fd.sibforms.com/serve/MUIEAO9t8eOB2GOqY73EWqFatPi328RiosfYMKieZ_8IxVL2jyEazmQ9LlkDj6pYrTlvB7JBsx3su8WdK5A4l445X0P-0r0Qf82LWXLSFa3yK0YZuypiIxy8hZfBXClZMANBeEVpBkswLw0RxDt2uWrN7B7zHTFXWY0W4mftpWo3Nqen7SQW1L9DYnXrex6lyw5EfHvZ3ZwsU6Xp"
|
343 |
+
data-type="subscription">
|
344 |
<div style="padding: 16px 0;">
|
345 |
<div class="sib-input sib-form-block">
|
346 |
<div class="form__entry entry_block">
|
347 |
<div class="form__label-row ">
|
348 |
<label class="entry__label" style="font-size:16px; text-align:left; font-weight:700; font-family:Helvetica, sans-serif; color:#3c4858; border-width:px;" for="EMAIL" data-required="*">
|
349 |
+
<?php _e('Enter your email address to subscribe', 'quiz-master-next'); ?>
|
350 |
</label>
|
351 |
|
352 |
<div class="entry__field">
|
357 |
<label class="entry__error entry__error--primary" style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#661d1d; background-color:#ffeded; border-radius:3px; border-width:px; border-color:#ff4949;">
|
358 |
</label>
|
359 |
<label class="entry__specification" style="font-size:12px; text-align:left; font-family:Helvetica, sans-serif; color:#8390A4; border-width:px;">
|
360 |
+
<?php _e('Provide your email address to subscribe. For e.g abc@xyz.com', 'quiz-master-next'); ?>
|
361 |
</label>
|
362 |
</div>
|
363 |
</div>
|
370 |
<path d="M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z"
|
371 |
/>
|
372 |
</svg>
|
373 |
+
<?php _e('SUBSCRIBE', 'quiz-master-next'); ?>
|
374 |
</button>
|
375 |
</div>
|
376 |
</div>
|
378 |
<div class="sib-form-block" style="font-size:14px; text-align:center; font-family:Helvetica, sans-serif; color:#333; background-color:transparent; border-width:px;">
|
379 |
<div class="sib-text-form-block">
|
380 |
<p>
|
381 |
+
<a href="https://sendinblue.com" target="_blank"><?php _e('Terms & Privacy policy', 'quiz-master-next'); ?></a>
|
382 |
</p>
|
383 |
</div>
|
384 |
</div>
|
418 |
</script>
|
419 |
<script src="https://www.google.com/recaptcha/api.js?hl=en"></script>
|
420 |
<!-- END - We recommend to place the above code in footer or bottom of your website html -->
|
421 |
+
<!-- End Sendinblue Form -->
|
422 |
</div>
|
423 |
</div>
|
424 |
|
@@ -7,16 +7,25 @@ function qsm_get_widget_data( $name ){
|
|
7 |
$get_dashboard_data = get_transient( 'qsm_admin_dashboard_data' );
|
8 |
if($get_dashboard_data !== false && !empty( $get_dashboard_data ) ){
|
9 |
$qsm_admin_dd = $get_dashboard_data;
|
10 |
-
}else{
|
11 |
-
$
|
12 |
-
|
13 |
-
$qsm_admin_dd = wp_remote_retrieve_body( $fetch_api_data );
|
14 |
-
$qsm_admin_dd = json_decode( $qsm_admin_dd, true );
|
15 |
-
set_transient( 'qsm_admin_dashboard_data', $qsm_admin_dd, 24*60*60 );
|
16 |
-
}
|
17 |
}
|
18 |
return isset( $qsm_admin_dd[$name] ) ? $qsm_admin_dd[$name] : array();
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* @since 7.0
|
22 |
* @param str $widget_id
|
@@ -131,7 +140,7 @@ function qsm_generate_dashboard_page() {
|
|
131 |
<div class="welcome-panel-column welcome-panel-last">
|
132 |
<h3><?php _e( 'Useful Links', 'quiz-master-next' ); ?></h3>
|
133 |
<ul>
|
134 |
-
<li><a target="_blank" href="https://
|
135 |
<li><a target="_blank" href="https://github.com/QuizandSurveyMaster/quiz_master_next" class="welcome-icon"><span class="dashicons dashicons-editor-code"></span> <?php _e( 'Github Repository', 'quiz-master-next' ); ?></a></li>
|
136 |
</ul>
|
137 |
</div>
|
@@ -304,7 +313,7 @@ function qsm_dashboard_popular_addon( $widget_id ) {
|
|
304 |
foreach ( $addon_array as $key => $single_arr ) {
|
305 |
?>
|
306 |
<li>
|
307 |
-
<a href="<?php echo $single_arr['link'];
|
308 |
<img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
|
309 |
</a>
|
310 |
</li>
|
7 |
$get_dashboard_data = get_transient( 'qsm_admin_dashboard_data' );
|
8 |
if($get_dashboard_data !== false && !empty( $get_dashboard_data ) ){
|
9 |
$qsm_admin_dd = $get_dashboard_data;
|
10 |
+
}else{
|
11 |
+
$qsm_admin_dd = qsm_fetch_data_from_script();
|
12 |
+
set_transient( 'qsm_admin_dashboard_data', $qsm_admin_dd, 24*60*60 );
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
return isset( $qsm_admin_dd[$name] ) ? $qsm_admin_dd[$name] : array();
|
15 |
}
|
16 |
+
|
17 |
+
function qsm_fetch_data_from_script(){
|
18 |
+
$args = array(
|
19 |
+
'timeout' => 10,
|
20 |
+
'sslverify' => false
|
21 |
+
);
|
22 |
+
$fetch_api_data = wp_remote_get('https://quizandsurveymaster.com/wp-json/qsmps/get-data', $args);
|
23 |
+
if( is_array( $fetch_api_data ) && isset( $fetch_api_data['response'] ) && isset( $fetch_api_data['response']['code'] ) && $fetch_api_data['response']['code'] == 200 ){
|
24 |
+
$qsm_admin_dd = wp_remote_retrieve_body( $fetch_api_data );
|
25 |
+
return json_decode( $qsm_admin_dd, true );
|
26 |
+
}
|
27 |
+
return array();
|
28 |
+
}
|
29 |
/**
|
30 |
* @since 7.0
|
31 |
* @param str $widget_id
|
140 |
<div class="welcome-panel-column welcome-panel-last">
|
141 |
<h3><?php _e( 'Useful Links', 'quiz-master-next' ); ?></h3>
|
142 |
<ul>
|
143 |
+
<li><a target="_blank" href="https://quizandsurveymaster.com/contact-support/" class="welcome-icon"><span class="dashicons dashicons-admin-users"></span> <?php _e( 'Support Forum', 'quiz-master-next' ); ?></a></li>
|
144 |
<li><a target="_blank" href="https://github.com/QuizandSurveyMaster/quiz_master_next" class="welcome-icon"><span class="dashicons dashicons-editor-code"></span> <?php _e( 'Github Repository', 'quiz-master-next' ); ?></a></li>
|
145 |
</ul>
|
146 |
</div>
|
313 |
foreach ( $addon_array as $key => $single_arr ) {
|
314 |
?>
|
315 |
<li>
|
316 |
+
<a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-dashoard-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank">
|
317 |
<img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
|
318 |
</a>
|
319 |
</li>
|
@@ -90,6 +90,22 @@ function qsm_add_author_column_in_db() {
|
|
90 |
}
|
91 |
update_option('qsm_update_quiz_db_column', '1');
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
|
@@ -598,4 +614,17 @@ function qsm_check_create_tables(){
|
|
598 |
QSM_Install::install();
|
599 |
}
|
600 |
}
|
601 |
-
add_action('admin_init', 'qsm_check_create_tables');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
update_option('qsm_update_quiz_db_column', '1');
|
92 |
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Changed result table column data type
|
96 |
+
* @since 7.0.1
|
97 |
+
*/
|
98 |
+
if( get_option('qsm_update_result_db_column_datatype', '') != '1' ){
|
99 |
+
global $wpdb;
|
100 |
+
$result_table_name = $wpdb->prefix . "mlw_results";
|
101 |
+
$table_quiz_result_obj = $wpdb->get_row( $wpdb->prepare(
|
102 |
+
'SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ', $wpdb->dbname, $result_table_name, 'quiz_results'
|
103 |
+
), ARRAY_A );
|
104 |
+
if ( isset( $table_quiz_result_obj['DATA_TYPE'] ) && $table_quiz_result_obj['DATA_TYPE'] == 'text' ) {
|
105 |
+
$wpdb->query("ALTER TABLE $result_table_name CHANGE `quiz_results` `quiz_results` LONGTEXT;");
|
106 |
+
}
|
107 |
+
update_option('qsm_update_result_db_column_datatype', '1');
|
108 |
+
}
|
109 |
}
|
110 |
|
111 |
|
614 |
QSM_Install::install();
|
615 |
}
|
616 |
}
|
617 |
+
add_action('admin_init', 'qsm_check_create_tables');
|
618 |
+
|
619 |
+
/**
|
620 |
+
* Redirect the admin old slug to new slug
|
621 |
+
*
|
622 |
+
* @since 7.0.0
|
623 |
+
*/
|
624 |
+
function qsm_admin_page_access_func(){
|
625 |
+
if( isset( $_GET['page'] ) && $_GET['page'] == 'quiz-master-next/mlw_quizmaster2.php'){
|
626 |
+
wp_redirect( admin_url( 'admin.php?page=qsm_dashboard' ) );
|
627 |
+
exit;
|
628 |
+
}
|
629 |
+
}
|
630 |
+
add_action('admin_page_access_denied', 'qsm_admin_page_access_func');
|
@@ -54,7 +54,7 @@ function qsm_documentation_meta_box_content() {
|
|
54 |
<p><?php esc_html_e( 'Need help with the plugin? Try any of the following:', 'quiz-master-next' ); ?></p>
|
55 |
<ul>
|
56 |
<li>For assistance in using the plugin, read our <a href="https://quizandsurveymaster.com/docs/" target="_blank">documentation</a></li>
|
57 |
-
<li>For support, fill out the form on our <a href="https://quizandsurveymaster.com/
|
58 |
</ul>
|
59 |
<?php
|
60 |
}
|
@@ -89,29 +89,29 @@ function qsm_get_system_info() {
|
|
89 |
$parent_theme = $parent_theme_data->Name . ' ' . $parent_theme_data->Version;
|
90 |
}
|
91 |
|
92 |
-
$sys_info .= '<h3>Site Information</h3>';
|
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>';
|
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 .=
|
102 |
-
$sys_info .=
|
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>';
|
107 |
$plugin_mu = get_mu_plugins();
|
108 |
if ( count( $plugin_mu ) > 0 ) {
|
109 |
-
$sys_info .= '<h4>Must Use</h4>';
|
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>';
|
115 |
$plugins = get_plugins();
|
116 |
$active_plugins = get_option( 'active_plugins', array() );
|
117 |
foreach ( $plugins as $plugin_path => $plugin ) {
|
@@ -120,7 +120,7 @@ function qsm_get_system_info() {
|
|
120 |
}
|
121 |
$sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
|
122 |
}
|
123 |
-
$sys_info .= '<h4>Inactive</h4>';
|
124 |
foreach ( $plugins as $plugin_path => $plugin ) {
|
125 |
if ( in_array( $plugin_path, $active_plugins ) ) {
|
126 |
continue;
|
@@ -128,10 +128,10 @@ function qsm_get_system_info() {
|
|
128 |
$sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
|
129 |
}
|
130 |
|
131 |
-
$sys_info .= '<h3>Server Information</h3>';
|
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" );
|
@@ -140,24 +140,24 @@ function qsm_get_system_info() {
|
|
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>';
|
144 |
-
$sys_info .= 'Initial Version : ' . get_option( 'qmn_original_version' ) . '<br />';
|
145 |
-
$sys_info .= 'Current Version : ' . $mlwQuizMasterNext->version . '<br />';
|
146 |
-
$sys_info .=
|
147 |
-
$sys_info .=
|
148 |
-
$sys_info .=
|
149 |
-
$sys_info .=
|
150 |
-
$sys_info .=
|
151 |
-
$sys_info .=
|
152 |
-
|
153 |
-
$sys_info .= '<h3>QSM Recent Logs</h3>';
|
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;
|
54 |
<p><?php esc_html_e( 'Need help with the plugin? Try any of the following:', 'quiz-master-next' ); ?></p>
|
55 |
<ul>
|
56 |
<li>For assistance in using the plugin, read our <a href="https://quizandsurveymaster.com/docs/" target="_blank">documentation</a></li>
|
57 |
+
<li>For support, fill out the form on our <a href="https://quizandsurveymaster.com/contact-support/?utm_source=qsm-help-page&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=contact_us" target="_blank">Contact Us Page</a></li>
|
58 |
</ul>
|
59 |
<?php
|
60 |
}
|
89 |
$parent_theme = $parent_theme_data->Name . ' ' . $parent_theme_data->Version;
|
90 |
}
|
91 |
|
92 |
+
$sys_info .= '<h3>'. __('Site Information', 'quiz-master-next') .'</h3>';
|
93 |
+
$sys_info .= __('Site URL:', 'quiz-master-next') . ' ' . site_url() . '<br />';
|
94 |
+
$sys_info .= __('Home URL:', 'quiz-master-next') . ' ' . home_url() . '<br />';
|
95 |
+
$sys_info .= __('Multisite: ', 'quiz-master-next') . ( is_multisite() ? 'Yes' : 'No' ) . '<br />';
|
96 |
+
|
97 |
+
$sys_info .= '<h3>'. __('WordPress Information', 'quiz-master-next') .'</h3>';
|
98 |
+
$sys_info .= __('Version: ', 'quiz-master-next') . get_bloginfo( 'version' ) . '<br />';
|
99 |
+
$sys_info .= __('Language: ', 'quiz-master-next') . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . '<br />';
|
100 |
+
$sys_info .= __('Permalink Structure: ', 'quiz-master-next') . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . '<br>';
|
101 |
+
$sys_info .= __('Active Theme: ', 'quiz-master-next') . "{$theme}";
|
102 |
+
$sys_info .= __('Parent Theme: ', 'quiz-master-next') . "{$parent_theme}<br>";
|
103 |
+
$sys_info .= __('Debug Mode: ', 'quiz-master-next') . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . '<br />';
|
104 |
+
$sys_info .= __('Memory Limit: ', 'quiz-master-next') . WP_MEMORY_LIMIT . '<br />';
|
105 |
+
|
106 |
+
$sys_info .= '<h3>'. __('Plugins Information', 'quiz-master-next') .'</h3>';
|
107 |
$plugin_mu = get_mu_plugins();
|
108 |
if ( count( $plugin_mu ) > 0 ) {
|
109 |
+
$sys_info .= '<h4>'. __('Must Use', 'quiz-master-next') .'</h4>';
|
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', 'quiz-master-next') .'</h4>';
|
115 |
$plugins = get_plugins();
|
116 |
$active_plugins = get_option( 'active_plugins', array() );
|
117 |
foreach ( $plugins as $plugin_path => $plugin ) {
|
120 |
}
|
121 |
$sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
|
122 |
}
|
123 |
+
$sys_info .= '<h4>'. __('Inactive', 'quiz-master-next') .'</h4>';
|
124 |
foreach ( $plugins as $plugin_path => $plugin ) {
|
125 |
if ( in_array( $plugin_path, $active_plugins ) ) {
|
126 |
continue;
|
128 |
$sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
|
129 |
}
|
130 |
|
131 |
+
$sys_info .= '<h3>'. __('Server Information', 'quiz-master-next') .'</h3>';
|
132 |
+
$sys_info .= __('PHP : ', 'quiz-master-next') . PHP_VERSION . '<br />';
|
133 |
+
$sys_info .= __('MySQL : ', 'quiz-master-next') . $wpdb->db_version() . '<br />';
|
134 |
+
$sys_info .= __('Webserver : ', 'quiz-master-next') . $_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" );
|
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', 'quiz-master-next') .'</h3>';
|
144 |
+
$sys_info .= __('Initial Version : ', 'quiz-master-next') . get_option( 'qmn_original_version' ) . '<br />';
|
145 |
+
$sys_info .= __('Current Version : ', 'quiz-master-next') . $mlwQuizMasterNext->version . '<br />';
|
146 |
+
$sys_info .= __('Total Quizzes : ', 'quiz-master-next') . "{$total_quizzes}<br />";
|
147 |
+
$sys_info .= __('Total Active Quizzes : ', 'quiz-master-next') . "{$total_active_quizzes}<br />";
|
148 |
+
$sys_info .= __('Total Questions : ', 'quiz-master-next') . "{$total_questions}<br />";
|
149 |
+
$sys_info .= __('Total Active Questions : ', 'quiz-master-next') . "{$total_active_questions}<br />";
|
150 |
+
$sys_info .= __('Total Results : ', 'quiz-master-next') . "{$total_results}<br />";
|
151 |
+
$sys_info .= __('Total Active Results : ', 'quiz-master-next') . "{$total_active_results}<br />";
|
152 |
+
|
153 |
+
$sys_info .= '<h3>'. __('QSM Recent Logs', 'quiz-master-next') .'</h3>';
|
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','quiz-master-next') . '<br />';
|
161 |
}
|
162 |
|
163 |
return $sys_info;
|
@@ -66,8 +66,8 @@ function qsm_options_emails_tab_content() {
|
|
66 |
<main class="email-content">
|
67 |
<div class="email-when">
|
68 |
<div class="email-content-header">
|
69 |
-
<h4
|
70 |
-
<p
|
71 |
</div>
|
72 |
<div class="email-when-conditions">
|
73 |
<!-- Conditions go here. Review template below. -->
|
@@ -76,14 +76,14 @@ function qsm_options_emails_tab_content() {
|
|
76 |
</div>
|
77 |
<div class="email-show">
|
78 |
<div class="email-content-header">
|
79 |
-
<h4
|
80 |
-
<p
|
81 |
</div>
|
82 |
-
<label
|
83 |
<input type="email" class="to-email" value="{{ data.to }}">
|
84 |
-
<label
|
85 |
<input type="text" class="subject" value="{{ data.subject }}">
|
86 |
-
<label
|
87 |
<textarea id="email-template-{{ data.id }}" class="email-template">{{{ data.content }}}</textarea>
|
88 |
<label><input type="checkbox" class="reply-to" <# if ( "true" == data.replyTo || true == data.replyTo ) { #>checked<# } #>>Add user email as Reply-To</label>
|
89 |
</div>
|
@@ -95,17 +95,17 @@ function qsm_options_emails_tab_content() {
|
|
95 |
<div class="email-condition">
|
96 |
<button class="delete-condition-button"><span class="dashicons dashicons-trash"></span></button>
|
97 |
<select class="email-condition-criteria">
|
98 |
-
<option value="points" <# if (data.criteria == 'points') { #>selected<# }
|
99 |
-
<option value="score" <# if (data.criteria == 'score') { #>selected<# }
|
100 |
<?php do_action( 'qsm_email_condition_criteria' ); ?>
|
101 |
</select>
|
102 |
<select class="email-condition-operator">
|
103 |
-
<option value="equal" <# if (data.operator == 'equal') { #>selected<# }
|
104 |
-
<option value="not-equal" <# if (data.operator == 'not-equal') { #>selected<# }
|
105 |
-
<option value="greater-equal" <# if (data.operator == 'greater-equal') { #>selected<# }
|
106 |
-
<option value="greater" <# if (data.operator == 'greater') { #>selected<# }
|
107 |
-
<option value="less-equal" <# if (data.operator == 'less-equal') { #>selected<# }
|
108 |
-
<option value="less" <# if (data.operator == 'less') { #>selected<# }
|
109 |
<?php do_action( 'qsm_email_condition_operator' ); ?>
|
110 |
</select>
|
111 |
<input type="text" class="email-condition-value" value="{{ data.value }}">
|
@@ -118,7 +118,7 @@ function qsm_options_emails_tab_content() {
|
|
118 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-3-title">
|
119 |
<header class="qsm-popup__header" style="display: block;">
|
120 |
<h2 class="qsm-popup__title"><?php _e('Template Variables', 'quiz-master-next'); ?></h2>
|
121 |
-
<span class="description"><?php _e('Use these dynamic variables to customize your quiz or survey. Just copy and paste one or more variables into the content templates and these will be replaced by actual values when user takes a quiz.', 'quiz-master-next'); ?></span>
|
122 |
</header>
|
123 |
<main class="qsm-popup__content" id="show-all-variable-content">
|
124 |
<?php
|
66 |
<main class="email-content">
|
67 |
<div class="email-when">
|
68 |
<div class="email-content-header">
|
69 |
+
<h4><?php esc_html_e('When...', 'quiz-master-') ?></h4>
|
70 |
+
<p><?php esc_html_e('Set conditions for when this email should be sent. Leave empty to set this as an email that is always sent.', 'quiz-master-next'); ?></p>
|
71 |
</div>
|
72 |
<div class="email-when-conditions">
|
73 |
<!-- Conditions go here. Review template below. -->
|
76 |
</div>
|
77 |
<div class="email-show">
|
78 |
<div class="email-content-header">
|
79 |
+
<h4><?php esc_html_e('...Send', 'quiz-master-next'); ?></h4>
|
80 |
+
<p><?php esc_html_e('Create the email that should be sent when the conditions are met.', 'quiz-master-next'); ?></p>
|
81 |
</div>
|
82 |
+
<label><?php esc_html_e('Who to send the email to? Put %USER_EMAIL% to send to user', 'quiz-master-next'); ?></label>
|
83 |
<input type="email" class="to-email" value="{{ data.to }}">
|
84 |
+
<label><?php esc_html_e('Email Subject', 'quiz-master-next'); ?></label>
|
85 |
<input type="text" class="subject" value="{{ data.subject }}">
|
86 |
+
<label><?php esc_html_e('Email Content', 'quiz-master-next'); ?></label>
|
87 |
<textarea id="email-template-{{ data.id }}" class="email-template">{{{ data.content }}}</textarea>
|
88 |
<label><input type="checkbox" class="reply-to" <# if ( "true" == data.replyTo || true == data.replyTo ) { #>checked<# } #>>Add user email as Reply-To</label>
|
89 |
</div>
|
95 |
<div class="email-condition">
|
96 |
<button class="delete-condition-button"><span class="dashicons dashicons-trash"></span></button>
|
97 |
<select class="email-condition-criteria">
|
98 |
+
<option value="points" <# if (data.criteria == 'points') { #>selected<# } #>><?php _e('Total points earned', 'quiz-master-next'); ?></option>
|
99 |
+
<option value="score" <# if (data.criteria == 'score') { #>selected<# } #>><?php _e('Correct score percentage', 'quiz-master-next'); ?></option>
|
100 |
<?php do_action( 'qsm_email_condition_criteria' ); ?>
|
101 |
</select>
|
102 |
<select class="email-condition-operator">
|
103 |
+
<option value="equal" <# if (data.operator == 'equal') { #>selected<# } #>><?php _e('is equal to', 'quiz-master-next'); ?></option>
|
104 |
+
<option value="not-equal" <# if (data.operator == 'not-equal') { #>selected<# } #>><?php _e('is not equal to', 'quiz-master-next'); ?></option>
|
105 |
+
<option value="greater-equal" <# if (data.operator == 'greater-equal') { #>selected<# } #>><?php _e('is greater than or equal to', 'quiz-master-next'); ?></option>
|
106 |
+
<option value="greater" <# if (data.operator == 'greater') { #>selected<# } #>><?php _e('is greater than', 'quiz-master-next'); ?></option>
|
107 |
+
<option value="less-equal" <# if (data.operator == 'less-equal') { #>selected<# } #>><?php _e('is less than or equal to', 'quiz-master-next'); ?></option>
|
108 |
+
<option value="less" <# if (data.operator == 'less') { #>selected<# } #>><?php _e('is less than', 'quiz-master-next'); ?></option>
|
109 |
<?php do_action( 'qsm_email_condition_operator' ); ?>
|
110 |
</select>
|
111 |
<input type="text" class="email-condition-value" value="{{ data.value }}">
|
118 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-3-title">
|
119 |
<header class="qsm-popup__header" style="display: block;">
|
120 |
<h2 class="qsm-popup__title"><?php _e('Template Variables', 'quiz-master-next'); ?></h2>
|
121 |
+
<span class="description"><?php _e('Use these dynamic variables to customize your quiz or survey. Just copy and paste one or more variables into the content templates and these will be replaced by actual values when user takes a quiz. <br/><b>Note:</b> Always use uppercase while using these variables.', 'quiz-master-next'); ?></span>
|
122 |
</header>
|
123 |
<main class="qsm-popup__content" id="show-all-variable-content">
|
124 |
<?php
|
@@ -61,7 +61,9 @@ function qsm_options_questions_tab_content() {
|
|
61 |
'saveNonce' => wp_create_nonce('ajax-nonce-sandy-page'),
|
62 |
'categories' => $question_categories,
|
63 |
'form_type' => $form_type,
|
64 |
-
'quiz_system' => $quiz_system
|
|
|
|
|
65 |
);
|
66 |
|
67 |
// Scripts and styles.
|
@@ -81,7 +83,7 @@ function qsm_options_questions_tab_content() {
|
|
81 |
if ( 0 != $pagination ) {
|
82 |
?>
|
83 |
<div class="notice notice-warning">
|
84 |
-
<p
|
85 |
</div>
|
86 |
<?php
|
87 |
}
|
@@ -89,7 +91,7 @@ function qsm_options_questions_tab_content() {
|
|
89 |
if ( 0 != $from_total ) {
|
90 |
?>
|
91 |
<div class="notice notice-warning">
|
92 |
-
<p
|
93 |
</div>
|
94 |
<?php
|
95 |
}
|
@@ -97,7 +99,7 @@ function qsm_options_questions_tab_content() {
|
|
97 |
if ( 0 != $randomness ) {
|
98 |
?>
|
99 |
<div class="notice notice-warning">
|
100 |
-
<p
|
101 |
</div>
|
102 |
<?php
|
103 |
}
|
@@ -105,11 +107,11 @@ function qsm_options_questions_tab_content() {
|
|
105 |
<h3 style="display: none;">Questions</h3>
|
106 |
<p style="text-align: right;"><a href="https://quizandsurveymaster.com/docs/v7/questions-tab/" target="_blank">View Documentation</a></p>
|
107 |
<div class="question-controls">
|
108 |
-
<span><b
|
109 |
<p class="search-box">
|
110 |
<label class="screen-reader-text" for="question_search">Search Questions:</label>
|
111 |
<input type="search" id="question_search" name="question_search" value="">
|
112 |
-
<a href="#" class="button"
|
113 |
</p>
|
114 |
</div>
|
115 |
<div class="questions quiz_form_type_<?php echo $form_type; ?> quiz_quiz_systen_<?php echo $quiz_system; ?>"><div class="qsm-showing-loader" style="text-align: center;margin-bottom: 20px;"><div class="qsm-spinner-loader"></div></div></div>
|
@@ -125,7 +127,7 @@ function qsm_options_questions_tab_content() {
|
|
125 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
126 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
127 |
<header class="qsm-popup__header">
|
128 |
-
<h2 class="qsm-popup__title" id="modal-2-title"
|
129 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
130 |
</header>
|
131 |
<main class="qsm-popup__content" id="modal-2-content">
|
@@ -145,7 +147,7 @@ function qsm_options_questions_tab_content() {
|
|
145 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
146 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
147 |
<header class="qsm-popup__header">
|
148 |
-
<h2 class="qsm-popup__title" id="modal-1-title"
|
149 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
150 |
</header>
|
151 |
<main class="qsm-popup__content" id="modal-1-content">
|
@@ -154,12 +156,13 @@ function qsm_options_questions_tab_content() {
|
|
154 |
<div id="post-body" class="metabox-holder columns-2">
|
155 |
<div id="post-body-content" style="position: relative;">
|
156 |
<div class="qsm-row">
|
157 |
-
<input type="text" id="question_title" class="question-title" name="question-title" value="" placeholder="<?php _e('
|
158 |
</div>
|
159 |
-
<
|
160 |
-
|
|
|
161 |
</div>
|
162 |
-
<div class="qsm-row">
|
163 |
<?php
|
164 |
$description_arr = array(
|
165 |
array(
|
@@ -221,7 +224,7 @@ function qsm_options_questions_tab_content() {
|
|
221 |
$polar_question_use = ',13';
|
222 |
}
|
223 |
?>
|
224 |
-
<div id="qsm_optoins_wrapper" class="qsm-row qsm_hide_for_other qsm_show_question_type_0 qsm_show_question_type_1 qsm_show_question_type_2 qsm_show_question_type_4 qsm_show_question_type_10 qsm_show_question_type_14 <?php echo $polar_class; ?>">
|
225 |
<label class="answer-header">
|
226 |
<?php _e( 'Answers', 'quiz-master-next' ); ?>
|
227 |
<a class="qsm-question-doc" href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Answers" target="_blank" title="View Documentation">
|
@@ -242,9 +245,9 @@ function qsm_options_questions_tab_content() {
|
|
242 |
'label' => __( 'Correct Answer Info', 'quiz-master-next' ),
|
243 |
'type' => 'textarea',
|
244 |
'default' => '',
|
245 |
-
'show' => '0,1,2,4,10,14' . $polar_question_use,
|
246 |
'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Correct-Answer-Info'
|
247 |
-
)
|
248 |
);
|
249 |
$answer_area_option = apply_filters('qsm_question_advanced_option', $answer_area_option);
|
250 |
foreach($answer_area_option as $qo_key => $single_answer_option){
|
@@ -458,7 +461,7 @@ function qsm_options_questions_tab_content() {
|
|
458 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
459 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
460 |
<header class="qsm-popup__header">
|
461 |
-
<h2 class="qsm-popup__title" id="modal-1-title"
|
462 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
463 |
</header>
|
464 |
<main class="qsm-popup__content" id="modal-page-1-content">
|
@@ -495,8 +498,8 @@ function qsm_options_questions_tab_content() {
|
|
495 |
</div>
|
496 |
<div class="page-footer">
|
497 |
<div class="page-header-buttons">
|
498 |
-
<a href="#" class="new-question-button button"><span class="dashicons dashicons-plus"></span> Create New Question
|
499 |
-
<a href="#" class="add-question-bank-button button"><span class="dashicons dashicons-plus"></span> Add Question From Question Bank
|
500 |
</div>
|
501 |
</div>
|
502 |
</div>
|
@@ -511,7 +514,7 @@ function qsm_options_questions_tab_content() {
|
|
511 |
<div><a href="#" title="Clone Question" class="duplicate-question-button"><span class="dashicons dashicons-admin-page"></span></a></div>
|
512 |
<div><a href="#" title="Delete Question" class="delete-question-button"><span class="dashicons dashicons-trash"></span></a></div>
|
513 |
<div class="question-content-text">{{{data.question}}}</div>
|
514 |
-
<div class="question-category"><# if ( 0 !== data.category.length ) { #> Category: {{data.category}} <# } #></div>
|
515 |
</div>
|
516 |
</div>
|
517 |
</script>
|
@@ -524,7 +527,7 @@ function qsm_options_questions_tab_content() {
|
|
524 |
</div>
|
525 |
<div><p>{{{data.question}}}</p><p style="font-size: 12px;color: gray;font-style: italic;"><b>Quiz Name:</b> {{data.quiz_name}} <# if ( data.category != '' ) { #> <b>Category:</b> {{data.category}} <# } #></p>
|
526 |
</div>
|
527 |
-
<div><a href="#" class="import-button button"
|
528 |
</div>
|
529 |
</script>
|
530 |
|
@@ -551,7 +554,7 @@ function qsm_options_questions_tab_content() {
|
|
551 |
<div><input type="text" class="answer-points" value="{{data.points}}" placeholder="Points"/></div>
|
552 |
<# } #>
|
553 |
<# if ( 0 == data.quiz_system || 3 == data.quiz_system ) { #>
|
554 |
-
<div><label class="correct-answer"><input type="checkbox" class="answer-correct" value="1" <# if ( 1 == data.correct ) { #> checked="checked" <# } #>/> Correct
|
555 |
<# } #>
|
556 |
<# } #>
|
557 |
</div>
|
61 |
'saveNonce' => wp_create_nonce('ajax-nonce-sandy-page'),
|
62 |
'categories' => $question_categories,
|
63 |
'form_type' => $form_type,
|
64 |
+
'quiz_system' => $quiz_system,
|
65 |
+
'hide_desc_text' => __('Less Description', 'quiz-master-next'),
|
66 |
+
'show_desc_text' => __('Add Description', 'quiz-master-next'),
|
67 |
);
|
68 |
|
69 |
// Scripts and styles.
|
83 |
if ( 0 != $pagination ) {
|
84 |
?>
|
85 |
<div class="notice notice-warning">
|
86 |
+
<p><?php _e('This quiz has the "How many questions per page would you like?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.', 'quiz-master-next'); ?></p>
|
87 |
</div>
|
88 |
<?php
|
89 |
}
|
91 |
if ( 0 != $from_total ) {
|
92 |
?>
|
93 |
<div class="notice notice-warning">
|
94 |
+
<p><?php _e('This quiz has the "How many questions should be loaded for quiz?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.', 'quiz-master-next'); ?></p>
|
95 |
</div>
|
96 |
<?php
|
97 |
}
|
99 |
if ( 0 != $randomness ) {
|
100 |
?>
|
101 |
<div class="notice notice-warning">
|
102 |
+
<p><?php _e('This quiz has the "Are the questions random?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to "No".', 'quiz-master-next'); ?></p>
|
103 |
</div>
|
104 |
<?php
|
105 |
}
|
107 |
<h3 style="display: none;">Questions</h3>
|
108 |
<p style="text-align: right;"><a href="https://quizandsurveymaster.com/docs/v7/questions-tab/" target="_blank">View Documentation</a></p>
|
109 |
<div class="question-controls">
|
110 |
+
<span><b><?php _e('Total Questions:', 'quiz-master-next'); ?></b> <span id="total-questions"></span></span>
|
111 |
<p class="search-box">
|
112 |
<label class="screen-reader-text" for="question_search">Search Questions:</label>
|
113 |
<input type="search" id="question_search" name="question_search" value="">
|
114 |
+
<a href="#" class="button"><?php esc_html_e('Search Questions', 'quiz-master-next'); ?></a>
|
115 |
</p>
|
116 |
</div>
|
117 |
<div class="questions quiz_form_type_<?php echo $form_type; ?> quiz_quiz_systen_<?php echo $quiz_system; ?>"><div class="qsm-showing-loader" style="text-align: center;margin-bottom: 20px;"><div class="qsm-spinner-loader"></div></div></div>
|
127 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
128 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
129 |
<header class="qsm-popup__header">
|
130 |
+
<h2 class="qsm-popup__title" id="modal-2-title"><?php _e('Add Question From Question Bank', 'quiz-master-next'); ?></h2>
|
131 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
132 |
</header>
|
133 |
<main class="qsm-popup__content" id="modal-2-content">
|
147 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
148 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
149 |
<header class="qsm-popup__header">
|
150 |
+
<h2 class="qsm-popup__title" id="modal-1-title"><?php _e('Edit Question', 'quiz-master-next'); ?> [ ID: <span id="edit-question-id"></span> ]</h2>
|
151 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
152 |
</header>
|
153 |
<main class="qsm-popup__content" id="modal-1-content">
|
156 |
<div id="post-body" class="metabox-holder columns-2">
|
157 |
<div id="post-body-content" style="position: relative;">
|
158 |
<div class="qsm-row">
|
159 |
+
<input type="text" id="question_title" class="question-title" name="question-title" value="" placeholder="<?php _e('Type your question here','quiz-master-next'); ?>">
|
160 |
</div>
|
161 |
+
<a href="#" class="qsm-show-question-desc-box button button-default"><span class="dashicons dashicons-plus-alt2"></span> <?php _e('Add Description', 'quiz-master-next'); ?></a>
|
162 |
+
<div class="qsm-row" style="display: none;">
|
163 |
+
<textarea placeholder="<?php _e('Add your description here', 'quiz-master-next'); ?>" id="question-text"></textarea>
|
164 |
</div>
|
165 |
+
<div class="qsm-row" style="margin-bottom: 0;">
|
166 |
<?php
|
167 |
$description_arr = array(
|
168 |
array(
|
224 |
$polar_question_use = ',13';
|
225 |
}
|
226 |
?>
|
227 |
+
<div id="qsm_optoins_wrapper" class="qsm-row qsm_hide_for_other qsm_show_question_type_0 qsm_show_question_type_1 qsm_show_question_type_2 qsm_show_question_type_3 qsm_show_question_type_4 qsm_show_question_type_5 qsm_show_question_type_7 qsm_show_question_type_10 qsm_show_question_type_12 qsm_show_question_type_14 <?php echo $polar_class; ?>">
|
228 |
<label class="answer-header">
|
229 |
<?php _e( 'Answers', 'quiz-master-next' ); ?>
|
230 |
<a class="qsm-question-doc" href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Answers" target="_blank" title="View Documentation">
|
245 |
'label' => __( 'Correct Answer Info', 'quiz-master-next' ),
|
246 |
'type' => 'textarea',
|
247 |
'default' => '',
|
248 |
+
'show' => '0,1,2,3,4,5,7,10,12,14' . $polar_question_use,
|
249 |
'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Correct-Answer-Info'
|
250 |
+
)
|
251 |
);
|
252 |
$answer_area_option = apply_filters('qsm_question_advanced_option', $answer_area_option);
|
253 |
foreach($answer_area_option as $qo_key => $single_answer_option){
|
461 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
462 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
463 |
<header class="qsm-popup__header">
|
464 |
+
<h2 class="qsm-popup__title" id="modal-1-title"><?php _e('Edit Page', 'quiz-master-next'); ?> <span style="display: none;">[ ID: <span id="edit-page-id"></span> ]</span></h2>
|
465 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
466 |
</header>
|
467 |
<main class="qsm-popup__content" id="modal-page-1-content">
|
498 |
</div>
|
499 |
<div class="page-footer">
|
500 |
<div class="page-header-buttons">
|
501 |
+
<a href="#" class="new-question-button button"><span class="dashicons dashicons-plus"></span> <?php _e('Create New Question', 'quiz-master-next'); ?></a>
|
502 |
+
<a href="#" class="add-question-bank-button button"><span class="dashicons dashicons-plus"></span> <?php _e('Add Question From Question Bank', 'quiz-master-next'); ?></a>
|
503 |
</div>
|
504 |
</div>
|
505 |
</div>
|
514 |
<div><a href="#" title="Clone Question" class="duplicate-question-button"><span class="dashicons dashicons-admin-page"></span></a></div>
|
515 |
<div><a href="#" title="Delete Question" class="delete-question-button"><span class="dashicons dashicons-trash"></span></a></div>
|
516 |
<div class="question-content-text">{{{data.question}}}</div>
|
517 |
+
<div class="question-category"><# if ( 0 !== data.category.length ) { #> <?php _e('Category:', 'quiz-master-next'); ?> {{data.category}} <# } #></div>
|
518 |
</div>
|
519 |
</div>
|
520 |
</script>
|
527 |
</div>
|
528 |
<div><p>{{{data.question}}}</p><p style="font-size: 12px;color: gray;font-style: italic;"><b>Quiz Name:</b> {{data.quiz_name}} <# if ( data.category != '' ) { #> <b>Category:</b> {{data.category}} <# } #></p>
|
529 |
</div>
|
530 |
+
<div><a href="#" class="import-button button"><?php _e('Add Question', 'quiz-master-next'); ?></a></div>
|
531 |
</div>
|
532 |
</script>
|
533 |
|
554 |
<div><input type="text" class="answer-points" value="{{data.points}}" placeholder="Points"/></div>
|
555 |
<# } #>
|
556 |
<# if ( 0 == data.quiz_system || 3 == data.quiz_system ) { #>
|
557 |
+
<div><label class="correct-answer"><input type="checkbox" class="answer-correct" value="1" <# if ( 1 == data.correct ) { #> checked="checked" <# } #>/> <?php _e('Correct', 'quiz-master-next'); ?></label></div>
|
558 |
<# } #>
|
559 |
<# } #>
|
560 |
</div>
|
@@ -64,8 +64,8 @@ function qsm_options_results_tab_content() {
|
|
64 |
<main class="results-page-content">
|
65 |
<div class="results-page-when">
|
66 |
<div class="results-page-content-header">
|
67 |
-
|
68 |
-
|
69 |
</div>
|
70 |
<div class="results-page-when-conditions">
|
71 |
<!-- Conditions go here. Review template below. -->
|
@@ -74,11 +74,11 @@ function qsm_options_results_tab_content() {
|
|
74 |
</div>
|
75 |
<div class="results-page-show">
|
76 |
<div class="results-page-content-header">
|
77 |
-
<h4
|
78 |
-
<p
|
79 |
</div>
|
80 |
<textarea id="results-page-{{ data.id }}" class="results-page-template">{{{ data.page }}}</textarea>
|
81 |
-
<p
|
82 |
<input type="text" class="results-page-redirect" value="<# if ( data.redirect ) { #>{{ data.redirect }}<# } #>">
|
83 |
</div>
|
84 |
</main>
|
@@ -89,17 +89,17 @@ function qsm_options_results_tab_content() {
|
|
89 |
<div class="results-page-condition">
|
90 |
<button class="delete-condition-button"><span class="dashicons dashicons-trash"></span></button>
|
91 |
<select class="results-page-condition-criteria">
|
92 |
-
<option value="points" <# if (data.criteria == 'points') { #>selected<# }
|
93 |
-
<option value="score" <# if (data.criteria == 'score') { #>selected<# }
|
94 |
<?php do_action( 'qsm_results_page_condition_criteria' ); ?>
|
95 |
</select>
|
96 |
<select class="results-page-condition-operator">
|
97 |
-
<option value="equal" <# if (data.operator == 'equal') { #>selected<# }
|
98 |
-
<option value="not-equal" <# if (data.operator == 'not-equal') { #>selected<# }
|
99 |
-
<option value="greater-equal" <# if (data.operator == 'greater-equal') { #>selected<# }
|
100 |
-
<option value="greater" <# if (data.operator == 'greater') { #>selected<# }
|
101 |
-
<option value="less-equal" <# if (data.operator == 'less-equal') { #>selected<# }
|
102 |
-
<option value="less" <# if (data.operator == 'less') { #>selected<# }
|
103 |
<?php do_action( 'qsm_results_page_condition_operator' ); ?>
|
104 |
</select>
|
105 |
<input type="text" class="results-page-condition-value" value="{{ data.value }}">
|
@@ -111,7 +111,7 @@ function qsm_options_results_tab_content() {
|
|
111 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-3-title">
|
112 |
<header class="qsm-popup__header" style="display: block;">
|
113 |
<h2 class="qsm-popup__title"><?php _e('Template Variables', 'quiz-master-next'); ?></h2>
|
114 |
-
<span class="description"><?php _e('Use these dynamic variables to customize your quiz or survey. Just copy and paste one or more variables into the content templates and these will be replaced by actual values when user takes a quiz.', 'quiz-master-next'); ?></span>
|
115 |
</header>
|
116 |
<main class="qsm-popup__content" id="show-all-variable-content">
|
117 |
<?php
|
64 |
<main class="results-page-content">
|
65 |
<div class="results-page-when">
|
66 |
<div class="results-page-content-header">
|
67 |
+
<h4><?php esc_html_e('When...', 'quiz-master-next'); ?></h4>
|
68 |
+
<p><?php esc_html_e('Set conditions for when this page should be shown. Leave empty to set this as the default page.', 'quiz-master-next'); ?></p>
|
69 |
</div>
|
70 |
<div class="results-page-when-conditions">
|
71 |
<!-- Conditions go here. Review template below. -->
|
74 |
</div>
|
75 |
<div class="results-page-show">
|
76 |
<div class="results-page-content-header">
|
77 |
+
<h4><?php esc_html_e('...Show', 'quiz-master-next'); ?></h4>
|
78 |
+
<p><?php esc_html_e('Create the results page that should be shown when the conditions are met.', 'quiz-master-next'); ?></p>
|
79 |
</div>
|
80 |
<textarea id="results-page-{{ data.id }}" class="results-page-template">{{{ data.page }}}</textarea>
|
81 |
+
<p><?php esc_html_e('Or, redirect the user by entering the URL below:', 'quiz-master-next'); ?></p>
|
82 |
<input type="text" class="results-page-redirect" value="<# if ( data.redirect ) { #>{{ data.redirect }}<# } #>">
|
83 |
</div>
|
84 |
</main>
|
89 |
<div class="results-page-condition">
|
90 |
<button class="delete-condition-button"><span class="dashicons dashicons-trash"></span></button>
|
91 |
<select class="results-page-condition-criteria">
|
92 |
+
<option value="points" <# if (data.criteria == 'points') { #>selected<# } #>><?php _e('Total points earned', 'quiz-master-next'); ?></option>
|
93 |
+
<option value="score" <# if (data.criteria == 'score') { #>selected<# } #>><?php _e('Correct score percentage', 'quiz-master-next'); ?></option>
|
94 |
<?php do_action( 'qsm_results_page_condition_criteria' ); ?>
|
95 |
</select>
|
96 |
<select class="results-page-condition-operator">
|
97 |
+
<option value="equal" <# if (data.operator == 'equal') { #>selected<# } #>><?php _e('is equal to', 'quiz-master-next'); ?></option>
|
98 |
+
<option value="not-equal" <# if (data.operator == 'not-equal') { #>selected<# } #>><?php _e('is not equal to', 'quiz-master-next'); ?></option>
|
99 |
+
<option value="greater-equal" <# if (data.operator == 'greater-equal') { #>selected<# } #>><?php _e('is greater than or equal to', 'quiz-master-next'); ?></option>
|
100 |
+
<option value="greater" <# if (data.operator == 'greater') { #>selected<# } #>><?php _e('is greater than', 'quiz-master-next'); ?></option>
|
101 |
+
<option value="less-equal" <# if (data.operator == 'less-equal') { #>selected<# } #>><?php _e('is less than or equal to', 'quiz-master-next'); ?></option>
|
102 |
+
<option value="less" <# if (data.operator == 'less') { #>selected<# } #>><?php _e('is less than', 'quiz-master-next'); ?></option>
|
103 |
<?php do_action( 'qsm_results_page_condition_operator' ); ?>
|
104 |
</select>
|
105 |
<input type="text" class="results-page-condition-value" value="{{ data.value }}">
|
111 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-3-title">
|
112 |
<header class="qsm-popup__header" style="display: block;">
|
113 |
<h2 class="qsm-popup__title"><?php _e('Template Variables', 'quiz-master-next'); ?></h2>
|
114 |
+
<span class="description"><?php _e('Use these dynamic variables to customize your quiz or survey. Just copy and paste one or more variables into the content templates and these will be replaced by actual values when user takes a quiz. <br/><b>Note:</b> Always use uppercase while using these variables.', 'quiz-master-next'); ?></span>
|
115 |
</header>
|
116 |
<main class="qsm-popup__content" id="show-all-variable-content">
|
117 |
<?php
|
@@ -155,7 +155,7 @@ function qsm_get_question_text_message(){
|
|
155 |
global $mlwQuizMasterNext;
|
156 |
$text_id = isset( $_POST['text_id'] ) ? sanitize_text_field( $_POST['text_id'] ) : '';
|
157 |
if( $text_id == '' ){
|
158 |
-
echo json_encode( array( 'success'=> false, 'message' => 'Text id is missing.') );
|
159 |
exit;
|
160 |
} else {
|
161 |
$settings = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', $text_id );
|
155 |
global $mlwQuizMasterNext;
|
156 |
$text_id = isset( $_POST['text_id'] ) ? sanitize_text_field( $_POST['text_id'] ) : '';
|
157 |
if( $text_id == '' ){
|
158 |
+
echo json_encode( array( 'success'=> false, 'message' => __('Text id is missing.', 'quiz-master-next')) );
|
159 |
exit;
|
160 |
} else {
|
161 |
$settings = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', $text_id );
|
@@ -229,7 +229,7 @@ function qsm_generate_quizzes_surveys_page() {
|
|
229 |
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
230 |
?>
|
231 |
<div class="qsm-info-box">
|
232 |
-
<p
|
233 |
</div>
|
234 |
<?php
|
235 |
}
|
@@ -460,7 +460,7 @@ function qsm_generate_quizzes_surveys_page() {
|
|
460 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
461 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
462 |
<header class="qsm-popup__header">
|
463 |
-
<h2 class="qsm-popup__title" id="modal-1-title"
|
464 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
465 |
</header>
|
466 |
<main class="qsm-popup__content" id="modal-1-content">
|
229 |
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
230 |
?>
|
231 |
<div class="qsm-info-box">
|
232 |
+
<p><?php esc_html_e('Your site is using PHP version', 'quiz-master-next'); ?> <?php echo esc_html(PHP_VERSION); ?>! <?php esc_html_e('Starting in QSM 6.0, your version of PHP will no longer be supported.', 'quiz-master-next'); ?> <a href="http://bit.ly/2lyrrm8" target="_blank"><?php esc_html_e("Click here to learn more about QSM's minimum PHP version change.", 'quiz-master-next'); ?></a></p>
|
233 |
</div>
|
234 |
<?php
|
235 |
}
|
460 |
<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
|
461 |
<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
|
462 |
<header class="qsm-popup__header">
|
463 |
+
<h2 class="qsm-popup__title" id="modal-1-title"><?php _e('Reset stats for this quiz?', 'quiz-master-next'); ?></h2>
|
464 |
<a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
|
465 |
</header>
|
466 |
<main class="qsm-popup__content" id="modal-1-content">
|
@@ -52,6 +52,7 @@ class QMNGlobalSettingsPage {
|
|
52 |
add_settings_field( 'facebook-app-id', __( 'Facebook App Id', 'quiz-master-next' ), array( $this, 'facebook_app_id' ), 'qmn_global_settings', 'qmn-global-section' );
|
53 |
add_settings_field( 'from-name', __( 'From Name (The name emails come from)', 'quiz-master-next' ), array( $this, 'from_name' ), 'qmn_global_settings', 'qmn-global-section' );
|
54 |
add_settings_field( 'from-email', __( 'From Email (The email address that emails come from)', 'quiz-master-next' ), array( $this, 'from_email' ), 'qmn_global_settings', 'qmn-global-section' );
|
|
|
55 |
add_settings_field( 'new-template-result-detail', __( 'New Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'new_template_results_details' ), 'qmn_global_settings', 'qmn-global-section' );
|
56 |
add_settings_field( 'results-details', __( 'Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'results_details_template' ), 'qmn_global_settings', 'qmn-global-section' );
|
57 |
}
|
@@ -90,6 +91,23 @@ class QMNGlobalSettingsPage {
|
|
90 |
<input type='email' name='qmn-settings[from_email]' id='qmn-settings[from_email]' value='<?php echo esc_attr( $from_email ); ?>' />
|
91 |
<?php
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
/**
|
95 |
* Generates Setting Field For From Name
|
52 |
add_settings_field( 'facebook-app-id', __( 'Facebook App Id', 'quiz-master-next' ), array( $this, 'facebook_app_id' ), 'qmn_global_settings', 'qmn-global-section' );
|
53 |
add_settings_field( 'from-name', __( 'From Name (The name emails come from)', 'quiz-master-next' ), array( $this, 'from_name' ), 'qmn_global_settings', 'qmn-global-section' );
|
54 |
add_settings_field( 'from-email', __( 'From Email (The email address that emails come from)', 'quiz-master-next' ), array( $this, 'from_email' ), 'qmn_global_settings', 'qmn-global-section' );
|
55 |
+
add_settings_field( 'items-per-page-question-bank', __( 'Items per page in question bank pagination', 'quiz-master-next' ), array( $this, 'items_per_page_question_bank' ), 'qmn_global_settings', 'qmn-global-section' );
|
56 |
add_settings_field( 'new-template-result-detail', __( 'New Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'new_template_results_details' ), 'qmn_global_settings', 'qmn-global-section' );
|
57 |
add_settings_field( 'results-details', __( 'Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'results_details_template' ), 'qmn_global_settings', 'qmn-global-section' );
|
58 |
}
|
91 |
<input type='email' name='qmn-settings[from_email]' id='qmn-settings[from_email]' value='<?php echo esc_attr( $from_email ); ?>' />
|
92 |
<?php
|
93 |
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Generates Setting Field For items per page in question bank pagination
|
97 |
+
*
|
98 |
+
* @since 7.0.1
|
99 |
+
* @return void
|
100 |
+
*/
|
101 |
+
public function items_per_page_question_bank() {
|
102 |
+
$settings = (array) get_option( 'qmn-settings' );
|
103 |
+
$items_per_page_question_bank = 20;
|
104 |
+
if ( isset( $settings['items_per_page_question_bank'] ) ) {
|
105 |
+
$items_per_page_question_bank = $settings['items_per_page_question_bank'];
|
106 |
+
}
|
107 |
+
?>
|
108 |
+
<input type='number' name='qmn-settings[items_per_page_question_bank]' id='qmn-settings[items_per_page_question_bank]' value='<?php echo esc_attr( $items_per_page_question_bank ); ?>' />
|
109 |
+
<?php
|
110 |
+
}
|
111 |
|
112 |
/**
|
113 |
* Generates Setting Field For From Name
|
@@ -108,12 +108,12 @@ function qmn_stats_overview_content()
|
|
108 |
<div class="postbox">
|
109 |
<form action="" method="post">
|
110 |
<select name="range">
|
111 |
-
<option value="daily" <?php if ( $range == "daily" ) { echo 'selected="selected"'; }
|
112 |
-
<option value="weekly" <?php if ( $range == "weekly" ) { echo 'selected="selected"'; }
|
113 |
-
<option value="monthly" <?php if ( $range == "monthly" ) { echo 'selected="selected"'; }
|
114 |
<?php do_action('qmn_quiz_taken_stats_options'); ?>
|
115 |
</select>
|
116 |
-
<button type="submit" class="button"
|
117 |
</form>
|
118 |
<div>
|
119 |
<canvas id="graph_canvas"></canvas>
|
108 |
<div class="postbox">
|
109 |
<form action="" method="post">
|
110 |
<select name="range">
|
111 |
+
<option value="daily" <?php if ( $range == "daily" ) { echo 'selected="selected"'; } ?>><?php _e('Daily', 'quiz-master-next'); ?></option>
|
112 |
+
<option value="weekly" <?php if ( $range == "weekly" ) { echo 'selected="selected"'; } ?>><?php _e('Weekly', 'quiz-master-next'); ?></option>
|
113 |
+
<option value="monthly" <?php if ( $range == "monthly" ) { echo 'selected="selected"'; } ?>><?php _e('Monthly', 'quiz-master-next'); ?></option>
|
114 |
<?php do_action('qmn_quiz_taken_stats_options'); ?>
|
115 |
</select>
|
116 |
+
<button type="submit" class="button"><?php _e('Filter', 'quiz-master-next'); ?></button>
|
117 |
</form>
|
118 |
<div>
|
119 |
<canvas id="graph_canvas"></canvas>
|
@@ -138,7 +138,7 @@ function qsm_audit_box() {
|
|
138 |
$audit_trails = $wpdb->get_results( $wpdb->prepare( "SELECT trail_id, action_user, action, time
|
139 |
FROM {$wpdb->prefix}mlw_qm_audit_trail ORDER BY trail_id DESC LIMIT %d, %d", $begin, $table_limit ) );
|
140 |
?>
|
141 |
-
|
142 |
<?php
|
143 |
|
144 |
// Determine which navigation to show.
|
138 |
$audit_trails = $wpdb->get_results( $wpdb->prepare( "SELECT trail_id, action_user, action, time
|
139 |
FROM {$wpdb->prefix}mlw_qm_audit_trail ORDER BY trail_id DESC LIMIT %d, %d", $begin, $table_limit ) );
|
140 |
?>
|
141 |
+
<p><?php esc_html_e('Total actions since QSM installed:', 'quiz-master-next'); ?> <?php echo esc_html( $audit_total ); ?></p>
|
142 |
<?php
|
143 |
|
144 |
// Determine which navigation to show.
|
@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {
|
|
14 |
* @since 4.0.0
|
15 |
*/
|
16 |
class QMNQuizManager {
|
17 |
-
|
18 |
protected $qsm_background_email;
|
19 |
/**
|
20 |
* Main Construct Function
|
@@ -49,15 +49,15 @@ class QMNQuizManager {
|
|
49 |
add_action('wp_ajax_nopriv_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
|
50 |
//Upload file of file upload question type
|
51 |
add_action('wp_ajax_qsm_upload_image_fd_question', array($this, 'qsm_upload_image_fd_question'));
|
52 |
-
add_action('wp_ajax_nopriv_qsm_upload_image_fd_question', array($this, 'qsm_upload_image_fd_question'));
|
53 |
-
|
54 |
//remove file of file upload question type
|
55 |
add_action('wp_ajax_qsm_remove_file_fd_question', array($this, 'qsm_remove_file_fd_question'));
|
56 |
-
add_action('wp_ajax_nopriv_qsm_remove_file_fd_question', array($this, 'qsm_remove_file_fd_question'));
|
57 |
-
|
58 |
add_action('init', array($this, 'qsm_process_background_email'));
|
59 |
}
|
60 |
-
|
61 |
/**
|
62 |
* @version 6.3.7
|
63 |
* Upload file to server
|
@@ -86,23 +86,25 @@ class QMNQuizManager {
|
|
86 |
$mimes[] = $value;
|
87 |
}
|
88 |
}
|
89 |
-
}
|
90 |
$json = array();
|
91 |
-
|
|
|
92 |
if($_FILES["file"]['size'] >= $file_upload_limit * 1024 * 1024){
|
93 |
$json['type']= 'error';
|
94 |
-
$json['message'] = 'File is too large. File must be less than ' . $file_upload_limit . ' MB';
|
95 |
echo json_encode($json);
|
96 |
exit;
|
97 |
}
|
98 |
-
$upload_dir = wp_upload_dir();
|
99 |
$datafile = $_FILES["file"]["tmp_name"];
|
100 |
$file_name = $_FILES["file"]["name"];
|
101 |
-
$file = $upload_dir['path'] . '/' . $_FILES['file']['name'];
|
102 |
-
$file_url = $upload_dir['url'] . '/' . $_FILES['file']['name'];
|
103 |
-
$counter = 1;
|
104 |
-
$rawBaseName = pathinfo($file_name, PATHINFO_FILENAME);
|
105 |
$extension = pathinfo($file_name, PATHINFO_EXTENSION);
|
|
|
|
|
|
|
|
|
|
|
106 |
if(file_exists($file)){
|
107 |
while (file_exists($file)) {
|
108 |
$new_fname = $rawBaseName . '-' . $counter . '.' . $extension;
|
@@ -111,40 +113,42 @@ class QMNQuizManager {
|
|
111 |
$counter++;
|
112 |
}
|
113 |
}
|
114 |
-
if (!move_uploaded_file($datafile, $file)) {
|
115 |
$json['type']= 'error';
|
116 |
-
$json['message'] = 'File not uploaded';
|
117 |
echo json_encode($json);
|
118 |
}else{
|
119 |
$json['type']= 'success';
|
120 |
-
$json['message'] = 'File uploaded successfully';
|
121 |
$json['file_url'] = $file_url;
|
122 |
-
$json['file_path'] = $
|
123 |
echo json_encode($json);
|
124 |
}
|
125 |
}else{
|
126 |
$json['type']= 'error';
|
127 |
-
$json['message'] = 'File type is not supported';
|
128 |
echo json_encode($json);
|
129 |
}
|
130 |
exit;
|
131 |
}
|
132 |
-
|
133 |
/**
|
134 |
* @since 6.3.7
|
135 |
* Remove the uploaded image
|
136 |
*/
|
137 |
public function qsm_remove_file_fd_question(){
|
138 |
-
$file_url = isset($_POST['file_url']) ? sanitize_text_field($_POST['file_url']) : '';
|
139 |
-
|
140 |
-
|
|
|
|
|
141 |
$json['type']= 'success';
|
142 |
-
$json['message'] = 'File removed successfully';
|
143 |
echo json_encode($json);
|
144 |
exit;
|
145 |
}
|
146 |
$json['type']= 'error';
|
147 |
-
$json['message'] = 'File not removed';
|
148 |
echo json_encode($json);
|
149 |
exit;
|
150 |
}
|
@@ -195,15 +199,15 @@ class QMNQuizManager {
|
|
195 |
ob_start();
|
196 |
if(isset($_GET['result_id']) && $_GET['result_id'] != ''){
|
197 |
global $wpdb;
|
198 |
-
$result_unique_id = $_GET['result_id'];
|
199 |
$query = $wpdb->prepare("SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE unique_id = %s",$result_unique_id);
|
200 |
-
$result = $wpdb->get_row($query,ARRAY_A);
|
201 |
if( !empty($result) && isset($result['result_id']) ){
|
202 |
$result_id = $result['result_id'];
|
203 |
$return_display = do_shortcode( '[qsm_result id="'. $result_id .'"]' );
|
204 |
}else{
|
205 |
$return_display = 'Result id is wrong!';
|
206 |
-
}
|
207 |
$return_display .= ob_get_clean();
|
208 |
}else{
|
209 |
global $wpdb;
|
@@ -233,7 +237,7 @@ class QMNQuizManager {
|
|
233 |
// Loads Quiz Template.
|
234 |
// The quiz_stye is misspelled because it has always been misspelled and fixing it would break many sites :(.
|
235 |
if ('default' == $qmn_quiz_options->theme_selected) {
|
236 |
-
$return_display .= '<style type="text/css">' . htmlspecialchars_decode($qmn_quiz_options->quiz_stye) . '</style>';
|
237 |
wp_enqueue_style('qmn_quiz_style', plugins_url('../../css/qmn_quiz.css', __FILE__));
|
238 |
} else {
|
239 |
$registered_template = $mlwQuizMasterNext->pluginHelper->get_quiz_templates($qmn_quiz_options->theme_selected);
|
@@ -282,6 +286,7 @@ class QMNQuizManager {
|
|
282 |
'progress_bar' => $qmn_quiz_options->progress_bar,
|
283 |
'contact_info_location' => $qmn_quiz_options->contact_info_location,
|
284 |
'qpages' => $qpages,
|
|
|
285 |
);
|
286 |
|
287 |
$return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
@@ -301,18 +306,18 @@ class QMNQuizManager {
|
|
301 |
|
302 |
$return_display .= ob_get_clean();
|
303 |
$return_display = apply_filters('qmn_end_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
304 |
-
}
|
305 |
return $return_display;
|
306 |
}
|
307 |
-
|
308 |
public function shortcode_display_result($atts){
|
309 |
extract(shortcode_atts(array(
|
310 |
-
'id' => 0,
|
311 |
), $atts));
|
312 |
ob_start();
|
313 |
if($id == 0){
|
314 |
$id = isset($_GET['result_id']) ? $_GET['result_id'] : 0;
|
315 |
-
}
|
316 |
global $wpdb;
|
317 |
$result_data = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = {$id}", ARRAY_A);
|
318 |
$quiz_result = unserialize($result_data['quiz_results']);
|
@@ -369,7 +374,7 @@ class QMNQuizManager {
|
|
369 |
$cat_query = '';
|
370 |
if (1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order) {
|
371 |
$order_by_sql = 'ORDER BY rand()';
|
372 |
-
$categories = isset($quiz_options->randon_category) ? $quiz_options->randon_category : '';
|
373 |
if($categories){
|
374 |
$exploded_arr = explode(',', $quiz_options->randon_category);
|
375 |
$cat_str = "'" . implode ( "', '", $exploded_arr ) . "'";
|
@@ -479,7 +484,7 @@ class QMNQuizManager {
|
|
479 |
* @return string The content for the quiz page section
|
480 |
*/
|
481 |
public function display_quiz($options, $quiz_data, $question_amount) {
|
482 |
-
|
483 |
global $qmn_allowed_visit;
|
484 |
global $mlwQuizMasterNext;
|
485 |
$quiz_display = '';
|
@@ -500,17 +505,17 @@ class QMNQuizManager {
|
|
500 |
'incorrect' => $options->incorrect_error_text,
|
501 |
'empty' => $options->empty_error_text,
|
502 |
);
|
503 |
-
|
504 |
wp_enqueue_script('progress-bar', plugins_url('../../js/progressbar.min.js', __FILE__));
|
505 |
wp_enqueue_script( 'jquery-ui-slider-js', plugins_url('../../js/jquery-ui.js', __FILE__));
|
506 |
wp_enqueue_script( 'jquery-ui-slider-rtl-js', plugins_url('../../js/jquery.ui.slider-rtl.js', __FILE__) );
|
507 |
wp_enqueue_style( 'jquery-ui-slider-rtl-css', plugins_url('../../css/jquery.ui.slider-rtl.css', __FILE__) );
|
508 |
-
wp_enqueue_script( 'jqueryui-touch-js', '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' );
|
509 |
wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
|
510 |
wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
|
511 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
512 |
wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'enable_quick_result_mc' => isset($options->enable_quick_result_mc) ? $options->enable_quick_result_mc : '','enable_result_after_timer_end' => isset($options->enable_result_after_timer_end) ? $options->enable_result_after_timer_end : '', 'quick_result_correct_text' => sprintf('<b>%s</b> %s', __( 'Correct!', 'quiz-master-next' ), __('You have selected correct answer.', 'quiz-master-next')), 'quick_result_wrong_text' => sprintf('<b>%s</b> %s', __( 'Wrong!', 'quiz-master-next' ), __('You have selected wrong answer.', 'quiz-master-next')) ));
|
513 |
-
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
514 |
global $qmn_total_questions;
|
515 |
$qmn_total_questions = 0;
|
516 |
global $mlw_qmn_section_count;
|
@@ -530,10 +535,10 @@ class QMNQuizManager {
|
|
530 |
),
|
531 |
);
|
532 |
$the_query = new WP_Query($args);
|
533 |
-
|
534 |
// The Loop
|
535 |
-
if ($the_query->have_posts()) {
|
536 |
-
while ($the_query->have_posts()) {
|
537 |
$the_query->the_post();
|
538 |
$quiz_display .= get_the_post_thumbnail(get_the_ID(),'full');
|
539 |
}
|
@@ -542,6 +547,7 @@ class QMNQuizManager {
|
|
542 |
}
|
543 |
$quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
|
544 |
$quiz_display .= "<form name='quizForm{$quiz_data['quiz_id']}' id='quizForm{$quiz_data['quiz_id']}' action='' method='POST' class='qsm-quiz-form qmn_quiz_form mlw_quiz_form' novalidate enctype='multipart/form-data'>";
|
|
|
545 |
$quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
|
546 |
$quiz_display .= "<span id='mlw_top_of_quiz'></span>";
|
547 |
$quiz_display = apply_filters('qmn_begin_quiz_form', $quiz_display, $options, $quiz_data);
|
@@ -591,7 +597,7 @@ class QMNQuizManager {
|
|
591 |
public function display_pages($options, $quiz_data) {
|
592 |
global $mlwQuizMasterNext;
|
593 |
global $qmn_json_data;
|
594 |
-
ob_start();
|
595 |
$pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('pages', array());
|
596 |
$qpages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('qpages', array());
|
597 |
$questions = QSM_Questions::load_questions_by_pages($options->quiz_id);
|
@@ -602,7 +608,7 @@ class QMNQuizManager {
|
|
602 |
if (count($pages) > 1 && (!empty($options->message_before) || ( 0 == $options->contact_info_location && $contact_fields ) )) {
|
603 |
$qmn_json_data['first_page'] = true;
|
604 |
$message_before = wpautop(htmlspecialchars_decode($options->message_before, ENT_QUOTES));
|
605 |
-
$message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $quiz_data);
|
606 |
?>
|
607 |
<section class="qsm-page <?php echo $animation_effect; ?>">
|
608 |
<div class="quiz_section quiz_begin">
|
@@ -618,7 +624,7 @@ class QMNQuizManager {
|
|
618 |
}
|
619 |
|
620 |
// If there is only one page.
|
621 |
-
if (1 == count($pages)) {
|
622 |
?>
|
623 |
<section class="qsm-page <?php echo $animation_effect; ?>">
|
624 |
<?php
|
@@ -636,7 +642,7 @@ class QMNQuizManager {
|
|
636 |
?>
|
637 |
</div>
|
638 |
<?php
|
639 |
-
}
|
640 |
foreach ($pages[0] as $question_id) {
|
641 |
$question_list .= $question_id . 'Q';
|
642 |
$question = $questions[$question_id];
|
@@ -717,9 +723,9 @@ class QMNQuizManager {
|
|
717 |
?>
|
718 |
</div>
|
719 |
<?php
|
720 |
-
}
|
721 |
if($enable_pagination_quiz){
|
722 |
-
?>
|
723 |
<span class="pages_count">
|
724 |
<?php
|
725 |
$text_c = $pages_count . ' out of ' .$total_pages_count;
|
@@ -841,8 +847,8 @@ class QMNQuizManager {
|
|
841 |
$enable_pagination_quiz = isset($qmn_quiz_options->enable_pagination_quiz) && $qmn_quiz_options->enable_pagination_quiz ? $qmn_quiz_options->enable_pagination_quiz : 0;
|
842 |
$pagination_optoin = $qmn_quiz_options->pagination;
|
843 |
if($enable_pagination_quiz && $pagination_optoin){
|
844 |
-
$total_pages_count = count($qmn_quiz_questions);
|
845 |
-
$total_pagination = ceil($total_pages_count / $pagination_optoin);
|
846 |
}
|
847 |
$pages_count = 1;
|
848 |
foreach ($qmn_quiz_questions as $mlw_question) {
|
@@ -865,7 +871,7 @@ class QMNQuizManager {
|
|
865 |
if (!empty($mlw_question->hints)) {
|
866 |
$question_display .= "<div title=\"" . esc_attr(htmlspecialchars_decode($mlw_question->hints, ENT_QUOTES)) . "\" class='qsm_hint mlw_qmn_hint_link'>{$qmn_quiz_options->hint_text}</div>";
|
867 |
$question_display .= "<br /><br />";
|
868 |
-
}
|
869 |
$question_display .= "</div>";
|
870 |
$pages_count++;
|
871 |
}
|
@@ -970,7 +976,7 @@ class QMNQuizManager {
|
|
970 |
public function ajax_submit_results() {
|
971 |
global $qmn_allowed_visit;
|
972 |
global $mlwQuizMasterNext;
|
973 |
-
|
974 |
$qmn_allowed_visit = true;
|
975 |
$quiz = intval($_POST["qmn_quiz_id"]);
|
976 |
$mlwQuizMasterNext->pluginHelper->prepare_quiz($quiz);
|
@@ -983,7 +989,7 @@ class QMNQuizManager {
|
|
983 |
);
|
984 |
$post_data = array(
|
985 |
'g-recaptcha-response' => isset($_POST['g-recaptcha-response']) ? sanitize_textarea_field($_POST['g-recaptcha-response']) : ''
|
986 |
-
);
|
987 |
if(class_exists('QSM_Recaptcha')){
|
988 |
$recaptcha_data = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( "recaptcha_integration_settings" );
|
989 |
if(isset($recaptcha_data['enable_recaptcha']) && $recaptcha_data['enable_recaptcha'] != 'no'){
|
@@ -995,12 +1001,12 @@ class QMNQuizManager {
|
|
995 |
));
|
996 |
exit;
|
997 |
}
|
998 |
-
}
|
999 |
-
}
|
1000 |
echo json_encode($this->submit_results($options, $data));
|
1001 |
die();
|
1002 |
}
|
1003 |
-
|
1004 |
/**
|
1005 |
* @version 6.3.2
|
1006 |
* Show quiz on button click
|
@@ -1030,7 +1036,7 @@ class QMNQuizManager {
|
|
1030 |
public function submit_results($qmn_quiz_options, $qmn_array_for_variables) {
|
1031 |
global $qmn_allowed_visit;
|
1032 |
$result_display = '';
|
1033 |
-
|
1034 |
$qmn_array_for_variables['user_ip'] = $this->get_user_ip();
|
1035 |
|
1036 |
$result_display = apply_filters('qmn_begin_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
|
@@ -1070,6 +1076,7 @@ class QMNQuizManager {
|
|
1070 |
$qmn_array_for_variables['timer_ms'] = $mlw_qmn_timer_ms;
|
1071 |
$qmn_array_for_variables['time_taken'] = current_time('h:i:s A m/d/Y');
|
1072 |
$qmn_array_for_variables['contact'] = $contact_responses;
|
|
|
1073 |
|
1074 |
if (!isset($_POST["mlw_code_captcha"]) || ( isset($_POST["mlw_code_captcha"]) && $_POST["mlw_user_captcha"] == $_POST["mlw_code_captcha"] )) {
|
1075 |
|
@@ -1093,6 +1100,9 @@ class QMNQuizManager {
|
|
1093 |
'pagetime' => $mlw_qmn_pagetime,
|
1094 |
);
|
1095 |
$results_array = apply_filters('qsm_results_array', $results_array, $qmn_array_for_variables);
|
|
|
|
|
|
|
1096 |
$serialized_results = serialize($results_array);
|
1097 |
|
1098 |
// Inserts the responses in the database.
|
@@ -1143,7 +1153,7 @@ class QMNQuizManager {
|
|
1143 |
);
|
1144 |
$results_id = $wpdb->insert_id;
|
1145 |
}
|
1146 |
-
|
1147 |
// Determines redirect/results page.
|
1148 |
$results_pages = $this->display_results_text($qmn_quiz_options, $qmn_array_for_variables);
|
1149 |
$result_display .= $results_pages['display'];
|
@@ -1156,7 +1166,7 @@ class QMNQuizManager {
|
|
1156 |
}
|
1157 |
|
1158 |
/*
|
1159 |
-
* Update the option `qmn_quiz_taken_cnt` value by 1 each time
|
1160 |
* whenever the record inserted into the required table.
|
1161 |
*/
|
1162 |
if( $results_insert ) {
|
@@ -1172,15 +1182,16 @@ class QMNQuizManager {
|
|
1172 |
|
1173 |
// Hook is fired after the responses are submitted. Passes responses, result ID, quiz settings, and response data.
|
1174 |
do_action('qsm_quiz_submitted', $results_array, $results_id, $qmn_quiz_options, $qmn_array_for_variables);
|
1175 |
-
|
1176 |
$qmn_array_for_variables = apply_filters( 'qmn_filter_email_content', $qmn_array_for_variables, $results_id);
|
1177 |
-
|
1178 |
// Send the emails in background.
|
|
|
1179 |
$this->qsm_background_email->data( array( 'name' => 'send_emails', 'variables' => $qmn_array_for_variables ) )->dispatch();
|
1180 |
-
|
1181 |
// Sends the emails - Defer the emails.
|
1182 |
//QSM_Emails::send_emails($qmn_array_for_variables);
|
1183 |
-
|
1184 |
/**
|
1185 |
* Filters for filtering the results text after emails are sent.
|
1186 |
*
|
@@ -1198,9 +1209,9 @@ class QMNQuizManager {
|
|
1198 |
} else {
|
1199 |
$result_display .= 'Thank you.';
|
1200 |
}
|
1201 |
-
|
1202 |
$result_display = str_replace('%FB_RESULT_ID%', $unique_id, $result_display);
|
1203 |
-
|
1204 |
// Prepares data to be sent back to front-end.
|
1205 |
$return_array = array(
|
1206 |
'display' => htmlspecialchars_decode($result_display),
|
@@ -1246,6 +1257,20 @@ class QMNQuizManager {
|
|
1246 |
$correct_status = "incorrect";
|
1247 |
$answer_points = 0;
|
1248 |
$question_data = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1249 |
|
1250 |
// If deprecated pagination setting is not used, use new system...
|
1251 |
if (0 == $options->question_from_total && 0 !== count($pages)) {
|
@@ -1263,6 +1288,15 @@ class QMNQuizManager {
|
|
1263 |
if ($page_question_id == $question_id) {
|
1264 |
|
1265 |
$question = $questions[$page_question_id];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1266 |
|
1267 |
// Reset question-specific variables
|
1268 |
$user_answer = "";
|
@@ -1272,16 +1306,24 @@ class QMNQuizManager {
|
|
1272 |
|
1273 |
// Send question to our grading function
|
1274 |
$results_array = apply_filters('qmn_results_array', $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']));
|
1275 |
-
|
|
|
|
|
1276 |
// If question was graded correctly.
|
1277 |
if (!isset($results_array["null_review"])) {
|
1278 |
-
$
|
1279 |
-
|
|
|
|
|
|
|
1280 |
|
1281 |
// If the user's answer was correct
|
1282 |
if ('correct' == $results_array["correct"]) {
|
1283 |
-
$
|
1284 |
-
|
|
|
|
|
|
|
1285 |
}
|
1286 |
$user_answer = $results_array["user_text"];
|
1287 |
$correct_answer = $results_array["correct_text"];
|
@@ -1688,7 +1730,7 @@ class QMNQuizManager {
|
|
1688 |
|
1689 |
/**
|
1690 |
* Returns the quiz taker's IP if IP collection is enabled
|
1691 |
-
*
|
1692 |
* @since 5.3.0
|
1693 |
* @return string The IP address or a phrase if not collected
|
1694 |
*/
|
@@ -1705,7 +1747,7 @@ class QMNQuizManager {
|
|
1705 |
} else {
|
1706 |
$ip = __('Unknown', 'quiz-master-next');
|
1707 |
}
|
1708 |
-
|
1709 |
if (getenv('HTTP_CLIENT_IP'))
|
1710 |
$ip = getenv('HTTP_CLIENT_IP');
|
1711 |
else if (getenv('HTTP_X_FORWARDED_FOR'))
|
@@ -1723,7 +1765,7 @@ class QMNQuizManager {
|
|
1723 |
}
|
1724 |
return $ip;
|
1725 |
}
|
1726 |
-
|
1727 |
/**
|
1728 |
* Determines whether a plugin is active.
|
1729 |
*
|
@@ -1735,7 +1777,7 @@ class QMNQuizManager {
|
|
1735 |
private function qsm_plugin_active( $plugin ){
|
1736 |
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || $this->qsm_plugin_active_for_network( $plugin );
|
1737 |
}
|
1738 |
-
|
1739 |
/**
|
1740 |
* Determines whether the plugin is active for the entire network.
|
1741 |
*
|
@@ -1756,10 +1798,10 @@ class QMNQuizManager {
|
|
1756 |
|
1757 |
return false;
|
1758 |
}
|
1759 |
-
|
1760 |
/**
|
1761 |
* Include background process files
|
1762 |
-
*
|
1763 |
* @singce 7.0
|
1764 |
*/
|
1765 |
public function qsm_process_background_email(){
|
@@ -1773,7 +1815,7 @@ $qmnQuizManager = new QMNQuizManager();
|
|
1773 |
|
1774 |
add_filter('qmn_begin_shortcode', 'qmn_require_login_check', 10, 3);
|
1775 |
|
1776 |
-
function qmn_require_login_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
|
1777 |
global $qmn_allowed_visit;
|
1778 |
if ($qmn_quiz_options->require_log_in == 1 && !is_user_logged_in()) {
|
1779 |
$qmn_allowed_visit = false;
|
@@ -1781,7 +1823,7 @@ function qmn_require_login_check($display, $qmn_quiz_options, $qmn_array_for_var
|
|
1781 |
$mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text, ENT_QUOTES));
|
1782 |
}else{
|
1783 |
$mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text, ENT_QUOTES));
|
1784 |
-
}
|
1785 |
$mlw_message = apply_filters('mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
|
1786 |
$mlw_message = str_replace("\n", "<br>", $mlw_message);
|
1787 |
//$display .= do_shortcode($mlw_message);
|
@@ -1793,18 +1835,18 @@ function qmn_require_login_check($display, $qmn_quiz_options, $qmn_array_for_var
|
|
1793 |
|
1794 |
add_filter('qmn_begin_shortcode', 'qsm_scheduled_timeframe_check', 99, 3);
|
1795 |
|
1796 |
-
/**
|
1797 |
* @since 7.0.0 Added the condition for start time ( end time blank ) and end time ( start time blank ).
|
1798 |
-
*
|
1799 |
* @global boolean $qmn_allowed_visit
|
1800 |
* @param HTML $display
|
1801 |
* @param Object $options
|
1802 |
* @param Array $variable_data
|
1803 |
-
* @return HTML This function check the time frame of quiz.
|
1804 |
*/
|
1805 |
function qsm_scheduled_timeframe_check($display, $options, $variable_data) {
|
1806 |
global $qmn_allowed_visit;
|
1807 |
-
|
1808 |
$checked_pass = FALSE;
|
1809 |
// Checks if the start and end dates have data
|
1810 |
if (!empty($options->scheduled_time_start) && !empty($options->scheduled_time_end)) {
|
@@ -1849,7 +1891,7 @@ add_filter('qmn_begin_shortcode', 'qmn_total_user_tries_check', 10, 3);
|
|
1849 |
* @return string The altered HTML display for the quiz
|
1850 |
*/
|
1851 |
function qmn_total_user_tries_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
|
1852 |
-
|
1853 |
global $qmn_allowed_visit;
|
1854 |
if ($qmn_quiz_options->total_user_tries != 0) {
|
1855 |
|
14 |
* @since 4.0.0
|
15 |
*/
|
16 |
class QMNQuizManager {
|
17 |
+
|
18 |
protected $qsm_background_email;
|
19 |
/**
|
20 |
* Main Construct Function
|
49 |
add_action('wp_ajax_nopriv_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
|
50 |
//Upload file of file upload question type
|
51 |
add_action('wp_ajax_qsm_upload_image_fd_question', array($this, 'qsm_upload_image_fd_question'));
|
52 |
+
add_action('wp_ajax_nopriv_qsm_upload_image_fd_question', array($this, 'qsm_upload_image_fd_question'));
|
53 |
+
|
54 |
//remove file of file upload question type
|
55 |
add_action('wp_ajax_qsm_remove_file_fd_question', array($this, 'qsm_remove_file_fd_question'));
|
56 |
+
add_action('wp_ajax_nopriv_qsm_remove_file_fd_question', array($this, 'qsm_remove_file_fd_question'));
|
57 |
+
|
58 |
add_action('init', array($this, 'qsm_process_background_email'));
|
59 |
}
|
60 |
+
|
61 |
/**
|
62 |
* @version 6.3.7
|
63 |
* Upload file to server
|
86 |
$mimes[] = $value;
|
87 |
}
|
88 |
}
|
89 |
+
}
|
90 |
$json = array();
|
91 |
+
$validate_file = wp_check_filetype( $_FILES["file"]["name"]);
|
92 |
+
if ( isset( $validate_file['type'] ) && in_array($validate_file['type'], $mimes)) {
|
93 |
if($_FILES["file"]['size'] >= $file_upload_limit * 1024 * 1024){
|
94 |
$json['type']= 'error';
|
95 |
+
$json['message'] = __('File is too large. File must be less than ', 'quiz-master-next') . $file_upload_limit . ' MB';
|
96 |
echo json_encode($json);
|
97 |
exit;
|
98 |
}
|
99 |
+
$upload_dir = wp_upload_dir();
|
100 |
$datafile = $_FILES["file"]["tmp_name"];
|
101 |
$file_name = $_FILES["file"]["name"];
|
|
|
|
|
|
|
|
|
102 |
$extension = pathinfo($file_name, PATHINFO_EXTENSION);
|
103 |
+
$rawBaseName = 'qsmfileupload_' . md5( date('Y-m-d H:i:s') ) . '_' . pathinfo($file_name, PATHINFO_FILENAME);
|
104 |
+
$new_fname = $rawBaseName . '.' . $extension;
|
105 |
+
$file = $upload_dir['path'] . '/' . $new_fname;
|
106 |
+
$file_url = $upload_dir['url'] . '/' . $new_fname;
|
107 |
+
$counter = 1;
|
108 |
if(file_exists($file)){
|
109 |
while (file_exists($file)) {
|
110 |
$new_fname = $rawBaseName . '-' . $counter . '.' . $extension;
|
113 |
$counter++;
|
114 |
}
|
115 |
}
|
116 |
+
if (!move_uploaded_file($datafile, $file)) {
|
117 |
$json['type']= 'error';
|
118 |
+
$json['message'] = __('File not uploaded', 'quiz-master-next');
|
119 |
echo json_encode($json);
|
120 |
}else{
|
121 |
$json['type']= 'success';
|
122 |
+
$json['message'] = __( 'File uploaded successfully', 'quiz-master-next' );
|
123 |
$json['file_url'] = $file_url;
|
124 |
+
$json['file_path'] = $new_fname;
|
125 |
echo json_encode($json);
|
126 |
}
|
127 |
}else{
|
128 |
$json['type']= 'error';
|
129 |
+
$json['message'] = __('File type is not supported', 'quiz-master-next');
|
130 |
echo json_encode($json);
|
131 |
}
|
132 |
exit;
|
133 |
}
|
134 |
+
|
135 |
/**
|
136 |
* @since 6.3.7
|
137 |
* Remove the uploaded image
|
138 |
*/
|
139 |
public function qsm_remove_file_fd_question(){
|
140 |
+
$file_url = isset($_POST['file_url']) ? sanitize_text_field($_POST['file_url']) : '';
|
141 |
+
$upload_dir = wp_upload_dir();
|
142 |
+
$uploaded_path = $upload_dir['path'];
|
143 |
+
if($file_url && stristr( $file_url, 'qsmfileupload_' ) && file_exists( $uploaded_path . '/' . $file_url ) ){
|
144 |
+
wp_delete_file( $uploaded_path . '/' . $file_url );
|
145 |
$json['type']= 'success';
|
146 |
+
$json['message'] = __( 'File removed successfully', 'quiz-master-next' );
|
147 |
echo json_encode($json);
|
148 |
exit;
|
149 |
}
|
150 |
$json['type']= 'error';
|
151 |
+
$json['message'] = __( 'File not removed', 'quiz-master-next' );
|
152 |
echo json_encode($json);
|
153 |
exit;
|
154 |
}
|
199 |
ob_start();
|
200 |
if(isset($_GET['result_id']) && $_GET['result_id'] != ''){
|
201 |
global $wpdb;
|
202 |
+
$result_unique_id = $_GET['result_id'];
|
203 |
$query = $wpdb->prepare("SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE unique_id = %s",$result_unique_id);
|
204 |
+
$result = $wpdb->get_row($query,ARRAY_A);
|
205 |
if( !empty($result) && isset($result['result_id']) ){
|
206 |
$result_id = $result['result_id'];
|
207 |
$return_display = do_shortcode( '[qsm_result id="'. $result_id .'"]' );
|
208 |
}else{
|
209 |
$return_display = 'Result id is wrong!';
|
210 |
+
}
|
211 |
$return_display .= ob_get_clean();
|
212 |
}else{
|
213 |
global $wpdb;
|
237 |
// Loads Quiz Template.
|
238 |
// The quiz_stye is misspelled because it has always been misspelled and fixing it would break many sites :(.
|
239 |
if ('default' == $qmn_quiz_options->theme_selected) {
|
240 |
+
$return_display .= '<style type="text/css">' . htmlspecialchars_decode($qmn_quiz_options->quiz_stye) . '</style>';
|
241 |
wp_enqueue_style('qmn_quiz_style', plugins_url('../../css/qmn_quiz.css', __FILE__));
|
242 |
} else {
|
243 |
$registered_template = $mlwQuizMasterNext->pluginHelper->get_quiz_templates($qmn_quiz_options->theme_selected);
|
286 |
'progress_bar' => $qmn_quiz_options->progress_bar,
|
287 |
'contact_info_location' => $qmn_quiz_options->contact_info_location,
|
288 |
'qpages' => $qpages,
|
289 |
+
'skip_validation_time_expire' => $qmn_quiz_options->skip_validation_time_expire
|
290 |
);
|
291 |
|
292 |
$return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
306 |
|
307 |
$return_display .= ob_get_clean();
|
308 |
$return_display = apply_filters('qmn_end_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
309 |
+
}
|
310 |
return $return_display;
|
311 |
}
|
312 |
+
|
313 |
public function shortcode_display_result($atts){
|
314 |
extract(shortcode_atts(array(
|
315 |
+
'id' => 0,
|
316 |
), $atts));
|
317 |
ob_start();
|
318 |
if($id == 0){
|
319 |
$id = isset($_GET['result_id']) ? $_GET['result_id'] : 0;
|
320 |
+
}
|
321 |
global $wpdb;
|
322 |
$result_data = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = {$id}", ARRAY_A);
|
323 |
$quiz_result = unserialize($result_data['quiz_results']);
|
374 |
$cat_query = '';
|
375 |
if (1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order) {
|
376 |
$order_by_sql = 'ORDER BY rand()';
|
377 |
+
$categories = isset($quiz_options->randon_category) ? $quiz_options->randon_category : '';
|
378 |
if($categories){
|
379 |
$exploded_arr = explode(',', $quiz_options->randon_category);
|
380 |
$cat_str = "'" . implode ( "', '", $exploded_arr ) . "'";
|
484 |
* @return string The content for the quiz page section
|
485 |
*/
|
486 |
public function display_quiz($options, $quiz_data, $question_amount) {
|
487 |
+
|
488 |
global $qmn_allowed_visit;
|
489 |
global $mlwQuizMasterNext;
|
490 |
$quiz_display = '';
|
505 |
'incorrect' => $options->incorrect_error_text,
|
506 |
'empty' => $options->empty_error_text,
|
507 |
);
|
508 |
+
|
509 |
wp_enqueue_script('progress-bar', plugins_url('../../js/progressbar.min.js', __FILE__));
|
510 |
wp_enqueue_script( 'jquery-ui-slider-js', plugins_url('../../js/jquery-ui.js', __FILE__));
|
511 |
wp_enqueue_script( 'jquery-ui-slider-rtl-js', plugins_url('../../js/jquery.ui.slider-rtl.js', __FILE__) );
|
512 |
wp_enqueue_style( 'jquery-ui-slider-rtl-css', plugins_url('../../css/jquery.ui.slider-rtl.css', __FILE__) );
|
513 |
+
wp_enqueue_script( 'jqueryui-touch-js', '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' );
|
514 |
wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
|
515 |
wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
|
516 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
517 |
wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'enable_quick_result_mc' => isset($options->enable_quick_result_mc) ? $options->enable_quick_result_mc : '','enable_result_after_timer_end' => isset($options->enable_result_after_timer_end) ? $options->enable_result_after_timer_end : '', 'quick_result_correct_text' => sprintf('<b>%s</b> %s', __( 'Correct!', 'quiz-master-next' ), __('You have selected correct answer.', 'quiz-master-next')), 'quick_result_wrong_text' => sprintf('<b>%s</b> %s', __( 'Wrong!', 'quiz-master-next' ), __('You have selected wrong answer.', 'quiz-master-next')) ));
|
518 |
+
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
519 |
global $qmn_total_questions;
|
520 |
$qmn_total_questions = 0;
|
521 |
global $mlw_qmn_section_count;
|
535 |
),
|
536 |
);
|
537 |
$the_query = new WP_Query($args);
|
538 |
+
|
539 |
// The Loop
|
540 |
+
if ($the_query->have_posts()) {
|
541 |
+
while ($the_query->have_posts()) {
|
542 |
$the_query->the_post();
|
543 |
$quiz_display .= get_the_post_thumbnail(get_the_ID(),'full');
|
544 |
}
|
547 |
}
|
548 |
$quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
|
549 |
$quiz_display .= "<form name='quizForm{$quiz_data['quiz_id']}' id='quizForm{$quiz_data['quiz_id']}' action='' method='POST' class='qsm-quiz-form qmn_quiz_form mlw_quiz_form' novalidate enctype='multipart/form-data'>";
|
550 |
+
$quiz_display .= "<input type='hidden' name='qsm_hidden_questions' id='qsm_hidden_questions' value=''>";
|
551 |
$quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
|
552 |
$quiz_display .= "<span id='mlw_top_of_quiz'></span>";
|
553 |
$quiz_display = apply_filters('qmn_begin_quiz_form', $quiz_display, $options, $quiz_data);
|
597 |
public function display_pages($options, $quiz_data) {
|
598 |
global $mlwQuizMasterNext;
|
599 |
global $qmn_json_data;
|
600 |
+
ob_start();
|
601 |
$pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('pages', array());
|
602 |
$qpages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('qpages', array());
|
603 |
$questions = QSM_Questions::load_questions_by_pages($options->quiz_id);
|
608 |
if (count($pages) > 1 && (!empty($options->message_before) || ( 0 == $options->contact_info_location && $contact_fields ) )) {
|
609 |
$qmn_json_data['first_page'] = true;
|
610 |
$message_before = wpautop(htmlspecialchars_decode($options->message_before, ENT_QUOTES));
|
611 |
+
$message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $quiz_data);
|
612 |
?>
|
613 |
<section class="qsm-page <?php echo $animation_effect; ?>">
|
614 |
<div class="quiz_section quiz_begin">
|
624 |
}
|
625 |
|
626 |
// If there is only one page.
|
627 |
+
if (1 == count($pages)) {
|
628 |
?>
|
629 |
<section class="qsm-page <?php echo $animation_effect; ?>">
|
630 |
<?php
|
642 |
?>
|
643 |
</div>
|
644 |
<?php
|
645 |
+
}
|
646 |
foreach ($pages[0] as $question_id) {
|
647 |
$question_list .= $question_id . 'Q';
|
648 |
$question = $questions[$question_id];
|
723 |
?>
|
724 |
</div>
|
725 |
<?php
|
726 |
+
}
|
727 |
if($enable_pagination_quiz){
|
728 |
+
?>
|
729 |
<span class="pages_count">
|
730 |
<?php
|
731 |
$text_c = $pages_count . ' out of ' .$total_pages_count;
|
847 |
$enable_pagination_quiz = isset($qmn_quiz_options->enable_pagination_quiz) && $qmn_quiz_options->enable_pagination_quiz ? $qmn_quiz_options->enable_pagination_quiz : 0;
|
848 |
$pagination_optoin = $qmn_quiz_options->pagination;
|
849 |
if($enable_pagination_quiz && $pagination_optoin){
|
850 |
+
$total_pages_count = count($qmn_quiz_questions);
|
851 |
+
$total_pagination = ceil($total_pages_count / $pagination_optoin);
|
852 |
}
|
853 |
$pages_count = 1;
|
854 |
foreach ($qmn_quiz_questions as $mlw_question) {
|
871 |
if (!empty($mlw_question->hints)) {
|
872 |
$question_display .= "<div title=\"" . esc_attr(htmlspecialchars_decode($mlw_question->hints, ENT_QUOTES)) . "\" class='qsm_hint mlw_qmn_hint_link'>{$qmn_quiz_options->hint_text}</div>";
|
873 |
$question_display .= "<br /><br />";
|
874 |
+
}
|
875 |
$question_display .= "</div>";
|
876 |
$pages_count++;
|
877 |
}
|
976 |
public function ajax_submit_results() {
|
977 |
global $qmn_allowed_visit;
|
978 |
global $mlwQuizMasterNext;
|
979 |
+
|
980 |
$qmn_allowed_visit = true;
|
981 |
$quiz = intval($_POST["qmn_quiz_id"]);
|
982 |
$mlwQuizMasterNext->pluginHelper->prepare_quiz($quiz);
|
989 |
);
|
990 |
$post_data = array(
|
991 |
'g-recaptcha-response' => isset($_POST['g-recaptcha-response']) ? sanitize_textarea_field($_POST['g-recaptcha-response']) : ''
|
992 |
+
);
|
993 |
if(class_exists('QSM_Recaptcha')){
|
994 |
$recaptcha_data = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( "recaptcha_integration_settings" );
|
995 |
if(isset($recaptcha_data['enable_recaptcha']) && $recaptcha_data['enable_recaptcha'] != 'no'){
|
1001 |
));
|
1002 |
exit;
|
1003 |
}
|
1004 |
+
}
|
1005 |
+
}
|
1006 |
echo json_encode($this->submit_results($options, $data));
|
1007 |
die();
|
1008 |
}
|
1009 |
+
|
1010 |
/**
|
1011 |
* @version 6.3.2
|
1012 |
* Show quiz on button click
|
1036 |
public function submit_results($qmn_quiz_options, $qmn_array_for_variables) {
|
1037 |
global $qmn_allowed_visit;
|
1038 |
$result_display = '';
|
1039 |
+
|
1040 |
$qmn_array_for_variables['user_ip'] = $this->get_user_ip();
|
1041 |
|
1042 |
$result_display = apply_filters('qmn_begin_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
|
1076 |
$qmn_array_for_variables['timer_ms'] = $mlw_qmn_timer_ms;
|
1077 |
$qmn_array_for_variables['time_taken'] = current_time('h:i:s A m/d/Y');
|
1078 |
$qmn_array_for_variables['contact'] = $contact_responses;
|
1079 |
+
$qmn_array_for_variables['hidden_questions'] = isset($_POST['qsm_hidden_questions']) ? json_decode(html_entity_decode(stripslashes($_POST['qsm_hidden_questions'])),true) : array();
|
1080 |
|
1081 |
if (!isset($_POST["mlw_code_captcha"]) || ( isset($_POST["mlw_code_captcha"]) && $_POST["mlw_user_captcha"] == $_POST["mlw_code_captcha"] )) {
|
1082 |
|
1100 |
'pagetime' => $mlw_qmn_pagetime,
|
1101 |
);
|
1102 |
$results_array = apply_filters('qsm_results_array', $results_array, $qmn_array_for_variables);
|
1103 |
+
if(isset($results_array['parameters'])) {
|
1104 |
+
$qmn_array_for_variables['parameters'] = $results_array['parameters'];
|
1105 |
+
}
|
1106 |
$serialized_results = serialize($results_array);
|
1107 |
|
1108 |
// Inserts the responses in the database.
|
1153 |
);
|
1154 |
$results_id = $wpdb->insert_id;
|
1155 |
}
|
1156 |
+
|
1157 |
// Determines redirect/results page.
|
1158 |
$results_pages = $this->display_results_text($qmn_quiz_options, $qmn_array_for_variables);
|
1159 |
$result_display .= $results_pages['display'];
|
1166 |
}
|
1167 |
|
1168 |
/*
|
1169 |
+
* Update the option `qmn_quiz_taken_cnt` value by 1 each time
|
1170 |
* whenever the record inserted into the required table.
|
1171 |
*/
|
1172 |
if( $results_insert ) {
|
1182 |
|
1183 |
// Hook is fired after the responses are submitted. Passes responses, result ID, quiz settings, and response data.
|
1184 |
do_action('qsm_quiz_submitted', $results_array, $results_id, $qmn_quiz_options, $qmn_array_for_variables);
|
1185 |
+
|
1186 |
$qmn_array_for_variables = apply_filters( 'qmn_filter_email_content', $qmn_array_for_variables, $results_id);
|
1187 |
+
|
1188 |
// Send the emails in background.
|
1189 |
+
$qmn_array_for_variables['quiz_settings'] = isset( $qmn_quiz_options->quiz_settings ) ? @unserialize( $qmn_quiz_options->quiz_settings ) : array();
|
1190 |
$this->qsm_background_email->data( array( 'name' => 'send_emails', 'variables' => $qmn_array_for_variables ) )->dispatch();
|
1191 |
+
|
1192 |
// Sends the emails - Defer the emails.
|
1193 |
//QSM_Emails::send_emails($qmn_array_for_variables);
|
1194 |
+
|
1195 |
/**
|
1196 |
* Filters for filtering the results text after emails are sent.
|
1197 |
*
|
1209 |
} else {
|
1210 |
$result_display .= 'Thank you.';
|
1211 |
}
|
1212 |
+
|
1213 |
$result_display = str_replace('%FB_RESULT_ID%', $unique_id, $result_display);
|
1214 |
+
|
1215 |
// Prepares data to be sent back to front-end.
|
1216 |
$return_array = array(
|
1217 |
'display' => htmlspecialchars_decode($result_display),
|
1257 |
$correct_status = "incorrect";
|
1258 |
$answer_points = 0;
|
1259 |
$question_data = array();
|
1260 |
+
|
1261 |
+
// Question types to calculate result on
|
1262 |
+
$result_question_types = array(
|
1263 |
+
0, // Multiple Choice
|
1264 |
+
1, // Horizontal Multiple Choice
|
1265 |
+
2, // Drop Down
|
1266 |
+
4, // Multiple Response
|
1267 |
+
10, // Horizontal Multiple Response
|
1268 |
+
12, // Date
|
1269 |
+
3, // Small Open Answer
|
1270 |
+
5, // Large Open Answer
|
1271 |
+
7, // Number
|
1272 |
+
14, // Fill In The Blank
|
1273 |
+
);
|
1274 |
|
1275 |
// If deprecated pagination setting is not used, use new system...
|
1276 |
if (0 == $options->question_from_total && 0 !== count($pages)) {
|
1288 |
if ($page_question_id == $question_id) {
|
1289 |
|
1290 |
$question = $questions[$page_question_id];
|
1291 |
+
// Ignore non points questions from result
|
1292 |
+
$question_type_new = $question['question_type_new'];
|
1293 |
+
if(!in_array($question_type_new,$result_question_types)) {
|
1294 |
+
$total_questions--;
|
1295 |
+
}
|
1296 |
+
if(in_array($question_id,$quiz_data['hidden_questions'])) {
|
1297 |
+
$total_questions--;
|
1298 |
+
continue;
|
1299 |
+
}
|
1300 |
|
1301 |
// Reset question-specific variables
|
1302 |
$user_answer = "";
|
1306 |
|
1307 |
// Send question to our grading function
|
1308 |
$results_array = apply_filters('qmn_results_array', $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']));
|
1309 |
+
if($results_array['question_type'] == 'file_upload') {
|
1310 |
+
$results_array['user_text'] = '<a target="_blank" href="'.$results_array['user_text'].'">Click here to view</a>';
|
1311 |
+
}
|
1312 |
// If question was graded correctly.
|
1313 |
if (!isset($results_array["null_review"])) {
|
1314 |
+
if(in_array($question_type_new,$result_question_types)) {
|
1315 |
+
$points_earned += $results_array["points"];
|
1316 |
+
$answer_points += $results_array["points"];
|
1317 |
+
}
|
1318 |
+
|
1319 |
|
1320 |
// If the user's answer was correct
|
1321 |
if ('correct' == $results_array["correct"]) {
|
1322 |
+
if(in_array($question_type_new,$result_question_types)) {
|
1323 |
+
$total_correct += 1;
|
1324 |
+
$correct_status = "correct";
|
1325 |
+
}
|
1326 |
+
|
1327 |
}
|
1328 |
$user_answer = $results_array["user_text"];
|
1329 |
$correct_answer = $results_array["correct_text"];
|
1730 |
|
1731 |
/**
|
1732 |
* Returns the quiz taker's IP if IP collection is enabled
|
1733 |
+
*
|
1734 |
* @since 5.3.0
|
1735 |
* @return string The IP address or a phrase if not collected
|
1736 |
*/
|
1747 |
} else {
|
1748 |
$ip = __('Unknown', 'quiz-master-next');
|
1749 |
}
|
1750 |
+
|
1751 |
if (getenv('HTTP_CLIENT_IP'))
|
1752 |
$ip = getenv('HTTP_CLIENT_IP');
|
1753 |
else if (getenv('HTTP_X_FORWARDED_FOR'))
|
1765 |
}
|
1766 |
return $ip;
|
1767 |
}
|
1768 |
+
|
1769 |
/**
|
1770 |
* Determines whether a plugin is active.
|
1771 |
*
|
1777 |
private function qsm_plugin_active( $plugin ){
|
1778 |
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || $this->qsm_plugin_active_for_network( $plugin );
|
1779 |
}
|
1780 |
+
|
1781 |
/**
|
1782 |
* Determines whether the plugin is active for the entire network.
|
1783 |
*
|
1798 |
|
1799 |
return false;
|
1800 |
}
|
1801 |
+
|
1802 |
/**
|
1803 |
* Include background process files
|
1804 |
+
*
|
1805 |
* @singce 7.0
|
1806 |
*/
|
1807 |
public function qsm_process_background_email(){
|
1815 |
|
1816 |
add_filter('qmn_begin_shortcode', 'qmn_require_login_check', 10, 3);
|
1817 |
|
1818 |
+
function qmn_require_login_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
|
1819 |
global $qmn_allowed_visit;
|
1820 |
if ($qmn_quiz_options->require_log_in == 1 && !is_user_logged_in()) {
|
1821 |
$qmn_allowed_visit = false;
|
1823 |
$mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text, ENT_QUOTES));
|
1824 |
}else{
|
1825 |
$mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text, ENT_QUOTES));
|
1826 |
+
}
|
1827 |
$mlw_message = apply_filters('mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
|
1828 |
$mlw_message = str_replace("\n", "<br>", $mlw_message);
|
1829 |
//$display .= do_shortcode($mlw_message);
|
1835 |
|
1836 |
add_filter('qmn_begin_shortcode', 'qsm_scheduled_timeframe_check', 99, 3);
|
1837 |
|
1838 |
+
/**
|
1839 |
* @since 7.0.0 Added the condition for start time ( end time blank ) and end time ( start time blank ).
|
1840 |
+
*
|
1841 |
* @global boolean $qmn_allowed_visit
|
1842 |
* @param HTML $display
|
1843 |
* @param Object $options
|
1844 |
* @param Array $variable_data
|
1845 |
+
* @return HTML This function check the time frame of quiz.
|
1846 |
*/
|
1847 |
function qsm_scheduled_timeframe_check($display, $options, $variable_data) {
|
1848 |
global $qmn_allowed_visit;
|
1849 |
+
|
1850 |
$checked_pass = FALSE;
|
1851 |
// Checks if the start and end dates have data
|
1852 |
if (!empty($options->scheduled_time_start) && !empty($options->scheduled_time_end)) {
|
1891 |
* @return string The altered HTML display for the quiz
|
1892 |
*/
|
1893 |
function qmn_total_user_tries_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
|
1894 |
+
|
1895 |
global $qmn_allowed_visit;
|
1896 |
if ($qmn_quiz_options->total_user_tries != 0) {
|
1897 |
|
@@ -145,7 +145,7 @@ class QSM_Install {
|
|
145 |
// Registers timer_limit setting
|
146 |
$field_array = array(
|
147 |
'id' => 'timer_limit',
|
148 |
-
'label' => __('Time Limit', 'quiz-master-next'),
|
149 |
'type' => 'number',
|
150 |
'options' => array(
|
151 |
|
@@ -173,6 +173,24 @@ class QSM_Install {
|
|
173 |
'default' => 0
|
174 |
);
|
175 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
// Registers total_user_tries setting
|
178 |
$field_array = array(
|
145 |
// Registers timer_limit setting
|
146 |
$field_array = array(
|
147 |
'id' => 'timer_limit',
|
148 |
+
'label' => __('Time Limit (in minutes)', 'quiz-master-next'),
|
149 |
'type' => 'number',
|
150 |
'options' => array(
|
151 |
|
173 |
'default' => 0
|
174 |
);
|
175 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
176 |
+
|
177 |
+
$field_array = array(
|
178 |
+
'id' => 'skip_validation_time_expire',
|
179 |
+
'label' => __('Skip validations when time expire', 'quiz-master-next'),
|
180 |
+
'type' => 'radio',
|
181 |
+
'options' => array(
|
182 |
+
array(
|
183 |
+
'label' => __('Yes', 'quiz-master-next'),
|
184 |
+
'value' => 1
|
185 |
+
),
|
186 |
+
array(
|
187 |
+
'label' => __('No', 'quiz-master-next'),
|
188 |
+
'value' => 0
|
189 |
+
)
|
190 |
+
),
|
191 |
+
'default' => 1
|
192 |
+
);
|
193 |
+
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
194 |
|
195 |
// Registers total_user_tries setting
|
196 |
$field_array = array(
|
@@ -164,7 +164,7 @@ class QSM_Quiz_Settings {
|
|
164 |
|
165 |
// Check if setting exists
|
166 |
if ( isset( $this->settings[ $setting ] ) ) {
|
167 |
-
|
168 |
// Try to unserialize it and then return it
|
169 |
return maybe_unserialize( $this->settings[ $setting ] );
|
170 |
} else {
|
164 |
|
165 |
// Check if setting exists
|
166 |
if ( isset( $this->settings[ $setting ] ) ) {
|
167 |
+
|
168 |
// Try to unserialize it and then return it
|
169 |
return maybe_unserialize( $this->settings[ $setting ] );
|
170 |
} else {
|
@@ -11,7 +11,7 @@ add_action("plugins_loaded", 'qmn_question_type_multiple_choice');
|
|
11 |
function qmn_question_type_multiple_choice()
|
12 |
{
|
13 |
global $mlwQuizMasterNext;
|
14 |
-
$mlwQuizMasterNext->pluginHelper->register_question_type(__("Multiple Choice", 'quiz-master-next'), 'qmn_multiple_choice_display', true, 'qmn_multiple_choice_review', null, null, 0);
|
15 |
}
|
16 |
|
17 |
add_action("plugins_loaded", 'qmn_question_type_file_upload');
|
@@ -44,7 +44,8 @@ function qmn_file_upload_display($id, $question, $answers)
|
|
44 |
//$question_title = apply_filters('the_content', $question);
|
45 |
$new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
|
46 |
$question_display .= qsm_question_title_func($question,'',$new_question_title);
|
47 |
-
$question_display .= "<input type='file' class='mlw_answer_file_upload $mlw_requireClass'/>";
|
|
|
48 |
$question_display .= "<div style='display: none;' class='remove-uploaded-file'><span class='dashicons dashicons-trash'></span></div>";
|
49 |
$question_display .= "<input class='mlw_file_upload_hidden_value' type='hidden' name='question".$id."' value='' />";
|
50 |
$question_display .= "<span style='display: none;' class='mlw-file-upload-error-msg'></span>";
|
@@ -443,7 +444,7 @@ add_action("plugins_loaded", 'qmn_question_type_small_open');
|
|
443 |
function qmn_question_type_small_open()
|
444 |
{
|
445 |
global $mlwQuizMasterNext;
|
446 |
-
$mlwQuizMasterNext->pluginHelper->register_question_type(__("
|
447 |
}
|
448 |
|
449 |
/**
|
@@ -626,7 +627,7 @@ add_action("plugins_loaded", 'qmn_question_type_large_open');
|
|
626 |
function qmn_question_type_large_open()
|
627 |
{
|
628 |
global $mlwQuizMasterNext;
|
629 |
-
$mlwQuizMasterNext->pluginHelper->register_question_type(__("
|
630 |
}
|
631 |
|
632 |
/**
|
@@ -825,7 +826,7 @@ function qmn_question_type_accept()
|
|
825 |
'extra_inputs' => array(),
|
826 |
'function' => ''
|
827 |
);
|
828 |
-
$mlwQuizMasterNext->pluginHelper->register_question_type(__("
|
829 |
}
|
830 |
|
831 |
/**
|
11 |
function qmn_question_type_multiple_choice()
|
12 |
{
|
13 |
global $mlwQuizMasterNext;
|
14 |
+
$mlwQuizMasterNext->pluginHelper->register_question_type(__("Vertical Multiple Choice", 'quiz-master-next'), 'qmn_multiple_choice_display', true, 'qmn_multiple_choice_review', null, null, 0);
|
15 |
}
|
16 |
|
17 |
add_action("plugins_loaded", 'qmn_question_type_file_upload');
|
44 |
//$question_title = apply_filters('the_content', $question);
|
45 |
$new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
|
46 |
$question_display .= qsm_question_title_func($question,'',$new_question_title);
|
47 |
+
$question_display .= "<div style=''></div><input type='file' class='mlw_answer_file_upload $mlw_requireClass'/>";
|
48 |
+
$question_display .= "<div style='display: none;' class='loading-uploaded-file'><img src='".get_site_url()."/wp-includes/images/spinner-2x.gif'></div>";
|
49 |
$question_display .= "<div style='display: none;' class='remove-uploaded-file'><span class='dashicons dashicons-trash'></span></div>";
|
50 |
$question_display .= "<input class='mlw_file_upload_hidden_value' type='hidden' name='question".$id."' value='' />";
|
51 |
$question_display .= "<span style='display: none;' class='mlw-file-upload-error-msg'></span>";
|
444 |
function qmn_question_type_small_open()
|
445 |
{
|
446 |
global $mlwQuizMasterNext;
|
447 |
+
$mlwQuizMasterNext->pluginHelper->register_question_type(__("Short Answer", 'quiz-master-next'), 'qmn_small_open_display', true, 'qmn_small_open_review', null, null, 3);
|
448 |
}
|
449 |
|
450 |
/**
|
627 |
function qmn_question_type_large_open()
|
628 |
{
|
629 |
global $mlwQuizMasterNext;
|
630 |
+
$mlwQuizMasterNext->pluginHelper->register_question_type(__("Paragraph", 'quiz-master-next'), 'qmn_large_open_display', true, 'qmn_large_open_review', null, null, 5);
|
631 |
}
|
632 |
|
633 |
/**
|
826 |
'extra_inputs' => array(),
|
827 |
'function' => ''
|
828 |
);
|
829 |
+
$mlwQuizMasterNext->pluginHelper->register_question_type(__("Opt-in", 'quiz-master-next'), 'qmn_accept_display', false, null, $edit_args, null, 8);
|
830 |
}
|
831 |
|
832 |
/**
|
@@ -78,7 +78,12 @@ function qsm_rest_get_bank_questions( WP_REST_Request $request ){
|
|
78 |
}
|
79 |
$total_count_query = $wpdb->get_row( "SELECT COUNT(question_id) as total_question FROM {$wpdb->prefix}mlw_questions WHERE deleted='0'$category_query", 'ARRAY_A' );
|
80 |
$total_count = isset($total_count_query['total_question']) ? $total_count_query['total_question'] : 0;
|
|
|
81 |
$limit = 20;
|
|
|
|
|
|
|
|
|
82 |
$total_pages = ceil($total_count / $limit);
|
83 |
$pageno = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
|
84 |
$offset = ($pageno-1) * $limit;
|
@@ -135,7 +140,7 @@ function qsm_rest_get_bank_questions( WP_REST_Request $request ){
|
|
135 |
}else{
|
136 |
return array(
|
137 |
'status' => 'error',
|
138 |
-
'msg' => 'User not logged in',
|
139 |
);
|
140 |
}
|
141 |
}
|
@@ -248,7 +253,7 @@ function qsm_rest_get_emails( WP_REST_Request $request ) {
|
|
248 |
}
|
249 |
return array(
|
250 |
'status' => 'error',
|
251 |
-
'msg' => 'User not logged in',
|
252 |
);
|
253 |
}
|
254 |
|
@@ -275,7 +280,7 @@ function qsm_rest_save_emails( WP_REST_Request $request ) {
|
|
275 |
}
|
276 |
return array(
|
277 |
'status' => 'error',
|
278 |
-
'msg' => 'User not logged in',
|
279 |
);
|
280 |
}
|
281 |
|
@@ -300,7 +305,7 @@ function qsm_rest_get_results( WP_REST_Request $request ) {
|
|
300 |
}
|
301 |
return array(
|
302 |
'status' => 'error',
|
303 |
-
'msg' => 'User not logged in',
|
304 |
);
|
305 |
}
|
306 |
|
@@ -327,7 +332,7 @@ function qsm_rest_save_results( WP_REST_Request $request ) {
|
|
327 |
}
|
328 |
return array(
|
329 |
'status' => 'error',
|
330 |
-
'msg' => 'User not logged in',
|
331 |
);
|
332 |
}
|
333 |
|
@@ -366,7 +371,7 @@ function qsm_rest_get_question( WP_REST_Request $request ) {
|
|
366 |
}
|
367 |
return array(
|
368 |
'status' => 'error',
|
369 |
-
'msg' => 'User not logged in',
|
370 |
);
|
371 |
}
|
372 |
|
@@ -422,7 +427,7 @@ function qsm_rest_get_questions( WP_REST_Request $request ) {
|
|
422 |
}
|
423 |
return array(
|
424 |
'status' => 'error',
|
425 |
-
'msg' => 'User not logged in',
|
426 |
);
|
427 |
}
|
428 |
|
@@ -476,7 +481,7 @@ function qsm_rest_create_question( WP_REST_Request $request ) {
|
|
476 |
}
|
477 |
return array(
|
478 |
'status' => 'error',
|
479 |
-
'msg' => 'User not logged in',
|
480 |
);
|
481 |
}
|
482 |
|
@@ -544,6 +549,6 @@ function qsm_rest_save_question( WP_REST_Request $request ) {
|
|
544 |
}
|
545 |
return array(
|
546 |
'status' => 'error',
|
547 |
-
'msg' => 'User not logged in',
|
548 |
);
|
549 |
}
|
78 |
}
|
79 |
$total_count_query = $wpdb->get_row( "SELECT COUNT(question_id) as total_question FROM {$wpdb->prefix}mlw_questions WHERE deleted='0'$category_query", 'ARRAY_A' );
|
80 |
$total_count = isset($total_count_query['total_question']) ? $total_count_query['total_question'] : 0;
|
81 |
+
$settings = (array) get_option( 'qmn-settings' );
|
82 |
$limit = 20;
|
83 |
+
if ( isset( $settings['items_per_page_question_bank'] ) ) {
|
84 |
+
$limit = $settings['items_per_page_question_bank'];
|
85 |
+
}
|
86 |
+
$limit = $limit == '' || $limit == 0 ? 20 : $limit;
|
87 |
$total_pages = ceil($total_count / $limit);
|
88 |
$pageno = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
|
89 |
$offset = ($pageno-1) * $limit;
|
140 |
}else{
|
141 |
return array(
|
142 |
'status' => 'error',
|
143 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
144 |
);
|
145 |
}
|
146 |
}
|
253 |
}
|
254 |
return array(
|
255 |
'status' => 'error',
|
256 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
257 |
);
|
258 |
}
|
259 |
|
280 |
}
|
281 |
return array(
|
282 |
'status' => 'error',
|
283 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
284 |
);
|
285 |
}
|
286 |
|
305 |
}
|
306 |
return array(
|
307 |
'status' => 'error',
|
308 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
309 |
);
|
310 |
}
|
311 |
|
332 |
}
|
333 |
return array(
|
334 |
'status' => 'error',
|
335 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
336 |
);
|
337 |
}
|
338 |
|
371 |
}
|
372 |
return array(
|
373 |
'status' => 'error',
|
374 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
375 |
);
|
376 |
}
|
377 |
|
427 |
}
|
428 |
return array(
|
429 |
'status' => 'error',
|
430 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
431 |
);
|
432 |
}
|
433 |
|
481 |
}
|
482 |
return array(
|
483 |
'status' => 'error',
|
484 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
485 |
);
|
486 |
}
|
487 |
|
549 |
}
|
550 |
return array(
|
551 |
'status' => 'error',
|
552 |
+
'msg' => __('User not logged in', 'quiz-master-next'),
|
553 |
);
|
554 |
}
|
@@ -89,7 +89,7 @@ function qsm_display_recent_quizzes($attrs) {
|
|
89 |
}
|
90 |
}
|
91 |
if ($i == 0)
|
92 |
-
$result .= "No quiz found";
|
93 |
$result .= "</div>";
|
94 |
return $result;
|
95 |
}
|
89 |
}
|
90 |
}
|
91 |
if ($i == 0)
|
92 |
+
$result .= __("No quiz found", 'quiz-master-next');
|
93 |
$result .= "</div>";
|
94 |
return $result;
|
95 |
}
|
@@ -72,9 +72,9 @@ add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user
|
|
72 |
* Show particular question answer.
|
73 |
*/
|
74 |
function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
|
75 |
-
$quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
|
76 |
while ( false !== strpos($content, '%QUESTION_ANSWER_') ) {
|
77 |
-
$question_id = mlw_qmn_get_string_between($content, '%QUESTION_ANSWER_', '%');
|
78 |
if( $question_id === 'X'){
|
79 |
$content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , '', $content);
|
80 |
return $content;
|
@@ -99,7 +99,7 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
|
|
99 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b><br />' . htmlspecialchars_decode($answer[0], ENT_QUOTES), $mlw_question_answer_display);
|
100 |
}else{
|
101 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
102 |
-
}
|
103 |
$mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
|
104 |
if($answer['question_type'] == 11){
|
105 |
$file_extension = substr($answer[1], -4);
|
@@ -107,16 +107,16 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
|
|
107 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
|
108 |
}else{
|
109 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".trim( htmlspecialchars_decode($answer[1], ENT_QUOTES) ).'</span>', $mlw_question_answer_display);
|
110 |
-
}
|
111 |
}else{
|
112 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
|
113 |
-
}
|
114 |
global $wpdb;
|
115 |
$qmn_questions = array();
|
116 |
$question_id_n = $answer['id'];
|
117 |
$question_array = $wpdb->get_row( "SELECT question_answer_info FROM {$wpdb->prefix}mlw_questions WHERE question_id = $question_id_n", 'ARRAY_A' );
|
118 |
-
$qmn_questions[ $question_id_n ] = $question_array['question_answer_info'];
|
119 |
-
$answer_2 = !empty( $answer[2] ) ? $answer[2] : 'NA';
|
120 |
$mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer_2, ENT_QUOTES), $mlw_question_answer_display);
|
121 |
$answer_3 = !empty( $answer[3] ) ? $answer[3] : 'NA';
|
122 |
$mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer_3, $mlw_question_answer_display);
|
@@ -125,7 +125,7 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
|
|
125 |
$mlw_question_answer_display = wp_kses_post( $mlw_question_answer_display );
|
126 |
$display = "<div class='qmn_question_answer $question_answer_class'>".apply_filters('qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array).'</div>';
|
127 |
$content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , $display, $content);
|
128 |
-
}
|
129 |
}
|
130 |
return $content;
|
131 |
}
|
@@ -136,9 +136,9 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
|
|
136 |
* @param arr $mlw_quiz_array
|
137 |
*/
|
138 |
function qsm_variable_poll_result($content, $mlw_quiz_array, $variables){
|
139 |
-
$quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
|
140 |
while ( false !== strpos($content, '%POLL_RESULTS_') ) {
|
141 |
-
$question_id = mlw_qmn_get_string_between($content, '%POLL_RESULTS_', '%');
|
142 |
if( $question_id === 'X'){
|
143 |
$content = str_replace( "%POLL_RESULTS_". $question_id ."%" , '', $content);
|
144 |
return $content;
|
@@ -149,24 +149,24 @@ function qsm_variable_poll_result($content, $mlw_quiz_array, $variables){
|
|
149 |
$total_query = $wpdb->get_row('SELECT count(*) AS total_count FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
|
150 |
$total_result = $total_query['total_count'];
|
151 |
$ser_answer = $wpdb->get_row('SELECT answer_array FROM ' . $table_question . ' WHERE question_id = ' . $question_id,ARRAY_A);
|
152 |
-
$ser_answer_arry = unserialize($ser_answer['answer_array']);
|
153 |
-
$ser_answer_arry_change = array_filter(array_merge(array(0), $ser_answer_arry));
|
154 |
-
$total_quiz_results = $wpdb->get_results('SELECT quiz_results FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
|
155 |
$answer_array = array();
|
156 |
if($total_quiz_results){
|
157 |
-
foreach ($total_quiz_results as $key => $value) {
|
158 |
$userdb = unserialize($value['quiz_results']);
|
159 |
if(!empty($userdb)){
|
160 |
$key = array_search($question_id, array_column($userdb[1], 'id'));
|
161 |
$answer_array[] = isset($userdb[1][$key]) ? $userdb[1][$key][1] : '';
|
162 |
}
|
163 |
}
|
164 |
-
}
|
165 |
$vals = array_count_values($answer_array);
|
166 |
-
$str = '';
|
167 |
if($vals){
|
168 |
$str .= '<h4>Poll Result:</h4>';
|
169 |
-
foreach ($vals as $answer_str => $answer_count) {
|
170 |
if($answer_str != '' && qsm_find_key_from_array($answer_str, $ser_answer_arry_change)){
|
171 |
$percentage = number_format($answer_count / $total_result * 100,2) ;
|
172 |
$str .= $answer_str . ' : ' . $percentage .'%<br/>';
|
@@ -175,7 +175,7 @@ function qsm_variable_poll_result($content, $mlw_quiz_array, $variables){
|
|
175 |
}
|
176 |
}
|
177 |
$content = str_replace( "%POLL_RESULTS_". $question_id ."%" , $str, $content);
|
178 |
-
}
|
179 |
return $content;
|
180 |
}
|
181 |
|
@@ -202,7 +202,7 @@ function qsm_find_key_from_array($search_value,$array){
|
|
202 |
/**
|
203 |
* Adds Facebook sharing link using the %FACEBOOK_SHARE% variable
|
204 |
*/
|
205 |
-
function qsm_variable_facebook_share( $content, $mlw_quiz_array ) {
|
206 |
if ( false !== strpos($content, '%FACEBOOK_SHARE%') ) {
|
207 |
wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( '../../js/qmn_social_share.js' , __FILE__ ) );
|
208 |
$settings = (array) get_option( 'qmn-settings' );
|
@@ -212,13 +212,13 @@ function qsm_variable_facebook_share( $content, $mlw_quiz_array ) {
|
|
212 |
}
|
213 |
|
214 |
global $mlwQuizMasterNext;
|
215 |
-
$sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '' );
|
216 |
-
$url = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
|
217 |
$page_link = $url . '?result_id=' . '%FB_RESULT_ID%';
|
218 |
$sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
|
219 |
-
$fb_image = plugins_url('', dirname(__FILE__) ) . '/assets/facebook.png';
|
220 |
$social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."', '$facebook_app_id', '$page_link');\"><img src='". $fb_image ."' alt='Facebbok Share' /></a>";
|
221 |
-
$content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
|
222 |
}
|
223 |
return $content;
|
224 |
}
|
@@ -349,6 +349,7 @@ function qsm_all_contact_fields_variable( $content, $results ) {
|
|
349 |
return $content;
|
350 |
}
|
351 |
|
|
|
352 |
/**
|
353 |
* Converts the %QUESTIONS_ANSWERS% into the template
|
354 |
*
|
@@ -356,30 +357,36 @@ function qsm_all_contact_fields_variable( $content, $results ) {
|
|
356 |
* @param array $mlw_quiz_array The array for the response data
|
357 |
*/
|
358 |
function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
|
|
|
|
|
|
|
|
|
359 |
|
360 |
// Checks if the variable is present in the content.
|
361 |
while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false ) {
|
362 |
-
global $mlwQuizMasterNext;
|
363 |
global $wpdb;
|
364 |
$display = '';
|
365 |
if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
|
366 |
-
$quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( $mlw_quiz_array['quiz_settings']['quiz_text'] ) : array();
|
367 |
-
$qmn_question_answer_template = isset( $quiz_text_settings['question_answer_template'] ) ? $quiz_text_settings['question_answer_template'] : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
368 |
}else{
|
369 |
$qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
370 |
-
}
|
371 |
$questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
|
372 |
$qmn_questions = array();
|
373 |
foreach ( $questions as $question ) {
|
374 |
$qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
|
375 |
}
|
376 |
-
|
377 |
-
// Cycles through each answer in the responses.
|
378 |
foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
|
379 |
-
|
|
|
|
|
|
|
380 |
$user_answer_class = "";
|
381 |
$question_answer_class = "";
|
382 |
-
if( isset( $mlw_quiz_array['form_type'] ) && $mlw_quiz_array['form_type'] == 0 ){
|
383 |
if( $mlw_quiz_array['quiz_system'] == 0 || $mlw_quiz_array['quiz_system'] == 3 ){
|
384 |
if ( $answer["correct"] === "correct" ){
|
385 |
$user_answer_class = "qmn_user_correct_answer";
|
@@ -389,7 +396,7 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
|
|
389 |
$question_answer_class = "qmn_question_answer_incorrect";
|
390 |
}
|
391 |
}
|
392 |
-
}
|
393 |
} else {
|
394 |
if ( $answer["correct"] === "correct" ){
|
395 |
$user_answer_class = "qmn_user_correct_answer";
|
@@ -399,13 +406,13 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
|
|
399 |
$question_answer_class = "qmn_question_answer_incorrect";
|
400 |
}
|
401 |
}
|
402 |
-
|
403 |
$mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
|
404 |
if( isset( $answer['question_title'] ) && $answer['question_title'] != '' ){
|
405 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b><br />' . htmlspecialchars_decode($answer[0], ENT_QUOTES), $mlw_question_answer_display);
|
406 |
}else{
|
407 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
408 |
-
}
|
409 |
$mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
|
410 |
if( isset($answer['question_type']) && $answer['question_type'] == 11 ){
|
411 |
$file_extension = substr($answer[1], -4);
|
@@ -413,11 +420,11 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
|
|
413 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
|
414 |
}else{
|
415 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".trim( htmlspecialchars_decode($answer[1], ENT_QUOTES) ).'</span>', $mlw_question_answer_display);
|
416 |
-
}
|
417 |
}else{
|
418 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
|
419 |
}
|
420 |
-
$answer_2 = !empty( $answer[2] ) ? $answer[2] : 'NA';
|
421 |
$mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer_2, ENT_QUOTES), $mlw_question_answer_display);
|
422 |
$answer_3 = !empty( $answer[3] ) ? $answer[3] : 'NA';
|
423 |
$mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer_3, $mlw_question_answer_display);
|
@@ -496,7 +503,7 @@ function qmn_variable_category_points($content, $mlw_quiz_array)
|
|
496 |
}else{
|
497 |
$category_name = $answer_text[1];
|
498 |
}
|
499 |
-
|
500 |
foreach ($mlw_quiz_array['question_answers_array'] as $answer)
|
501 |
{
|
502 |
if ($answer["category"] == $category_name)
|
@@ -508,7 +515,7 @@ function qmn_variable_category_points($content, $mlw_quiz_array)
|
|
508 |
$content = str_replace( '%CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
|
509 |
}else{
|
510 |
$content = str_replace( $answer_text[0] , $return_points, $content);
|
511 |
-
}
|
512 |
}
|
513 |
return $content;
|
514 |
}
|
@@ -549,7 +556,7 @@ function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
|
|
549 |
$content = str_replace( '%AVERAGE_CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
|
550 |
}else{
|
551 |
$content = str_replace( $answer_text[0] , $return_points, $content);
|
552 |
-
}
|
553 |
}
|
554 |
return $content;
|
555 |
}
|
@@ -570,7 +577,7 @@ function qmn_variable_category_score($content, $mlw_quiz_array)
|
|
570 |
$total_questions = 0;
|
571 |
$amount_correct = 0;
|
572 |
while (strpos($content, '%CATEGORY_SCORE%') !== false || false !== strpos($content, '%CATEGORY_SCORE_'))
|
573 |
-
{
|
574 |
$return_score = 0;
|
575 |
$total_questions = 0;
|
576 |
$amount_correct = 0;
|
@@ -599,13 +606,13 @@ function qmn_variable_category_score($content, $mlw_quiz_array)
|
|
599 |
{
|
600 |
$return_score = 0;
|
601 |
}
|
602 |
-
|
603 |
if(empty($answer_text)){
|
604 |
$content = str_replace( '%CATEGORY_SCORE_'.$category_name.'%' , $return_score, $content);
|
605 |
}else{
|
606 |
$content = str_replace( $answer_text[0] , $return_score, $content);
|
607 |
-
}
|
608 |
-
|
609 |
}
|
610 |
return $content;
|
611 |
}
|
@@ -739,11 +746,11 @@ function qsm_end_results_rank($result_display, $qmn_quiz_options, $qmn_array_for
|
|
739 |
}
|
740 |
|
741 |
/**
|
742 |
-
*
|
743 |
* Add iFrame to allowed wp_kses_post tags
|
744 |
*
|
745 |
* @since 7.0.0
|
746 |
-
*
|
747 |
* @param array $tags Allowed tags, attributes, and/or entities.
|
748 |
* @param string $context Context to judge allowed tags by. Allowed values are 'post'.
|
749 |
*
|
@@ -772,4 +779,4 @@ function qsm_custom_wpkses_post_tags( $tags, $context ) {
|
|
772 |
return $tags;
|
773 |
}
|
774 |
|
775 |
-
add_filter( 'wp_kses_allowed_html', 'qsm_custom_wpkses_post_tags', 10, 2 );
|
72 |
* Show particular question answer.
|
73 |
*/
|
74 |
function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
|
75 |
+
$quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
|
76 |
while ( false !== strpos($content, '%QUESTION_ANSWER_') ) {
|
77 |
+
$question_id = mlw_qmn_get_string_between($content, '%QUESTION_ANSWER_', '%');
|
78 |
if( $question_id === 'X'){
|
79 |
$content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , '', $content);
|
80 |
return $content;
|
99 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b><br />' . htmlspecialchars_decode($answer[0], ENT_QUOTES), $mlw_question_answer_display);
|
100 |
}else{
|
101 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
102 |
+
}
|
103 |
$mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
|
104 |
if($answer['question_type'] == 11){
|
105 |
$file_extension = substr($answer[1], -4);
|
107 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
|
108 |
}else{
|
109 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".trim( htmlspecialchars_decode($answer[1], ENT_QUOTES) ).'</span>', $mlw_question_answer_display);
|
110 |
+
}
|
111 |
}else{
|
112 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
|
113 |
+
}
|
114 |
global $wpdb;
|
115 |
$qmn_questions = array();
|
116 |
$question_id_n = $answer['id'];
|
117 |
$question_array = $wpdb->get_row( "SELECT question_answer_info FROM {$wpdb->prefix}mlw_questions WHERE question_id = $question_id_n", 'ARRAY_A' );
|
118 |
+
$qmn_questions[ $question_id_n ] = $question_array['question_answer_info'];
|
119 |
+
$answer_2 = !empty( $answer[2] ) ? $answer[2] : 'NA';
|
120 |
$mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer_2, ENT_QUOTES), $mlw_question_answer_display);
|
121 |
$answer_3 = !empty( $answer[3] ) ? $answer[3] : 'NA';
|
122 |
$mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer_3, $mlw_question_answer_display);
|
125 |
$mlw_question_answer_display = wp_kses_post( $mlw_question_answer_display );
|
126 |
$display = "<div class='qmn_question_answer $question_answer_class'>".apply_filters('qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array).'</div>';
|
127 |
$content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , $display, $content);
|
128 |
+
}
|
129 |
}
|
130 |
return $content;
|
131 |
}
|
136 |
* @param arr $mlw_quiz_array
|
137 |
*/
|
138 |
function qsm_variable_poll_result($content, $mlw_quiz_array, $variables){
|
139 |
+
$quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
|
140 |
while ( false !== strpos($content, '%POLL_RESULTS_') ) {
|
141 |
+
$question_id = mlw_qmn_get_string_between($content, '%POLL_RESULTS_', '%');
|
142 |
if( $question_id === 'X'){
|
143 |
$content = str_replace( "%POLL_RESULTS_". $question_id ."%" , '', $content);
|
144 |
return $content;
|
149 |
$total_query = $wpdb->get_row('SELECT count(*) AS total_count FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
|
150 |
$total_result = $total_query['total_count'];
|
151 |
$ser_answer = $wpdb->get_row('SELECT answer_array FROM ' . $table_question . ' WHERE question_id = ' . $question_id,ARRAY_A);
|
152 |
+
$ser_answer_arry = unserialize($ser_answer['answer_array']);
|
153 |
+
$ser_answer_arry_change = array_filter(array_merge(array(0), $ser_answer_arry));
|
154 |
+
$total_quiz_results = $wpdb->get_results('SELECT quiz_results FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
|
155 |
$answer_array = array();
|
156 |
if($total_quiz_results){
|
157 |
+
foreach ($total_quiz_results as $key => $value) {
|
158 |
$userdb = unserialize($value['quiz_results']);
|
159 |
if(!empty($userdb)){
|
160 |
$key = array_search($question_id, array_column($userdb[1], 'id'));
|
161 |
$answer_array[] = isset($userdb[1][$key]) ? $userdb[1][$key][1] : '';
|
162 |
}
|
163 |
}
|
164 |
+
}
|
165 |
$vals = array_count_values($answer_array);
|
166 |
+
$str = '';
|
167 |
if($vals){
|
168 |
$str .= '<h4>Poll Result:</h4>';
|
169 |
+
foreach ($vals as $answer_str => $answer_count) {
|
170 |
if($answer_str != '' && qsm_find_key_from_array($answer_str, $ser_answer_arry_change)){
|
171 |
$percentage = number_format($answer_count / $total_result * 100,2) ;
|
172 |
$str .= $answer_str . ' : ' . $percentage .'%<br/>';
|
175 |
}
|
176 |
}
|
177 |
$content = str_replace( "%POLL_RESULTS_". $question_id ."%" , $str, $content);
|
178 |
+
}
|
179 |
return $content;
|
180 |
}
|
181 |
|
202 |
/**
|
203 |
* Adds Facebook sharing link using the %FACEBOOK_SHARE% variable
|
204 |
*/
|
205 |
+
function qsm_variable_facebook_share( $content, $mlw_quiz_array ) {
|
206 |
if ( false !== strpos($content, '%FACEBOOK_SHARE%') ) {
|
207 |
wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( '../../js/qmn_social_share.js' , __FILE__ ) );
|
208 |
$settings = (array) get_option( 'qmn-settings' );
|
212 |
}
|
213 |
|
214 |
global $mlwQuizMasterNext;
|
215 |
+
$sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '' );
|
216 |
+
$url = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
|
217 |
$page_link = $url . '?result_id=' . '%FB_RESULT_ID%';
|
218 |
$sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
|
219 |
+
$fb_image = plugins_url('', dirname(__FILE__) ) . '/assets/facebook.png';
|
220 |
$social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."', '$facebook_app_id', '$page_link');\"><img src='". $fb_image ."' alt='Facebbok Share' /></a>";
|
221 |
+
$content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
|
222 |
}
|
223 |
return $content;
|
224 |
}
|
349 |
return $content;
|
350 |
}
|
351 |
|
352 |
+
|
353 |
/**
|
354 |
* Converts the %QUESTIONS_ANSWERS% into the template
|
355 |
*
|
357 |
* @param array $mlw_quiz_array The array for the response data
|
358 |
*/
|
359 |
function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
|
360 |
+
global $mlwQuizMasterNext;
|
361 |
+
$logic_rules = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'logic_rules' );
|
362 |
+
$logic_rules = unserialize( $logic_rules );
|
363 |
+
$hidden_questions = isset($mlw_quiz_array['hidden_questions']) ? $mlw_quiz_array['hidden_questions'] : array();
|
364 |
|
365 |
// Checks if the variable is present in the content.
|
366 |
while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false ) {
|
|
|
367 |
global $wpdb;
|
368 |
$display = '';
|
369 |
if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
|
370 |
+
$quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
|
371 |
+
$qmn_question_answer_template = isset( $quiz_text_settings['question_answer_template'] ) ? $quiz_text_settings['question_answer_template'] : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
372 |
}else{
|
373 |
$qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
374 |
+
}
|
375 |
$questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
|
376 |
$qmn_questions = array();
|
377 |
foreach ( $questions as $question ) {
|
378 |
$qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
|
379 |
}
|
380 |
+
|
381 |
+
// Cycles through each answer in the responses.
|
382 |
foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
|
383 |
+
if(in_array($answer['id'],$hidden_questions)) {
|
384 |
+
continue;
|
385 |
+
}
|
386 |
+
if( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'qsm_quiz_result_details' ){
|
387 |
$user_answer_class = "";
|
388 |
$question_answer_class = "";
|
389 |
+
if( isset( $mlw_quiz_array['form_type'] ) && $mlw_quiz_array['form_type'] == 0 ){
|
390 |
if( $mlw_quiz_array['quiz_system'] == 0 || $mlw_quiz_array['quiz_system'] == 3 ){
|
391 |
if ( $answer["correct"] === "correct" ){
|
392 |
$user_answer_class = "qmn_user_correct_answer";
|
396 |
$question_answer_class = "qmn_question_answer_incorrect";
|
397 |
}
|
398 |
}
|
399 |
+
}
|
400 |
} else {
|
401 |
if ( $answer["correct"] === "correct" ){
|
402 |
$user_answer_class = "qmn_user_correct_answer";
|
406 |
$question_answer_class = "qmn_question_answer_incorrect";
|
407 |
}
|
408 |
}
|
409 |
+
|
410 |
$mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
|
411 |
if( isset( $answer['question_title'] ) && $answer['question_title'] != '' ){
|
412 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b><br />' . htmlspecialchars_decode($answer[0], ENT_QUOTES), $mlw_question_answer_display);
|
413 |
}else{
|
414 |
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
415 |
+
}
|
416 |
$mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
|
417 |
if( isset($answer['question_type']) && $answer['question_type'] == 11 ){
|
418 |
$file_extension = substr($answer[1], -4);
|
420 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
|
421 |
}else{
|
422 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".trim( htmlspecialchars_decode($answer[1], ENT_QUOTES) ).'</span>', $mlw_question_answer_display);
|
423 |
+
}
|
424 |
}else{
|
425 |
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
|
426 |
}
|
427 |
+
$answer_2 = !empty( $answer[2] ) ? $answer[2] : 'NA';
|
428 |
$mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer_2, ENT_QUOTES), $mlw_question_answer_display);
|
429 |
$answer_3 = !empty( $answer[3] ) ? $answer[3] : 'NA';
|
430 |
$mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer_3, $mlw_question_answer_display);
|
503 |
}else{
|
504 |
$category_name = $answer_text[1];
|
505 |
}
|
506 |
+
|
507 |
foreach ($mlw_quiz_array['question_answers_array'] as $answer)
|
508 |
{
|
509 |
if ($answer["category"] == $category_name)
|
515 |
$content = str_replace( '%CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
|
516 |
}else{
|
517 |
$content = str_replace( $answer_text[0] , $return_points, $content);
|
518 |
+
}
|
519 |
}
|
520 |
return $content;
|
521 |
}
|
556 |
$content = str_replace( '%AVERAGE_CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
|
557 |
}else{
|
558 |
$content = str_replace( $answer_text[0] , $return_points, $content);
|
559 |
+
}
|
560 |
}
|
561 |
return $content;
|
562 |
}
|
577 |
$total_questions = 0;
|
578 |
$amount_correct = 0;
|
579 |
while (strpos($content, '%CATEGORY_SCORE%') !== false || false !== strpos($content, '%CATEGORY_SCORE_'))
|
580 |
+
{
|
581 |
$return_score = 0;
|
582 |
$total_questions = 0;
|
583 |
$amount_correct = 0;
|
606 |
{
|
607 |
$return_score = 0;
|
608 |
}
|
609 |
+
|
610 |
if(empty($answer_text)){
|
611 |
$content = str_replace( '%CATEGORY_SCORE_'.$category_name.'%' , $return_score, $content);
|
612 |
}else{
|
613 |
$content = str_replace( $answer_text[0] , $return_score, $content);
|
614 |
+
}
|
615 |
+
|
616 |
}
|
617 |
return $content;
|
618 |
}
|
746 |
}
|
747 |
|
748 |
/**
|
749 |
+
*
|
750 |
* Add iFrame to allowed wp_kses_post tags
|
751 |
*
|
752 |
* @since 7.0.0
|
753 |
+
*
|
754 |
* @param array $tags Allowed tags, attributes, and/or entities.
|
755 |
* @param string $context Context to judge allowed tags by. Allowed values are 'post'.
|
756 |
*
|
779 |
return $tags;
|
780 |
}
|
781 |
|
782 |
+
add_filter( 'wp_kses_allowed_html', 'qsm_custom_wpkses_post_tags', 10, 2 );
|
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: quizsurvey,expresstech
|
3 |
Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress quiz plugin
|
4 |
Requires at least: 4.9
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 7.0.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -121,6 +121,19 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
= 7.0.0 (July 22, 2020) =
|
125 |
* Enhancement: Complete UI overhaul QSM admin view including new Dashboard
|
126 |
* Enhancement: A new wizard to create quizzes effortlessly
|
2 |
Contributors: quizsurvey,expresstech
|
3 |
Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress quiz plugin
|
4 |
Requires at least: 4.9
|
5 |
+
Tested up to: 5.5
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 7.0.1
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= 7.0.1 (August 05, 2020) =
|
125 |
+
* Enhancement: Added option to set items per page while adding questions from question bank.
|
126 |
+
* Enhancement: Hide question description by default or when empty.
|
127 |
+
* Enhancement: Fixed the question number position while displaying questions.
|
128 |
+
* Enhancement: Added new option to skip validations when timer expires.
|
129 |
+
* Enhancement: Redesigned addons setting page.
|
130 |
+
* Enhancement: Renamed the question type for better understanding [Read Documentation](https://quizandsurveymaster.com/docs/v7/questions-tab/#Question-Type).
|
131 |
+
* Bug: Fixed issue with storing results when questions are more than 100.
|
132 |
+
* Bug: Fixed issue with force submit option after timer expiry.
|
133 |
+
* Bug: Fixed incorrect data issue in email when using %QUESTIONS_ANSWERS%.
|
134 |
+
* Bug: Fixed broken layout when editing or adding question.
|
135 |
+
* Bug: Fixed security vulnerability (discovered by Wordfence).
|
136 |
+
|
137 |
= 7.0.0 (July 22, 2020) =
|
138 |
* Enhancement: Complete UI overhaul QSM admin view including new Dashboard
|
139 |
* Enhancement: A new wizard to create quizzes effortlessly
|
@@ -459,19 +459,6 @@ border: 1px solid #e3e3e3;
|
|
459 |
.qsm-results-page .qmn_question_answer{
|
460 |
margin-bottom: 30px;
|
461 |
}
|
462 |
-
.quiz_section .mlw-file-upload-error-msg{
|
463 |
-
color: red;
|
464 |
-
display: block;
|
465 |
-
}
|
466 |
-
|
467 |
-
.quiz_section .remove-uploaded-file{
|
468 |
-
color: red;
|
469 |
-
border: 1px solid red;
|
470 |
-
width: 31px;
|
471 |
-
padding: 5px 5px 0px 5px;
|
472 |
-
display: inline-block;
|
473 |
-
cursor: pointer;
|
474 |
-
}
|
475 |
|
476 |
.page-timer-wrapper{
|
477 |
display: flex;
|
459 |
.qsm-results-page .qmn_question_answer{
|
460 |
margin-bottom: 30px;
|
461 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
|
463 |
.page-timer-wrapper{
|
464 |
display: flex;
|
@@ -68,6 +68,7 @@ $qsm_transients = array(
|
|
68 |
'qsm_sidebar_feed_data',
|
69 |
'qmn_contributors',
|
70 |
'qsm_ads_data',
|
|
|
71 |
);
|
72 |
|
73 |
// Remove the orphaned transients now.
|
68 |
'qsm_sidebar_feed_data',
|
69 |
'qmn_contributors',
|
70 |
'qsm_ads_data',
|
71 |
+
'qsm_admin_dashboard_data'
|
72 |
);
|
73 |
|
74 |
// Remove the orphaned transients now.
|