Version Description
(September 22, 2020) = * Bug: Fixed issues when email templates were not showing if classic editor was disabled. * Bug: Fixed the issue of Certificate Addon link not showing in admin result detail page issue. * Bug: Fixed point score calculation issue for rich answers. * Bug: Fixed the issue of question title not showing on front while using captcha question type. * Bug: Fixed the issue of Comment Field showing placeholder text when the comment field is blank. * Bug: Removed unnecessary gap between question and answers in quiz result page. * Bug: Fixed the issue of text showing in the next line on mobile while using Fill in the blank question type. * Bug: Fixed the issue of apostrophes showing backslash in email content. * Bug: Fixed the issue of cloning of the question which was creating a blank answer * Bug: Fixed conflict between %QUESTION_ANSWER_X% variable and Extra Template Variables. * Bug: Fixed %QUESTION_ANSWER_X% variable content issue in email. * Enhancement: Implemented %CORRECT_SCORE% template variable score to round figure. * Enhancement: Added the option to disable scroll on click of next and previous button. * Enhancement: Added the option of Deleting a question from question bank while deleting the quiz. * Enhancement: Added a message when multiple choice limits are reached while using Multiple Response and Horizontal Multiple Response question type.
Release Info
Developer | expresstech |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 7.1.3 |
Comparing to | |
See all releases |
Code changes from version 7.1.2 to 7.1.3
- css/common.css +11 -0
- css/qsm-admin-question.css +6 -0
- js/qsm-admin-emails.js +18 -10
- js/qsm-admin-question.js +38 -1
- js/qsm-quiz.js +15 -7
- mlw_quizmaster2.php +3 -3
- php/admin/admin-results-details-page.php +2 -2
- php/admin/functions.php +18 -0
- php/admin/options-page-email-tab.php +2 -0
- php/admin/options-page-questions-tab.php +35 -0
- php/admin/quizzes-page.php +5 -1
- php/classes/class-qmn-quiz-creator.php +6 -2
- php/classes/class-qmn-quiz-manager.php +12 -9
- php/classes/class-qsm-install.php +20 -0
- php/question-types.php +65 -34
- php/rest-api.php +2 -2
- php/template-variables.php +225 -217
- readme.txt +18 -1
@@ -234,6 +234,17 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover{
|
|
234 |
.qmn_quiz_container.qsm_auto_pagination_enabled .quiz_section:not(.quiz_begin) {
|
235 |
display: none;
|
236 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
@media screen and (max-width: 767px){
|
238 |
.question-type-polar-s .left-polar-title,
|
239 |
.question-type-polar-s .slider-main-wrapper,
|
234 |
.qmn_quiz_container.qsm_auto_pagination_enabled .quiz_section:not(.quiz_begin) {
|
235 |
display: none;
|
236 |
}
|
237 |
+
.quiz_section input[type="text"].qmn_fill_blank{
|
238 |
+
display: inline-block;
|
239 |
+
}
|
240 |
+
.qmn_quiz_container .mlw_previous{
|
241 |
+
margin-bottom: 15px;
|
242 |
+
}
|
243 |
+
.multi-checkbox-limit-reach{
|
244 |
+
color: red;
|
245 |
+
margin-top: 5px;
|
246 |
+
display: inline-block;
|
247 |
+
}
|
248 |
@media screen and (max-width: 767px){
|
249 |
.question-type-polar-s .left-polar-title,
|
250 |
.question-type-polar-s .slider-main-wrapper,
|
@@ -163,6 +163,9 @@
|
|
163 |
#qsm-import-selected-question{
|
164 |
margin-right: 30px;
|
165 |
}
|
|
|
|
|
|
|
166 |
|
167 |
.question-bank-question div {
|
168 |
margin: 0 10px;
|
@@ -654,6 +657,9 @@ a#qsm-category-add-toggle {
|
|
654 |
.qsm-show-question-desc-box span.dashicons{
|
655 |
line-height: 29px;
|
656 |
}
|
|
|
|
|
|
|
657 |
@media screen and (max-width: 575px){
|
658 |
.qsm-popup__container{
|
659 |
min-width: auto;
|
163 |
#qsm-import-selected-question{
|
164 |
margin-right: 30px;
|
165 |
}
|
166 |
+
#qsm-delete-selected-question{
|
167 |
+
margin-right: 10px;
|
168 |
+
}
|
169 |
|
170 |
.question-bank-question div {
|
171 |
margin: 0 10px;
|
657 |
.qsm-show-question-desc-box span.dashicons{
|
658 |
line-height: 29px;
|
659 |
}
|
660 |
+
#modal-2 .qsm-popup__container{
|
661 |
+
max-width: 900px;
|
662 |
+
}
|
663 |
@media screen and (max-width: 575px){
|
664 |
.qsm-popup__container{
|
665 |
min-width: auto;
|
@@ -11,11 +11,17 @@ var QSMAdminEmails;
|
|
11 |
var emails = [];
|
12 |
var email = {};
|
13 |
$( '.qsm-email' ).each( function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
email = {
|
15 |
'conditions': [],
|
16 |
'to': $( this ).find( '.to-email' ).val(),
|
17 |
'subject': $( this ).find( '.subject' ).val(),
|
18 |
-
'content':
|
19 |
'replyTo': $( this ).find( '.reply-to' ).prop( 'checked' ),
|
20 |
};
|
21 |
$( this ).find( '.email-condition' ).each( function() {
|
@@ -83,15 +89,17 @@ var QSMAdminEmails;
|
|
83 |
condition.value
|
84 |
);
|
85 |
});
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
95 |
},
|
96 |
newEmail: function() {
|
97 |
var conditions = [{
|
11 |
var emails = [];
|
12 |
var email = {};
|
13 |
$( '.qsm-email' ).each( function() {
|
14 |
+
var email_content = '';
|
15 |
+
if( $( this ).find( '.email-template' ).parent('.wp-editor-container').length > 0 ){
|
16 |
+
email_content = wp.editor.getContent( $( this ).find( '.email-template' ).attr( 'id' ) );
|
17 |
+
} else {
|
18 |
+
email_content = $( this ).find( '.email-template' ).val()
|
19 |
+
}
|
20 |
email = {
|
21 |
'conditions': [],
|
22 |
'to': $( this ).find( '.to-email' ).val(),
|
23 |
'subject': $( this ).find( '.subject' ).val(),
|
24 |
+
'content': email_content,
|
25 |
'replyTo': $( this ).find( '.reply-to' ).prop( 'checked' ),
|
26 |
};
|
27 |
$( this ).find( '.email-condition' ).each( function() {
|
89 |
condition.value
|
90 |
);
|
91 |
});
|
92 |
+
if(qsmEmailsObject.qsm_user_ve === 'true'){
|
93 |
+
var settings = {
|
94 |
+
mediaButtons: true,
|
95 |
+
tinymce: {
|
96 |
+
forced_root_block : '',
|
97 |
+
toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo'
|
98 |
+
},
|
99 |
+
quicktags: true,
|
100 |
+
};
|
101 |
+
wp.editor.initialize( 'email-template-' + QSMAdminEmails.total, settings );
|
102 |
+
}
|
103 |
},
|
104 |
newEmail: function() {
|
105 |
var conditions = [{
|
@@ -125,6 +125,7 @@ var import_button;
|
|
125 |
}
|
126 |
if(pagination.current_page == 1){
|
127 |
$( '#question-bank' ).prepend('<button class="button button-primary" id="qsm-import-selected-question">Import All Selected Questions</button>');
|
|
|
128 |
$( '#question-bank' ).prepend('<label class="qsm-select-all-label"><input type="checkbox" id="qsm_select_all_question" /> Select All Question</button>');
|
129 |
}
|
130 |
},
|
@@ -295,7 +296,9 @@ var import_button;
|
|
295 |
QSMQuestion.addQuestionToPage( model );
|
296 |
QSMQuestion.openEditPopup( model.id, $( '.question[data-question-id=' + model.id + ']' ).find('.edit-question-button') );
|
297 |
QSMQuestion.countTotal();
|
298 |
-
$('#
|
|
|
|
|
299 |
},
|
300 |
addQuestionToPage: function( model ) {
|
301 |
var page = model.get( 'page' ) + 1;
|
@@ -778,6 +781,40 @@ var import_button;
|
|
778 |
$('#question-bank').find('[name="qsm-question-checkbox[]"]').attr('checked',false);
|
779 |
}
|
780 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
781 |
|
782 |
//Select all button.
|
783 |
$( document ).on( 'change', '#qsm_select_all_question', function( event) {
|
125 |
}
|
126 |
if(pagination.current_page == 1){
|
127 |
$( '#question-bank' ).prepend('<button class="button button-primary" id="qsm-import-selected-question">Import All Selected Questions</button>');
|
128 |
+
$( '#question-bank' ).prepend('<button class="button button-default" id="qsm-delete-selected-question">Delete Selected Question from Bank</button>');
|
129 |
$( '#question-bank' ).prepend('<label class="qsm-select-all-label"><input type="checkbox" id="qsm_select_all_question" /> Select All Question</button>');
|
130 |
}
|
131 |
},
|
296 |
QSMQuestion.addQuestionToPage( model );
|
297 |
QSMQuestion.openEditPopup( model.id, $( '.question[data-question-id=' + model.id + ']' ).find('.edit-question-button') );
|
298 |
QSMQuestion.countTotal();
|
299 |
+
if( $('#answers').find('.answers-single').length == 0 ){
|
300 |
+
$('#new-answer-button').trigger('click');
|
301 |
+
}
|
302 |
},
|
303 |
addQuestionToPage: function( model ) {
|
304 |
var page = model.get( 'page' ) + 1;
|
781 |
$('#question-bank').find('[name="qsm-question-checkbox[]"]').attr('checked',false);
|
782 |
}
|
783 |
});
|
784 |
+
//Delete question from question bank
|
785 |
+
$( '.qsm-popup-bank' ).on( 'click', '#qsm-delete-selected-question', function( event) {
|
786 |
+
if( confirm( 'are you sure?' ) ){
|
787 |
+
var $total_selction = $('#question-bank').find('[name="qsm-question-checkbox[]"]:checked').length;
|
788 |
+
if($total_selction === 0){
|
789 |
+
alert('No question is selected.');
|
790 |
+
}else{
|
791 |
+
$.fn.reverse = [].reverse;
|
792 |
+
var question_ids = $($('#question-bank').find('[name="qsm-question-checkbox[]"]:checked').parents('.question-bank-question').reverse()).map(function() {
|
793 |
+
return $( this ).data( 'question-id' );
|
794 |
+
}).get().join(',');
|
795 |
+
if( question_ids ){
|
796 |
+
$.ajax( {
|
797 |
+
url: ajaxurl,
|
798 |
+
method: 'POST',
|
799 |
+
data: {
|
800 |
+
'action' : 'qsm_delete_question_question_bank',
|
801 |
+
'question_ids': question_ids,
|
802 |
+
'nonce': qsmQuestionSettings.question_bank_nonce
|
803 |
+
},
|
804 |
+
success: function(response) {
|
805 |
+
var data = jQuery.parseJSON( response );
|
806 |
+
if( data.success === true ){
|
807 |
+
$('#question-bank').find('[name="qsm-question-checkbox[]"]:checked').parents('.question-bank-question').slideUp('slow');
|
808 |
+
alert( data.message );
|
809 |
+
} else {
|
810 |
+
alert( data.message );
|
811 |
+
}
|
812 |
+
}
|
813 |
+
} );
|
814 |
+
}
|
815 |
+
}
|
816 |
+
}
|
817 |
+
});
|
818 |
|
819 |
//Select all button.
|
820 |
$( document ).on( 'change', '#qsm_select_all_question', function( event) {
|
@@ -305,14 +305,18 @@ var QSMPageTimer;
|
|
305 |
$quizForm.find( '.qsm-pagination .qsm-next' ).on( 'click', function( event ) {
|
306 |
event.preventDefault();
|
307 |
QSM.nextPage( quizID );
|
308 |
-
var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
|
309 |
-
|
|
|
|
|
310 |
});
|
311 |
$quizForm.find( '.qsm-pagination .qsm-previous' ).on( 'click', function( event ) {
|
312 |
event.preventDefault();
|
313 |
QSM.prevPage( quizID );
|
314 |
var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
|
315 |
-
|
|
|
|
|
316 |
});
|
317 |
}
|
318 |
},
|
@@ -614,6 +618,11 @@ 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 |
}
|
618 |
}
|
619 |
|
@@ -923,9 +932,8 @@ function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
|
|
923 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.slide_number_hidden' ).val( slide_number );
|
924 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.previous_amount_hidden' ).val( 0 );
|
925 |
|
926 |
-
qmnUpdatePageNumber( 1, quiz_form_id );
|
927 |
-
|
928 |
-
if (go_to_top == 1) {
|
929 |
qsmScrollTo( $container );
|
930 |
}
|
931 |
var page_number = slide_number - pagination;
|
@@ -997,7 +1005,7 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
|
|
997 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.slide_number_hidden' ).val( slide_number );
|
998 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.previous_amount_hidden' ).val( 0 );
|
999 |
|
1000 |
-
if (go_to_top == 1) {
|
1001 |
qsmScrollTo( $container );
|
1002 |
}
|
1003 |
var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
|
305 |
$quizForm.find( '.qsm-pagination .qsm-next' ).on( 'click', function( event ) {
|
306 |
event.preventDefault();
|
307 |
QSM.nextPage( quizID );
|
308 |
+
var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
|
309 |
+
if( qmn_quiz_data[ quizID ].disable_scroll_next_previous_click != 1 ){
|
310 |
+
qsmScrollTo( $container );
|
311 |
+
}
|
312 |
});
|
313 |
$quizForm.find( '.qsm-pagination .qsm-previous' ).on( 'click', function( event ) {
|
314 |
event.preventDefault();
|
315 |
QSM.prevPage( quizID );
|
316 |
var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
|
317 |
+
if( qmn_quiz_data[ quizID ].disable_scroll_next_previous_click != 1 ){
|
318 |
+
qsmScrollTo( $container );
|
319 |
+
}
|
320 |
});
|
321 |
}
|
322 |
},
|
618 |
var checked = jQuery(event).parents('.quiz_section').find(':checkbox:checked').length;
|
619 |
if (checked > limit) {
|
620 |
event.checked = false;
|
621 |
+
if( jQuery(event).parents('.quiz_section').find('.multi-checkbox-limit-reach').length == 0 ){
|
622 |
+
jQuery(event).parents('.quiz_section').append('<span class="multi-checkbox-limit-reach">'+ qmn_ajax_object.multicheckbox_limit_reach +'</span>');
|
623 |
+
}
|
624 |
+
} else {
|
625 |
+
jQuery(event).parents('.quiz_section').find('.multi-checkbox-limit-reach').remove();
|
626 |
}
|
627 |
}
|
628 |
|
932 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.slide_number_hidden' ).val( slide_number );
|
933 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.previous_amount_hidden' ).val( 0 );
|
934 |
|
935 |
+
qmnUpdatePageNumber( 1, quiz_form_id );
|
936 |
+
if (go_to_top == 1 && qmn_quiz_data[ quiz_id ].disable_scroll_next_previous_click != 1 ) {
|
|
|
937 |
qsmScrollTo( $container );
|
938 |
}
|
939 |
var page_number = slide_number - pagination;
|
1005 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.slide_number_hidden' ).val( slide_number );
|
1006 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.previous_amount_hidden' ).val( 0 );
|
1007 |
|
1008 |
+
if (go_to_top == 1 && qmn_quiz_data[ quiz_id ].disable_scroll_next_previous_click != 1 ) {
|
1009 |
qsmScrollTo( $container );
|
1010 |
}
|
1011 |
var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
|
@@ -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.3
|
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.3
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
37 |
* @var string
|
38 |
* @since 4.0.0
|
39 |
*/
|
40 |
+
public $version = '7.1.3';
|
41 |
|
42 |
/**
|
43 |
* QSM Alert Manager Object
|
@@ -15,7 +15,7 @@ function qsm_generate_result_details() {
|
|
15 |
wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
|
16 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
17 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'results';
|
18 |
-
$tab_array = $mlwQuizMasterNext->pluginHelper->get_results_tabs();
|
19 |
?>
|
20 |
<style>
|
21 |
.prettyprint {
|
@@ -24,7 +24,7 @@ function qsm_generate_result_details() {
|
|
24 |
</style>
|
25 |
<div class="wrap">
|
26 |
<h2 style="display: none;"><?php _e('Quiz Results', 'quiz-master-next'); ?></h2>
|
27 |
-
<h2 class="nav-tab-wrapper"
|
28 |
<?php
|
29 |
foreach( $tab_array as $tab ) {
|
30 |
$active_class = '';
|
15 |
wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
|
16 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
17 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'results';
|
18 |
+
$tab_array = $mlwQuizMasterNext->pluginHelper->get_results_tabs();
|
19 |
?>
|
20 |
<style>
|
21 |
.prettyprint {
|
24 |
</style>
|
25 |
<div class="wrap">
|
26 |
<h2 style="display: none;"><?php _e('Quiz Results', 'quiz-master-next'); ?></h2>
|
27 |
+
<h2 class="nav-tab-wrapper">
|
28 |
<?php
|
29 |
foreach( $tab_array as $tab ) {
|
30 |
$active_class = '';
|
@@ -106,6 +106,24 @@ function qsm_add_author_column_in_db() {
|
|
106 |
}
|
107 |
update_option('qsm_update_result_db_column_datatype', '1');
|
108 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
|
106 |
}
|
107 |
update_option('qsm_update_result_db_column_datatype', '1');
|
108 |
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Add new column in question table
|
112 |
+
* @since 7.0.3
|
113 |
+
*/
|
114 |
+
if( get_option('qsm_add_new_column_question_table_table', '1') <= 3 ){
|
115 |
+
$total_count_val = get_option('qsm_add_new_column_question_table_table', '1');
|
116 |
+
global $wpdb;
|
117 |
+
$question_table_name = $wpdb->prefix . "mlw_questions";
|
118 |
+
$table_result_col_obj = $wpdb->get_results( $wpdb->prepare(
|
119 |
+
'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ', $wpdb->dbname, $question_table_name, 'deleted_question_bank'
|
120 |
+
) );
|
121 |
+
if ( empty( $table_result_col_obj ) ) {
|
122 |
+
$wpdb->query("ALTER TABLE $question_table_name ADD deleted_question_bank INT NOT NULL");
|
123 |
+
}
|
124 |
+
$inc_val = $total_count_val + 1;
|
125 |
+
update_option('qsm_add_new_column_question_table_table', $inc_val);
|
126 |
+
}
|
127 |
}
|
128 |
|
129 |
|
@@ -31,9 +31,11 @@ function qsm_options_emails_tab_content() {
|
|
31 |
global $wpdb;
|
32 |
global $mlwQuizMasterNext;
|
33 |
$quiz_id = intval( $_GET['quiz_id'] );
|
|
|
34 |
$js_data = array(
|
35 |
'quizID' => $quiz_id,
|
36 |
'nonce' => wp_create_nonce( 'wp_rest' ),
|
|
|
37 |
);
|
38 |
wp_enqueue_script( 'qsm_emails_admin_script', plugins_url( '../../js/qsm-admin-emails.js', __FILE__ ), array( 'jquery-ui-sortable', 'qmn_admin_js' ), $mlwQuizMasterNext->version );
|
39 |
wp_localize_script( 'qsm_emails_admin_script', 'qsmEmailsObject', $js_data );
|
31 |
global $wpdb;
|
32 |
global $mlwQuizMasterNext;
|
33 |
$quiz_id = intval( $_GET['quiz_id'] );
|
34 |
+
$user_id = get_current_user_id();
|
35 |
$js_data = array(
|
36 |
'quizID' => $quiz_id,
|
37 |
'nonce' => wp_create_nonce( 'wp_rest' ),
|
38 |
+
'qsm_user_ve' => get_user_meta($user_id, 'rich_editing', true),
|
39 |
);
|
40 |
wp_enqueue_script( 'qsm_emails_admin_script', plugins_url( '../../js/qsm-admin-emails.js', __FILE__ ), array( 'jquery-ui-sortable', 'qmn_admin_js' ), $mlwQuizMasterNext->version );
|
41 |
wp_localize_script( 'qsm_emails_admin_script', 'qsmEmailsObject', $js_data );
|
@@ -67,6 +67,7 @@ function qsm_options_questions_tab_content() {
|
|
67 |
'quiz_system' => $quiz_system,
|
68 |
'hide_desc_text' => __('Less Description', 'quiz-master-next'),
|
69 |
'show_desc_text' => __('Add Description', 'quiz-master-next'),
|
|
|
70 |
);
|
71 |
|
72 |
// Scripts and styles.
|
@@ -692,4 +693,38 @@ function qsm_dashboard_delete_result(){
|
|
692 |
echo 'failed';
|
693 |
exit;
|
694 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
695 |
?>
|
67 |
'quiz_system' => $quiz_system,
|
68 |
'hide_desc_text' => __('Less Description', 'quiz-master-next'),
|
69 |
'show_desc_text' => __('Add Description', 'quiz-master-next'),
|
70 |
+
'question_bank_nonce' => wp_create_nonce("delete_question_question_bank_nonce")
|
71 |
);
|
72 |
|
73 |
// Scripts and styles.
|
693 |
echo 'failed';
|
694 |
exit;
|
695 |
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Delete question from question bank
|
699 |
+
*
|
700 |
+
* @since 7.1.3
|
701 |
+
*/
|
702 |
+
function qsm_delete_question_question_bank(){
|
703 |
+
if ( !wp_verify_nonce( $_REQUEST['nonce'], "delete_question_question_bank_nonce") ) {
|
704 |
+
echo wp_json_encode( array( 'success' => false, 'message' => __( 'Nonce verification failed.','quiz-master-next' ) ) );
|
705 |
+
wp_die();
|
706 |
+
}
|
707 |
+
$question_ids = isset( $_POST['question_ids'] ) ? sanitize_textarea_field($_POST['question_ids']) : '';
|
708 |
+
$question_arr = explode(',', $question_ids);
|
709 |
+
$response = array();
|
710 |
+
if( $question_arr ){
|
711 |
+
global $wpdb;
|
712 |
+
foreach ($question_arr as $key => $value) {
|
713 |
+
$wpdb->update(
|
714 |
+
$wpdb->prefix."mlw_questions",
|
715 |
+
array(
|
716 |
+
'deleted_question_bank' => 1,
|
717 |
+
),
|
718 |
+
array( 'question_id' => $value ),
|
719 |
+
array(
|
720 |
+
'%d'
|
721 |
+
),
|
722 |
+
array( '%d' )
|
723 |
+
);
|
724 |
+
}
|
725 |
+
echo wp_json_encode( array( 'success' => true, 'message' => __( 'Selected Questions are removed from question bank.','quiz-master-next' ) ) );
|
726 |
+
}
|
727 |
+
exit;
|
728 |
+
}
|
729 |
+
add_action( 'wp_ajax_qsm_delete_question_question_bank', 'qsm_delete_question_question_bank' );
|
730 |
?>
|
@@ -111,7 +111,8 @@ function qsm_generate_quizzes_surveys_page() {
|
|
111 |
if( ( isset($_POST[ 'qsm-ql-action-top' ]) && $_POST['qsm-ql-action-top'] == 'delete_pr' ) || ( isset($_POST[ 'qsm-ql-action-bottom' ]) && $_POST['qsm-ql-action-bottom'] == 'delete_pr' ) ){
|
112 |
$quiz_ids_arr = $_POST['chk_remove_all'];
|
113 |
if($quiz_ids_arr){
|
114 |
-
|
|
|
115 |
$mlwQuizMasterNext->quizCreator->delete_quiz($quiz_id, $quiz_id);
|
116 |
}
|
117 |
}
|
@@ -517,6 +518,9 @@ function qsm_generate_quizzes_surveys_page() {
|
|
517 |
<main class="qsm-popup__content" id="modal-5-content">
|
518 |
<form action='' method='post' id="delete-quiz-form">
|
519 |
<h3><b><?php _e('Are you sure you want to delete this quiz or survey?', 'quiz-master-next'); ?></b></h3>
|
|
|
|
|
|
|
520 |
<?php wp_nonce_field('qsm_delete_quiz', 'qsm_delete_quiz_nonce'); ?>
|
521 |
<input type='hidden' id='delete_quiz_id' name='delete_quiz_id' value='' />
|
522 |
<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />
|
111 |
if( ( isset($_POST[ 'qsm-ql-action-top' ]) && $_POST['qsm-ql-action-top'] == 'delete_pr' ) || ( isset($_POST[ 'qsm-ql-action-bottom' ]) && $_POST['qsm-ql-action-bottom'] == 'delete_pr' ) ){
|
112 |
$quiz_ids_arr = $_POST['chk_remove_all'];
|
113 |
if($quiz_ids_arr){
|
114 |
+
$_POST['qsm_delete_question_from_qb'] = 1;
|
115 |
+
foreach ($quiz_ids_arr as $quiz_id) {
|
116 |
$mlwQuizMasterNext->quizCreator->delete_quiz($quiz_id, $quiz_id);
|
117 |
}
|
118 |
}
|
518 |
<main class="qsm-popup__content" id="modal-5-content">
|
519 |
<form action='' method='post' id="delete-quiz-form">
|
520 |
<h3><b><?php _e('Are you sure you want to delete this quiz or survey?', 'quiz-master-next'); ?></b></h3>
|
521 |
+
<label>
|
522 |
+
<input type="checkbox" value="1" name="qsm_delete_question_from_qb" checked="checked" /> <?php _e('Delete question from question bank?', 'quiz-master-next'); ?>
|
523 |
+
</label>
|
524 |
<?php wp_nonce_field('qsm_delete_quiz', 'qsm_delete_quiz_nonce'); ?>
|
525 |
<input type='hidden' id='delete_quiz_id' name='delete_quiz_id' value='' />
|
526 |
<input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />
|
@@ -215,7 +215,7 @@ class QMNQuizCreator {
|
|
215 |
* @return void
|
216 |
*/
|
217 |
public function delete_quiz($quiz_id, $quiz_name)
|
218 |
-
{
|
219 |
global $mlwQuizMasterNext;
|
220 |
global $wpdb;
|
221 |
$results = $wpdb->update(
|
@@ -229,10 +229,14 @@ class QMNQuizCreator {
|
|
229 |
),
|
230 |
array( '%d' )
|
231 |
);
|
|
|
|
|
|
|
|
|
232 |
$delete_question_results = $wpdb->update(
|
233 |
$wpdb->prefix . "mlw_questions",
|
234 |
array(
|
235 |
-
'deleted' =>
|
236 |
),
|
237 |
array( 'quiz_id' => $quiz_id ),
|
238 |
array(
|
215 |
* @return void
|
216 |
*/
|
217 |
public function delete_quiz($quiz_id, $quiz_name)
|
218 |
+
{
|
219 |
global $mlwQuizMasterNext;
|
220 |
global $wpdb;
|
221 |
$results = $wpdb->update(
|
229 |
),
|
230 |
array( '%d' )
|
231 |
);
|
232 |
+
$deleted = 0;
|
233 |
+
if( isset( $_POST['qsm_delete_question_from_qb'] ) && $_POST['qsm_delete_question_from_qb'] == 1 ){
|
234 |
+
$deleted = 1;
|
235 |
+
}
|
236 |
$delete_question_results = $wpdb->update(
|
237 |
$wpdb->prefix . "mlw_questions",
|
238 |
array(
|
239 |
+
'deleted' => $deleted
|
240 |
),
|
241 |
array( 'quiz_id' => $quiz_id ),
|
242 |
array(
|
@@ -308,7 +308,8 @@ class QMNQuizManager {
|
|
308 |
'contact_info_location' => $qmn_quiz_options->contact_info_location,
|
309 |
'qpages' => $qpages,
|
310 |
'skip_validation_time_expire' => $qmn_quiz_options->skip_validation_time_expire,
|
311 |
-
'timer_limit_val' => $qmn_quiz_options->timer_limit
|
|
|
312 |
);
|
313 |
|
314 |
$return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
@@ -543,7 +544,7 @@ class QMNQuizManager {
|
|
543 |
wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
|
544 |
wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
|
545 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
546 |
-
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' => $options->quick_result_correct_answer_text, 'quick_result_wrong_text' => $options->quick_result_wrong_answer_text ));
|
547 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
548 |
global $qmn_total_questions;
|
549 |
$qmn_total_questions = 0;
|
@@ -689,10 +690,10 @@ class QMNQuizManager {
|
|
689 |
<?php
|
690 |
echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
|
691 |
if (0 == $question['comments']) {
|
692 |
-
echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id'
|
693 |
}
|
694 |
if (2 == $question['comments']) {
|
695 |
-
echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id'
|
696 |
}
|
697 |
// Checks if a hint is entered.
|
698 |
if (!empty($question['hints'])) {
|
@@ -750,10 +751,10 @@ class QMNQuizManager {
|
|
750 |
<?php
|
751 |
echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
|
752 |
if (0 == $question['comments']) {
|
753 |
-
echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id'
|
754 |
}
|
755 |
-
if (2 == $question['comments']) {
|
756 |
-
echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id'
|
757 |
}
|
758 |
// Checks if a hint is entered.
|
759 |
if (!empty($question['hints'])) {
|
@@ -902,11 +903,11 @@ class QMNQuizManager {
|
|
902 |
$question_display .= $mlwQuizMasterNext->pluginHelper->display_question($mlw_question->question_type_new, $mlw_question->question_id, $qmn_quiz_options);
|
903 |
|
904 |
if (0 == $mlw_question->comments) {
|
905 |
-
$question_display .= "<input type='text' class='mlw_qmn_question_comment' id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "'
|
906 |
$question_display .= "<br />";
|
907 |
}
|
908 |
if (2 == $mlw_question->comments) {
|
909 |
-
$question_display .= "<textarea cols='70' rows='5' class='mlw_qmn_question_comment' id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "'
|
910 |
$question_display .= "<br />";
|
911 |
}
|
912 |
|
@@ -1252,9 +1253,11 @@ class QMNQuizManager {
|
|
1252 |
if( $background_quiz_email_process == 1 ){
|
1253 |
// Send the emails in background.
|
1254 |
$qmn_array_for_variables['quiz_settings'] = isset( $qmn_quiz_options->quiz_settings ) ? @unserialize( $qmn_quiz_options->quiz_settings ) : array();
|
|
|
1255 |
$this->qsm_background_email->data( array( 'name' => 'send_emails', 'variables' => $qmn_array_for_variables ) )->dispatch();
|
1256 |
}else{
|
1257 |
// Sends the emails.
|
|
|
1258 |
QSM_Emails::send_emails($qmn_array_for_variables);
|
1259 |
}
|
1260 |
|
308 |
'contact_info_location' => $qmn_quiz_options->contact_info_location,
|
309 |
'qpages' => $qpages,
|
310 |
'skip_validation_time_expire' => $qmn_quiz_options->skip_validation_time_expire,
|
311 |
+
'timer_limit_val' => $qmn_quiz_options->timer_limit,
|
312 |
+
'disable_scroll_next_previous_click' => $qmn_quiz_options->disable_scroll_next_previous_click
|
313 |
);
|
314 |
|
315 |
$return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
|
544 |
wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
|
545 |
wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
|
546 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
547 |
+
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' => $options->quick_result_correct_answer_text, 'quick_result_wrong_text' => $options->quick_result_wrong_answer_text, 'multicheckbox_limit_reach' => __('Limit of choice is reached.', 'quiz-master-next') ));
|
548 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
549 |
global $qmn_total_questions;
|
550 |
$qmn_total_questions = 0;
|
690 |
<?php
|
691 |
echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
|
692 |
if (0 == $question['comments']) {
|
693 |
+
echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' placeholder='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
|
694 |
}
|
695 |
if (2 == $question['comments']) {
|
696 |
+
echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' placeholder='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) ."' onclick='qmnClearField(this)' ></textarea>";
|
697 |
}
|
698 |
// Checks if a hint is entered.
|
699 |
if (!empty($question['hints'])) {
|
751 |
<?php
|
752 |
echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
|
753 |
if (0 == $question['comments']) {
|
754 |
+
echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' placeholder='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
|
755 |
}
|
756 |
+
if (2 == $question['comments']) {
|
757 |
+
echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' placeholder='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) ."' onclick='qmnClearField(this)' ></textarea>";
|
758 |
}
|
759 |
// Checks if a hint is entered.
|
760 |
if (!empty($question['hints'])) {
|
903 |
$question_display .= $mlwQuizMasterNext->pluginHelper->display_question($mlw_question->question_type_new, $mlw_question->question_id, $qmn_quiz_options);
|
904 |
|
905 |
if (0 == $mlw_question->comments) {
|
906 |
+
$question_display .= "<input type='text' class='mlw_qmn_question_comment' id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "' placeholder='" . esc_attr(htmlspecialchars_decode($qmn_quiz_options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
|
907 |
$question_display .= "<br />";
|
908 |
}
|
909 |
if (2 == $mlw_question->comments) {
|
910 |
+
$question_display .= "<textarea cols='70' rows='5' class='mlw_qmn_question_comment' id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "' placeholder='" . htmlspecialchars_decode($qmn_quiz_options->comment_field_text, ENT_QUOTES) . "' onclick='qmnClearField(this)'></textarea>";
|
911 |
$question_display .= "<br />";
|
912 |
}
|
913 |
|
1253 |
if( $background_quiz_email_process == 1 ){
|
1254 |
// Send the emails in background.
|
1255 |
$qmn_array_for_variables['quiz_settings'] = isset( $qmn_quiz_options->quiz_settings ) ? @unserialize( $qmn_quiz_options->quiz_settings ) : array();
|
1256 |
+
$qmn_array_for_variables['email_processed'] = 'yes';
|
1257 |
$this->qsm_background_email->data( array( 'name' => 'send_emails', 'variables' => $qmn_array_for_variables ) )->dispatch();
|
1258 |
}else{
|
1259 |
// Sends the emails.
|
1260 |
+
$qmn_array_for_variables['email_processed'] = 'yes';
|
1261 |
QSM_Emails::send_emails($qmn_array_for_variables);
|
1262 |
}
|
1263 |
|
@@ -581,6 +581,25 @@ class QSM_Install {
|
|
581 |
);
|
582 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
583 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
//Setting for animation
|
585 |
$field_array = array(
|
586 |
'id' => 'quiz_animation',
|
@@ -1217,6 +1236,7 @@ class QSM_Install {
|
|
1217 |
question_settings TEXT NOT NULL,
|
1218 |
category TEXT NOT NULL,
|
1219 |
deleted INT NOT NULL,
|
|
|
1220 |
PRIMARY KEY (question_id)
|
1221 |
) $charset_collate;";
|
1222 |
|
581 |
);
|
582 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
583 |
|
584 |
+
//Setting for pagination of quiz
|
585 |
+
$field_array = array(
|
586 |
+
'id' => 'disable_scroll_next_previous_click',
|
587 |
+
'label' => __('Disable scroll on next and previous button click?', 'quiz-master-next'),
|
588 |
+
'type' => 'radio',
|
589 |
+
'options' => array(
|
590 |
+
array(
|
591 |
+
'label' => __('Yes', 'quiz-master-next'),
|
592 |
+
'value' => 1
|
593 |
+
),
|
594 |
+
array(
|
595 |
+
'label' => __('No', 'quiz-master-next'),
|
596 |
+
'value' => 0
|
597 |
+
),
|
598 |
+
),
|
599 |
+
'default' => 0,
|
600 |
+
);
|
601 |
+
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
602 |
+
|
603 |
//Setting for animation
|
604 |
$field_array = array(
|
605 |
'id' => 'quiz_animation',
|
1236 |
question_settings TEXT NOT NULL,
|
1237 |
category TEXT NOT NULL,
|
1238 |
deleted INT NOT NULL,
|
1239 |
+
deleted_question_bank INT NOT NULL,
|
1240 |
PRIMARY KEY (question_id)
|
1241 |
) $charset_collate;";
|
1242 |
|
@@ -155,26 +155,41 @@ function qmn_multiple_choice_review($id, $question, $answers)
|
|
155 |
$answerEditor = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'answerEditor');
|
156 |
if ( isset( $_POST["question".$id] ) ) {
|
157 |
$mlw_user_answer = $_POST["question".$id];
|
158 |
-
|
159 |
} else {
|
160 |
$mlw_user_answer = " ";
|
161 |
-
}
|
162 |
-
$return_array['user_text'] = stripslashes( htmlspecialchars_decode($mlw_user_answer, ENT_QUOTES) );
|
163 |
-
foreach($answers as $answer)
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
return $return_array;
|
180 |
}
|
@@ -321,25 +336,39 @@ function qmn_horizontal_multiple_choice_review($id, $question, $answers)
|
|
321 |
);
|
322 |
if ( isset( $_POST["question".$id] ) ) {
|
323 |
$mlw_user_answer = $_POST["question".$id];
|
324 |
-
|
325 |
} else {
|
326 |
$mlw_user_answer = " ";
|
327 |
}
|
328 |
-
|
329 |
-
{
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
|
|
343 |
}
|
344 |
return $return_array;
|
345 |
}
|
@@ -903,7 +932,9 @@ function qmn_captcha_display($id, $question, $answers)
|
|
903 |
$question_display .= "<canvas alt='' id='mlw_captcha' class='mlw_captcha' width='100' height='50'></canvas>";
|
904 |
$question_display .= "</div>";
|
905 |
$question_display .= "<span class='mlw_qmn_question'>";
|
906 |
-
$
|
|
|
|
|
907 |
$question_display .= "<input type='text' class='mlw_answer_open_text $mlw_requireClass' id='mlw_captcha_text' name='mlw_user_captcha'/>";
|
908 |
$question_display .= "<input type='hidden' name='mlw_code_captcha' id='mlw_code_captcha' value='none' />";
|
909 |
$question_display .= "<script>
|
155 |
$answerEditor = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'answerEditor');
|
156 |
if ( isset( $_POST["question".$id] ) ) {
|
157 |
$mlw_user_answer = $_POST["question".$id];
|
158 |
+
$mlw_user_answer = trim( stripslashes( htmlspecialchars_decode($mlw_user_answer, ENT_QUOTES) ) );
|
159 |
} else {
|
160 |
$mlw_user_answer = " ";
|
161 |
+
}
|
162 |
+
$return_array['user_text'] = stripslashes( htmlspecialchars_decode($mlw_user_answer, ENT_QUOTES) );
|
163 |
+
foreach($answers as $answer){
|
164 |
+
if($answerEditor === 'rich'){
|
165 |
+
$answer_option = stripslashes( htmlspecialchars_decode($answer[0], ENT_QUOTES) );
|
166 |
+
if ( $mlw_user_answer == trim( $answer_option ) ){
|
167 |
+
$return_array["points"] = $answer[1];
|
168 |
+
$return_array["user_text"] = $answer[0];
|
169 |
+
if ($answer[2] == 1){
|
170 |
+
$return_array["correct"] = "correct";
|
171 |
+
}
|
172 |
+
}
|
173 |
+
if ($answer[2] == 1){
|
174 |
+
$return_array["correct_text"] = htmlspecialchars_decode($answer[0], ENT_QUOTES);
|
175 |
+
}
|
176 |
+
} else {
|
177 |
+
$mlw_user_answer = '';
|
178 |
+
if ( isset( $_POST["question".$id] ) ) {
|
179 |
+
$mlw_user_answer = $_POST["question".$id];
|
180 |
+
$mlw_user_answer = trim( stripslashes( htmlspecialchars_decode($mlw_user_answer, ENT_QUOTES) ) );
|
181 |
+
}
|
182 |
+
if ( $mlw_user_answer == trim( stripslashes( htmlspecialchars_decode($answer[0], ENT_QUOTES) ) ) ){
|
183 |
+
$return_array["points"] = $answer[1];
|
184 |
+
$return_array["user_text"] = $answer[0];
|
185 |
+
if ($answer[2] == 1){
|
186 |
+
$return_array["correct"] = "correct";
|
187 |
+
}
|
188 |
+
}
|
189 |
+
if ($answer[2] == 1){
|
190 |
+
$return_array["correct_text"] = htmlspecialchars_decode($answer[0], ENT_QUOTES);
|
191 |
+
}
|
192 |
+
}
|
193 |
}
|
194 |
return $return_array;
|
195 |
}
|
336 |
);
|
337 |
if ( isset( $_POST["question".$id] ) ) {
|
338 |
$mlw_user_answer = $_POST["question".$id];
|
339 |
+
$mlw_user_answer = trim( stripslashes( htmlspecialchars_decode($mlw_user_answer, ENT_QUOTES) ) );
|
340 |
} else {
|
341 |
$mlw_user_answer = " ";
|
342 |
}
|
343 |
+
|
344 |
+
foreach($answers as $answer){
|
345 |
+
if($answerEditor === 'rich'){
|
346 |
+
$answer_option = stripslashes( htmlspecialchars_decode($answer[0], ENT_QUOTES) );
|
347 |
+
if ( $mlw_user_answer == trim( $answer_option ) ){
|
348 |
+
$return_array["points"] = $answer[1];
|
349 |
+
$return_array["user_text"] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
|
350 |
+
if ($answer[2] == 1){
|
351 |
+
$return_array["correct"] = "correct";
|
352 |
+
}
|
353 |
+
}
|
354 |
+
if ($answer[2] == 1){
|
355 |
+
$return_array["correct_text"] = htmlspecialchars_decode($answer[0], ENT_QUOTES);
|
356 |
+
}
|
357 |
+
} else{
|
358 |
+
if ( $mlw_user_answer == trim( stripslashes( htmlspecialchars_decode($answer[0], ENT_QUOTES) ) ) ){
|
359 |
+
$return_array["points"] = $answer[1];
|
360 |
+
$return_array["user_text"] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
|
361 |
+
if ($answer[2] == 1)
|
362 |
+
{
|
363 |
+
$return_array["correct"] = "correct";
|
364 |
+
}
|
365 |
+
}
|
366 |
+
if ($answer[2] == 1)
|
367 |
+
{
|
368 |
+
$return_array["correct_text"] = htmlspecialchars_decode($answer[0], ENT_QUOTES);
|
369 |
+
}
|
370 |
}
|
371 |
+
|
372 |
}
|
373 |
return $return_array;
|
374 |
}
|
932 |
$question_display .= "<canvas alt='' id='mlw_captcha' class='mlw_captcha' width='100' height='50'></canvas>";
|
933 |
$question_display .= "</div>";
|
934 |
$question_display .= "<span class='mlw_qmn_question'>";
|
935 |
+
$new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
|
936 |
+
$question_title = qsm_question_title_func($question, '', $new_question_title);
|
937 |
+
$question_display .= $question_title ."</span>";
|
938 |
$question_display .= "<input type='text' class='mlw_answer_open_text $mlw_requireClass' id='mlw_captcha_text' name='mlw_user_captcha'/>";
|
939 |
$question_display .= "<input type='hidden' name='mlw_code_captcha' id='mlw_code_captcha' value='none' />";
|
940 |
$question_display .= "<script>
|
@@ -93,7 +93,7 @@ function qsm_rest_get_bank_questions( WP_REST_Request $request ){
|
|
93 |
if($category){
|
94 |
$category_query = ' AND category = "' . $category . '"';
|
95 |
}
|
96 |
-
$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' );
|
97 |
$total_count = isset($total_count_query['total_question']) ? $total_count_query['total_question'] : 0;
|
98 |
$settings = (array) get_option( 'qmn-settings' );
|
99 |
$limit = 20;
|
@@ -104,7 +104,7 @@ function qsm_rest_get_bank_questions( WP_REST_Request $request ){
|
|
104 |
$total_pages = ceil($total_count / $limit);
|
105 |
$pageno = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
|
106 |
$offset = ($pageno-1) * $limit;
|
107 |
-
$questions = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted='0'$category_query ORDER BY question_order ASC LIMIT $offset, $limit", 'ARRAY_A' );
|
108 |
$quiz_table = $wpdb->prefix . 'mlw_quizzes';
|
109 |
$question_array = array();
|
110 |
$question_array['pagination'] = array(
|
93 |
if($category){
|
94 |
$category_query = ' AND category = "' . $category . '"';
|
95 |
}
|
96 |
+
$total_count_query = $wpdb->get_row( "SELECT COUNT(question_id) as total_question FROM {$wpdb->prefix}mlw_questions WHERE deleted='0' AND deleted_question_bank='0'$category_query", 'ARRAY_A' );
|
97 |
$total_count = isset($total_count_query['total_question']) ? $total_count_query['total_question'] : 0;
|
98 |
$settings = (array) get_option( 'qmn-settings' );
|
99 |
$limit = 20;
|
104 |
$total_pages = ceil($total_count / $limit);
|
105 |
$pageno = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
|
106 |
$offset = ($pageno-1) * $limit;
|
107 |
+
$questions = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted='0' AND deleted_question_bank='0'$category_query ORDER BY question_order ASC LIMIT $offset, $limit", 'ARRAY_A' );
|
108 |
$quiz_table = $wpdb->prefix . 'mlw_quizzes';
|
109 |
$question_array = array();
|
110 |
$question_array['pagination'] = array(
|
@@ -59,7 +59,7 @@ add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date_take
|
|
59 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_facebook_share',10,2);
|
60 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_twitter_share',10,2);
|
61 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_result_id',10,2);
|
62 |
-
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_single_question_answer',
|
63 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_total_possible_points',10,2);
|
64 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_total_attempted_questions',10,2);
|
65 |
add_filter('qmn_end_results', 'qsm_variable_poll_result',10,3);
|
@@ -70,6 +70,7 @@ add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user
|
|
70 |
|
71 |
/**
|
72 |
* @since 6.4.11
|
|
|
73 |
* @param str $content
|
74 |
* @param array $mlw_quiz_array
|
75 |
* Show particular question answer.
|
@@ -89,44 +90,30 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
|
|
89 |
if( isset($question_answers_array[$key]) ){
|
90 |
global $mlwQuizMasterNext;
|
91 |
$answer = $question_answers_array[$key];
|
92 |
-
|
93 |
-
|
94 |
-
$
|
95 |
-
$
|
|
|
|
|
|
|
96 |
} else {
|
97 |
-
|
98 |
-
$
|
99 |
-
|
100 |
-
$mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
|
101 |
-
if( isset( $answer['question_title'] ) && $answer['question_title'] != '' ){
|
102 |
-
$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);
|
103 |
-
}else{
|
104 |
-
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
105 |
-
}
|
106 |
-
$mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
|
107 |
-
if($answer['question_type'] == 11){
|
108 |
-
$file_extension = substr($answer[1], -4);
|
109 |
-
if($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif'){
|
110 |
-
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
|
111 |
}else{
|
112 |
-
$
|
113 |
}
|
114 |
-
}
|
115 |
-
|
116 |
-
|
117 |
-
global $wpdb;
|
118 |
$qmn_questions = array();
|
119 |
-
$
|
120 |
-
|
121 |
-
|
122 |
-
$
|
123 |
-
$
|
124 |
-
$
|
125 |
-
$mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer_3, $mlw_question_answer_display);
|
126 |
-
$answer_4 = !empty( $qmn_questions[$answer['id']] ) ? $qmn_questions[$answer['id']] : 'NA';
|
127 |
-
$mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($answer_4, ENT_QUOTES), $mlw_question_answer_display);
|
128 |
-
$mlw_question_answer_display = wp_kses_post( $mlw_question_answer_display );
|
129 |
-
$display = "<div class='qmn_question_answer $question_answer_class'>".apply_filters('qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array).'</div>';
|
130 |
$content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , $display, $content);
|
131 |
}
|
132 |
}
|
@@ -335,7 +322,7 @@ function mlw_qmn_variable_total_questions($content, $mlw_quiz_array)
|
|
335 |
}
|
336 |
function mlw_qmn_variable_correct_score($content, $mlw_quiz_array)
|
337 |
{
|
338 |
-
$content = str_replace( "%CORRECT_SCORE%" , $mlw_quiz_array["total_score"], $content);
|
339 |
return $content;
|
340 |
}
|
341 |
function mlw_qmn_variable_quiz_name($content, $mlw_quiz_array)
|
@@ -421,7 +408,7 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
|
|
421 |
while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false || strpos( $content, '%QUESTIONS_ANSWERS_EMAIL%' ) !== false ) {
|
422 |
global $wpdb;
|
423 |
$display = '';
|
424 |
-
if( strpos( $content, '%QUESTIONS_ANSWERS_EMAIL%' ) !== false ){
|
425 |
if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
|
426 |
$quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
|
427 |
$qmn_question_answer_template = isset( $quiz_text_settings['question_answer_email_template'] ) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_email_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
@@ -446,185 +433,11 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
|
|
446 |
$total_question_cnt = count( $mlw_quiz_array['question_answers_array'] );
|
447 |
$qsm_question_cnt = 1;
|
448 |
foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
$question_answer_class = "";
|
455 |
-
if( isset( $mlw_quiz_array['form_type'] ) && $mlw_quiz_array['form_type'] == 0 ){
|
456 |
-
if( $mlw_quiz_array['quiz_system'] == 0 || $mlw_quiz_array['quiz_system'] == 3 ){
|
457 |
-
if ( $answer["correct"] === "correct" ){
|
458 |
-
$user_answer_class = "qmn_user_correct_answer";
|
459 |
-
$question_answer_class = "qmn_question_answer_correct";
|
460 |
-
} else {
|
461 |
-
$user_answer_class = "qmn_user_incorrect_answer";
|
462 |
-
$question_answer_class = "qmn_question_answer_incorrect";
|
463 |
-
}
|
464 |
-
}
|
465 |
-
}
|
466 |
-
} else {
|
467 |
-
if ( $answer["correct"] === "correct" ){
|
468 |
-
$user_answer_class = "qmn_user_correct_answer";
|
469 |
-
$question_answer_class = "qmn_question_answer_correct";
|
470 |
-
} else {
|
471 |
-
$user_answer_class = "qmn_user_incorrect_answer";
|
472 |
-
$question_answer_class = "qmn_question_answer_incorrect";
|
473 |
-
}
|
474 |
-
}
|
475 |
-
|
476 |
-
$mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
|
477 |
-
$disable_description_on_result = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'disable_description_on_result' );
|
478 |
-
if( isset( $answer['question_title'] ) && $answer['question_title'] != '' ){
|
479 |
-
$add_br = '';
|
480 |
-
if( $answer[0] != '' ){
|
481 |
-
$add_br = '<br/>';
|
482 |
-
}
|
483 |
-
if( $disable_description_on_result == 1 ){
|
484 |
-
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
485 |
-
}else{
|
486 |
-
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b>'. $add_br . htmlspecialchars_decode($answer[0], ENT_QUOTES), $mlw_question_answer_display);
|
487 |
-
}
|
488 |
-
}else{
|
489 |
-
$mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
490 |
-
}
|
491 |
-
$mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
|
492 |
-
$extra_border_bottom_class = '';
|
493 |
-
if( strpos( $mlw_question_answer_display, '%USER_ANSWERS_DEFAULT%') !== false ){
|
494 |
-
$extra_border_bottom_class = 'qsm-add-border-bottom';
|
495 |
-
$show_two_option_questions = array(
|
496 |
-
3,12,5,7,14
|
497 |
-
);
|
498 |
-
$form_type = isset( $mlw_quiz_array['form_type'] ) ? $mlw_quiz_array['form_type'] : 0;
|
499 |
-
$quiz_system = isset( $mlw_quiz_array['quiz_system'] ) ? $mlw_quiz_array['quiz_system'] : 0;
|
500 |
-
if( isset( $answer['id'] ) && isset( $questions[ $answer['id'] ] ) && !empty( $questions[ $answer['id'] ] ) ){
|
501 |
-
$total_answers = isset( $questions[ $answer['id'] ][ 'answers' ] ) ? $questions[ $answer['id'] ][ 'answers' ] : array();
|
502 |
-
$question_with_answer_text = '';
|
503 |
-
if( $total_answers ){
|
504 |
-
if( isset($answer['question_type']) && in_array( $answer['question_type'], $show_two_option_questions) ){
|
505 |
-
$do_show_wrong = true;
|
506 |
-
foreach( $total_answers as $single_answer ){
|
507 |
-
if( $form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 ) ){
|
508 |
-
if( isset( $single_answer[2] ) && $single_answer[2] == 1 && htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0] ){
|
509 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
510 |
-
$do_show_wrong = false;
|
511 |
-
}
|
512 |
-
}else{
|
513 |
-
if( isset( $single_answer[2] ) && htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0] ){
|
514 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
515 |
-
$do_show_wrong = false;
|
516 |
-
}
|
517 |
-
}
|
518 |
-
}
|
519 |
-
if( $do_show_wrong ){
|
520 |
-
if( $form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 ) ){
|
521 |
-
$user_given_answer = $answer[1] == '' ? __('No answer provided', 'quiz-master-next') : $answer[1];
|
522 |
-
$question_with_answer_text .= '<span class="qsm-text-wrong-option">'. htmlspecialchars_decode($user_given_answer, ENT_QUOTES) .'</span>';
|
523 |
-
foreach( $total_answers as $single_answer ){
|
524 |
-
if( isset( $single_answer[2] ) && $single_answer[2] == 1 ){
|
525 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
526 |
-
break;
|
527 |
-
}
|
528 |
-
}
|
529 |
-
} else {
|
530 |
-
$user_given_answer = $answer[1] == '' ? __('No answer provided', 'quiz-master-next') : $answer[1];
|
531 |
-
$question_with_answer_text .= '<span class="qsm-text-simple-option">'. htmlspecialchars_decode($user_given_answer, ENT_QUOTES) .'</span>';
|
532 |
-
}
|
533 |
-
}
|
534 |
-
} else if( isset($answer['question_type']) && $answer['question_type'] == 11 ){
|
535 |
-
$file_extension = substr($answer[1], -4);
|
536 |
-
if($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif'){
|
537 |
-
$question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
|
538 |
-
}else{
|
539 |
-
$question_with_answer_text .= "<span class='$user_answer_class'>".trim( htmlspecialchars_decode($answer[1], ENT_QUOTES) ).'</span>';
|
540 |
-
}
|
541 |
-
} else {
|
542 |
-
if( $form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 ) ){
|
543 |
-
if( isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 ) ){
|
544 |
-
$user_selected_answer = htmlspecialchars_decode($answer[1], ENT_QUOTES);
|
545 |
-
foreach ( $total_answers as $single_answer ) {
|
546 |
-
$current_answer_text = $single_answer[0];
|
547 |
-
if( isset( $single_answer[2] ) && $single_answer[2] == 1 && preg_match("/\b$current_answer_text\b/", $user_selected_answer) ){
|
548 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
549 |
-
}else if( isset( $single_answer[2] ) && $single_answer[2] == 1 ){
|
550 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
551 |
-
}else if( preg_match("/\b$current_answer_text\b/", $user_selected_answer) && $single_answer[2] !== 1 ){
|
552 |
-
$question_with_answer_text .= '<span class="qsm-text-wrong-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
553 |
-
}else{
|
554 |
-
$question_with_answer_text .= '<span class="qsm-text-simple-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
555 |
-
}
|
556 |
-
}
|
557 |
-
} else {
|
558 |
-
foreach ( $total_answers as $single_answer ) {
|
559 |
-
if( isset( $single_answer[2] ) && $single_answer[2] == 1 && htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0] ){
|
560 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
561 |
-
}else if( isset( $single_answer[2] ) && $single_answer[2] == 1 ){
|
562 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
563 |
-
}else if( htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0] && $single_answer[2] !== 1 ){
|
564 |
-
$question_with_answer_text .= '<span class="qsm-text-wrong-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
565 |
-
}else{
|
566 |
-
$question_with_answer_text .= '<span class="qsm-text-simple-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
567 |
-
}
|
568 |
-
}
|
569 |
-
}
|
570 |
-
} else {
|
571 |
-
if( isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 ) ){
|
572 |
-
$user_selected_answer = htmlspecialchars_decode($answer[1], ENT_QUOTES);
|
573 |
-
foreach ( $total_answers as $single_answer ) {
|
574 |
-
if( strpos( $user_selected_answer, $single_answer[0]) !== false ){
|
575 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
576 |
-
}else{
|
577 |
-
$question_with_answer_text .= '<span class="qsm-text-simple-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
578 |
-
}
|
579 |
-
}
|
580 |
-
} else {
|
581 |
-
foreach ( $total_answers as $single_answer ) {
|
582 |
-
if( htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0] ){
|
583 |
-
$question_with_answer_text .= '<span class="qsm-text-correct-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
584 |
-
}else{
|
585 |
-
$question_with_answer_text .= '<span class="qsm-text-simple-option">'. htmlspecialchars_decode($single_answer[0], ENT_QUOTES) .'</span>';
|
586 |
-
}
|
587 |
-
}
|
588 |
-
}
|
589 |
-
}
|
590 |
-
}
|
591 |
-
} else {
|
592 |
-
if( isset($answer['question_type']) && $answer['question_type'] == 11 ){
|
593 |
-
$file_extension = substr($answer[1], -4);
|
594 |
-
if($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif'){
|
595 |
-
$question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
|
596 |
-
}else{
|
597 |
-
$question_with_answer_text .= "<span class='$user_answer_class'>".trim( htmlspecialchars_decode($answer[1], ENT_QUOTES) ).'</span>';
|
598 |
-
}
|
599 |
-
} else {
|
600 |
-
$question_with_answer_text .= '<span class="qsm-user-answer-text">' . htmlspecialchars_decode($answer[1], ENT_QUOTES) . '</span>';
|
601 |
-
}
|
602 |
-
}
|
603 |
-
}
|
604 |
-
$mlw_question_answer_display = str_replace( "%USER_ANSWERS_DEFAULT%" , $question_with_answer_text, $mlw_question_answer_display);
|
605 |
-
}
|
606 |
-
if( isset($answer['question_type']) && $answer['question_type'] == 11 ){
|
607 |
-
$file_extension = substr($answer[1], -4);
|
608 |
-
if($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif'){
|
609 |
-
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
|
610 |
-
}else{
|
611 |
-
$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);
|
612 |
-
}
|
613 |
-
}else{
|
614 |
-
$mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
|
615 |
-
}
|
616 |
-
$answer_2 = !empty( $answer[2] ) ? $answer[2] : 'NA';
|
617 |
-
$mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer_2, ENT_QUOTES), $mlw_question_answer_display);
|
618 |
-
$answer_3 = !empty( $answer[3] ) ? $answer[3] : 'NA';
|
619 |
-
$mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer_3, $mlw_question_answer_display);
|
620 |
-
$answer_4 = !empty( $qmn_questions[$answer['id']] ) ? $qmn_questions[$answer['id']] : 'NA';
|
621 |
-
$mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($answer_4, ENT_QUOTES), $mlw_question_answer_display);
|
622 |
-
$mlw_question_answer_display = wp_kses_post( $mlw_question_answer_display );
|
623 |
-
if( $total_question_cnt == $qsm_question_cnt){
|
624 |
-
$extra_border_bottom_class = 'qsm-remove-border-bottom';
|
625 |
-
}
|
626 |
-
$display .= "<div class='qmn_question_answer $extra_border_bottom_class $question_answer_class'>".apply_filters('qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array).'</div>';
|
627 |
-
$qsm_question_cnt++;
|
628 |
}
|
629 |
$content = str_replace( "%QUESTIONS_ANSWERS%" , $display, $content);
|
630 |
$content = str_replace( "%QUESTIONS_ANSWERS_EMAIL%" , $display, $content);
|
@@ -974,4 +787,199 @@ function qsm_custom_wpkses_post_tags( $tags, $context ) {
|
|
974 |
return $tags;
|
975 |
}
|
976 |
|
977 |
-
add_filter( 'wp_kses_allowed_html', 'qsm_custom_wpkses_post_tags', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_facebook_share',10,2);
|
60 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_twitter_share',10,2);
|
61 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_result_id',10,2);
|
62 |
+
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_single_question_answer',20,2);
|
63 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_total_possible_points',10,2);
|
64 |
add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_total_attempted_questions',10,2);
|
65 |
add_filter('qmn_end_results', 'qsm_variable_poll_result',10,3);
|
70 |
|
71 |
/**
|
72 |
* @since 6.4.11
|
73 |
+
* @since 7.1.3 Changed the display structure to new structure.
|
74 |
* @param str $content
|
75 |
* @param array $mlw_quiz_array
|
76 |
* Show particular question answer.
|
90 |
if( isset($question_answers_array[$key]) ){
|
91 |
global $mlwQuizMasterNext;
|
92 |
$answer = $question_answers_array[$key];
|
93 |
+
if( isset( $mlw_quiz_array['email_processed'] ) && $mlw_quiz_array['email_processed'] == 'yes' ){
|
94 |
+
if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
|
95 |
+
$quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
|
96 |
+
$qmn_question_answer_template = isset( $quiz_text_settings['question_answer_email_template'] ) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_email_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
97 |
+
}else{
|
98 |
+
$qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
99 |
+
}
|
100 |
} else {
|
101 |
+
if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
|
102 |
+
$quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
|
103 |
+
$qmn_question_answer_template = isset( $quiz_text_settings['question_answer_template'] ) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}else{
|
105 |
+
$qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
|
106 |
}
|
107 |
+
}
|
108 |
+
$mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
|
109 |
+
$questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
|
|
|
110 |
$qmn_questions = array();
|
111 |
+
foreach ( $questions as $question ) {
|
112 |
+
$qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
|
113 |
+
}
|
114 |
+
$total_question_cnt = 2;
|
115 |
+
$qsm_question_cnt = 1;
|
116 |
+
$display = qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $mlw_question_answer_display, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt);
|
|
|
|
|
|
|
|
|
|
|
117 |
$content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , $display, $content);
|
118 |
}
|
119 |
}
|
322 |
}
|
323 |
function mlw_qmn_variable_correct_score($content, $mlw_quiz_array)
|
324 |
{
|
325 |
+
$content = str_replace( "%CORRECT_SCORE%" , round( $mlw_quiz_array["total_score"] ), $content);
|
326 |
return $content;
|
327 |
}
|
328 |
function mlw_qmn_variable_quiz_name($content, $mlw_quiz_array)
|
408 |
while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false || strpos( $content, '%QUESTIONS_ANSWERS_EMAIL%' ) !== false ) {
|
409 |
global $wpdb;
|
410 |
$display = '';
|
411 |
+
if( strpos( $content, '%QUESTIONS_ANSWERS_EMAIL%' ) !== false ){
|
412 |
if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
|
413 |
$quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
|
414 |
$qmn_question_answer_template = isset( $quiz_text_settings['question_answer_email_template'] ) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_email_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
|
433 |
$total_question_cnt = count( $mlw_quiz_array['question_answers_array'] );
|
434 |
$qsm_question_cnt = 1;
|
435 |
foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
|
436 |
+
if(in_array($answer['id'],$hidden_questions)) {
|
437 |
+
continue;
|
438 |
+
}
|
439 |
+
$display .= qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $qmn_question_answer_template, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt);
|
440 |
+
$qsm_question_cnt++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
}
|
442 |
$content = str_replace( "%QUESTIONS_ANSWERS%" , $display, $content);
|
443 |
$content = str_replace( "%QUESTIONS_ANSWERS_EMAIL%" , $display, $content);
|
787 |
return $tags;
|
788 |
}
|
789 |
|
790 |
+
add_filter( 'wp_kses_allowed_html', 'qsm_custom_wpkses_post_tags', 10, 2 );
|
791 |
+
|
792 |
+
/**
|
793 |
+
* Function will convert all the QUESIONS_ANSWERS variable into appropriate data
|
794 |
+
*
|
795 |
+
* @since 7.1.3
|
796 |
+
*
|
797 |
+
* @param arr $mlw_quiz_array
|
798 |
+
* @param str $qmn_question_answer_template
|
799 |
+
* @param str $answer
|
800 |
+
* @param int $qsm_question_cnt
|
801 |
+
* @param int $total_question_cnt
|
802 |
+
* @return string
|
803 |
+
*/
|
804 |
+
function qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $qmn_question_answer_template, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt) {
|
805 |
+
global $mlwQuizMasterNext;
|
806 |
+
if (is_admin() && isset($_GET['page']) && $_GET['page'] == 'qsm_quiz_result_details') {
|
807 |
+
$user_answer_class = "";
|
808 |
+
$question_answer_class = "";
|
809 |
+
if (isset($mlw_quiz_array['form_type']) && $mlw_quiz_array['form_type'] == 0) {
|
810 |
+
if ($mlw_quiz_array['quiz_system'] == 0 || $mlw_quiz_array['quiz_system'] == 3) {
|
811 |
+
if ($answer["correct"] === "correct") {
|
812 |
+
$user_answer_class = "qmn_user_correct_answer";
|
813 |
+
$question_answer_class = "qmn_question_answer_correct";
|
814 |
+
} else {
|
815 |
+
$user_answer_class = "qmn_user_incorrect_answer";
|
816 |
+
$question_answer_class = "qmn_question_answer_incorrect";
|
817 |
+
}
|
818 |
+
}
|
819 |
+
}
|
820 |
+
} else {
|
821 |
+
if ($answer["correct"] === "correct") {
|
822 |
+
$user_answer_class = "qmn_user_correct_answer";
|
823 |
+
$question_answer_class = "qmn_question_answer_correct";
|
824 |
+
} else {
|
825 |
+
$user_answer_class = "qmn_user_incorrect_answer";
|
826 |
+
$question_answer_class = "qmn_question_answer_incorrect";
|
827 |
+
}
|
828 |
+
}
|
829 |
+
|
830 |
+
$mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
|
831 |
+
$disable_description_on_result = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'disable_description_on_result');
|
832 |
+
|
833 |
+
if (isset($answer['question_title']) && $answer['question_title'] != '') {
|
834 |
+
$add_br = '';
|
835 |
+
if ($answer[0] != '') {
|
836 |
+
$add_br = '<br/>';
|
837 |
+
}
|
838 |
+
if ($disable_description_on_result == 1) {
|
839 |
+
$mlw_question_answer_display = str_replace("%QUESTION%", '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
|
840 |
+
} else {
|
841 |
+
$mlw_question_answer_display = str_replace("%QUESTION%", '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b>' . $add_br . stripslashes( htmlspecialchars_decode($answer[0], ENT_QUOTES) ), $mlw_question_answer_display);
|
842 |
+
}
|
843 |
+
} else {
|
844 |
+
$mlw_question_answer_display = str_replace("%QUESTION%", '<b>' . stripslashes( htmlspecialchars_decode($answer[0], ENT_QUOTES) ) . '</b>', $mlw_question_answer_display);
|
845 |
+
}
|
846 |
+
$mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
|
847 |
+
$extra_border_bottom_class = '';
|
848 |
+
$remove_border = true;
|
849 |
+
if (strpos($mlw_question_answer_display, '%USER_ANSWERS_DEFAULT%') !== false) {
|
850 |
+
$remove_border = false;
|
851 |
+
$question_with_answer_text = '';
|
852 |
+
$extra_border_bottom_class = 'qsm-add-border-bottom';
|
853 |
+
$show_two_option_questions = array(
|
854 |
+
3, 12, 5, 7, 14
|
855 |
+
);
|
856 |
+
$form_type = isset($mlw_quiz_array['form_type']) ? $mlw_quiz_array['form_type'] : 0;
|
857 |
+
$quiz_system = isset($mlw_quiz_array['quiz_system']) ? $mlw_quiz_array['quiz_system'] : 0;
|
858 |
+
if (isset($answer['id']) && isset($questions[$answer['id']]) && !empty($questions[$answer['id']])) {
|
859 |
+
$total_answers = isset($questions[$answer['id']]['answers']) ? $questions[$answer['id']]['answers'] : array();
|
860 |
+
if ($total_answers) {
|
861 |
+
if (isset($answer['question_type']) && in_array($answer['question_type'], $show_two_option_questions)) {
|
862 |
+
$do_show_wrong = true;
|
863 |
+
foreach ($total_answers as $single_answer) {
|
864 |
+
if ($form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 )) {
|
865 |
+
if (isset($single_answer[2]) && $single_answer[2] == 1 && htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0]) {
|
866 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
867 |
+
$do_show_wrong = false;
|
868 |
+
}
|
869 |
+
} else {
|
870 |
+
if (isset($single_answer[2]) && htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0]) {
|
871 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
872 |
+
$do_show_wrong = false;
|
873 |
+
}
|
874 |
+
}
|
875 |
+
}
|
876 |
+
if ($do_show_wrong) {
|
877 |
+
if ($form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 )) {
|
878 |
+
$user_given_answer = $answer[1] == '' ? __('No answer provided', 'quiz-master-next') : $answer[1];
|
879 |
+
$question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode($user_given_answer, ENT_QUOTES) . '</span>';
|
880 |
+
foreach ($total_answers as $single_answer) {
|
881 |
+
if (isset($single_answer[2]) && $single_answer[2] == 1) {
|
882 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
883 |
+
break;
|
884 |
+
}
|
885 |
+
}
|
886 |
+
} else {
|
887 |
+
$user_given_answer = $answer[1] == '' ? __('No answer provided', 'quiz-master-next') : $answer[1];
|
888 |
+
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($user_given_answer, ENT_QUOTES) . '</span>';
|
889 |
+
}
|
890 |
+
}
|
891 |
+
} else if (isset($answer['question_type']) && $answer['question_type'] == 11) {
|
892 |
+
$file_extension = substr($answer[1], -4);
|
893 |
+
if ($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif') {
|
894 |
+
$question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
|
895 |
+
} else {
|
896 |
+
$question_with_answer_text .= "<span class='$user_answer_class'>" . trim(htmlspecialchars_decode($answer[1], ENT_QUOTES)) . '</span>';
|
897 |
+
}
|
898 |
+
} else {
|
899 |
+
if ($form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 )) {
|
900 |
+
if (isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 )) {
|
901 |
+
$user_selected_answer = htmlspecialchars_decode($answer[1], ENT_QUOTES);
|
902 |
+
foreach ($total_answers as $single_answer) {
|
903 |
+
$current_answer_text = $single_answer[0];
|
904 |
+
if (isset($single_answer[2]) && $single_answer[2] == 1 && preg_match("/\b$current_answer_text\b/", $user_selected_answer)) {
|
905 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
906 |
+
} else if (isset($single_answer[2]) && $single_answer[2] == 1) {
|
907 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
908 |
+
} else if (preg_match("/\b$current_answer_text\b/", $user_selected_answer) && $single_answer[2] !== 1) {
|
909 |
+
$question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
910 |
+
} else {
|
911 |
+
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
912 |
+
}
|
913 |
+
}
|
914 |
+
} else {
|
915 |
+
foreach ($total_answers as $single_answer) {
|
916 |
+
if (isset($single_answer[2]) && $single_answer[2] == 1 && htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0] ) {
|
917 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
918 |
+
} else if (isset($single_answer[2]) && $single_answer[2] == 1) {
|
919 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
920 |
+
} else if (htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0] && $single_answer[2] !== 1) {
|
921 |
+
$question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
922 |
+
} else {
|
923 |
+
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
924 |
+
}
|
925 |
+
}
|
926 |
+
}
|
927 |
+
} else {
|
928 |
+
if (isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 )) {
|
929 |
+
$user_selected_answer = htmlspecialchars_decode($answer[1], ENT_QUOTES);
|
930 |
+
foreach ($total_answers as $single_answer) {
|
931 |
+
if (strpos($user_selected_answer, $single_answer[0]) !== false) {
|
932 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
933 |
+
} else {
|
934 |
+
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
935 |
+
}
|
936 |
+
}
|
937 |
+
} else {
|
938 |
+
foreach ($total_answers as $single_answer) {
|
939 |
+
if (htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0]) {
|
940 |
+
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
941 |
+
} else {
|
942 |
+
$question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
|
943 |
+
}
|
944 |
+
}
|
945 |
+
}
|
946 |
+
}
|
947 |
+
}
|
948 |
+
} else {
|
949 |
+
if (isset($answer['question_type']) && $answer['question_type'] == 11) {
|
950 |
+
$file_extension = substr($answer[1], -4);
|
951 |
+
if ($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif') {
|
952 |
+
$question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
|
953 |
+
} else {
|
954 |
+
$question_with_answer_text .= "<span class='$user_answer_class'>" . trim(htmlspecialchars_decode($answer[1], ENT_QUOTES)) . '</span>';
|
955 |
+
}
|
956 |
+
} else {
|
957 |
+
$question_with_answer_text .= '<span class="qsm-user-answer-text">' . htmlspecialchars_decode($answer[1], ENT_QUOTES) . '</span>';
|
958 |
+
}
|
959 |
+
}
|
960 |
+
}
|
961 |
+
$mlw_question_answer_display = str_replace("%USER_ANSWERS_DEFAULT%", $question_with_answer_text, $mlw_question_answer_display);
|
962 |
+
}
|
963 |
+
if (isset($answer['question_type']) && $answer['question_type'] == 11) {
|
964 |
+
$file_extension = substr($answer[1], -4);
|
965 |
+
if ($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif') {
|
966 |
+
$mlw_question_answer_display = str_replace("%USER_ANSWER%", "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
|
967 |
+
} else {
|
968 |
+
$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);
|
969 |
+
}
|
970 |
+
} else {
|
971 |
+
$mlw_question_answer_display = str_replace("%USER_ANSWER%", "<span class='$user_answer_class'>" . htmlspecialchars_decode($answer[1], ENT_QUOTES) . '</span>', $mlw_question_answer_display);
|
972 |
+
}
|
973 |
+
$answer_2 = !empty($answer[2]) ? $answer[2] : 'NA';
|
974 |
+
$mlw_question_answer_display = str_replace("%CORRECT_ANSWER%", htmlspecialchars_decode($answer_2, ENT_QUOTES), $mlw_question_answer_display);
|
975 |
+
$answer_3 = !empty($answer[3]) ? $answer[3] : 'NA';
|
976 |
+
$mlw_question_answer_display = str_replace("%USER_COMMENTS%", $answer_3, $mlw_question_answer_display);
|
977 |
+
$answer_4 = !empty($qmn_questions[$answer['id']]) ? $qmn_questions[$answer['id']] : 'NA';
|
978 |
+
$mlw_question_answer_display = str_replace("%CORRECT_ANSWER_INFO%", htmlspecialchars_decode($answer_4, ENT_QUOTES), $mlw_question_answer_display);
|
979 |
+
$mlw_question_answer_display = wp_kses_post($mlw_question_answer_display);
|
980 |
+
if ($total_question_cnt == $qsm_question_cnt && $remove_border == false ) {
|
981 |
+
$extra_border_bottom_class = 'qsm-remove-border-bottom';
|
982 |
+
}
|
983 |
+
$display = "<div class='qmn_question_answer $extra_border_bottom_class $question_answer_class'>" . apply_filters('qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array) . '</div>';
|
984 |
+
return $display;
|
985 |
+
}
|
@@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress q
|
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.5.1
|
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,23 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
|
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
= 7.1.2 (September 04, 2020) =
|
139 |
* Bug: Fixed admin results page to make it compatible with new variable %QUESTIONS_ANSWERS_DEFAULT%.
|
140 |
* Bug: Fixed issues with %QUESTIONS_ANSWERS_DEFAULT% variable in quiz result while using point based quiz.
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.5.1
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 7.1.3
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 7.1.3 (September 22, 2020) =
|
139 |
+
* Bug: Fixed issues when email templates were not showing if classic editor was disabled.
|
140 |
+
* Bug: Fixed the issue of Certificate Addon link not showing in admin result detail page issue.
|
141 |
+
* Bug: Fixed point score calculation issue for rich answers.
|
142 |
+
* Bug: Fixed the issue of question title not showing on front while using captcha question type.
|
143 |
+
* Bug: Fixed the issue of Comment Field showing placeholder text when the comment field is blank.
|
144 |
+
* Bug: Removed unnecessary gap between question and answers in quiz result page.
|
145 |
+
* Bug: Fixed the issue of text showing in the next line on mobile while using Fill in the blank question type.
|
146 |
+
* Bug: Fixed the issue of apostrophes showing backslash in email content.
|
147 |
+
* Bug: Fixed the issue of cloning of the question which was creating a blank answer
|
148 |
+
* Bug: Fixed conflict between %QUESTION_ANSWER_X% variable and Extra Template Variables.
|
149 |
+
* Bug: Fixed %QUESTION_ANSWER_X% variable content issue in email.
|
150 |
+
* Enhancement: Implemented %CORRECT_SCORE% template variable score to round figure.
|
151 |
+
* Enhancement: Added the option to disable scroll on click of next and previous button.
|
152 |
+
* Enhancement: Added the option of Deleting a question from question bank while deleting the quiz.
|
153 |
+
* Enhancement: Added a message when multiple choice limits are reached while using Multiple Response and Horizontal Multiple Response question type.
|
154 |
+
|
155 |
= 7.1.2 (September 04, 2020) =
|
156 |
* Bug: Fixed admin results page to make it compatible with new variable %QUESTIONS_ANSWERS_DEFAULT%.
|
157 |
* Bug: Fixed issues with %QUESTIONS_ANSWERS_DEFAULT% variable in quiz result while using point based quiz.
|