Quiz And Survey Master (Formerly Quiz Master Next) - Version 6.4

Version Description

(Jan 1, 2020) = * Bug: Result summary page is not displaying Math problems * Feature: Client wants users to upload images/attachments to the survey * Bug: Edit question popup not working * Bug: PHP Warnings * Bug: Quiz post setting not working properly * Bug: Broken links to documentation pages in quiz setting * Bug: Export & Import addon bug * Bug: Customising form with CSS is not easy * Bug: Bug Regarding Pagination Feature * Feature: User wants a logic to work in the same way for Checkbox & Multiple choice questions * Feature: Provide an export button on top of quiz index

Download this release

Release Info

Developer quizsurvey
Plugin Icon 128x128 Quiz And Survey Master (Formerly Quiz Master Next)
Version 6.4
Comparing to
See all releases

Code changes from version 6.3.6 to 6.4

css/common.css CHANGED
@@ -1,6 +1,7 @@
1
  /**
2
  * Created by dev: 06-11-2019
3
  */
 
4
  .qsm-page .pages_count,
5
  .quiz_section .pages_count{
6
  display: block;
@@ -8,4 +9,10 @@
8
  }
9
  .mlw_qmn_question p:empty{
10
  display: none;
 
 
 
 
 
 
11
  }
1
  /**
2
  * Created by dev: 06-11-2019
3
  */
4
+ .pages_count,
5
  .qsm-page .pages_count,
6
  .quiz_section .pages_count{
7
  display: block;
9
  }
10
  .mlw_qmn_question p:empty{
11
  display: none;
12
+ }
13
+ .MJXc-display{
14
+ display: inline-block !important;
15
+ }
16
+ .mlw_qmn_question{
17
+ display: block;
18
  }
css/qsm-admin.css CHANGED
@@ -730,11 +730,11 @@ h3.addon_category_name {
730
  border-radius: 5px;
731
  box-shadow: none;
732
  color: #666666;
733
- padding: 10px 15px;
734
  width: auto;
735
  height: auto;
736
- min-width: 230px;
737
- max-width:100%;
738
  }
739
  .qsm_tab_content textarea{
740
  background: #ffffff none repeat scroll 0 0;
730
  border-radius: 5px;
731
  box-shadow: none;
732
  color: #666666;
733
+ /*padding: 10px 15px;*/
734
  width: auto;
735
  height: auto;
736
+ /*min-width: 230px;*/
737
+ /*max-width:100%;*/
738
  }
739
  .qsm_tab_content textarea{
740
  background: #ffffff none repeat scroll 0 0;
js/qsm-admin-question.js CHANGED
@@ -266,6 +266,11 @@ var import_button;
266
  var autofill = $( "#hide_autofill" ).val();
267
  var limit_text = $( "#limit_text" ).val();
268
  var limit_multiple_response = $( "#limit_multiple_response" ).val();
 
 
 
 
 
269
  if ( 'new_category' == category ) {
270
  category = $( '#new_category' ).val();
271
  }
@@ -305,7 +310,9 @@ var import_button;
305
  answerEditor: answerType,
306
  autofill: autofill,
307
  limit_text: limit_text,
308
- limit_multiple_response: limit_multiple_response
 
 
309
  },
310
  {
311
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
@@ -347,8 +354,7 @@ var import_button;
347
  openEditPopup: function( questionID ) {
348
  QSMQuestion.prepareCategories();
349
  QSMQuestion.processCategories();
350
- var question = QSMQuestion.questions.get( questionID );
351
- console.log(question)
352
  var questionText = QSMQuestion.prepareQuestionText( question.get( 'name' ) );
353
  $( '#edit_question_id' ).val( questionID );
354
  var question_editor = ''
@@ -380,10 +386,25 @@ var import_button;
380
  get_limit_text = '0';
381
  }
382
  //Get limit multiple response value
383
- var get_limit_mr = question.get( 'limit_multiple_response' );
384
  if( get_limit_mr === null || typeof get_limit_mr === "undefined" ){
385
  get_limit_mr = '0';
386
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  var al = 0;
388
  _.each( answers, function( answer ) {
389
  answer.push(al + 1);
@@ -392,6 +413,14 @@ var import_button;
392
  QSMQuestion.addNewAnswer( answer );
393
  al++;
394
  });
 
 
 
 
 
 
 
 
395
  $( '#hint' ).val( question.get( 'hint' ) );
396
  $( '#correct_answer_info' ).val( question.get( 'answerInfo' ) );
397
  $( "#question_type" ).val( question.get( 'type' ) );
@@ -400,6 +429,7 @@ var import_button;
400
  $( "#hide_autofill" ).val( disableAutofill );
401
  $( "#limit_text" ).val( get_limit_text );
402
  $( "#limit_multiple_response" ).val( get_limit_mr );
 
403
  $( "#change-answer-editor" ).val( answerEditor );
404
  $( ".category-radio" ).removeAttr( 'checked' );
405
  $( "#edit-question-id" ).text('').text(questionID);
@@ -579,6 +609,17 @@ var import_button;
579
  });
580
  }
581
  });
 
 
 
 
 
 
 
 
 
 
 
582
  });
583
  var decodeEntities = (function () {
584
  //create a new html document (doesn't execute script tags in child elements)
266
  var autofill = $( "#hide_autofill" ).val();
267
  var limit_text = $( "#limit_text" ).val();
268
  var limit_multiple_response = $( "#limit_multiple_response" ).val();
269
+ var file_upload_limit = $( "#file_upload_limit" ).val();
270
+ var type_arr = [];
271
+ $.each($("input[name='file_upload_type[]']:checked"), function(){
272
+ type_arr.push($(this).val());
273
+ });
274
  if ( 'new_category' == category ) {
275
  category = $( '#new_category' ).val();
276
  }
310
  answerEditor: answerType,
311
  autofill: autofill,
312
  limit_text: limit_text,
313
+ limit_multiple_response: limit_multiple_response,
314
+ file_upload_limit: file_upload_limit,
315
+ file_upload_type: type_arr.join(","),
316
  },
317
  {
318
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
354
  openEditPopup: function( questionID ) {
355
  QSMQuestion.prepareCategories();
356
  QSMQuestion.processCategories();
357
+ var question = QSMQuestion.questions.get( questionID );
 
358
  var questionText = QSMQuestion.prepareQuestionText( question.get( 'name' ) );
359
  $( '#edit_question_id' ).val( questionID );
360
  var question_editor = ''
386
  get_limit_text = '0';
387
  }
388
  //Get limit multiple response value
389
+ var get_limit_mr = question.get( 'limit_multiple_response' );
390
  if( get_limit_mr === null || typeof get_limit_mr === "undefined" ){
391
  get_limit_mr = '0';
392
  }
393
+ //Get file upload limit
394
+ var get_limit_fu = question.get( 'file_upload_limit' );
395
+ if( get_limit_fu === null || typeof get_limit_fu === "undefined" ){
396
+ get_limit_fu = '0';
397
+ }
398
+ //Get checked question type
399
+ var get_file_upload_type = question.get( 'file_upload_type' );
400
+ $("input[name='file_upload_type[]']:checkbox").attr("checked",false);
401
+ if( get_file_upload_type === null || typeof get_file_upload_type === "undefined" ){
402
+ }else{
403
+ var fut_arr = get_file_upload_type.split(",");
404
+ $.each(fut_arr,function(i){
405
+ $("input[name='file_upload_type[]']:checkbox[value='"+ fut_arr[i] +"']").attr("checked","true");
406
+ });
407
+ }
408
  var al = 0;
409
  _.each( answers, function( answer ) {
410
  answer.push(al + 1);
413
  QSMQuestion.addNewAnswer( answer );
414
  al++;
415
  });
416
+ //Hide the question settings based on question type
417
+ if(question.get( 'type' ) == 11){
418
+ jQuery('#file-upload-type-div').show();
419
+ jQuery('#file-upload-limit').show();
420
+ }else{
421
+ jQuery('#file-upload-type-div').hide();
422
+ jQuery('#file-upload-limit').hide();
423
+ }
424
  $( '#hint' ).val( question.get( 'hint' ) );
425
  $( '#correct_answer_info' ).val( question.get( 'answerInfo' ) );
426
  $( "#question_type" ).val( question.get( 'type' ) );
429
  $( "#hide_autofill" ).val( disableAutofill );
430
  $( "#limit_text" ).val( get_limit_text );
431
  $( "#limit_multiple_response" ).val( get_limit_mr );
432
+ $( "#file_upload_limit" ).val( get_limit_fu );
433
  $( "#change-answer-editor" ).val( answerEditor );
434
  $( ".category-radio" ).removeAttr( 'checked' );
435
  $( "#edit-question-id" ).text('').text(questionID);
609
  });
610
  }
611
  });
612
+ //Hide the question settings based on question type
613
+ $(document).on('change','#question_type', function(){
614
+ var question_val = $(this).val();
615
+ if(question_val == 11){
616
+ jQuery('#file-upload-type-div').show();
617
+ jQuery('#file-upload-limit').show();
618
+ }else{
619
+ jQuery('#file-upload-type-div').hide();
620
+ jQuery('#file-upload-limit').hide();
621
+ }
622
+ });
623
  });
624
  var decodeEntities = (function () {
625
  //create a new html document (doesn't execute script tags in child elements)
js/qsm-admin.js CHANGED
@@ -27,7 +27,8 @@ var QSMQuizzesSurveys;
27
  'views': quizData.views,
28
  'taken': quizData.taken,
29
  'lastActivity': quizData.lastActivity,
30
- 'lastActivityDateTime': quizData.lastActivityDateTime
 
31
  };
32
  var row = $( template( values ) );
33
  $( '#the-list' ).append( row );
@@ -79,6 +80,10 @@ var QSMQuizzesSurveys;
79
  event.preventDefault();
80
  MicroModal.show( 'modal-2' );
81
  });
 
 
 
 
82
  $( '#quiz_search' ).keyup( function() {
83
  QSMQuizzesSurveys.searchQuizzes( $( this ).val() );
84
  });
27
  'views': quizData.views,
28
  'taken': quizData.taken,
29
  'lastActivity': quizData.lastActivity,
30
+ 'lastActivityDateTime': quizData.lastActivityDateTime,
31
+ 'post_status' : quizData.post_status != 'publish' ? '— ' + quizData.post_status : ''
32
  };
33
  var row = $( template( values ) );
34
  $( '#the-list' ).append( row );
80
  event.preventDefault();
81
  MicroModal.show( 'modal-2' );
82
  });
83
+ $( '#show_import_export_popup' ).on( 'click', function( event ) {
84
+ event.preventDefault();
85
+ MicroModal.show( 'modal-export-import' );
86
+ });
87
  $( '#quiz_search' ).keyup( function() {
88
  QSMQuizzesSurveys.searchQuizzes( $( this ).val() );
89
  });
js/qsm-quiz.js CHANGED
@@ -439,6 +439,13 @@ function qmnValidation( element, quiz_form_id ) {
439
  result = false;
440
  }
441
  }
 
 
 
 
 
 
 
442
  if( jQuery( this ).attr( 'class' ).indexOf( 'qsmRequiredSelect' ) > -1 ) {
443
  check_val = jQuery( this ).val();
444
  if ( check_val == "No Answer Provided" ) {
@@ -513,6 +520,7 @@ function qmnDisplayResults( results, quiz_form_id, $container ) {
513
  $container.append( '<div class="qmn_results_page"></div>' );
514
  $container.find( '.qmn_results_page' ).html( results.display );
515
  qsmScrollTo( $container );
 
516
  }
517
  }
518
 
@@ -607,6 +615,21 @@ function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
607
  if (go_to_top == 1) {
608
  qsmScrollTo( $container );
609
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  }
611
 
612
  function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
@@ -655,6 +678,19 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
655
  if (go_to_top == 1) {
656
  qsmScrollTo( $container );
657
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
658
  }
659
 
660
  function qmnUpdatePageNumber( amount, quiz_form_id ) {
@@ -805,6 +841,70 @@ jQuery(function() {
805
  jQuery(radButton).prop("checked", true);
806
  }
807
  });*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
808
  });
