Version Description
(December 29, 2020) = * Bug: Fixed the inconsistency between no of participants and available results. * Bug: Fixed incorrect pagination in results page. * Bug: Fixed the issue with interchanging of settings while using two quiz on same page. * Bug: Fixed shortcode not working while using rich answer. * Bug: Fixed ID and Class names not showing on result page while using rich answer. * Bug: Fixed selected options not being shown while using Polar question type. * Enhancement: Changed the captcha validation message. * Enhancement: Added the option to round off Score of correct/incorrect answer to a whole number.
Download this release
Release Info
Developer | expresstech |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 7.1.10 |
Comparing to | |
See all releases |
Code changes from version 7.1.9 to 7.1.10
- js/admin.js +15 -0
- js/qsm-quiz.js +167 -181
- mlw_quizmaster2.php +3 -3
- php/classes/class-qmn-quiz-manager.php +18 -13
- php/classes/class-qsm-fields.php +34 -0
- php/classes/class-qsm-install.php +15 -10
- php/question-types.php +7 -6
- php/template-variables.php +189 -45
- readme.txt +12 -2
js/admin.js
CHANGED
@@ -275,6 +275,21 @@ var QSMAdmin;
|
|
275 |
$( '.' + name + '_' + value ).show();
|
276 |
}
|
277 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
if( $('.qsm-text-label-wrapper').length > 0 ){
|
279 |
var element_position = $('.qsm-text-label-wrapper').offset().top;
|
280 |
$(window).scroll(function() {
|
275 |
$( '.' + name + '_' + value ).show();
|
276 |
}
|
277 |
});
|
278 |
+
$(document).on('click', '.qsm_tab_content input[name="system"]', function(){
|
279 |
+
var name = $(this).attr('name');
|
280 |
+
var value = $(this).val();
|
281 |
+
$( '.qsm_hidden_tr_gradingsystem' ).hide();
|
282 |
+
if(value == 0 || value == 3){
|
283 |
+
$( '.qsm_hidden_tr_gradingsystem').show();
|
284 |
+
}
|
285 |
+
});
|
286 |
+
$( document ).ready(function() {
|
287 |
+
var system_option = $("input[type=radio][name='system']:checked").val();
|
288 |
+
$( '.qsm_hidden_tr_gradingsystem' ).hide();
|
289 |
+
if(system_option == 0 || system_option == 3){
|
290 |
+
$( '.qsm_hidden_tr_gradingsystem').show();
|
291 |
+
}
|
292 |
+
});
|
293 |
if( $('.qsm-text-label-wrapper').length > 0 ){
|
294 |
var element_position = $('.qsm-text-label-wrapper').offset().top;
|
295 |
$(window).scroll(function() {
|
js/qsm-quiz.js
CHANGED
@@ -156,26 +156,26 @@ var QSMPageTimer;
|
|
156 |
$timer.text( display );
|
157 |
document.title = display + ' ' + qsmTitleText;
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
|
180 |
// If timer is run out, disable fields.
|
181 |
if ( 0 >= secondsRemaining ) {
|
@@ -188,14 +188,12 @@ var QSMPageTimer;
|
|
188 |
$( ".mlw_answer_number" ).attr( 'readonly', true );
|
189 |
|
190 |
$quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
}
|
198 |
-
//document.quizForm.submit();
|
199 |
return;
|
200 |
}
|
201 |
},
|
@@ -1149,170 +1147,158 @@ jQuery(function() {
|
|
1149 |
}
|
1150 |
});
|
1151 |
|
1152 |
-
// jQuery( '.qmn_quiz_form' ).on( "submit", function( event ) {
|
1153 |
jQuery(document).on( 'click', ".qsm-submit-btn", function( event ) {
|
1154 |
event.preventDefault();
|
1155 |
var form = jQuery(this).closest('form')[0];
|
1156 |
qmnFormSubmit( form.id );
|
1157 |
});
|
1158 |
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
$this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val(obj.file_path);
|
1259 |
-
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide();
|
1260 |
-
}else{
|
1261 |
-
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').text('').text(obj.message);
|
1262 |
-
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').show();
|
1263 |
-
$this.parent('.quiz_section').find('.mlw_answer_file_upload').val('');
|
1264 |
-
}
|
1265 |
-
}
|
1266 |
-
});
|
1267 |
-
return false;
|
1268 |
-
});
|
1269 |
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
|
1317 |
jQuery('.pagetime-goto-nextpage').click(function (e) {
|
1318 |
e.preventDefault();
|
156 |
$timer.text( display );
|
157 |
document.title = display + ' ' + qsmTitleText;
|
158 |
|
159 |
+
/*CUSTOM TIMER*/
|
160 |
+
if(qmn_quiz_data[quizID].hasOwnProperty('advanced_timer') && qmn_quiz_data[quizID].advanced_timer.timer_design == 'big_timer'){
|
161 |
+
$(".second.circle").parent('.mlw_quiz_form').addClass('qsm_big_timer');
|
162 |
+
$(".second.circle").show();
|
163 |
+
$(".second.circle strong").html(display);
|
164 |
+
var datashow =( $(".hiddentimer").html() - secondsRemaining ) / $(".hiddentimer").html();
|
165 |
+
$(".second.circle").circleProgress({
|
166 |
+
startAngle: 11,
|
167 |
+
value: datashow,
|
168 |
+
animation: false,
|
169 |
+
fill: {gradient: ["#00bb40", "#00511c"]}
|
170 |
+
});
|
171 |
+
}
|
172 |
+
|
173 |
+
var $quizForm = QSM.getQuizForm( quizID );
|
174 |
+
var total_seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
175 |
+
var ninety_sec = total_seconds - ( total_seconds * 90 / 100 );
|
176 |
+
if(ninety_sec == secondsRemaining){
|
177 |
+
$quizForm.closest( '.qmn_quiz_container' ).find('.qsm_ninety_warning').fadeIn();
|
178 |
+
}
|
179 |
|
180 |
// If timer is run out, disable fields.
|
181 |
if ( 0 >= secondsRemaining ) {
|
188 |
$( ".mlw_answer_number" ).attr( 'readonly', true );
|
189 |
|
190 |
$quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
|
191 |
+
$quizForm.closest( '.qmn_quiz_container' ).prepend('<p style="color: red;">Quiz time is over</p>');
|
192 |
+
if(qmn_quiz_data[ quizID ].enable_result_after_timer_end == 1){
|
193 |
+
$quizForm.closest( '.qmn_quiz_container' ).find('.qsm-submit-btn').trigger('click');
|
194 |
+
}else{
|
195 |
+
MicroModal.show( 'modal-3' );
|
196 |
+
}
|
|
|
|
|
197 |
return;
|
198 |
}
|
199 |
},
|
1147 |
}
|
1148 |
});
|
1149 |
|
|
|
1150 |
jQuery(document).on( 'click', ".qsm-submit-btn", function( event ) {
|
1151 |
event.preventDefault();
|
1152 |
var form = jQuery(this).closest('form')[0];
|
1153 |
qmnFormSubmit( form.id );
|
1154 |
});
|
1155 |
|
1156 |
+
jQuery(document).on('click', '.btn-reload-quiz', function (e) {
|
1157 |
+
e.preventDefault();
|
1158 |
+
var quiz_id = jQuery(this).data('quiz_id');
|
1159 |
+
var parent_div = jQuery(this).parents('.qsm-quiz-container');
|
1160 |
+
qsmDisplayLoading(parent_div);
|
1161 |
+
jQuery.ajax({
|
1162 |
+
type: 'POST',
|
1163 |
+
url: qmn_ajax_object.ajaxurl,
|
1164 |
+
data: {
|
1165 |
+
action: "qsm_get_quiz_to_reload",
|
1166 |
+
quiz_id: quiz_id,
|
1167 |
+
},
|
1168 |
+
success: function (response) {
|
1169 |
+
parent_div.replaceWith(response);
|
1170 |
+
//Reload the timer and pagination
|
1171 |
+
QSM.init();
|
1172 |
+
qmnInit();
|
1173 |
+
QSM.initTimer(quiz_id);
|
1174 |
+
jQuery("input[name='timer_ms']").each(function () {
|
1175 |
+
var timems = qsmTimeInMS();
|
1176 |
+
jQuery(this).val(timems);
|
1177 |
+
});
|
1178 |
+
setInterval(qmnTimeTakenTimer, 1000);
|
1179 |
+
},
|
1180 |
+
error: function (errorThrown) {
|
1181 |
+
console.log('error');
|
1182 |
+
}
|
1183 |
+
});
|
1184 |
+
});
|
1185 |
|
1186 |
+
jQuery(document).on('change','.qmn_radio_answers input',function(e){
|
1187 |
+
var quizID = jQuery(this).parents('.qsm-quiz-container').find('.qmn_quiz_id').val();
|
1188 |
+
if (qmn_quiz_data[ quizID ].enable_quick_result_mc == 1) {
|
1189 |
+
var question_id = jQuery(this).attr('name').split('question')[1],
|
1190 |
+
value = jQuery(this).val(),
|
1191 |
+
$this = jQuery(this).parents('.quiz_section');
|
1192 |
+
jQuery.ajax({
|
1193 |
+
type: 'POST',
|
1194 |
+
url: qmn_ajax_object.ajaxurl,
|
1195 |
+
data: {
|
1196 |
+
action: "qsm_get_question_quick_result",
|
1197 |
+
question_id: question_id,
|
1198 |
+
answer: value,
|
1199 |
+
show_correct_info: qmn_quiz_data[ quizID ].enable_quick_correct_answer_info
|
1200 |
+
},
|
1201 |
+
success: function (response) {
|
1202 |
+
var data = jQuery.parseJSON(response);
|
1203 |
+
$this.find('.quick-question-res-p').remove();
|
1204 |
+
$this.find('.qsm-inline-correct-info').remove();
|
1205 |
+
if (data.success == 'correct') {
|
1206 |
+
$this.append('<p style="color: green" class="quick-question-res-p">' + qmn_quiz_data[ quizID ].quick_result_correct_answer_text + '</p>')
|
1207 |
+
$this.append('<p class="qsm-inline-correct-info">' + data.message + '</p>');
|
1208 |
+
} else if (data.success == 'incorrect') {
|
1209 |
+
$this.append('<p style="color: red" class="quick-question-res-p">' + qmn_quiz_data[ quizID ].quick_result_wrong_answer_text + '</p>')
|
1210 |
+
$this.append('<p class="qsm-inline-correct-info">' + data.message + '</p>');
|
1211 |
+
}
|
1212 |
+
},
|
1213 |
+
error: function (errorThrown) {
|
1214 |
+
alert(errorThrown);
|
1215 |
+
}
|
1216 |
+
});
|
1217 |
+
}
|
1218 |
+
});
|
1219 |
|
1220 |
+
//Ajax upload file code
|
1221 |
+
jQuery('.quiz_section .mlw_answer_file_upload').on('change', function(){
|
1222 |
+
var $this = jQuery(this);
|
1223 |
+
var hidden_val = jQuery(this).parent('.quiz_section').find('.mlw_file_upload_hidden_path').val();
|
1224 |
+
var file_data = jQuery(this).prop('files')[0];
|
1225 |
+
var form_data = new FormData();
|
1226 |
+
form_data.append('file', file_data);
|
1227 |
+
form_data.append('action', 'qsm_upload_image_fd_question');
|
1228 |
+
var question_id = $this.parent('.quiz_section').find('.mlw_file_upload_hidden_value').attr("name").replace('question','');
|
1229 |
+
form_data.append('question_id', question_id);
|
1230 |
+
$this.next('.loading-uploaded-file').show();
|
1231 |
+
jQuery.ajax({
|
1232 |
+
url: qmn_ajax_object.ajaxurl,
|
1233 |
+
type: 'POST',
|
1234 |
+
data: form_data,
|
1235 |
+
cache: false,
|
1236 |
+
contentType: false,
|
1237 |
+
processData: false,
|
1238 |
+
success: function (response) {
|
1239 |
+
var obj = jQuery.parseJSON(response);
|
1240 |
+
$this.next('.loading-uploaded-file').hide();
|
1241 |
+
if(obj.type == 'success'){
|
1242 |
+
$this.next().next('.remove-uploaded-file').show();
|
1243 |
+
$this.next().next().next('.mlw_file_upload_hidden_value').val(obj.file_url);
|
1244 |
+
$this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val(obj.file_path);
|
1245 |
+
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide();
|
1246 |
+
}else{
|
1247 |
+
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').text('').text(obj.message);
|
1248 |
+
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').show();
|
1249 |
+
$this.parent('.quiz_section').find('.mlw_answer_file_upload').val('');
|
1250 |
+
}
|
1251 |
+
}
|
1252 |
+
});
|
1253 |
+
return false;
|
1254 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1255 |
|
1256 |
+
//Ajax remove file code
|
1257 |
+
jQuery('.quiz_section .remove-uploaded-file').on('click', function(){
|
1258 |
+
var $this = jQuery(this);
|
1259 |
+
var file_data = jQuery(this).parent('.quiz_section').find('.mlw_file_upload_hidden_path').val();
|
1260 |
+
var form_data = new FormData();
|
1261 |
+
form_data.append('action', 'qsm_remove_file_fd_question');
|
1262 |
+
form_data.append('file_url', file_data);
|
1263 |
+
jQuery.ajax({
|
1264 |
+
url: qmn_ajax_object.ajaxurl,
|
1265 |
+
type: 'POST',
|
1266 |
+
data: form_data,
|
1267 |
+
cache: false,
|
1268 |
+
contentType: false,
|
1269 |
+
processData: false,
|
1270 |
+
success: function (response) {
|
1271 |
+
var obj = jQuery.parseJSON(response);
|
1272 |
+
if(obj.type == 'success'){
|
1273 |
+
$this.hide();
|
1274 |
+
$this.parent('.quiz_section').find('.mlw_file_upload_hidden_value').val('');
|
1275 |
+
$this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val('');
|
1276 |
+
$this.parent('.quiz_section').find('.mlw_answer_file_upload').val('');
|
1277 |
+
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide();
|
1278 |
+
}else{
|
1279 |
+
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').text('').text(obj.message);
|
1280 |
+
$this.parent('.quiz_section').find('.mlw-file-upload-error-msg').show();
|
1281 |
+
}
|
1282 |
+
}
|
1283 |
+
});
|
1284 |
+
return false;
|
1285 |
+
});
|
1286 |
|
1287 |
+
//Deselect all answer on select
|
1288 |
+
jQuery('.qsm-deselect-answer').click(function(e){
|
1289 |
+
e.preventDefault();
|
1290 |
+
jQuery(this).parents('.quiz_section').find('input[type="radio"]').prop('checked', false);
|
1291 |
+
jQuery(this).parents('.quiz_section').find('input[type="radio"][value="No Answer Provided"]').prop('checked', true);
|
1292 |
+
jQuery(this).parents('.quiz_section').find('input[type="radio"][value=""]').prop('checked', true);
|
1293 |
+
});
|
1294 |
|
1295 |
+
//Submit the form on popup click
|
1296 |
+
jQuery(document).on( 'click', '.submit-the-form', function(e) {
|
1297 |
+
e.preventDefault();
|
1298 |
+
// Triggger the click event on the quiz form's submit button.
|
1299 |
+
jQuery( '.qsm-submit-btn' ).trigger( 'click' );
|
1300 |
+
jQuery('#modal-3').removeClass('is-open');
|
1301 |
+
});
|
1302 |
|
1303 |
jQuery('.pagetime-goto-nextpage').click(function (e) {
|
1304 |
e.preventDefault();
|
mlw_quizmaster2.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
-
* Version: 7.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.1.
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
@@ -37,7 +37,7 @@ class MLWQuizMasterNext {
|
|
37 |
* @var string
|
38 |
* @since 4.0.0
|
39 |
*/
|
40 |
-
public $version = '7.1.
|
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.1.10
|
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.1.10
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
37 |
* @var string
|
38 |
* @since 4.0.0
|
39 |
*/
|
40 |
+
public $version = '7.1.10';
|
41 |
|
42 |
/**
|
43 |
* QSM Alert Manager Object
|
php/classes/class-qmn-quiz-manager.php
CHANGED
@@ -312,17 +312,22 @@ class QMNQuizManager {
|
|
312 |
}
|
313 |
}
|
314 |
$qmn_json_data = array(
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
$return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
328 |
|
@@ -556,7 +561,7 @@ class QMNQuizManager {
|
|
556 |
wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
|
557 |
wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
|
558 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
559 |
-
wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), '
|
560 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
561 |
global $qmn_total_questions;
|
562 |
$qmn_total_questions = 0;
|
@@ -1316,7 +1321,7 @@ class QMNQuizManager {
|
|
1316 |
// Legacy Code.
|
1317 |
do_action('mlw_qmn_load_results_page', $wpdb->insert_id, $qmn_quiz_options->quiz_settings);
|
1318 |
} else {
|
1319 |
-
$result_display .= '
|
1320 |
}
|
1321 |
|
1322 |
$result_display = str_replace('%FB_RESULT_ID%', $unique_id, $result_display);
|
312 |
}
|
313 |
}
|
314 |
$qmn_json_data = array(
|
315 |
+
'quiz_id' => $qmn_array_for_variables['quiz_id'],
|
316 |
+
'quiz_name' => $qmn_array_for_variables['quiz_name'],
|
317 |
+
'disable_answer' => $qmn_quiz_options->disable_answer_onselect,
|
318 |
+
'ajax_show_correct' => $qmn_quiz_options->ajax_show_correct,
|
319 |
+
'progress_bar' => $qmn_quiz_options->progress_bar,
|
320 |
+
'contact_info_location' => $qmn_quiz_options->contact_info_location,
|
321 |
+
'qpages' => $qpages,
|
322 |
+
'skip_validation_time_expire' => $qmn_quiz_options->skip_validation_time_expire,
|
323 |
+
'timer_limit_val' => $qmn_quiz_options->timer_limit,
|
324 |
+
'disable_scroll_next_previous_click' => $qmn_quiz_options->disable_scroll_next_previous_click,
|
325 |
+
'enable_result_after_timer_end' => isset($qmn_quiz_options->enable_result_after_timer_end) ? $qmn_quiz_options->enable_result_after_timer_end : '',
|
326 |
+
'enable_quick_result_mc' => isset($qmn_quiz_options->enable_quick_result_mc) ? $qmn_quiz_options->enable_quick_result_mc : '',
|
327 |
+
'enable_quick_correct_answer_info' => isset($qmn_quiz_options->enable_quick_correct_answer_info) ? $qmn_quiz_options->enable_quick_correct_answer_info : 0,
|
328 |
+
'quick_result_correct_answer_text' => $qmn_quiz_options->quick_result_correct_answer_text,
|
329 |
+
'quick_result_wrong_answer_text' => $qmn_quiz_options->quick_result_wrong_answer_text,
|
330 |
+
);
|
331 |
|
332 |
$return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
333 |
|
561 |
wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
|
562 |
wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
|
563 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
564 |
+
wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'multicheckbox_limit_reach' => __('Limit of choice is reached.', 'quiz-master-next'), 'out_of_text' => __(' out of ', 'quiz-master-next')));
|
565 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
566 |
global $qmn_total_questions;
|
567 |
$qmn_total_questions = 0;
|
1321 |
// Legacy Code.
|
1322 |
do_action('mlw_qmn_load_results_page', $wpdb->insert_id, $qmn_quiz_options->quiz_settings);
|
1323 |
} else {
|
1324 |
+
$result_display .= apply_filters('qmn_captcha_varification_failed_msg', __('Captcha verification failed.', 'quiz-master-next'), $qmn_quiz_options, $qmn_array_for_variables);
|
1325 |
}
|
1326 |
|
1327 |
$result_display = str_replace('%FB_RESULT_ID%', $unique_id, $result_display);
|
php/classes/class-qsm-fields.php
CHANGED
@@ -481,6 +481,40 @@ class QSM_Fields {
|
|
481 |
</tr>
|
482 |
<?php
|
483 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
|
485 |
}
|
486 |
|
481 |
</tr>
|
482 |
<?php
|
483 |
}
|
484 |
+
/**
|
485 |
+
* Generates checkbox inputs
|
486 |
+
*
|
487 |
+
* @since 7.1.10
|
488 |
+
* @param array $field The array that contains the data for the input field
|
489 |
+
* @param mixed $value The current value of the setting
|
490 |
+
*/
|
491 |
+
public static function generate_checkbox_field( $field, $value ) {
|
492 |
+
$show_option = isset( $field['show_option'] ) ? $field['show_option'] : '';
|
493 |
+
global $mlwQuizMasterNext;
|
494 |
+
$score_roundoff = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'score_roundoff');
|
495 |
+
?>
|
496 |
+
<tr valign="top" <?php if( $show_option ){ echo "class='". $show_option ." hidden qsm_hidden_tr qsm_hidden_tr_gradingsystem'"; } ?>>
|
497 |
+
<th scope="row" class="qsm-opt-tr">
|
498 |
+
<label for="<?php echo $field["id"]; ?>"><?php echo $field["label"]; ?></label>
|
499 |
+
</th>
|
500 |
+
<td>
|
501 |
+
<fieldset class="buttonset buttonset-hide" data-hide='1'>
|
502 |
+
<?php
|
503 |
+
foreach ( $field["options"] as $option ) {
|
504 |
+
?>
|
505 |
+
<input type="checkbox" id="<?php echo $field["id"] . '-' . $option["value"]; ?>" name="<?php echo $field["id"]; ?>" <?php checked( $option["value"], $score_roundoff ); ?> value="<?php echo $option["value"]; ?>" />
|
506 |
+
<br/>
|
507 |
+
<?php
|
508 |
+
}
|
509 |
+
?>
|
510 |
+
</fieldset>
|
511 |
+
<?php if( isset($field['help']) && $field['help'] != ''){ ?>
|
512 |
+
<span class="qsm-opt-desc"><?php echo $field['help']; ?></span>
|
513 |
+
<?php } ?>
|
514 |
+
</td>
|
515 |
+
</tr>
|
516 |
+
<?php
|
517 |
+
}
|
518 |
|
519 |
}
|
520 |
|
php/classes/class-qsm-install.php
CHANGED
@@ -88,6 +88,21 @@ class QSM_Install {
|
|
88 |
'tooltip' => __('To know more about our grading systems please ', 'quiz-master-next') . '<a target="_blank" href="https://quizandsurveymaster.com/docs/">'. __('read the documentation.', 'quiz-master-next') .'</a>',
|
89 |
'show_option' => 'form_type_0'
|
90 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
92 |
|
93 |
// Registers progress_bar setting
|
@@ -824,8 +839,6 @@ class QSM_Install {
|
|
824 |
'%QUIZ_NAME%',
|
825 |
'%QUIZ_LINK%',
|
826 |
'%CURRENT_DATE%',
|
827 |
-
'%FACEBOOK_SHARE%',
|
828 |
-
'%TWITTER_SHARE%'
|
829 |
)
|
830 |
);
|
831 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
@@ -840,8 +853,6 @@ class QSM_Install {
|
|
840 |
'%QUIZ_NAME%',
|
841 |
'%QUIZ_LINK%',
|
842 |
'%CURRENT_DATE%',
|
843 |
-
'%FACEBOOK_SHARE%',
|
844 |
-
'%TWITTER_SHARE%'
|
845 |
)
|
846 |
);
|
847 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
@@ -856,8 +867,6 @@ class QSM_Install {
|
|
856 |
'%QUIZ_NAME%',
|
857 |
'%QUIZ_LINK%',
|
858 |
'%CURRENT_DATE%',
|
859 |
-
'%FACEBOOK_SHARE%',
|
860 |
-
'%TWITTER_SHARE%'
|
861 |
)
|
862 |
);
|
863 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
@@ -886,8 +895,6 @@ class QSM_Install {
|
|
886 |
'%QUIZ_NAME%',
|
887 |
'%QUIZ_LINK%',
|
888 |
'%CURRENT_DATE%',
|
889 |
-
'%FACEBOOK_SHARE%',
|
890 |
-
'%TWITTER_SHARE%'
|
891 |
)
|
892 |
);
|
893 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
@@ -902,8 +909,6 @@ class QSM_Install {
|
|
902 |
'%QUIZ_NAME%',
|
903 |
'%QUIZ_LINK%',
|
904 |
'%CURRENT_DATE%',
|
905 |
-
'%FACEBOOK_SHARE%',
|
906 |
-
'%TWITTER_SHARE%'
|
907 |
)
|
908 |
);
|
909 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
88 |
'tooltip' => __('To know more about our grading systems please ', 'quiz-master-next') . '<a target="_blank" href="https://quizandsurveymaster.com/docs/">'. __('read the documentation.', 'quiz-master-next') .'</a>',
|
89 |
'show_option' => 'form_type_0'
|
90 |
);
|
91 |
+
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
92 |
+
|
93 |
+
// Registers Rounding setting
|
94 |
+
$field_array = array(
|
95 |
+
'id' => 'score_roundoff',
|
96 |
+
'label' => __('Allow Score Round-off', 'quiz-master-next'),
|
97 |
+
'type' => 'checkbox',
|
98 |
+
'options' => array(
|
99 |
+
array(
|
100 |
+
'value' => 1
|
101 |
+
)
|
102 |
+
),
|
103 |
+
'default' => 0,
|
104 |
+
'show_option' => 'form_type_0'
|
105 |
+
);
|
106 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
107 |
|
108 |
// Registers progress_bar setting
|
839 |
'%QUIZ_NAME%',
|
840 |
'%QUIZ_LINK%',
|
841 |
'%CURRENT_DATE%',
|
|
|
|
|
842 |
)
|
843 |
);
|
844 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
853 |
'%QUIZ_NAME%',
|
854 |
'%QUIZ_LINK%',
|
855 |
'%CURRENT_DATE%',
|
|
|
|
|
856 |
)
|
857 |
);
|
858 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
867 |
'%QUIZ_NAME%',
|
868 |
'%QUIZ_LINK%',
|
869 |
'%CURRENT_DATE%',
|
|
|
|
|
870 |
)
|
871 |
);
|
872 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
895 |
'%QUIZ_NAME%',
|
896 |
'%QUIZ_LINK%',
|
897 |
'%CURRENT_DATE%',
|
|
|
|
|
898 |
)
|
899 |
);
|
900 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
909 |
'%QUIZ_NAME%',
|
910 |
'%QUIZ_LINK%',
|
911 |
'%CURRENT_DATE%',
|
|
|
|
|
912 |
)
|
913 |
);
|
914 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
|
php/question-types.php
CHANGED
@@ -124,8 +124,9 @@ function qmn_multiple_choice_display($id, $question, $answers)
|
|
124 |
}else{
|
125 |
$question_display .= "<div class='qmn_mc_answer_wrap' id='question".$id."-".str_replace(" ","-",esc_attr($answer[0]))."'>";
|
126 |
}
|
127 |
-
$question_display .= "<input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='". $answer[0] ."' />
|
128 |
-
|
|
|
129 |
}
|
130 |
}
|
131 |
$question_display .= "<input type='radio' style='display: none;' name='question".$id."' id='question".$id."_none' checked='checked' value='' />";
|
@@ -311,7 +312,7 @@ function qmn_horizontal_multiple_choice_display($id, $question, $answers)
|
|
311 |
$mlw_answer_total++;
|
312 |
if ($answer[0] != "")
|
313 |
{
|
314 |
-
$question_display .= "<span class='mlw_horizontal_choice'><input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='". $answer[0] ."' /><label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label></span>";
|
315 |
}
|
316 |
}
|
317 |
$question_display .= "<input type='radio' style='display: none;' name='question".$id."' id='question".$id."_none' checked='checked' value='' />";
|
@@ -601,7 +602,7 @@ function qmn_multiple_response_display($id, $question, $answers)
|
|
601 |
{
|
602 |
$question_display .= '<div class="qsm_check_answer">';
|
603 |
$question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
|
604 |
-
$question_display .= "<input type='checkbox' " . $limit_mr_text ." name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label>";
|
605 |
$question_display .= '</div>';
|
606 |
}
|
607 |
}
|
@@ -635,7 +636,7 @@ function qmn_multiple_response_review($id, $question, $answers) {
|
|
635 |
for ($i = 1; $i <= $total_answers; $i++) {
|
636 |
if (isset($_POST["question" . $id . "_" . $i]) && sanitize_textarea_field(htmlspecialchars(stripslashes($_POST["question" . $id . "_" . $i]), ENT_QUOTES)) == esc_attr($answer[0])) {
|
637 |
$return_array["points"] += $answer[1];
|
638 |
-
$return_array["user_text"] .=
|
639 |
$return_array["user_compare_text"] .= sanitize_textarea_field(strval(htmlspecialchars_decode($answer[0], ENT_QUOTES))) . "=====";
|
640 |
if ($answer[2] == 1) {
|
641 |
$user_correct += 1;
|
@@ -1009,7 +1010,7 @@ function qmn_horizontal_multiple_response_display($id, $question, $answers)
|
|
1009 |
if ($answer[0] != "")
|
1010 |
{
|
1011 |
$question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
|
1012 |
-
$question_display .= "<span class='mlw_horizontal_multiple'><input type='checkbox' " . $limit_mr_text ." name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)." </label></span>";
|
1013 |
}
|
1014 |
}
|
1015 |
}
|
124 |
}else{
|
125 |
$question_display .= "<div class='qmn_mc_answer_wrap' id='question".$id."-".str_replace(" ","-",esc_attr($answer[0]))."'>";
|
126 |
}
|
127 |
+
$question_display .= "<input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='". $answer[0] ."' />";
|
128 |
+
$question_display .= "<label for='question".$id."_".$mlw_answer_total."'>". trim(do_shortcode(htmlspecialchars_decode($answer[0], ENT_QUOTES)) ) ."</label>";
|
129 |
+
$question_display .= "</div>";
|
130 |
}
|
131 |
}
|
132 |
$question_display .= "<input type='radio' style='display: none;' name='question".$id."' id='question".$id."_none' checked='checked' value='' />";
|
312 |
$mlw_answer_total++;
|
313 |
if ($answer[0] != "")
|
314 |
{
|
315 |
+
$question_display .= "<span class='mlw_horizontal_choice'><input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='". $answer[0] ."' /><label for='question".$id."_".$mlw_answer_total."'>".trim(do_shortcode(htmlspecialchars_decode($answer[0], ENT_QUOTES)) )."</label></span>";
|
316 |
}
|
317 |
}
|
318 |
$question_display .= "<input type='radio' style='display: none;' name='question".$id."' id='question".$id."_none' checked='checked' value='' />";
|
602 |
{
|
603 |
$question_display .= '<div class="qsm_check_answer">';
|
604 |
$question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
|
605 |
+
$question_display .= "<input type='checkbox' " . $limit_mr_text ." name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".trim(do_shortcode(htmlspecialchars_decode($answer[0], ENT_QUOTES)) )."</label>";
|
606 |
$question_display .= '</div>';
|
607 |
}
|
608 |
}
|
636 |
for ($i = 1; $i <= $total_answers; $i++) {
|
637 |
if (isset($_POST["question" . $id . "_" . $i]) && sanitize_textarea_field(htmlspecialchars(stripslashes($_POST["question" . $id . "_" . $i]), ENT_QUOTES)) == esc_attr($answer[0])) {
|
638 |
$return_array["points"] += $answer[1];
|
639 |
+
$return_array["user_text"] .= htmlspecialchars_decode($answer[0], ENT_QUOTES) . ".";
|
640 |
$return_array["user_compare_text"] .= sanitize_textarea_field(strval(htmlspecialchars_decode($answer[0], ENT_QUOTES))) . "=====";
|
641 |
if ($answer[2] == 1) {
|
642 |
$user_correct += 1;
|
1010 |
if ($answer[0] != "")
|
1011 |
{
|
1012 |
$question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
|
1013 |
+
$question_display .= "<span class='mlw_horizontal_multiple'><input type='checkbox' " . $limit_mr_text ." name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".trim(do_shortcode(htmlspecialchars_decode($answer[0], ENT_QUOTES)) )." </label></span>";
|
1014 |
}
|
1015 |
}
|
1016 |
}
|
php/template-variables.php
CHANGED
@@ -230,37 +230,28 @@ function qsm_find_key_from_array($search_value,$array){
|
|
230 |
function mlw_qmn_variable_social_share($content, $mlw_quiz_array) {
|
231 |
global $wpdb, $mlwQuizMasterNext;
|
232 |
$page_link = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
|
|
|
|
|
|
|
233 |
if (false !== strpos($content, '%FACEBOOK_SHARE%')) {
|
234 |
$settings = (array) get_option('qmn-settings');
|
235 |
$facebook_app_id = '483815031724529';
|
236 |
if (isset($settings['facebook_app_id'])) {
|
237 |
$facebook_app_id = esc_js($settings['facebook_app_id']);
|
238 |
}
|
239 |
-
$
|
240 |
-
$
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
$sharing = str_replace("%RESULT_LINK%", $page_link, $sharing);
|
247 |
-
}
|
248 |
-
$sharing = apply_filters('mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
|
249 |
-
$social_display = "<a class='qsm_social_share_link' data-network='facebook' data-text='" . urlencode($sharing) . "' data-link='{$page_link}' data-id='{$facebook_app_id}'><img src='{$fb_image}' alt='" . __('Facebbok Share', 'quiz-master-next') . "' /></a>";
|
250 |
-
$content = str_replace("%FACEBOOK_SHARE%", $social_display, $content);
|
251 |
}
|
252 |
if (false !== strpos($content, '%TWITTER_SHARE%')) {
|
253 |
-
$tw_image = plugins_url('', dirname(__FILE__)
|
254 |
$sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_text', 'twitter_sharing_text', '%QUIZ_NAME%');
|
255 |
-
if (false !== strpos($sharing, '%RESULT_LINK%')) {
|
256 |
-
if (isset($mlw_quiz_array['result_id'])) {
|
257 |
-
$unique_id = $wpdb->get_var("SELECT `unique_id` FROM `{$wpdb->prefix}mlw_results` WHERE `quiz_id`='{$mlw_quiz_array['quiz_id']}' AND `result_id`='{$mlw_quiz_array['result_id']}'");
|
258 |
-
$page_link = add_query_arg('result_id', $unique_id, $page_link);
|
259 |
-
}
|
260 |
-
$sharing = str_replace("%RESULT_LINK%", $page_link, $sharing);
|
261 |
-
}
|
262 |
$sharing = apply_filters('mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
|
263 |
-
$social_display = "<a class
|
264 |
$content = str_replace("%TWITTER_SHARE%", $social_display, $content);
|
265 |
}
|
266 |
return $content;
|
@@ -294,7 +285,10 @@ function mlw_qmn_variable_average_point($content, $mlw_quiz_array){
|
|
294 |
}
|
295 |
}
|
296 |
if (isset($mlw_quiz_array['total_questions']) && $mlw_quiz_array["total_questions"] != 0 && $question_total != 0){
|
297 |
-
|
|
|
|
|
|
|
298 |
}
|
299 |
else
|
300 |
{
|
@@ -586,7 +580,10 @@ function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
|
|
586 |
}
|
587 |
}
|
588 |
if ( $total_questions !== 0 ) {
|
589 |
-
|
|
|
|
|
|
|
590 |
} else {
|
591 |
$return_points = 0;
|
592 |
}
|
@@ -638,7 +635,10 @@ function qmn_variable_category_score($content, $mlw_quiz_array)
|
|
638 |
}
|
639 |
if ($total_questions != 0)
|
640 |
{
|
641 |
-
|
|
|
|
|
|
|
642 |
}
|
643 |
else
|
644 |
{
|
@@ -696,7 +696,10 @@ function qmn_variable_category_average_score($content, $mlw_quiz_array)
|
|
696 |
}
|
697 |
if ($total_categories != 0)
|
698 |
{
|
699 |
-
|
|
|
|
|
|
|
700 |
}
|
701 |
else
|
702 |
{
|
@@ -954,19 +957,27 @@ function qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $qmn_question_
|
|
954 |
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
955 |
}
|
956 |
}
|
957 |
-
} else {
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
}
|
971 |
} else {
|
972 |
if (isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 )) {
|
@@ -979,13 +990,22 @@ function qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $qmn_question_
|
|
979 |
}
|
980 |
}
|
981 |
} else {
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
989 |
}
|
990 |
}
|
991 |
}
|
@@ -1060,3 +1080,127 @@ function qsm_get_question_maximum_points($question = array()) {
|
|
1060 |
}
|
1061 |
return $question_max_point;
|
1062 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
function mlw_qmn_variable_social_share($content, $mlw_quiz_array) {
|
231 |
global $wpdb, $mlwQuizMasterNext;
|
232 |
$page_link = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
|
233 |
+
if (false !== strpos($content, '%FACEBOOK_SHARE%') || false !== strpos($content, '%TWITTER_SHARE%')) {
|
234 |
+
wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( '../../js/qmn_social_share.js' , __FILE__ ) );
|
235 |
+
}
|
236 |
if (false !== strpos($content, '%FACEBOOK_SHARE%')) {
|
237 |
$settings = (array) get_option('qmn-settings');
|
238 |
$facebook_app_id = '483815031724529';
|
239 |
if (isset($settings['facebook_app_id'])) {
|
240 |
$facebook_app_id = esc_js($settings['facebook_app_id']);
|
241 |
}
|
242 |
+
$url = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
|
243 |
+
$page_link = $url . '?result_id=' . '%FB_RESULT_ID%';
|
244 |
+
$sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '%QUIZ_NAME%' );
|
245 |
+
$sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
|
246 |
+
$fb_image = plugins_url('', dirname(__FILE__) ) . '/assets/facebook.png';
|
247 |
+
$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', 'quiz-master-next') . "' /></a>";
|
248 |
+
$content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
250 |
if (false !== strpos($content, '%TWITTER_SHARE%')) {
|
251 |
+
$tw_image = plugins_url('', dirname(__FILE__)) . '/assets/twitter.png';
|
252 |
$sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_text', 'twitter_sharing_text', '%QUIZ_NAME%');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
$sharing = apply_filters('mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
|
254 |
+
$social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '" . esc_js($sharing) . "', '" . esc_js($mlw_quiz_array["quiz_name"]) . "');\"><img src='" . $tw_image . "' alt='" . __('Twitter Share', 'quiz-master-next') . "' /></a>";
|
255 |
$content = str_replace("%TWITTER_SHARE%", $social_display, $content);
|
256 |
}
|
257 |
return $content;
|
285 |
}
|
286 |
}
|
287 |
if (isset($mlw_quiz_array['total_questions']) && $mlw_quiz_array["total_questions"] != 0 && $question_total != 0){
|
288 |
+
if(qsm_is_allow_score_roundoff())
|
289 |
+
$mlw_average_points = round($mlw_quiz_array["total_points"]/$question_total);
|
290 |
+
else
|
291 |
+
$mlw_average_points = round($mlw_quiz_array["total_points"]/$question_total, 2);
|
292 |
}
|
293 |
else
|
294 |
{
|
580 |
}
|
581 |
}
|
582 |
if ( $total_questions !== 0 ) {
|
583 |
+
if(qsm_is_allow_score_roundoff())
|
584 |
+
$return_points = round( $return_points / $total_questions);
|
585 |
+
else
|
586 |
+
$return_points = round( $return_points / $total_questions, 2 );
|
587 |
} else {
|
588 |
$return_points = 0;
|
589 |
}
|
635 |
}
|
636 |
if ($total_questions != 0)
|
637 |
{
|
638 |
+
if(qsm_is_allow_score_roundoff())
|
639 |
+
$return_score = round((($amount_correct/$total_questions)*100));
|
640 |
+
else
|
641 |
+
$return_score = round((($amount_correct/$total_questions)*100), 2);
|
642 |
}
|
643 |
else
|
644 |
{
|
696 |
}
|
697 |
if ($total_categories != 0)
|
698 |
{
|
699 |
+
if(qsm_is_allow_score_roundoff())
|
700 |
+
$return_score = round((($total_score/$total_categories)*100));
|
701 |
+
else
|
702 |
+
$return_score = round((($total_score/$total_categories)*100), 2);
|
703 |
}
|
704 |
else
|
705 |
{
|
957 |
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
958 |
}
|
959 |
}
|
960 |
+
} else {
|
961 |
+
if($answer['question_type'] == 13)
|
962 |
+
{
|
963 |
+
$questionid = $questions[$answer['id']]['question_id'];
|
964 |
+
$question_with_answer_text .= qmn_polar_display_on_resultspage($questionid, $questions, $total_answers,$answer);
|
965 |
+
}
|
966 |
+
else
|
967 |
+
{
|
968 |
+
foreach ($total_answers as $single_answer) {
|
969 |
+
$single_answer_option = $single_answer[0];
|
970 |
+
if (isset($single_answer[2]) && $single_answer[2] == 1 && htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer_option ) {
|
971 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
972 |
+
} else if (isset($single_answer[2]) && $single_answer[2] == 1) {
|
973 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
974 |
+
} else if (htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer_option && $single_answer[2] !== 1) {
|
975 |
+
$question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
976 |
+
} else {
|
977 |
+
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
978 |
+
}
|
979 |
+
}
|
980 |
+
}
|
981 |
}
|
982 |
} else {
|
983 |
if (isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 )) {
|
990 |
}
|
991 |
}
|
992 |
} else {
|
993 |
+
if($answer['question_type'] == 13)
|
994 |
+
{
|
995 |
+
$questionid = $questions[$answer['id']]['question_id'];
|
996 |
+
|
997 |
+
$question_with_answer_text .= qmn_polar_display_on_resultspage($questionid, $questions, $total_answers,$answer);
|
998 |
+
}
|
999 |
+
else
|
1000 |
+
{
|
1001 |
+
foreach ($total_answers as $single_answer) {
|
1002 |
+
if (htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0]) {
|
1003 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
1004 |
+
} else {
|
1005 |
+
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
1006 |
+
}
|
1007 |
+
}
|
1008 |
+
}
|
1009 |
}
|
1010 |
}
|
1011 |
}
|
1080 |
}
|
1081 |
return $question_max_point;
|
1082 |
}
|
1083 |
+
/**
|
1084 |
+
* check is allow round off
|
1085 |
+
*
|
1086 |
+
* @since 7.1.10
|
1087 |
+
*/
|
1088 |
+
function qsm_is_allow_score_roundoff()
|
1089 |
+
{
|
1090 |
+
global $mlwQuizMasterNext;
|
1091 |
+
$score_roundoff = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'score_roundoff');
|
1092 |
+
$form_type = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'form_type');
|
1093 |
+
$system = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'system');
|
1094 |
+
|
1095 |
+
// check if quiz type Quiz and Geading system Correct/Incorrect Or Both Type
|
1096 |
+
if($score_roundoff && $form_type ==0 && ($system ==0 || $system == 3))
|
1097 |
+
return 1;
|
1098 |
+
else
|
1099 |
+
return 0;
|
1100 |
+
}
|
1101 |
+
/**
|
1102 |
+
* Display Polor Question on Result page
|
1103 |
+
*
|
1104 |
+
* @params $id The ID of the multiple choice question
|
1105 |
+
* @params $question The question that is being edited.
|
1106 |
+
* @params @answers The array that contains the answers to the question.
|
1107 |
+
* @params @answer The array that contains the answers choose by user.
|
1108 |
+
* @return $question_display Returns the content of the question
|
1109 |
+
* @since 7.1.10
|
1110 |
+
*/
|
1111 |
+
function qmn_polar_display_on_resultspage($id, $question, $answers,$answer) {
|
1112 |
+
$question_display = '';
|
1113 |
+
global $mlwQuizMasterNext;
|
1114 |
+
$required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
|
1115 |
+
$autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
|
1116 |
+
$limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_text');
|
1117 |
+
$autofill_att = $autofill ? "autocomplete='off' " : '';
|
1118 |
+
$limit_text_att = $limit_text ? "maxlength='" . $limit_text . "' " : '';
|
1119 |
+
$input_text = '';
|
1120 |
+
$first_point = isset($answers[0][1]) ? $answers[0][1] : 0;
|
1121 |
+
$second_point = isset($answers[1][1]) ? $answers[1][1] : 0;
|
1122 |
+
$is_reverse = false;
|
1123 |
+
$check_point = $second_point;
|
1124 |
+
$font_weight_lc = 'right-polar-title';
|
1125 |
+
$font_weight_rc = 'left-polar-title';
|
1126 |
+
if($first_point > $second_point){
|
1127 |
+
$is_reverse = true;
|
1128 |
+
$check_point = $first_point;
|
1129 |
+
$font_weight_lc = 'left-polar-title';
|
1130 |
+
$font_weight_rc = 'right-polar-title';
|
1131 |
+
}
|
1132 |
+
$total_answer = count($answers);
|
1133 |
+
?>
|
1134 |
+
<script type="text/javascript">
|
1135 |
+
(function($) {
|
1136 |
+
$(document).ready(function() {
|
1137 |
+
|
1138 |
+
$('#slider-' + '<?php echo $id; ?>').slider({
|
1139 |
+
<?php if ($total_answer == 2 && $is_reverse) { ?>
|
1140 |
+
max: <?php echo $answers[0][1]; ?>,
|
1141 |
+
min: <?php echo $answers[1][1]; ?>,
|
1142 |
+
isRTL: true,
|
1143 |
+
<?php }else{ ?>
|
1144 |
+
min: <?php echo $answers[0][1]; ?>,
|
1145 |
+
max: <?php echo $answers[1][1]; ?>,
|
1146 |
+
<?php } ?>
|
1147 |
+
step: 1,
|
1148 |
+
range: false,
|
1149 |
+
value: <?php echo $answer['points']; ?>,
|
1150 |
+
slide: function slider_slide(event, ui) {
|
1151 |
+
return false; // this code not allow to dragging
|
1152 |
+
}
|
1153 |
+
});
|
1154 |
+
var maxHeight = Math.max.apply(null, $(".mlw-qmn-question-result-<?php echo $id; ?>> div").map(function (){
|
1155 |
+
return $(this).height();
|
1156 |
+
}).get());
|
1157 |
+
$('.mlw-qmn-question-result-<?php echo $id; ?>').height(maxHeight);
|
1158 |
+
});
|
1159 |
+
})(jQuery);
|
1160 |
+
</script>
|
1161 |
+
<?php
|
1162 |
+
if ($required == 0) {
|
1163 |
+
$mlw_requireClass = "mlwRequiredText";
|
1164 |
+
} else {
|
1165 |
+
$mlw_requireClass = "";
|
1166 |
+
}
|
1167 |
+
if($answer['points'] == $answers[0][1])
|
1168 |
+
{
|
1169 |
+
$left_polar_title_style = "style='font-weight:900;'";
|
1170 |
+
$right_polar_title_style = "style='font-weight:100';";
|
1171 |
+
}
|
1172 |
+
else if($answer['points'] == $answers[0][1])
|
1173 |
+
{
|
1174 |
+
$left_polar_title_style = "style='font-weight:100;'";
|
1175 |
+
$right_polar_title_style = "style='font-weight:900;'";
|
1176 |
+
}
|
1177 |
+
else if($answer['points'] == $check_point / 2)
|
1178 |
+
{
|
1179 |
+
$left_polar_title_style = "style='font-weight:400;'";
|
1180 |
+
$right_polar_title_style = "style='font-weight400;'";
|
1181 |
+
}
|
1182 |
+
else if($answer['points'] > $check_point / 2)
|
1183 |
+
{
|
1184 |
+
$left_polar_title_style = "style='font-weight:400;'";
|
1185 |
+
$right_polar_title_style = "style='font-weight:600;'";
|
1186 |
+
}
|
1187 |
+
else if($answer['points'] < $check_point / 2)
|
1188 |
+
{
|
1189 |
+
$left_polar_title_style = "style='font-weight:600;'";
|
1190 |
+
$right_polar_title_style = "style='font-weight:400;'";
|
1191 |
+
}
|
1192 |
+
else
|
1193 |
+
{
|
1194 |
+
$left_polar_title_style = "style='font-weight:400;'";
|
1195 |
+
$right_polar_title_style = "style='font-weight:400;'";
|
1196 |
+
}
|
1197 |
+
$new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
|
1198 |
+
$question_title = qsm_question_title_func($question, '', $new_question_title);
|
1199 |
+
$input_text .= "<div class='left-polar-title' $left_polar_title_style>" . $answers[0][0] ."</div>";
|
1200 |
+
$input_text .= "<div class='slider-main-wrapper'><input type='hidden' class='qmn_polar $mlw_requireClass' id='question" . $id . "' name='question" . $id . "' />";
|
1201 |
+
$input_text .= '<div id="slider-'. $id .'"></div></div>';
|
1202 |
+
$input_text .= "<div class='right-polar-title' $right_polar_title_style>" . $answers[1][0] . "</div>";
|
1203 |
+
$question = $input_text;
|
1204 |
+
$question_display .= "<span class='mlw_qmn_question mlw-qmn-question-result-$id question-type-polar-s'>" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . "</span>";;
|
1205 |
+
return apply_filters('qmn_polar_display_front', $question_display, $id, $question, $answers);
|
1206 |
+
}
|
readme.txt
CHANGED
@@ -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.1.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -135,6 +135,16 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
|
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
= 7.1.9 (December 14, 2020) =
|
139 |
* Bug: Fixed the issue where answers with apostrophe's are not being recognized as correct.
|
140 |
* Bug: Fixed the issue where inline are shown twice when Random Questions are enabled.
|
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
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 7.1.10
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 7.1.10 (December 29, 2020) =
|
139 |
+
* Bug: Fixed the inconsistency between no of participants and available results.
|
140 |
+
* Bug: Fixed incorrect pagination in results page.
|
141 |
+
* Bug: Fixed the issue with interchanging of settings while using two quiz on same page.
|
142 |
+
* Bug: Fixed shortcode not working while using rich answer.
|
143 |
+
* Bug: Fixed ID and Class names not showing on result page while using rich answer.
|
144 |
+
* Bug: Fixed selected options not being shown while using Polar question type.
|
145 |
+
* Enhancement: Changed the captcha validation message.
|
146 |
+
* Enhancement: Added the option to round off Score of correct/incorrect answer to a whole number.
|
147 |
+
|
148 |
= 7.1.9 (December 14, 2020) =
|
149 |
* Bug: Fixed the issue where answers with apostrophe's are not being recognized as correct.
|
150 |
* Bug: Fixed the issue where inline are shown twice when Random Questions are enabled.
|