809
 
810
  var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
439
  result = false;
440
  }
441
  }
442
+ if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredFileUpload' ) > -1 ) {
443
+ var selected_file = jQuery( this ).get(0).files.length;
444
+ if ( selected_file === 0 ) {
445
+ qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
446
+ result = false;
447
+ }
448
+ }
449
  if( jQuery( this ).attr( 'class' ).indexOf( 'qsmRequiredSelect' ) > -1 ) {
450
  check_val = jQuery( this ).val();
451
  if ( check_val == "No Answer Provided" ) {
520
  $container.append( '<div class="qmn_results_page"></div>' );
521
  $container.find( '.qmn_results_page' ).html( results.display );
522
  qsmScrollTo( $container );
523
+ MathJax.Hub.queue.Push(["Typeset", MathJax.Hub]);
524
  }
525
  }
526
 
615
  if (go_to_top == 1) {
616
  qsmScrollTo( $container );
617
  }
618
+ var page_number = slide_number - pagination;
619
+ if(page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
620
+ var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
621
+ if(hiddem_page_number > 0){
622
+ page_number = parseInt(hiddem_page_number) + 1;
623
+ }
624
+ var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
625
+ var total_page_number = Math.ceil(total_questions / pagination);
626
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
627
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
628
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
629
+ }else{
630
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
631
+ }
632
+
633
  }
634
 
635
  function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
678
  if (go_to_top == 1) {
679
  qsmScrollTo( $container );
680
  }
681
+ var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
682
+ if(hiddem_page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
683
+ var page_number = parseInt(hiddem_page_number) - 1;
684
+ var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
685
+ var total_page_number = Math.ceil(total_questions / pagination);
686
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
687
+ if(page_number == 0){
688
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
689
+ }else{
690
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
691
+ }
692
+ jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
693
+ }
694
  }
695
 
696
  function qmnUpdatePageNumber( amount, quiz_form_id ) {
841
  jQuery(radButton).prop("checked", true);
842
  }
843
  });*/
844
+ //Ajax upload file code
845
+ jQuery('.quiz_section .mlw_answer_file_upload').on('change', function(){
846
+ var $this = jQuery(this);
847
+ var hidden_val = jQuery(this).parent('.quiz_section').find('.mlw_file_upload_hidden_path').val();
848
+ var file_data = jQuery(this).prop('files')[0];
849
+ var form_data = new FormData();
850
+ form_data.append('file', file_data);
851
+ form_data.append('action', 'qsm_upload_image_fd_question');
852
+ var question_id = $this.parent('.quiz_section').find('.mlw_file_upload_hidden_value').attr("name").replace('question','');
853
+ form_data.append('question_id', question_id);
854
+ jQuery.ajax({
855
+ url: qmn_ajax_object.ajaxurl,
856
+ type: 'POST',
857
+ data: form_data,
858
+ cache: false,
859
+ contentType: false,
860
+ processData: false,
861
+ success: function (response) {
862
+ var obj = jQuery.parseJSON(response);
863
+ if(obj.type == 'success'){
864
+ $this.next('.remove-uploaded-file').show();
865
+ $this.next().next('.mlw_file_upload_hidden_value').val(obj.file_url);
866
+ $this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val(obj.file_path);
867
+ $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide();
868
+ }else{
869
+ $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').text('').text(obj.message);
870
+ $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').show();
871
+ $this.parent('.quiz_section').find('.mlw_answer_file_upload').val('');
872
+ }
873
+ }
874
+ });
875
+ return false;
876
+ });
877
+
878
+ //Ajax remove file code
879
+ jQuery('.quiz_section .remove-uploaded-file').on('click', function(){
880
+ var $this = jQuery(this);
881
+ var file_data = jQuery(this).parent('.quiz_section').find('.mlw_file_upload_hidden_path').val();
882
+ var form_data = new FormData();
883
+ form_data.append('action', 'qsm_remove_file_fd_question');
884
+ form_data.append('file_url', file_data);
885
+ jQuery.ajax({
886
+ url: qmn_ajax_object.ajaxurl,
887
+ type: 'POST',
888
+ data: form_data,
889
+ cache: false,
890
+ contentType: false,
891
+ processData: false,
892
+ success: function (response) {
893
+ var obj = jQuery.parseJSON(response);
894
+ if(obj.type == 'success'){
895
+ $this.hide();
896
+ $this.parent('.quiz_section').find('.mlw_file_upload_hidden_value').val('');
897
+ $this.parent('.quiz_section').find('.mlw_file_upload_hidden_path').val('');
898
+ $this.parent('.quiz_section').find('.mlw_answer_file_upload').val('');
899
+ $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').hide();
900
+ }else{
901
+ $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').text('').text(obj.message);
902
+ $this.parent('.quiz_section').find('.mlw-file-upload-error-msg').show();
903
+ }
904
+ }
905
+ });
906
+ return false;
907
+ });
908
  });
909
 
910
  var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
mlw_quizmaster2.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 6.3.6
6
  * Author: ExpressTech
7
- * Author URI: https://expresstech.io/
8
- * Plugin URI: https://quizandsurveymaster.com/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 6.4
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
php/admin/addons-page.php CHANGED
@@ -132,6 +132,7 @@ add_action('plugins_loaded', 'qsm_featured_addons_tab');
132
  * Display get a free addon page
133
  */
134
  function qsm_display_optin_page() {
 
135
  wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
136
  ?>
137
  <div class="wrap about-wrap">
132
  * Display get a free addon page
133
  */
134
  function qsm_display_optin_page() {
135
+ global $mlwQuizMasterNext;
136
  wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
137
  ?>
138
  <div class="wrap about-wrap">
php/admin/options-page-contact-tab.php CHANGED
@@ -58,7 +58,7 @@ function qsm_options_contact_tab_content() {
58
  }
59
 
60
  add_action( 'wp_ajax_qsm_save_contact', 'qsm_contact_form_admin_ajax' );
61
- add_action( 'wp_ajax_nopriv_qsm_save_contact', 'qsm_contact_form_admin_ajax' );
62
 
63
  /**
64
  * Saves the contact form from the quiz settings tab
58
  }
59
 
60
  add_action( 'wp_ajax_qsm_save_contact', 'qsm_contact_form_admin_ajax' );
61
+ //add_action( 'wp_ajax_nopriv_qsm_save_contact', 'qsm_contact_form_admin_ajax' );
62
 
63
  /**
64
  * Saves the contact form from the quiz settings tab
php/admin/options-page-questions-tab.php CHANGED
@@ -80,7 +80,7 @@ function qsm_options_questions_tab_content() {
80
  }
81
  ?>
82
  <h3>Questions</h3>
83
- <p>Use this tab to create and modify the different pages of your quiz or survey as well as the questions on each page. Click "Create New Page" to get started! Need more information? Check out the <a href="https://docs.quizandsurveymaster.com/article/19-creating-pages-and-questions" target="_blank">documentation for this tab!</a></p>
84
  <div class="question-controls">
85
  <div>
86
  <button class="new-page-button button">Create New Page</button>
@@ -200,6 +200,19 @@ function qsm_options_questions_tab_content() {
200
  <label><?php _e( 'Limit Multiple choice( Works for Multiple Response )', 'quiz-master-next' ); ?></label>
201
  <input type="number" name="limit_multiple_response" value="" id="limit_multiple_response"/>
202
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  </div>
204
  </main>
205
  <footer class="qsm-popup__footer">
@@ -276,7 +289,7 @@ function qsm_options_questions_tab_content() {
276
 
277
 
278
  add_action( 'wp_ajax_qsm_save_pages', 'qsm_ajax_save_pages' );
279
- add_action( 'wp_ajax_nopriv_qsm_save_pages', 'qsm_ajax_save_pages' );
280
 
281
 
282
  /**
@@ -300,7 +313,7 @@ function qsm_ajax_save_pages() {
300
  }
301
 
302
  add_action( 'wp_ajax_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
303
- add_action( 'wp_ajax_nopriv_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
304
 
305
  /**
306
  * Loads all the questions and echos out JSON
@@ -330,7 +343,7 @@ function qsm_load_all_quiz_questions_ajax() {
330
  }
331
 
332
  add_action( 'wp_ajax_qsm_send_data_sendy', 'qsm_send_data_sendy' );
333
- add_action( 'wp_ajax_nopriv_qsm_send_data_sendy', 'qsm_send_data_sendy' );
334
 
335
  /**
336
  * @version 6.3.2
80
  }
81
  ?>
82
  <h3>Questions</h3>
83
+ <p>Use this tab to create and modify the different pages of your quiz or survey as well as the questions on each page. Click "Create New Page" to get started! Need more information? Check out the <a href="https://quizandsurveymaster.com/docs/creating-quizzes-and-surveys/adding-and-editing-questions/" target="_blank">documentation for this tab!</a></p>
84
  <div class="question-controls">
85
  <div>
86
  <button class="new-page-button button">Create New Page</button>
200
  <label><?php _e( 'Limit Multiple choice( Works for Multiple Response )', 'quiz-master-next' ); ?></label>
201
  <input type="number" name="limit_multiple_response" value="" id="limit_multiple_response"/>
202
  </div>
203
+ <div id="file-upload-limit" class="qsm-row">
204
+ <label><?php _e( 'File upload limit ( in MB )', 'quiz-master-next' ); ?></label>
205
+ <input type="number" name="file_upload_limit" value="" id="file_upload_limit"/>
206
+ </div>
207
+ <div id="file-upload-type-div" class="qsm-row">
208
+ <label><?php _e( 'Allow File type', 'quiz-master-next' ); ?></label>
209
+ <input type="checkbox" name="file_upload_type[]" value="text/plain" /> <?php _e( 'Text File', 'quiz-master-next' ); ?><br/>
210
+ <input type="checkbox" name="file_upload_type[]" value="image" /> <?php _e( 'Image', 'quiz-master-next' ); ?><br/>
211
+ <input type="checkbox" name="file_upload_type[]" value="application/pdf" /> <?php _e( 'PDF', 'quiz-master-next' ); ?><br/>
212
+ <input type="checkbox" name="file_upload_type[]" value="doc" /> <?php _e( 'Doc', 'quiz-master-next' ); ?><br/>
213
+ <input type="checkbox" name="file_upload_type[]" value="excel" /> <?php _e( 'Excel', 'quiz-master-next' ); ?><br/>
214
+ <input type="checkbox" name="file_upload_type[]" value="video/mp4" /> <?php _e( 'Video', 'quiz-master-next' ); ?>
215
+ </div>
216
  </div>
217
  </main>
218
  <footer class="qsm-popup__footer">
289
 
290
 
291
  add_action( 'wp_ajax_qsm_save_pages', 'qsm_ajax_save_pages' );
292
+ //add_action( 'wp_ajax_nopriv_qsm_save_pages', 'qsm_ajax_save_pages' );
293
 
294
 
295
  /**
313
  }
314
 
315
  add_action( 'wp_ajax_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
316
+ //add_action( 'wp_ajax_nopriv_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
317
 
318
  /**
319
  * Loads all the questions and echos out JSON
343
  }
344
 
345
  add_action( 'wp_ajax_qsm_send_data_sendy', 'qsm_send_data_sendy' );
346
+ //add_action( 'wp_ajax_nopriv_qsm_send_data_sendy', 'qsm_send_data_sendy' );
347
 
348
  /**
349
  * @version 6.3.2
php/admin/options-page-style-tab.php CHANGED
@@ -32,7 +32,7 @@ function qsm_options_styling_tab_content() {
32
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
33
 
34
  $quiz_id = intval( $_GET['quiz_id'] );
35
- if ( isset( $_POST['save_style_options'] ) && 'confirmation' == $_POST['save_style_options'] ) {
36
 
37
  $style_quiz_id = intval( $_POST['style_quiz_id'] );
38
  $quiz_theme = sanitize_text_field( $_POST['save_quiz_theme'] );
@@ -92,12 +92,13 @@ function qsm_options_styling_tab_content() {
92
  <hr />
93
  <h3><?php _e('Custom Style CSS', 'quiz-master-next'); ?></h3>
94
  <p><?php _e('For help and guidance along with a list of different classes used in this plugin, please visit the following link:', 'quiz-master-next'); ?>
95
- <a target="_blank" href="https://docs.quizandsurveymaster.com/article/34-css-in-qsm">CSS in QSM</a></p>
96
  <table class="form-table">
97
  <tr>
98
  <td><textarea style="width: 100%; height: 700px;" id="quiz_css" name="quiz_css"><?php echo $mlw_quiz_options->quiz_stye; ?></textarea></td>
99
  </tr>
100
  </table>
 
101
  <button id="save_styles_button" class="button-primary"><?php _e('Save Quiz Style', 'quiz-master-next'); ?></button>
102
  </form>
103
  <?php
32
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
33
 
34
  $quiz_id = intval( $_GET['quiz_id'] );
35
+ if ( isset( $_POST['qsm_style_tab_nonce'] ) && wp_verify_nonce( $_POST['qsm_style_tab_nonce'], 'qsm_style_tab_nonce_action' ) && isset( $_POST['save_style_options'] ) && 'confirmation' == $_POST['save_style_options'] ) {
36
 
37
  $style_quiz_id = intval( $_POST['style_quiz_id'] );
38
  $quiz_theme = sanitize_text_field( $_POST['save_quiz_theme'] );
92
  <hr />
93
  <h3><?php _e('Custom Style CSS', 'quiz-master-next'); ?></h3>
94
  <p><?php _e('For help and guidance along with a list of different classes used in this plugin, please visit the following link:', 'quiz-master-next'); ?>
95
+ <a target="_blank" href="https://quizandsurveymaster.com/docs/advanced-topics/editing-design-styles-css/">CSS in QSM</a></p>
96
  <table class="form-table">
97
  <tr>
98
  <td><textarea style="width: 100%; height: 700px;" id="quiz_css" name="quiz_css"><?php echo $mlw_quiz_options->quiz_stye; ?></textarea></td>
99
  </tr>
100
  </table>
101
+ <?php wp_nonce_field( 'qsm_style_tab_nonce_action', 'qsm_style_tab_nonce' ); ?>
102
  <button id="save_styles_button" class="button-primary"><?php _e('Save Quiz Style', 'quiz-master-next'); ?></button>
103
  </form>
104
  <?php
php/admin/quiz-options-page.php CHANGED
@@ -51,11 +51,11 @@ function qsm_generate_quiz_options() {
51
  wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
52
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
53
  wp_enqueue_style( 'qmn_jquery_redmond_theme', plugins_url( '../../css/jquery-ui.css', __FILE__ ) );
54
- wp_enqueue_script( 'math_jax', QSM_PLUGIN_URL . 'js/MathJax.js?config=TeX-MML-AM_CHTML' );
55
 
56
  // Edit Quiz Name.
57
  if ( isset( $_POST['qsm_edit_name_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_edit_name_quiz_nonce'], 'qsm_edit_name_quiz' ) ) {
58
- $quiz_id = intval( $_POST['edit_quiz_id'] );
59
  $quiz_name = sanitize_text_field( htmlspecialchars( stripslashes( $_POST['edit_quiz_name'] ), ENT_QUOTES ) );
60
  $mlwQuizMasterNext->quizCreator->edit_quiz_name( $quiz_id, $quiz_name );
61
  }
@@ -81,7 +81,7 @@ function qsm_generate_quiz_options() {
81
 
82
  // The Loop
83
  $post_permalink = '';
84
- if ($the_query->have_posts()) {
85
  while ($the_query->have_posts()) {
86
  $the_query->the_post();
87
  $post_permalink = get_the_permalink(get_the_ID());
@@ -98,7 +98,7 @@ function qsm_generate_quiz_options() {
98
  ob_start();
99
 
100
  // If the quiz is set and not empty.
101
- if ( ! empty( $quiz_id ) ) {
102
  ?>
103
  <nav class="nav-tab-wrapper">
104
  <?php
@@ -125,7 +125,7 @@ function qsm_generate_quiz_options() {
125
  ?>
126
  </div>
127
  <?php
128
- } else {
129
  ?>
130
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
131
  <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
51
  wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
52
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
53
  wp_enqueue_style( 'qmn_jquery_redmond_theme', plugins_url( '../../css/jquery-ui.css', __FILE__ ) );
54
+ wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
55
 
56
  // Edit Quiz Name.
57
  if ( isset( $_POST['qsm_edit_name_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_edit_name_quiz_nonce'], 'qsm_edit_name_quiz' ) ) {
58
+ //$quiz_id = intval( $_POST['edit_quiz_id'] );
59
  $quiz_name = sanitize_text_field( htmlspecialchars( stripslashes( $_POST['edit_quiz_name'] ), ENT_QUOTES ) );
60
  $mlwQuizMasterNext->quizCreator->edit_quiz_name( $quiz_id, $quiz_name );
61
  }
81
 
82
  // The Loop
83
  $post_permalink = '';
84
+ if ($the_query->have_posts()) {
85
  while ($the_query->have_posts()) {
86
  $the_query->the_post();
87
  $post_permalink = get_the_permalink(get_the_ID());
98
  ob_start();
99
 
100
  // If the quiz is set and not empty.
101
+ if ( $quiz_id ) {
102
  ?>
103
  <nav class="nav-tab-wrapper">
104
  <?php
125
  ?>
126
  </div>
127
  <?php
128
+ } else {
129
  ?>
130
  <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
131
  <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
php/admin/quizzes-page.php CHANGED
@@ -85,19 +85,19 @@ function qsm_generate_quizzes_surveys_page() {
85
  $my_query = new WP_Query( array(
86
  'post_type' => 'quiz',
87
  'posts_per_page' => -1,
88
- 'post_status' => 'publish',
89
  ));
90
  if ( $my_query->have_posts() ) {
91
  while ( $my_query->have_posts() ) {
92
  $my_query->the_post();
93
  $post_to_quiz_array[ get_post_meta( get_the_ID(), 'quiz_id', true ) ] = array(
94
- 'link' => get_permalink(),
95
  'id' => get_the_ID(),
 
96
  );
97
  }
98
  }
99
- wp_reset_postdata();
100
-
101
  $quiz_json_array = array();
102
  foreach ( $quizzes as $quiz ) {
103
  if ( ! isset( $post_to_quiz_array[ $quiz->quiz_id ] ) ) {
@@ -105,7 +105,7 @@ function qsm_generate_quizzes_surveys_page() {
105
  $quiz_post = array(
106
  'post_title' => $quiz->quiz_name,
107
  'post_content' => "[qsm quiz={$quiz->quiz_id}]",
108
- 'post_status' => 'publish',
109
  'post_author' => $current_user->ID,
110
  'post_type' => 'quiz',
111
  );
@@ -114,6 +114,7 @@ function qsm_generate_quizzes_surveys_page() {
114
  $post_to_quiz_array[ $quiz->quiz_id ] = array(
115
  'link' => get_permalink( $quiz_post_id ),
116
  'id' => $quiz_post_id,
 
117
  );
118
  }
119
 
@@ -128,13 +129,17 @@ function qsm_generate_quizzes_surveys_page() {
128
  'taken' => $quiz->quiz_taken,
129
  'lastActivity' => $activity_date,
130
  'lastActivityDateTime' => $activity_date . ' ' .$activity_time,
 
131
  );
132
  }
133
- $total_count = count( $quiz_json_array );
134
  wp_localize_script( 'qsm_admin_script', 'qsmQuizObject', $quiz_json_array );
135
  ?>
136
  <div class="wrap qsm-quizes-page">
137
- <h1><?php esc_html_e( 'Quizzes/Surveys', 'quiz-master-next' ); ?><a id="new_quiz_button" href="#" class="add-new-h2"><?php _e( 'Add New', 'quiz-master-next' ); ?></a></h1>
 
 
 
138
  <?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
139
  <?php
140
  if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) {
@@ -151,6 +156,11 @@ function qsm_generate_quizzes_surveys_page() {
151
  <label class="screen-reader-text" for="quiz_search"><?php esc_html_e( 'Search', 'quiz-master-next' ); ?></label>
152
  <input type="search" id="quiz_search" name="quiz_search" value="">
153
  <a href="#" class="button"><?php esc_html_e( 'Search', 'quiz-master-next' ); ?></a>
 
 
 
 
 
154
  </p>
155
  <div class="tablenav top">
156
  <div class="tablenav-pages">
@@ -336,6 +346,25 @@ function qsm_generate_quizzes_surveys_page() {
336
  </div>
337
  </div>
338
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
 
340
  <!-- Popup for delete quiz -->
341
  <div class="qsm-popup qsm-popup-slide" id="modal-6" aria-hidden="true">
@@ -363,7 +392,7 @@ function qsm_generate_quizzes_surveys_page() {
363
  <script type="text/template" id="tmpl-quiz-row">
364
  <tr class="qsm-quiz-row" data-id="{{ data.id }}">
365
  <td class="post-title column-title">
366
- <a class="row-title" href="admin.php?page=mlw_quiz_options&&quiz_id={{ data.id }}" aria-label="{{ data.name }}">{{ data.name }}</a><a target="_blank" class="quiz-preview-link" href="{{ data.link }}"><span class="dashicons dashicons-external"></span></a>
367
  <div class="row-actions">
368
  <a class="qsm-action-link" href="admin.php?page=mlw_quiz_options&&quiz_id={{ data.id }}"><?php _e( 'Edit', 'quiz-master-next' ); ?></a> |
369
  <a class="qsm-action-link" href="post.php?post={{ data.postID }}&action=edit"><?php _e( 'Post Settings', 'quiz-master-next' ); ?></a> |
85
  $my_query = new WP_Query( array(
86
  'post_type' => 'quiz',
87
  'posts_per_page' => -1,
88
+ 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private')
89
  ));
90
  if ( $my_query->have_posts() ) {
91
  while ( $my_query->have_posts() ) {
92
  $my_query->the_post();
93
  $post_to_quiz_array[ get_post_meta( get_the_ID(), 'quiz_id', true ) ] = array(
94
+ 'link' => get_the_permalink(get_the_ID()),
95
  'id' => get_the_ID(),
96
+ 'post_status' => get_post_status(get_the_ID()),
97
  );
98
  }
99
  }
100
+ wp_reset_postdata();
 
101
  $quiz_json_array = array();
102
  foreach ( $quizzes as $quiz ) {
103
  if ( ! isset( $post_to_quiz_array[ $quiz->quiz_id ] ) ) {
105
  $quiz_post = array(
106
  'post_title' => $quiz->quiz_name,
107
  'post_content' => "[qsm quiz={$quiz->quiz_id}]",
108
+ //'post_status' => 'publish',
109
  'post_author' => $current_user->ID,
110
  'post_type' => 'quiz',
111
  );
114
  $post_to_quiz_array[ $quiz->quiz_id ] = array(
115
  'link' => get_permalink( $quiz_post_id ),
116
  'id' => $quiz_post_id,
117
+ 'post_status' => get_post_status($quiz_post_id),
118
  );
119
  }
120
 
129
  'taken' => $quiz->quiz_taken,
130
  'lastActivity' => $activity_date,
131
  'lastActivityDateTime' => $activity_date . ' ' .$activity_time,
132
+ 'post_status' => $post_to_quiz_array[ $quiz->quiz_id ]['post_status'],
133
  );
134
  }
135
+ $total_count = count( $quiz_json_array );
136
  wp_localize_script( 'qsm_admin_script', 'qsmQuizObject', $quiz_json_array );
137
  ?>
138
  <div class="wrap qsm-quizes-page">
139
+ <h1>
140
+ <?php esc_html_e( 'Quizzes/Surveys', 'quiz-master-next' ); ?>
141
+ <a id="new_quiz_button" href="#" class="add-new-h2"><?php _e( 'Add New', 'quiz-master-next' ); ?></a>
142
+ </h1>
143
  <?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
144
  <?php
145
  if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) {
156
  <label class="screen-reader-text" for="quiz_search"><?php esc_html_e( 'Search', 'quiz-master-next' ); ?></label>
157
  <input type="search" id="quiz_search" name="quiz_search" value="">
158
  <a href="#" class="button"><?php esc_html_e( 'Search', 'quiz-master-next' ); ?></a>
159
+ <?php if(class_exists('QSM_Export_Import')){ ?>
160
+ <a class="button button-primary" href="<?php echo admin_url() . 'admin.php?page=qmn_addons&tab=export-and-import'; ?>" target="_blank"><?php _e( 'Import & Export', 'quiz-master-next' ); ?></a>
161
+ <?php } else{ ?>
162
+ <a id="show_import_export_popup" href="#" style="position: relative;top: 0px;" class="add-new-h2 button-primary"><?php _e( 'Import & Export', 'quiz-master-next' ); ?></a>
163
+ <?php } ?>
164
  </p>
165
  <div class="tablenav top">
166
  <div class="tablenav-pages">
346
  </div>
347
  </div>
348
  </div>
349
+
350
+ <!-- Popup for export import upsell -->
351
+ <div class="qsm-popup qsm-popup-slide" id="modal-export-import" aria-hidden="true">
352
+ <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
353
+ <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-5-title">
354
+ <header class="qsm-popup__header">
355
+ <h2 class="qsm-popup__title" id="modal-5-title"><?php _e( 'Extend QSM', 'quiz-master-next' ); ?></h2>
356
+ <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
357
+ </header>
358
+ <main class="qsm-popup__content" id="modal-5-content">
359
+ <h3><b><?php _e( 'Export functionality is provided as Premium addon.', 'quiz-master-next' ); ?></b></h3>
360
+ </main>
361
+ <footer class="qsm-popup__footer">
362
+ <a style="color: white; text-decoration: none;" href="https://quizandsurveymaster.com/downloads/export-import/" target="_blank" class="qsm-popup__btn qsm-popup__btn-primary"><?php _e('Buy Now', 'quiz-master-next'); ?></a>
363
+ <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window"><?php _e('Cancel', 'quiz-master-next'); ?></button>
364
+ </footer>
365
+ </div>
366
+ </div>
367
+ </div>
368
 
369
  <!-- Popup for delete quiz -->
370
  <div class="qsm-popup qsm-popup-slide" id="modal-6" aria-hidden="true">
392
  <script type="text/template" id="tmpl-quiz-row">
393
  <tr class="qsm-quiz-row" data-id="{{ data.id }}">
394
  <td class="post-title column-title">
395
+ <a class="row-title" href="admin.php?page=mlw_quiz_options&&quiz_id={{ data.id }}" aria-label="{{ data.name }}">{{ data.name }} <b style="color: #222; text-transform: capitalize;">{{ data.post_status }}</b></a><a target="_blank" class="quiz-preview-link" href="{{ data.link }}"><span class="dashicons dashicons-external"></span></a>
396
  <div class="row-actions">
397
  <a class="qsm-action-link" href="admin.php?page=mlw_quiz_options&&quiz_id={{ data.id }}"><?php _e( 'Edit', 'quiz-master-next' ); ?></a> |
398
  <a class="qsm-action-link" href="post.php?post={{ data.postID }}&action=edit"><?php _e( 'Post Settings', 'quiz-master-next' ); ?></a> |
php/admin/settings-page.php CHANGED
@@ -285,6 +285,7 @@ class QMNGlobalSettingsPage {
285
  * @return void
286
  */
287
  public static function display_page() {
 
288
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
289
  ?>
290
  <div class="wrap">
285
  * @return void
286
  */
287
  public static function display_page() {
288
+ global $mlwQuizMasterNext;
289
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
290
  ?>
291
  <div class="wrap">
php/classes/class-qmn-plugin-helper.php CHANGED
@@ -367,9 +367,9 @@ class QMNPluginHelper {
367
  }
368
  if ( 2 == $quiz_options->randomness_order || 3 == $quiz_options->randomness_order ) {
369
  shuffle( $answers );
370
- }
371
  foreach($this->question_types as $type)
372
- {
373
  if ($type["slug"] == strtolower(str_replace( " ", "-", $slug)))
374
  {
375
  if ($type["graded"])
@@ -382,7 +382,7 @@ class QMNPluginHelper {
382
  }
383
  if($quiz_options->show_category_on_front && $question->category != ''){
384
  $display .= '<div class="quiz-cat">[ ' . $question->category .' ]</div>';
385
- }
386
  $display .= call_user_func($type['display'], intval($question_id), $question->question_name, $answers);
387
  }
388
  }
367
  }
368
  if ( 2 == $quiz_options->randomness_order || 3 == $quiz_options->randomness_order ) {
369
  shuffle( $answers );
370
+ }
371
  foreach($this->question_types as $type)
372
+ {
373
  if ($type["slug"] == strtolower(str_replace( " ", "-", $slug)))
374
  {
375
  if ($type["graded"])
382
  }
383
  if($quiz_options->show_category_on_front && $question->category != ''){
384
  $display .= '<div class="quiz-cat">[ ' . $question->category .' ]</div>';
385
+ }
386
  $display .= call_user_func($type['display'], intval($question_id), $question->question_name, $answers);
387
  }
388
  }
php/classes/class-qmn-quiz-creator.php CHANGED
@@ -290,7 +290,7 @@ class QMNQuizCreator {
290
  ),
291
  array( '%d' )
292
  );
293
- if ( false !== $results ) {
294
  $mlwQuizMasterNext->alertManager->newAlert( __( 'The name of your quiz or survey has been updated successfully.', 'quiz-master-next' ), 'success' );
295
  $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Name Has Been Edited: $quiz_name" );
296
  } else {
290
  ),
291
  array( '%d' )
292
  );
293
+ if ( false !== $results ) {
294
  $mlwQuizMasterNext->alertManager->newAlert( __( 'The name of your quiz or survey has been updated successfully.', 'quiz-master-next' ), 'success' );
295
  $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Name Has Been Edited: $quiz_name" );
296
  } else {
php/classes/class-qmn-quiz-manager.php CHANGED
@@ -46,8 +46,106 @@ class QMNQuizManager {
46
  add_action('wp_ajax_nopriv_qsm_get_quiz_to_reload', array($this, 'qsm_get_quiz_to_reload'));
47
  add_action('wp_ajax_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
48
  add_action('wp_ajax_nopriv_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
 
 
 
 
 
 
 
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /**
52
  * @version 6.3.2
53
  * Get question quick result
@@ -137,6 +235,7 @@ class QMNQuizManager {
137
  }
138
  wp_enqueue_style('qmn_quiz_animation_style', plugins_url('../../css/animate.css', __FILE__));
139
  wp_enqueue_style('qmn_quiz_common_style', plugins_url('../../css/common.css', __FILE__));
 
140
 
141
  // Starts to prepare variable array for filters.
142
  $qmn_array_for_variables = array(
@@ -368,7 +467,7 @@ class QMNQuizManager {
368
  wp_enqueue_script('progress-bar', plugins_url('../../js/progressbar.min.js', __FILE__));
369
  wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
370
  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 : ''));
371
- wp_enqueue_script( 'math_jax', QSM_PLUGIN_URL . 'js/MathJax.js' );
372
  global $qmn_total_questions;
373
  $qmn_total_questions = 0;
374
  global $mlw_qmn_section_count;
@@ -399,7 +498,7 @@ class QMNQuizManager {
399
  wp_reset_postdata();
400
  }
401
  $quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
402
- $quiz_display .= "<form name='quizForm{$quiz_data['quiz_id']}' id='quizForm{$quiz_data['quiz_id']}' action='' method='post' class='qsm-quiz-form qmn_quiz_form mlw_quiz_form' novalidate >";
403
  $quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
404
  $quiz_display .= "<span id='mlw_top_of_quiz'></span>";
405
  $quiz_display = apply_filters('qmn_begin_quiz_form', $quiz_display, $options, $quiz_data);
@@ -409,7 +508,7 @@ class QMNQuizManager {
409
  if (0 == $options->randomness_order && 0 == $options->question_from_total && 0 == $options->pagination && 0 !== count($pages)) {
410
  $quiz_display .= $this->display_pages($options, $quiz_data);
411
  } else {
412
- // ... else, use older system.
413
  $questions = $this->load_questions($quiz_data['quiz_id'], $options, true, $question_amount);
414
  $answers = $this->create_answer_array($questions);
415
  $quiz_display .= $this->display_begin_section($options, $quiz_data);
@@ -454,6 +553,7 @@ class QMNQuizManager {
454
  $question_list = '';
455
  $contact_fields = QSM_Contact_Manager::load_fields();
456
  $animation_effect = isset($options->quiz_animation) && $options->quiz_animation != '' ? ' animated ' . $options->quiz_animation : '';
 
457
  if (count($pages) > 1 && (!empty($options->message_before) || ( 0 == $options->contact_info_location && $contact_fields ) )) {
458
  $qmn_json_data['first_page'] = true;
459
  $message_before = wpautop(htmlspecialchars_decode($options->message_before, ENT_QUOTES));
@@ -491,10 +591,10 @@ class QMNQuizManager {
491
  ?>
492
  </div>
493
  <?php
494
- }
495
  foreach ($pages[0] as $question_id) {
496
  $question_list .= $question_id . 'Q';
497
- $question = $questions[$question_id];
498
  ?>
499
  <div class='quiz_section question-section-id-<?php echo esc_attr($question_id); ?>'>
500
  <?php
@@ -567,14 +667,16 @@ class QMNQuizManager {
567
  ?>
568
  </div>
569
  <?php
570
- }
 
571
  ?>
572
- <span class="pages_count">
573
- <?php
574
- $text_c = $pages_count . ' out of ' .$total_pages_count;
575
- echo apply_filters('qsm_total_pages_count',$text_c,$pages_count,$total_pages_count);
576
- ?>
577
- </span>
 
578
  </section>
579
  <?php
580
  $pages_count++;
@@ -686,7 +788,12 @@ class QMNQuizManager {
686
  global $mlw_qmn_section_count;
687
  $question_id_list = '';
688
  $animation_effect = isset($qmn_quiz_options->quiz_animation) && $qmn_quiz_options->quiz_animation != '' ? ' animated ' . $qmn_quiz_options->quiz_animation : '';
689
- $total_pages_count = count($qmn_quiz_questions);
 
 
 
 
 
690
  $pages_count = 1;
691
  foreach ($qmn_quiz_questions as $mlw_question) {
692
  $question_id_list .= $mlw_question->question_id . "Q";
@@ -708,14 +815,16 @@ class QMNQuizManager {
708
  if (!empty($mlw_question->hints)) {
709
  $question_display .= "<div title=\"" . esc_attr(htmlspecialchars_decode($mlw_question->hints, ENT_QUOTES)) . "\" class='qsm_hint mlw_qmn_hint_link'>{$qmn_quiz_options->hint_text}</div>";
710
  $question_display .= "<br /><br />";
711
- }
712
- $question_display .= "<span class='pages_count'>";
713
- $text_c = $pages_count . ' out of ' .$total_pages_count;
714
- $question_display .= apply_filters('qsm_total_pages_count',$text_c,$pages_count,$total_pages_count);
715
- $question_display .= "</span>";
716
  $question_display .= "</div>";
717
  $pages_count++;
718
  }
 
 
 
 
 
 
719
  $question_display .= "<input type='hidden' name='qmn_question_list' value='$question_id_list' />";
720
  return $question_display;
721
  }
@@ -811,8 +920,8 @@ class QMNQuizManager {
811
  */
812
  public function ajax_submit_results() {
813
  global $qmn_allowed_visit;
814
- global $mlwQuizMasterNext;
815
- parse_str($_POST["quizData"], $_POST);
816
  $qmn_allowed_visit = true;
817
  $quiz = intval($_POST["qmn_quiz_id"]);
818
  $mlwQuizMasterNext->pluginHelper->prepare_quiz($quiz);
@@ -825,16 +934,19 @@ class QMNQuizManager {
825
  );
826
  $post_data = array(
827
  'g-recaptcha-response' => isset($_POST['g-recaptcha-response']) ? sanitize_textarea_field($_POST['g-recaptcha-response']) : ''
828
- );
829
  if(class_exists('QSM_Recaptcha')){
830
- $verified = qsm_verify_recaptcha($post_data);
831
- if(!$verified){
832
- echo json_encode(array(
833
- 'display' => htmlspecialchars_decode('ReCaptcha Validation failed'),
834
- 'redirect' => FALSE,
835
- ));
836
- exit;
837
- }
 
 
 
838
  }
839
  echo json_encode($this->submit_results($options, $data));
840
  die();
@@ -869,7 +981,7 @@ class QMNQuizManager {
869
  public function submit_results($qmn_quiz_options, $qmn_array_for_variables) {
870
  global $qmn_allowed_visit;
871
  $result_display = '';
872
-
873
  $qmn_array_for_variables['user_ip'] = $this->get_user_ip();
874
 
875
  $result_display = apply_filters('qmn_begin_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
@@ -1113,7 +1225,8 @@ class QMNQuizManager {
1113
  "correct" => $correct_status,
1114
  "id" => $question['question_id'],
1115
  "points" => $answer_points,
1116
- "category" => $question['category']
 
1117
  ), $options, $quiz_data);
1118
  }
1119
  break;
@@ -1521,7 +1634,11 @@ function qmn_require_login_check($display, $qmn_quiz_options, $qmn_array_for_var
1521
  global $qmn_allowed_visit;
1522
  if ($qmn_quiz_options->require_log_in == 1 && !is_user_logged_in()) {
1523
  $qmn_allowed_visit = false;
1524
- $mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text, ENT_QUOTES));
 
 
 
 
1525
  $mlw_message = apply_filters('mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
1526
  $mlw_message = str_replace("\n", "<br>", $mlw_message);
1527
  $display .= $mlw_message;
46
  add_action('wp_ajax_nopriv_qsm_get_quiz_to_reload', array($this, 'qsm_get_quiz_to_reload'));
47
  add_action('wp_ajax_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
48
  add_action('wp_ajax_nopriv_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
49
+ //Upload file of file upload question type
50
+ add_action('wp_ajax_qsm_upload_image_fd_question', array($this, 'qsm_upload_image_fd_question'));
51
+ add_action('wp_ajax_nopriv_qsm_upload_image_fd_question', array($this, 'qsm_upload_image_fd_question'));
52
+
53
+ //remove file of file upload question type
54
+ add_action('wp_ajax_qsm_remove_file_fd_question', array($this, 'qsm_remove_file_fd_question'));
55
+ add_action('wp_ajax_nopriv_qsm_remove_file_fd_question', array($this, 'qsm_remove_file_fd_question'));
56
  }
57
 
58
+ /**
59
+ * @version 6.3.7
60
+ * Upload file to server
61
+ */
62
+ public function qsm_upload_image_fd_question(){
63
+ global $mlwQuizMasterNext;
64
+ $question_id = isset($_POST['question_id']) ? sanitize_text_field($_POST['question_id']) : 0;
65
+ $file_upload_type = $mlwQuizMasterNext->pluginHelper->get_question_setting($question_id, 'file_upload_type');
66
+ $file_upload_limit = $mlwQuizMasterNext->pluginHelper->get_question_setting($question_id, 'file_upload_limit');
67
+ $mimes = array();
68
+ if($file_upload_type){
69
+ $file_type_exp = explode(',', $file_upload_type);
70
+ foreach ($file_type_exp as $value) {
71
+ if($value == 'image'){
72
+ $mimes[] = 'image/jpeg';
73
+ $mimes[] = 'image/png';
74
+ $mimes[] = 'image/x-icon';
75
+ $mimes[] = 'image/gif';
76
+ }else if($value == 'doc'){
77
+ $mimes[] = 'application/msword';
78
+ $mimes[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
79
+ }else if($value == 'excel'){
80
+ $mimes[] = 'application/excel, application/vnd.ms-excel, application/x-excel, application/x-msexcel';
81
+ $mimes[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
82
+ }else{
83
+ $mimes[] = $value;
84
+ }
85
+ }
86
+ }
87
+ $json = array();
88
+ if (in_array($_FILES["file"]['type'], $mimes)) {
89
+ if($_FILES["file"]['size'] >= $file_upload_limit * 1024 * 1024){
90
+ $json['type']= 'error';
91
+ $json['message'] = 'File is too large. File must be less than ' . $file_upload_limit . ' MB';
92
+ echo json_encode($json);
93
+ exit;
94
+ }
95
+ $upload_dir = wp_upload_dir();
96
+ $datafile = $_FILES["file"]["tmp_name"];
97
+ $file_name = $_FILES["file"]["name"];
98
+ $file = $upload_dir['path'] . '/' . $_FILES['productbd']['name'];
99
+ $counter = 1;
100
+ $rawBaseName = pathinfo($file_name, PATHINFO_FILENAME);
101
+ $extension = pathinfo($file_name, PATHINFO_EXTENSION);
102
+ if(file_exists($file)){
103
+ while (file_exists($file)) {
104
+ $new_fname = $rawBaseName . '-' . $counter . '.' . $extension;
105
+ $file = $upload_dir['path'] . '/' . $new_fname;
106
+ $file_url = $upload_dir['url'] . '/' . $new_fname;
107
+ $counter++;
108
+ }
109
+ }
110
+ if (!move_uploaded_file($datafile, $file)) {
111
+ $json['type']= 'error';
112
+ $json['message'] = 'File not uploaded';
113
+ echo json_encode($json);
114
+ }else{
115
+ $json['type']= 'success';
116
+ $json['message'] = 'File uploaded successfully';
117
+ $json['file_url'] = $file_url;
118
+ $json['file_path'] = $file;
119
+ echo json_encode($json);
120
+ }
121
+ }else{
122
+ $json['type']= 'error';
123
+ $json['message'] = 'File type is not supported';
124
+ echo json_encode($json);
125
+ }
126
+ exit;
127
+ }
128
+
129
+ /**
130
+ * @since 6.3.7
131
+ * Remove the uploaded image
132
+ */
133
+ public function qsm_remove_file_fd_question(){
134
+ $file_url = isset($_POST['file_url']) ? sanitize_text_field($_POST['file_url']) : '';
135
+ if($file_url){
136
+ wp_delete_file($file_url);
137
+ $json['type']= 'success';
138
+ $json['message'] = 'File removed successfully';
139
+ echo json_encode($json);
140
+ exit;
141
+ }
142
+ $json['type']= 'error';
143
+ $json['message'] = 'File not removed';
144
+ echo json_encode($json);
145
+ exit;
146
+ }
147
+
148
+
149
  /**
150
  * @version 6.3.2
151
  * Get question quick result
235
  }
236
  wp_enqueue_style('qmn_quiz_animation_style', plugins_url('../../css/animate.css', __FILE__));
237
  wp_enqueue_style('qmn_quiz_common_style', plugins_url('../../css/common.css', __FILE__));
238
+ wp_enqueue_style('dashicons');
239
 
240
  // Starts to prepare variable array for filters.
241
  $qmn_array_for_variables = array(
467
  wp_enqueue_script('progress-bar', plugins_url('../../js/progressbar.min.js', __FILE__));
468
  wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
469
  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 : ''));
470
+ wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
471
  global $qmn_total_questions;
472
  $qmn_total_questions = 0;
473
  global $mlw_qmn_section_count;
498
  wp_reset_postdata();
499
  }
500
  $quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
501
+ $quiz_display .= "<form name='quizForm{$quiz_data['quiz_id']}' id='quizForm{$quiz_data['quiz_id']}' action='' method='POST' class='qsm-quiz-form qmn_quiz_form mlw_quiz_form' novalidate enctype='multipart/form-data'>";
502
  $quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
503
  $quiz_display .= "<span id='mlw_top_of_quiz'></span>";
504
  $quiz_display = apply_filters('qmn_begin_quiz_form', $quiz_display, $options, $quiz_data);
508
  if (0 == $options->randomness_order && 0 == $options->question_from_total && 0 == $options->pagination && 0 !== count($pages)) {
509
  $quiz_display .= $this->display_pages($options, $quiz_data);
510
  } else {
511
+ // ... else, use older system.
512
  $questions = $this->load_questions($quiz_data['quiz_id'], $options, true, $question_amount);
513
  $answers = $this->create_answer_array($questions);
514
  $quiz_display .= $this->display_begin_section($options, $quiz_data);
553
  $question_list = '';
554
  $contact_fields = QSM_Contact_Manager::load_fields();
555
  $animation_effect = isset($options->quiz_animation) && $options->quiz_animation != '' ? ' animated ' . $options->quiz_animation : '';
556
+ $enable_pagination_quiz = isset($options->enable_pagination_quiz) && $options->enable_pagination_quiz != '' ? true : false;
557
  if (count($pages) > 1 && (!empty($options->message_before) || ( 0 == $options->contact_info_location && $contact_fields ) )) {
558
  $qmn_json_data['first_page'] = true;
559
  $message_before = wpautop(htmlspecialchars_decode($options->message_before, ENT_QUOTES));
591
  ?>
592
  </div>
593
  <?php
594
+ }
595
  foreach ($pages[0] as $question_id) {
596
  $question_list .= $question_id . 'Q';
597
+ $question = $questions[$question_id];
598
  ?>
599
  <div class='quiz_section question-section-id-<?php echo esc_attr($question_id); ?>'>
600
  <?php
667
  ?>
668
  </div>
669
  <?php
670
+ }
671
+ if($enable_pagination_quiz){
672
  ?>
673
+ <span class="pages_count">
674
+ <?php
675
+ $text_c = $pages_count . ' out of ' .$total_pages_count;
676
+ echo apply_filters('qsm_total_pages_count',$text_c,$pages_count,$total_pages_count);
677
+ ?>
678
+ </span>
679
+ <?php } ?>
680
  </section>
681
  <?php
682
  $pages_count++;
788
  global $mlw_qmn_section_count;
789
  $question_id_list = '';
790
  $animation_effect = isset($qmn_quiz_options->quiz_animation) && $qmn_quiz_options->quiz_animation != '' ? ' animated ' . $qmn_quiz_options->quiz_animation : '';
791
+ $enable_pagination_quiz = isset($qmn_quiz_options->enable_pagination_quiz) && $qmn_quiz_options->enable_pagination_quiz ? $qmn_quiz_options->enable_pagination_quiz : 0;
792
+ $pagination_optoin = $qmn_quiz_options->pagination;
793
+ if($enable_pagination_quiz && $pagination_optoin){
794
+ $total_pages_count = count($qmn_quiz_questions);
795
+ $total_pagination = ceil($total_pages_count / $pagination_optoin);
796
+ }
797
  $pages_count = 1;
798
  foreach ($qmn_quiz_questions as $mlw_question) {
799
  $question_id_list .= $mlw_question->question_id . "Q";
815
  if (!empty($mlw_question->hints)) {
816
  $question_display .= "<div title=\"" . esc_attr(htmlspecialchars_decode($mlw_question->hints, ENT_QUOTES)) . "\" class='qsm_hint mlw_qmn_hint_link'>{$qmn_quiz_options->hint_text}</div>";
817
  $question_display .= "<br /><br />";
818
+ }
 
 
 
 
819
  $question_display .= "</div>";
820
  $pages_count++;
821
  }
822
+ if($enable_pagination_quiz){
823
+ $question_display .= "<span class='pages_count' style='display: none;'>";
824
+ $text_c = $pages_count . ' out of ' .$total_pagination;
825
+ $question_display .= apply_filters('qsm_total_pages_count',$text_c,$pages_count,$total_pages_count);
826
+ $question_display .= "</span>";
827
+ }
828
  $question_display .= "<input type='hidden' name='qmn_question_list' value='$question_id_list' />";
829
  return $question_display;
830
  }
920
  */
921
  public function ajax_submit_results() {
922
  global $qmn_allowed_visit;
923
+ global $mlwQuizMasterNext;
924
+ parse_str(sanitize_textarea_field($_POST["quizData"]), $_POST);
925
  $qmn_allowed_visit = true;
926
  $quiz = intval($_POST["qmn_quiz_id"]);
927
  $mlwQuizMasterNext->pluginHelper->prepare_quiz($quiz);
934
  );
935
  $post_data = array(
936
  'g-recaptcha-response' => isset($_POST['g-recaptcha-response']) ? sanitize_textarea_field($_POST['g-recaptcha-response']) : ''
937
+ );
938
  if(class_exists('QSM_Recaptcha')){
939
+ $recaptcha_data = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( "recaptcha_integration_settings" );
940
+ if(isset($recaptcha_data['enable_recaptcha']) && $recaptcha_data['enable_recaptcha'] != 'no'){
941
+ $verified = qsm_verify_recaptcha($post_data);
942
+ if(!$verified){
943
+ echo json_encode(array(
944
+ 'display' => htmlspecialchars_decode('ReCaptcha Validation failed'),
945
+ 'redirect' => FALSE,
946
+ ));
947
+ exit;
948
+ }
949
+ }
950
  }
951
  echo json_encode($this->submit_results($options, $data));
952
  die();
981
  public function submit_results($qmn_quiz_options, $qmn_array_for_variables) {
982
  global $qmn_allowed_visit;
983
  $result_display = '';
984
+
985
  $qmn_array_for_variables['user_ip'] = $this->get_user_ip();
986
 
987
  $result_display = apply_filters('qmn_begin_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
1225
  "correct" => $correct_status,
1226
  "id" => $question['question_id'],
1227
  "points" => $answer_points,
1228
+ "category" => $question['category'],
1229
+ "question_type" => $question['question_type_new']
1230
  ), $options, $quiz_data);
1231
  }
1232
  break;
1634
  global $qmn_allowed_visit;
1635
  if ($qmn_quiz_options->require_log_in == 1 && !is_user_logged_in()) {
1636
  $qmn_allowed_visit = false;
1637
+ if(isset($qmn_quiz_options->require_log_in_text_msg) && $qmn_quiz_options->require_log_in_text_msg != ''){
1638
+ $mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text_msg, ENT_QUOTES));
1639
+ }else{
1640
+ $mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text, ENT_QUOTES));
1641
+ }
1642
  $mlw_message = apply_filters('mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
1643
  $mlw_message = str_replace("\n", "<br>", $mlw_message);
1644
  $display .= $mlw_message;
php/classes/class-qsm-install.php CHANGED
@@ -101,6 +101,15 @@ class QSM_Install {
101
  'default' => 0
102
  );
103
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
 
 
 
 
 
 
 
 
 
104
 
105
  // Registers pagination setting
106
  $field_array = array(
@@ -131,14 +140,14 @@ class QSM_Install {
131
  'id' => 'enable_result_after_timer_end',
132
  'label' => __('Force submit after timer expiry?', 'quiz-master-next'),
133
  'type' => 'radio',
134
- 'options' => array(
135
- array(
136
- 'label' => __('No', 'quiz-master-next'),
137
- 'value' => 0
138
- ),
139
  array(
140
  'label' => __('Yes', 'quiz-master-next'),
141
  'value' => 1
 
 
 
 
142
  )
143
  ),
144
  'default' => 0
@@ -481,15 +490,15 @@ class QSM_Install {
481
  'id' => 'contact_disable_autofill',
482
  'label' => __('Disable auto fill for contact input?', 'quiz-master-next'),
483
  'type' => 'radio',
484
- 'options' => array(
485
- array(
486
- 'label' => __('No', 'quiz-master-next'),
487
- 'value' => 0
488
- ),
489
  array(
490
  'label' => __('Yes', 'quiz-master-next'),
491
  'value' => 1
492
- )
 
 
 
 
493
  ),
494
  'default' => 0
495
  );
@@ -500,15 +509,15 @@ class QSM_Install {
500
  'id' => 'show_category_on_front',
501
  'label' => __('Show category on front?', 'quiz-master-next'),
502
  'type' => 'radio',
503
- 'options' => array(
504
- array(
505
- 'label' => __('No', 'quiz-master-next'),
506
- 'value' => 0
507
- ),
508
  array(
509
  'label' => __('Yes', 'quiz-master-next'),
510
  'value' => 1
511
- )
 
 
 
 
512
  ),
513
  'default' => 0
514
  );
@@ -519,15 +528,15 @@ class QSM_Install {
519
  'id' => 'enable_quick_result_mc',
520
  'label' => __('Show live results for questions inline', 'quiz-master-next'),
521
  'type' => 'radio',
522
- 'options' => array(
523
- array(
524
- 'label' => __('No', 'quiz-master-next'),
525
- 'value' => 0
526
- ),
527
  array(
528
  'label' => __('Yes', 'quiz-master-next'),
529
  'value' => 1
530
- )
 
 
 
 
531
  ),
532
  'default' => 0
533
  );
@@ -538,15 +547,34 @@ class QSM_Install {
538
  'id' => 'enable_retake_quiz_button',
539
  'label' => __('Show RETAKE QUIZ button on result page', 'quiz-master-next'),
540
  'type' => 'radio',
541
- 'options' => array(
542
  array(
543
- 'label' => __('No', 'quiz-master-next'),
544
- 'value' => 0
545
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  array(
547
  'label' => __('Yes', 'quiz-master-next'),
548
  'value' => 1
549
- )
 
 
 
 
550
  ),
551
  'default' => 0
552
  );
101
  'default' => 0
102
  );
103
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
104
+
105
+ // Registers required text setting
106
+ $field_array = array(
107
+ 'id' => 'require_log_in_text_msg',
108
+ 'label' => __('Text for non logged in user. Note: This option will work if above option set to yes', 'quiz-master-next'),
109
+ 'type' => 'text',
110
+ 'default' => 'This quiz is for logged in users only.'
111
+ );
112
+ $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
113
 
114
  // Registers pagination setting
115
  $field_array = array(
140
  'id' => 'enable_result_after_timer_end',
141
  'label' => __('Force submit after timer expiry?', 'quiz-master-next'),
142
  'type' => 'radio',
143
+ 'options' => array(
 
 
 
 
144
  array(
145
  'label' => __('Yes', 'quiz-master-next'),
146
  'value' => 1
147
+ ),
148
+ array(
149
+ 'label' => __('No', 'quiz-master-next'),
150
+ 'value' => 0
151
  )
152
  ),
153
  'default' => 0
490
  'id' => 'contact_disable_autofill',
491
  'label' => __('Disable auto fill for contact input?', 'quiz-master-next'),
492
  'type' => 'radio',
493
+ 'options' => array(
 
 
 
 
494
  array(
495
  'label' => __('Yes', 'quiz-master-next'),
496
  'value' => 1
497
+ ),
498
+ array(
499
+ 'label' => __('No', 'quiz-master-next'),
500
+ 'value' => 0
501
+ ),
502
  ),
503
  'default' => 0
504
  );
509
  'id' => 'show_category_on_front',
510
  'label' => __('Show category on front?', 'quiz-master-next'),
511
  'type' => 'radio',
512
+ 'options' => array(
 
 
 
 
513
  array(
514
  'label' => __('Yes', 'quiz-master-next'),
515
  'value' => 1
516
+ ),
517
+ array(
518
+ 'label' => __('No', 'quiz-master-next'),
519
+ 'value' => 0
520
+ ),
521
  ),
522
  'default' => 0
523
  );
528
  'id' => 'enable_quick_result_mc',
529
  'label' => __('Show live results for questions inline', 'quiz-master-next'),
530
  'type' => 'radio',
531
+ 'options' => array(
 
 
 
 
532
  array(
533
  'label' => __('Yes', 'quiz-master-next'),
534
  'value' => 1
535
+ ),
536
+ array(
537
+ 'label' => __('No', 'quiz-master-next'),
538
+ 'value' => 0
539
+ )
540
  ),
541
  'default' => 0
542
  );
547
  'id' => 'enable_retake_quiz_button',
548
  'label' => __('Show RETAKE QUIZ button on result page', 'quiz-master-next'),
549
  'type' => 'radio',
550
+ 'options' => array(
551
  array(
552
+ 'label' => __('Yes', 'quiz-master-next'),
553
+ 'value' => 1
554
  ),
555
+ array(
556
+ 'label' => __('No', 'quiz-master-next'),
557
+ 'value' => 0
558
+ ),
559
+ ),
560
+ 'default' => 0
561
+ );
562
+ $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
563
+
564
+ //Setting for pagination of quiz
565
+ $field_array = array(
566
+ 'id' => 'enable_pagination_quiz',
567
+ 'label' => __('Enable pagination of quiz', 'quiz-master-next'),
568
+ 'type' => 'radio',
569
+ 'options' => array(
570
  array(
571
  'label' => __('Yes', 'quiz-master-next'),
572
  'value' => 1
573
+ ),
574
+ array(
575
+ 'label' => __('No', 'quiz-master-next'),
576
+ 'value' => 0
577
+ ),
578
  ),
579
  'default' => 0
580
  );
php/question-types.php CHANGED
@@ -14,6 +14,82 @@ function qmn_question_type_multiple_choice()
14
  $mlwQuizMasterNext->pluginHelper->register_question_type(__("Multiple Choice", 'quiz-master-next'), 'qmn_multiple_choice_display', true, 'qmn_multiple_choice_review', null, null, 0);
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * This function shows the content of the multiple choice question.
19
  *
@@ -29,7 +105,8 @@ function qmn_multiple_choice_display($id, $question, $answers)
29
  global $mlwQuizMasterNext;
30
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
31
  if ($required == 0) {$mlw_requireClass = "mlwRequiredRadio";} else {$mlw_requireClass = "";}
32
- $question_title = apply_filters('the_content', $question);
 
33
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
34
  $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
35
  if (is_array($answers))
@@ -69,7 +146,7 @@ function qmn_multiple_choice_review($id, $question, $answers)
69
  'correct_text' => ''
70
  );
71
  if ( isset( $_POST["question".$id] ) ) {
72
- $mlw_user_answer = sanitize_textarea_field( stripslashes( $_POST["question".$id] ) );
73
  } else {
74
  $mlw_user_answer = " ";
75
  }
@@ -78,7 +155,7 @@ function qmn_multiple_choice_review($id, $question, $answers)
78
  if ( $mlw_user_answer == esc_attr( $answer[0] ) )
79
  {
80
  $return_array["points"] = $answer[1];
81
- $return_array["user_text"] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
82
  if ($answer[2] == 1)
83
  {
84
  $return_array["correct"] = "correct";
@@ -92,6 +169,76 @@ function qmn_multiple_choice_review($id, $question, $answers)
92
  return $return_array;
93
  }
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  add_action("plugins_loaded", 'qmn_question_type_horizontal_multiple_choice');
96
 
97
  /**
@@ -121,7 +268,8 @@ function qmn_horizontal_multiple_choice_display($id, $question, $answers)
121
  global $mlwQuizMasterNext;
122
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
123
  if ($required == 0) {$mlw_requireClass = "mlwRequiredRadio";} else {$mlw_requireClass = "";}
124
- $question_title = apply_filters('the_content', $question);
 
125
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
126
  $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
127
  if (is_array($answers))
@@ -215,8 +363,9 @@ function qmn_drop_down_display($id, $question, $answers)
215
  $require_class = "qsmRequiredSelect";
216
  } else {
217
  $require_class = "";
218
- }
219
- $question_title = apply_filters('the_content', $question);
 
220
  $question_display .= "<span class='mlw_qmn_question'>" . do_shortcode( htmlspecialchars_decode( $question_title, ENT_QUOTES ) ) . "</span>";
221
  $question_display .= "<select class='qsm_select $require_class' name='question".$id."'>";
222
  $question_display .= "<option value='No Answer Provided'>" . __('Please select your answer','quiz-master-next') . "</option>";
@@ -310,7 +459,8 @@ function qmn_small_open_display($id, $question, $answers)
310
  $autofill_att = $autofill ? "autocomplete='off' " : '';
311
  $limit_text_att = $limit_text ? "maxlength='". $limit_text ."' " : '';
312
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
313
- $question_title = apply_filters('the_content', $question);
 
314
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
315
  $question_display .= "<input ". $autofill_att . $limit_text_att . " type='text' class='mlw_answer_open_text $mlw_requireClass' name='question".$id."' />";
316
  return apply_filters('qmn_small_open_display_front',$question_display,$id, $question, $answers);
@@ -386,7 +536,8 @@ function qmn_multiple_response_display($id, $question, $answers)
386
  if($limit_multiple_response > 0)
387
  $limit_mr_text = 'onchange="qsmCheckMR(this,'. $limit_multiple_response .')"';
388
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
389
- $question_title = apply_filters('the_content', $question);
 
390
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
391
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
392
  if (is_array($answers))
@@ -487,7 +638,8 @@ function qmn_large_open_display($id, $question, $answers)
487
  global $mlwQuizMasterNext;
488
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
489
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
490
- $question_title = apply_filters('the_content', $question);
 
491
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
492
  $question_display .= "<textarea class='mlw_answer_open_text $mlw_requireClass' cols='70' rows='5' name='question".$id."' /></textarea>";
493
  return apply_filters('qmn_large_open_display_front',$question_display,$id, $question, $answers);
@@ -603,7 +755,8 @@ function qmn_number_display($id, $question, $answers)
603
  global $mlwQuizMasterNext;
604
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
605
  if ($required == 0) {$mlw_requireClass = "mlwRequiredNumber";} else {$mlw_requireClass = "";}
606
- $question_title = apply_filters('the_content', $question);
 
607
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
608
  $question_display .= "<input type='number' class='mlw_answer_number $mlw_requireClass' name='question".$id."' />";
609
  return apply_filters('qmn_number_display_front',$question_display,$id, $question, $answers);
@@ -787,7 +940,8 @@ function qmn_horizontal_multiple_response_display($id, $question, $answers)
787
  global $mlwQuizMasterNext;
788
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
789
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
790
- $question_title = apply_filters('the_content', $question);
 
791
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
792
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
793
  if (is_array($answers))
@@ -912,7 +1066,8 @@ function qmn_fill_blank_display($id, $question, $answers)
912
  {
913
  $question = str_replace( "%BLANK%", $input_text, do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
914
  }
915
- $question_title = apply_filters('the_content', $question);
 
916
  $question_display = "<span class='mlw_qmn_question'>" . do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES)) ."</span>";
917
  return apply_filters('qmn_fill_blank_display_front',$question_display,$id, $question, $answers);
918
  }
14
  $mlwQuizMasterNext->pluginHelper->register_question_type(__("Multiple Choice", 'quiz-master-next'), 'qmn_multiple_choice_display', true, 'qmn_multiple_choice_review', null, null, 0);
15
  }
16
 
17
+ add_action("plugins_loaded", 'qmn_question_type_file_upload');
18
+ /**
19
+ * Registers the file upload type
20
+ *
21
+ * @return void
22
+ * @since 6.3.7
23
+ */
24
+ function qmn_question_type_file_upload(){
25
+ global $mlwQuizMasterNext;
26
+ $mlwQuizMasterNext->pluginHelper->register_question_type(__("File Upload", 'quiz-master-next'), 'qmn_file_upload_display', true, 'qmn_file_upload_review', null, null, 11);
27
+ }
28
+
29
+ /**
30
+ * This function shows the content of the file upload
31
+ *
32
+ * @params $id The ID of the multiple choice question
33
+ * @params $question The question that is being edited.
34
+ * @params @answers The array that contains the answers to the question.
35
+ * @return $question_display Contains all the content of the question
36
+ * @since 6.3.7
37
+ */
38
+ function qmn_file_upload_display($id, $question, $answers)
39
+ {
40
+ $question_display = '';
41
+ global $mlwQuizMasterNext;
42
+ $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
43
+ if ($required == 0) {$mlw_requireClass = "mlwRequiredFileUpload";} else {$mlw_requireClass = "";}
44
+ //$question_title = apply_filters('the_content', $question);
45
+ $question_title = $question;
46
+ $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
47
+ $question_display .= "<input type='file' class='mlw_answer_file_upload $mlw_requireClass'/>";
48
+ $question_display .= "<div style='display: none;' class='remove-uploaded-file'><span class='dashicons dashicons-trash'></span></div>";
49
+ $question_display .= "<input class='mlw_file_upload_hidden_value' type='hidden' name='question".$id."' value='' />";
50
+ $question_display .= "<span style='display: none;' class='mlw-file-upload-error-msg'></span>";
51
+ $question_display .= "<input class='mlw_file_upload_hidden_path' type='hidden' value='' />";
52
+ return apply_filters('qmn_file_upload_display_front',$question_display,$id, $question, $answers);
53
+ }
54
+
55
+ /**
56
+ * This function determines how the file upload will work.
57
+ *
58
+ * @params $id The ID of the multiple choice question
59
+ * @params $question The question that is being edited.
60
+ * @params @answers The array that contains the answers to the question.
61
+ * @return $return_array Returns the graded question to the results page
62
+ * @since 5.3.7
63
+ */
64
+ function qmn_file_upload_review($id, $question, $answers){
65
+ $return_array = array(
66
+ 'points' => 0,
67
+ 'correct' => 'incorrect',
68
+ 'user_text' => '',
69
+ 'correct_text' => '',
70
+ 'question_type' => 'file_upload'
71
+ );
72
+ if ( isset( $_POST["question".$id] ) ) {
73
+ $decode_user_answer = sanitize_text_field( $_POST["question".$id] );
74
+ $mlw_user_answer = trim( $decode_user_answer );
75
+ } else {
76
+ $mlw_user_answer = " ";
77
+ }
78
+ $return_array['user_text'] = $mlw_user_answer;
79
+ foreach($answers as $answer)
80
+ {
81
+ $decode_correct_text = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
82
+ $return_array['correct_text'] = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_correct_text ) ) );
83
+ if (mb_strtoupper($return_array['user_text']) == mb_strtoupper($return_array['correct_text']))
84
+ {
85
+ $return_array['correct'] = "correct";
86
+ $return_array['points'] = $answer[1];
87
+ break;
88
+ }
89
+ }
90
+ return $return_array;
91
+ }
92
+
93
  /**
94
  * This function shows the content of the multiple choice question.
95
  *
105
  global $mlwQuizMasterNext;
106
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
107
  if ($required == 0) {$mlw_requireClass = "mlwRequiredRadio";} else {$mlw_requireClass = "";}
108
+ //$question_title = apply_filters('the_content', $question);
109
+ $question_title = $question;
110
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
111
  $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
112
  if (is_array($answers))
146
  'correct_text' => ''
147
  );
148
  if ( isset( $_POST["question".$id] ) ) {
149
+ $mlw_user_answer = sanitize_textarea_field( $_POST["question".$id] );
150
  } else {
151
  $mlw_user_answer = " ";
152
  }
155
  if ( $mlw_user_answer == esc_attr( $answer[0] ) )
156
  {
157
  $return_array["points"] = $answer[1];
158
+ $return_array["user_text"] = $answer[0];
159
  if ($answer[2] == 1)
160
  {
161
  $return_array["correct"] = "correct";
169
  return $return_array;
170
  }
171
 
172
+ add_action("plugins_loaded", 'qmn_question_type_date');
173
+ /**
174
+ * Registers the date type
175
+ *
176
+ * @return void
177
+ * @since 6.3.7
178
+ */
179
+ function qmn_question_type_date(){
180
+ global $mlwQuizMasterNext;
181
+ $mlwQuizMasterNext->pluginHelper->register_question_type(__("Date", 'quiz-master-next'), 'qmn_date_display', true, 'qmn_date_review', null, null, 12);
182
+ }
183
+
184
+ /**
185
+ * This function shows the content of the date field
186
+ *
187
+ * @params $id The ID of the multiple choice question
188
+ * @params $question The question that is being edited.
189
+ * @params @answers The array that contains the answers to the question.
190
+ * @return $question_display Contains all the content of the question
191
+ * @since 6.3.7
192
+ */
193
+ function qmn_date_display($id, $question, $answers)
194
+ {
195
+ $question_display = '';
196
+ global $mlwQuizMasterNext;
197
+ $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
198
+ if ($required == 0) {$mlw_requireClass = "mlwRequiredDate";} else {$mlw_requireClass = "";}
199
+ //$question_title = apply_filters('the_content', $question);
200
+ $question_title = $question;
201
+ $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
202
+ $question_display .= "<input type='date' class='mlw_answer_date $mlw_requireClass' name='question".$id."' id='question".$id."' value=''/>";
203
+ //$question_display .= "<script>jQuery(document).ready(function () { jQuery('#question".$id."').datepicker(); });</script>";
204
+ return apply_filters('qmn_date_display_front',$question_display,$id, $question, $answers);
205
+ }
206
+
207
+ /**
208
+ * This function reviews the date type.
209
+ *
210
+ * @params $id The ID of the multiple choice question
211
+ * @params $question The question that is being edited.
212
+ * @params @answers The array that contains the answers to the question.
213
+ * @return $return_array Returns the graded question to the results page
214
+ * @since 6.3.7
215
+ */
216
+ function qmn_date_review($id, $question, $answers) {
217
+ $return_array = array(
218
+ 'points' => 0,
219
+ 'correct' => 'incorrect',
220
+ 'user_text' => '',
221
+ 'correct_text' => ''
222
+ );
223
+ if (isset($_POST["question" . $id])) {
224
+ $decode_user_answer = sanitize_textarea_field(strval(stripslashes(htmlspecialchars_decode($_POST["question" . $id], ENT_QUOTES))));
225
+ $mlw_user_answer = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $decode_user_answer)));
226
+ } else {
227
+ $mlw_user_answer = " ";
228
+ }
229
+ $return_array['user_text'] = $mlw_user_answer;
230
+ foreach ($answers as $answer) {
231
+ $decode_correct_text = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
232
+ $return_array['correct_text'] = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $decode_correct_text)));
233
+ if (mb_strtoupper($return_array['user_text']) == mb_strtoupper($return_array['correct_text'])) {
234
+ $return_array['correct'] = "correct";
235
+ $return_array['points'] = $answer[1];
236
+ break;
237
+ }
238
+ }
239
+ return $return_array;
240
+ }
241
+
242
  add_action("plugins_loaded", 'qmn_question_type_horizontal_multiple_choice');
243
 
244
  /**
268
  global $mlwQuizMasterNext;
269
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
270
  if ($required == 0) {$mlw_requireClass = "mlwRequiredRadio";} else {$mlw_requireClass = "";}
271
+ //$question_title = apply_filters('the_content', $question);
272
+ $question_title = $question;
273
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
274
  $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
275
  if (is_array($answers))
363
  $require_class = "qsmRequiredSelect";
364
  } else {
365
  $require_class = "";
366
+ }
367
+ //$question_title = apply_filters('the_content', $question);
368
+ $question_title = $question;
369
  $question_display .= "<span class='mlw_qmn_question'>" . do_shortcode( htmlspecialchars_decode( $question_title, ENT_QUOTES ) ) . "</span>";
370
  $question_display .= "<select class='qsm_select $require_class' name='question".$id."'>";
371
  $question_display .= "<option value='No Answer Provided'>" . __('Please select your answer','quiz-master-next') . "</option>";
459
  $autofill_att = $autofill ? "autocomplete='off' " : '';
460
  $limit_text_att = $limit_text ? "maxlength='". $limit_text ."' " : '';
461
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
462
+ //$question_title = apply_filters('the_content', $question);
463
+ $question_title = $question;
464
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
465
  $question_display .= "<input ". $autofill_att . $limit_text_att . " type='text' class='mlw_answer_open_text $mlw_requireClass' name='question".$id."' />";
466
  return apply_filters('qmn_small_open_display_front',$question_display,$id, $question, $answers);
536
  if($limit_multiple_response > 0)
537
  $limit_mr_text = 'onchange="qsmCheckMR(this,'. $limit_multiple_response .')"';
538
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
539
+ //$question_title = apply_filters('the_content', $question);
540
+ $question_title = $question;
541
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
542
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
543
  if (is_array($answers))
638
  global $mlwQuizMasterNext;
639
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
640
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
641
+ //$question_title = apply_filters('the_content', $question);
642
+ $question_title = $question;
643
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
644
  $question_display .= "<textarea class='mlw_answer_open_text $mlw_requireClass' cols='70' rows='5' name='question".$id."' /></textarea>";
645
  return apply_filters('qmn_large_open_display_front',$question_display,$id, $question, $answers);
755
  global $mlwQuizMasterNext;
756
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
757
  if ($required == 0) {$mlw_requireClass = "mlwRequiredNumber";} else {$mlw_requireClass = "";}
758
+ //$question_title = apply_filters('the_content', $question);
759
+ $question_title = $question;
760
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
761
  $question_display .= "<input type='number' class='mlw_answer_number $mlw_requireClass' name='question".$id."' />";
762
  return apply_filters('qmn_number_display_front',$question_display,$id, $question, $answers);
940
  global $mlwQuizMasterNext;
941
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
942
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
943
+ //$question_title = apply_filters('the_content', $question);
944
+ $question_title = $question;
945
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES))."</span>";
946
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
947
  if (is_array($answers))
1066
  {
1067
  $question = str_replace( "%BLANK%", $input_text, do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
1068
  }
1069
+ //$question_title = apply_filters('the_content', $question);
1070
+ $question_title = $question;
1071
  $question_display = "<span class='mlw_qmn_question'>" . do_shortcode(htmlspecialchars_decode($question_title, ENT_QUOTES)) ."</span>";
1072
  return apply_filters('qmn_fill_blank_display_front',$question_display,$id, $question, $answers);
1073
  }
php/rest-api.php CHANGED
@@ -321,6 +321,8 @@ function qsm_rest_get_questions( WP_REST_Request $request ) {
321
  'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
322
  'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
323
  'limit_multiple_response' => isset($question['settings']['limit_multiple_response']) ? $question['settings']['limit_multiple_response'] : 0,
 
 
324
  'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
325
  );
326
  }
@@ -417,6 +419,8 @@ function qsm_rest_save_question( WP_REST_Request $request ) {
417
  'autofill' => $request['autofill'],
418
  'limit_text' => $request['limit_text'],
419
  'limit_multiple_response' => $request['limit_multiple_response'],
 
 
420
  );
421
  $intial_answers = $request['answers'];
422
  $answers = array();
321
  'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
322
  'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
323
  'limit_multiple_response' => isset($question['settings']['limit_multiple_response']) ? $question['settings']['limit_multiple_response'] : 0,
324
+ 'file_upload_limit' => isset($question['settings']['file_upload_limit']) ? $question['settings']['file_upload_limit'] : 0,
325
+ 'file_upload_type' => isset($question['settings']['file_upload_type']) ? $question['settings']['file_upload_type'] : '',
326
  'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
327
  );
328
  }
419
  'autofill' => $request['autofill'],
420
  'limit_text' => $request['limit_text'],
421
  'limit_multiple_response' => $request['limit_multiple_response'],
422
+ 'file_upload_limit' => $request['file_upload_limit'],
423
+ 'file_upload_type' => $request['file_upload_type'],
424
  );
425
  $intial_answers = $request['answers'];
426
  $answers = array();
php/template-variables.php CHANGED
@@ -307,7 +307,16 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
307
  }
308
  $mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
309
  $mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
310
- $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
 
 
 
 
 
 
 
 
 
311
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer[2], ENT_QUOTES), $mlw_question_answer_display);
312
  $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer[3], $mlw_question_answer_display);
313
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($qmn_questions[$answer['id']], ENT_QUOTES), $mlw_question_answer_display);
307
  }
308
  $mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
309
  $mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
310
+ if($answer['question_type'] == 11){
311
+ $file_extension = substr($answer[1], -4);
312
+ if($file_extension == '.jpg' || $file_extension == 'jepg' || $file_extension == '.png' || $file_extension == '.gif'){
313
+ $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
314
+ }else{
315
+ $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
316
+ }
317
+ }else{
318
+ $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
319
+ }
320
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer[2], ENT_QUOTES), $mlw_question_answer_display);
321
  $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer[3], $mlw_question_answer_display);
322
  $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($qmn_questions[$answer['id']], ENT_QUOTES), $mlw_question_answer_display);
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.3
6
  Requires PHP: 5.4
7
- Stable tag: 6.3.6
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -15,6 +15,8 @@ Native quiz and surveys for your WordPress site. Easily and quickly add unlimite
15
  = Demoes! =
16
  Looking for demoes? Check out [Sample Quiz](https://quizandsurveymaster.com/quiz/sample-quiz/?utm_source=readme&utm_medium=plugin&utm_content=sample-quiz&utm_campaign=qsm_plugin) and [Sample Survey](https://quizandsurveymaster.com/quiz/sample-survey/?utm_source=readme&utm_medium=plugin&utm_content=sample-survey&utm_campaign=qsm_plugin)!
17
 
 
 
18
  = Easily Create Surveys For Your Users =
19
  You can easily create surveys for your users. Everything from customer satisfaction surveys to employee surveys.
20
 
@@ -114,6 +116,19 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
114
 
115
  == Changelog ==
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  = 6.3.6 (Nov 28, 2019) =
118
  * Included all the suggestions made by WordPress.org team
119
  * Made external files loading from local website
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.3.2
6
  Requires PHP: 5.4
7
+ Stable tag: 6.4
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
15
  = Demoes! =
16
  Looking for demoes? Check out [Sample Quiz](https://quizandsurveymaster.com/quiz/sample-quiz/?utm_source=readme&utm_medium=plugin&utm_content=sample-quiz&utm_campaign=qsm_plugin) and [Sample Survey](https://quizandsurveymaster.com/quiz/sample-survey/?utm_source=readme&utm_medium=plugin&utm_content=sample-survey&utm_campaign=qsm_plugin)!
17
 
18
+ [youtube https://www.youtube.com/watch?v=DyiCCNnDpHk]
19
+
20
  = Easily Create Surveys For Your Users =
21
  You can easily create surveys for your users. Everything from customer satisfaction surveys to employee surveys.
22
 
116
 
117
  == Changelog ==
118
 
119
+ = 6.4 (Jan 1, 2020) =
120
+ * Bug: Result summary page is not displaying Math problems
121
+ * Feature: Client wants users to upload images/attachments to the survey
122
+ * Bug: Edit question popup not working
123
+ * Bug: PHP Warnings
124
+ * Bug: Quiz post setting not working properly
125
+ * Bug: Broken links to documentation pages in quiz setting
126
+ * Bug: Export & Import addon bug
127
+ * Bug: Customising form with CSS is not easy
128
+ * Bug: Bug Regarding Pagination Feature
129
+ * Feature: User wants a logic to work in the same way for Checkbox & Multiple choice questions
130
+ * Feature: Provide an export button on top of quiz index
131
+
132
  = 6.3.6 (Nov 28, 2019) =
133
  * Included all the suggestions made by WordPress.org team
134
  * Made external files loading from local website
templates/qmn_primary.css CHANGED
@@ -238,18 +238,21 @@ border: 1px solid #e3e3e3;
238
  .quiz_section.qmn_error input[type="number"],
239
  .quiz_section.qmn_error input[type="email"],
240
  .quiz_section.qmn_error input[type="checkbox"],
 
241
  .quiz_section.qmn_error select:hover,
242
  .quiz_section.qmn_error textarea:hover,
243
  .quiz_section.qmn_error input[type="text"]:hover,
244
  .quiz_section.qmn_error input[type="number"]:hover,
245
  .quiz_section.qmn_error input[type="email"]:hover,
246
  .quiz_section.qmn_error input[type="checkbox"]:hover,
 
247
  .quiz_section.qmn_error select:focus,
248
  .quiz_section.qmn_error textarea:focus,
249
  .quiz_section.qmn_error input[type="text"]:focus,
250
  .quiz_section.qmn_error input[type="number"]:focus,
251
  .quiz_section.qmn_error input[type="email"]:focus,
252
- .quiz_section.qmn_error input[type="checkbox"]:focus {
 
253
  position: relative;
254
  border: 1px solid #da4f49;
255
  background: #F2DEDE;
@@ -455,4 +458,17 @@ border: 1px solid #e3e3e3;
455
 
456
  .qsm-results-page .qmn_question_answer{
457
  margin-bottom: 30px;
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  }
238
  .quiz_section.qmn_error input[type="number"],
239
  .quiz_section.qmn_error input[type="email"],
240
  .quiz_section.qmn_error input[type="checkbox"],
241
+ .quiz_section.qmn_error input[type="file"],
242
  .quiz_section.qmn_error select:hover,
243
  .quiz_section.qmn_error textarea:hover,
244
  .quiz_section.qmn_error input[type="text"]:hover,
245
  .quiz_section.qmn_error input[type="number"]:hover,
246
  .quiz_section.qmn_error input[type="email"]:hover,
247
  .quiz_section.qmn_error input[type="checkbox"]:hover,
248
+ .quiz_section.qmn_error input[type="file"]:hover,
249
  .quiz_section.qmn_error select:focus,
250
  .quiz_section.qmn_error textarea:focus,
251
  .quiz_section.qmn_error input[type="text"]:focus,
252
  .quiz_section.qmn_error input[type="number"]:focus,
253
  .quiz_section.qmn_error input[type="email"]:focus,
254
+ .quiz_section.qmn_error input[type="checkbox"]:focus,
255
+ .quiz_section.qmn_error input[type="file"]:focus {
256
  position: relative;
257
  border: 1px solid #da4f49;
258
  background: #F2DEDE;
458
 
459
  .qsm-results-page .qmn_question_answer{
460
  margin-bottom: 30px;
461
+ }
462
+ .quiz_section .mlw-file-upload-error-msg{
463
+ color: red;
464
+ display: block;
465
+ }
466
+
467
+ .quiz_section .remove-uploaded-file{
468
+ color: red;
469
+ border: 1px solid red;
470
+ width: 31px;
471
+ padding: 5px 5px 0px 5px;
472
+ display: inline-block;
473
+ cursor: pointer;
474
  }