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

Version Description

(July 6, 2019) =

  • Added Feature: UI Changes
  • Added Feature: Addons Pricing Page Update
  • Added Feature: Free Addon Page Added
  • Added Feature: Show results of quiz in realtime - (Issue #646)
  • Added Feature: Timer Enhacements - Auto submit at expiry and show message on expiry
  • Added Feature: Personality Quiz Enhancements - Show category on frontend and Show results per category
  • Added Feature: Retake Quiz - (Issue #661)
  • Added Feature: Question Bank Enhacements - (Issue #39)
  • Added Feature: Facebook Button Icons
Download this release

Release Info

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

Code changes from version 6.3.1 to 6.3.2

addons.xml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <addon-list>
4
+ <item>
5
+ <name>Landing Page</name>
6
+ <desc>Display your quizzes and surveys in their own standalone page without distracting menus, themes, or other content from your site.</desc>
7
+ <img></img>
8
+ <link>https://quizandsurveymaster.com/downloads/landing-page/?utm_source=qsm-addons-page</link>
9
+ <category>Frontend</category>
10
+ <price>25</price>
11
+ <slug>landing-page</slug>
12
+ </item>
13
+ <item>
14
+ <name>Reporting and Analysis</name>
15
+ <desc>Analyze your quiz's or survey's results to see the percentage of users who chose each answer displayed on useful charts. You can then filter that data or export it.</desc>
16
+ <img></img>
17
+ <link>http://quizandsurveymaster.com/downloads/results-analysis/?utm_source=qsm-addons-page</link>
18
+ <category>Analytics</category>
19
+ <price>35</price>
20
+ <slug>reporting-and-analysis</slug>
21
+ </item>
22
+ <item>
23
+ <name>Export Results</name>
24
+ <desc>This addon gives you the ability to export your quiz results as a CSV file.</desc>
25
+ <img></img>
26
+ <link>http://quizandsurveymaster.com/downloads/export-results/?utm_source=qsm-addons-page</link>
27
+ <category>Utility</category>
28
+ <price>25</price>
29
+ <slug>export-results</slug>
30
+ </item>
31
+ <item>
32
+ <name>Advertisement Be Gone</name>
33
+ <desc>This addon will remove all services/addon advertisements throughout the plugin.</desc>
34
+ <img></img>
35
+ <link>http://quizandsurveymaster.com/downloads/advertisement-gone/?utm_source=qsm-addons-page</link>
36
+ <category>Utility</category>
37
+ <price>10</price>
38
+ <slug>advertisement-be-gone</slug>
39
+ </item>
40
+ <item>
41
+ <name>MailChimp Integration</name>
42
+ <desc>Grow your list of subscribers in MailChimp by using this addon to add users who take your quizzes and surveys!</desc>
43
+ <img></img>
44
+ <link>http://quizandsurveymaster.com/downloads/mailchimp-integration/?utm_source=qsm-addons-page</link>
45
+ <category>Integrations</category>
46
+ <price>25</price>
47
+ <slug>mailchimp-integration</slug>
48
+ </item>
49
+ <item>
50
+ <name>User Dashboard</name>
51
+ <desc>This addon gives you the ability to set up a page where users can review their results from all the quizzes they have taken.</desc>
52
+ <img></img>
53
+ <link>http://quizandsurveymaster.com/downloads/user-dashboard/?utm_source=qsm-addons-page</link>
54
+ <category>Frontend</category>
55
+ <price>25</price>
56
+ <slug>user-dashboard</slug>
57
+ </item>
58
+ <item>
59
+ <name>Aweber Integration</name>
60
+ <desc>Grow your list of subscribers in AWeber by using this addon to add users who take your quizzes!</desc>
61
+ <img></img>
62
+ <link>http://quizandsurveymaster.com/downloads/aweber-integration/?utm_source=qsm-addons-page</link>
63
+ <category>Integrations</category>
64
+ <price>25 </price>
65
+ <slug>aweber-integration</slug>
66
+ </item>
67
+ <item>
68
+ <name>Extra Template Variables</name>
69
+ <desc>This addon gives you several more template variables to use in your emails and results pages.</desc>
70
+ <img></img>
71
+ <link>http://quizandsurveymaster.com/downloads/extra-template-variables/?utm_source=qsm-addons-page</link>
72
+ <category>Developer</category>
73
+ <price>8</price>
74
+ <slug>extra-template-variables</slug>
75
+ </item>
76
+ <qsm_bundle>
77
+ <starter_bundle>
78
+ <name>Starter Bundle</name>
79
+ <desc>Get a bundle of 10 addons together which would cost over $225. With the Starter Plan, you get to use all the included addons on one site for only $49 per year. That is over 70% off compared to purchasing the addons individually.</desc>
80
+ <price>69</price>
81
+ <link>https://quizandsurveymaster.com/downloads/starter-plan/</link>
82
+ </starter_bundle>
83
+ <premium_bundle>
84
+ <name>Premium Bundle</name>
85
+ <desc>Buy our Premium Bundle and save over 95% on addon costs. You will get all 30+ plugins included in the Premium Bundle which is worth over $1500. View our pricing page for more details.!</desc>
86
+ <price>99</price>
87
+ <link>https://quizandsurveymaster.com/downloads/starter-plan/</link>
88
+ <slug>all-addons-top</slug>
89
+ </premium_bundle>
90
+ </qsm_bundle>
91
+ <qsm_news>
92
+ <title>Subscribe to our newsletter!</title>
93
+ <desc>Join our mailing list to learn about our newest features, receive email-only promotions, receive tips and guides, and more!</desc>
94
+ <link>http://quizandsurveymaster.com/subscribe-to-our-newsletter/</link>
95
+ </qsm_news>
96
+ <qsm_ads>
97
+ <ads>
98
+ <text>Are you finding this plugin very beneficial? Please consider checking out our premium addons which help support continued development of this plugin. Visit our [link] for details!</text>
99
+ <link>http://quizandsurveymaster.com/addons/?utm_source=qsm-plugin-ads#38utm_medium=plugin#38utm_content=#38utm_campaign=qsm_plugin</link>
100
+ <link_text>Addon Store</link_text>
101
+ </ads>
102
+ <ads>
103
+ <text>Are you receiving a lot of responses to your quizzes and surveys? Consider our Reporting and Anaylsis addon which analyzes the data for you and allows you to filter the data as well as export it! [link]</text>
104
+ <link>http://quizandsurveymaster.com/downloads/results-analysis/?utm_source=qsm-plugin-ads#38utm_medium=plugin#38utm_content=reporting-analysis-1#38utm_campaign=qsm_plugin</link>
105
+ <link_text>Click here for more details!</link_text>
106
+ </ads>
107
+ <ads>
108
+ <text>Want to grow your email list? Check out our addons for adding your quiz or survey takers to your email lists! [link].</text>
109
+ <link>http://bit.ly/2Bsw0Je</link>
110
+ <link_text>View our addon store</link_text>
111
+ </ads>
112
+ </qsm_ads>
113
+ </addon-list>
assets/facebook.png ADDED
Binary file
assets/twitter.png ADDED
Binary file
css/qsm-admin-question.css CHANGED
@@ -65,6 +65,7 @@
65
  display: flex;
66
  align-items: center;
67
  justify-content: space-between;
 
68
  }
69
 
70
  .question-bank-question div {
@@ -325,4 +326,28 @@ from { transform: translateY(15%); }
325
  }
326
  .change-answer-editor-label > #change-answer-editor{
327
  width: auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  }
65
  display: flex;
66
  align-items: center;
67
  justify-content: space-between;
68
+ clear: both;
69
  }
70
 
71
  .question-bank-question div {
326
  }
327
  .change-answer-editor-label > #change-answer-editor{
328
  width: auto;
329
+ }
330
+
331
+ a.import-button.button.disable_import{
332
+ position: relative;
333
+ z-index: 0;
334
+ }
335
+
336
+ a.import-button.button.disable_import::before {
337
+ content: '';
338
+ background: rgba(255,255,255,0.5);
339
+ width: 100%;
340
+ height: 100%;
341
+ left: 0;
342
+ right: 0;
343
+ top: 0;
344
+ bottom: 0;
345
+ position: absolute;
346
+ z-index: 5;
347
+ }
348
+
349
+ #question-bank-cat{
350
+ float: right;
351
+ margin-bottom: 20px;
352
+ margin-right: 10px;
353
  }
css/qsm-admin.css CHANGED
@@ -60,6 +60,16 @@ span.qsm-quiz-name {
60
  padding-right: 30px;
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
63
  @media screen and (min-width: 1200px) {
64
  .qsm-quizzes-page-content {
65
  flex-direction: row;
@@ -74,6 +84,15 @@ span.qsm-quiz-name {
74
  }
75
  }
76
 
 
 
 
 
 
 
 
 
 
77
 
78
 
79
  /********************
@@ -436,7 +455,7 @@ Misc.
436
  background: #fff;
437
  padding: 10px 5px;
438
  transition-duration: 0.5s;
439
- max-width: 400px;
440
  }
441
 
442
  .qsm-info-widget:hover {
@@ -658,4 +677,10 @@ from { transform: translateY(15%); }
658
  font-size: 13px;
659
  font-weight: bold;
660
  margin-left: 10px;
 
 
 
 
 
 
661
  }
60
  padding-right: 30px;
61
  }
62
 
63
+ .qsm-quiz-page-addon{
64
+ width: 83%;
65
+ float: left;
66
+ }
67
+
68
+ .quizzes-surveys_page_qmn_addons .qsm-news-ads{
69
+ width: 15%;
70
+ float: right;
71
+ }
72
+
73
  @media screen and (min-width: 1200px) {
74
  .qsm-quizzes-page-content {
75
  flex-direction: row;
84
  }
85
  }
86
 
87
+ @media screen and (max-width: 767px) {
88
+ .qsm-quiz-page-addon{
89
+ width: 100%;
90
+ }
91
+
92
+ .quizzes-surveys_page_qmn_addons .qsm-news-ads{
93
+ width: 100%;
94
+ }
95
+ }
96
 
97
 
98
  /********************
455
  background: #fff;
456
  padding: 10px 5px;
457
  transition-duration: 0.5s;
458
+ max-width: 330px;
459
  }
460
 
461
  .qsm-info-widget:hover {
677
  font-size: 13px;
678
  font-weight: bold;
679
  margin-left: 10px;
680
+ }
681
+
682
+ h3.addon_category_name {
683
+ width: 100%;
684
+ background: #d7d1d1;
685
+ padding: 15px;
686
  }
js/admin.js CHANGED
@@ -4,62 +4,104 @@
4
  var QSMAdmin;
5
  (function ($) {
6
 
7
- QSMAdmin = {
8
- /**
9
- * Catches an error from a jQuery function (i.e. $.ajax())
10
- */
11
- displayjQueryError: function( jqXHR, textStatus, errorThrown ) {
12
- QSMAdmin.displayAlert( 'Error: ' + errorThrown + '! Please try again.', 'error' );
13
- },
14
- /**
15
- * Catches an error from a BackBone function (i.e. model.save())
16
- */
17
- displayError: function( jqXHR, textStatus, errorThrown ) {
18
- QSMAdmin.displayAlert( 'Error: ' + errorThrown.errorThrown + '! Please try again.', 'error' );
19
- },
20
- /**
21
- * Displays an alert within the "Quiz Settings" page
22
- *
23
- * @param string message The message of the alert
24
- * @param string type The type of alert. Choose from 'error', 'info', 'success', and 'warning'
25
- */
26
- displayAlert: function( message, type ) {
27
- QSMAdmin.clearAlerts();
28
- var template = wp.template( 'notice' );
29
- var data = {
30
- message: message,
31
- type: type
32
- };
33
- $( '.qsm-alerts' ).append( template( data ) );
34
- },
35
- clearAlerts: function() {
36
- $( '.qsm-alerts' ).empty();
37
- },
38
- selectTab: function( tab ) {
39
- $( '.qsm-tab' ).removeClass( 'nav-tab-active' );
40
- $( '.qsm-tab-content' ).hide();
41
- tab.addClass( 'nav-tab-active' );
42
- tabID = tab.data( 'tab' );
43
- $( '.tab-' + tabID ).show();
44
- }
45
- };
46
- $(function() {
47
- $( '.qsm-tab' ).on( 'click', function( event ) {
48
- event.preventDefault();
49
- QSMAdmin.selectTab( $( this ) );
50
- });
51
 
52
- $( '#qmn_check_all' ).change( function() {
53
- $( '.qmn_delete_checkbox' ).prop( 'checked', jQuery( '#qmn_check_all' ).prop( 'checked' ) );
54
- });
55
-
56
- $( '.edit-quiz-name' ).click( function(e){
57
- e.preventDefault();
58
- MicroModal.show( 'modal-3' );
59
- });
60
- $( '#edit-name-button' ).on( 'click', function( event ) {
61
- event.preventDefault();
62
- $( '#edit-name-form' ).submit();
63
- });
64
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }(jQuery));
4
  var QSMAdmin;
5
  (function ($) {
6
 
7
+ QSMAdmin = {
8
+ /**
9
+ * Catches an error from a jQuery function (i.e. $.ajax())
10
+ */
11
+ displayjQueryError: function (jqXHR, textStatus, errorThrown) {
12
+ QSMAdmin.displayAlert('Error: ' + errorThrown + '! Please try again.', 'error');
13
+ },
14
+ /**
15
+ * Catches an error from a BackBone function (i.e. model.save())
16
+ */
17
+ displayError: function (jqXHR, textStatus, errorThrown) {
18
+ QSMAdmin.displayAlert('Error: ' + errorThrown.errorThrown + '! Please try again.', 'error');
19
+ },
20
+ /**
21
+ * Displays an alert within the "Quiz Settings" page
22
+ *
23
+ * @param string message The message of the alert
24
+ * @param string type The type of alert. Choose from 'error', 'info', 'success', and 'warning'
25
+ */
26
+ displayAlert: function (message, type) {
27
+ QSMAdmin.clearAlerts();
28
+ var template = wp.template('notice');
29
+ var data = {
30
+ message: message,
31
+ type: type
32
+ };
33
+ $('.qsm-alerts').append(template(data));
34
+ },
35
+ clearAlerts: function () {
36
+ $('.qsm-alerts').empty();
37
+ },
38
+ selectTab: function (tab) {
39
+ $('.qsm-tab').removeClass('nav-tab-active');
40
+ $('.qsm-tab-content').hide();
41
+ tab.addClass('nav-tab-active');
42
+ tabID = tab.data('tab');
43
+ $('.tab-' + tabID).show();
44
+ }
45
+ };
46
+ $(function () {
47
+ $('.qsm-tab').on('click', function (event) {
48
+ event.preventDefault();
49
+ QSMAdmin.selectTab($(this));
50
+ });
51
 
52
+ $('#qmn_check_all').change(function () {
53
+ $('.qmn_delete_checkbox').prop('checked', jQuery('#qmn_check_all').prop('checked'));
54
+ });
55
+
56
+ $('.edit-quiz-name').click(function (e) {
57
+ e.preventDefault();
58
+ MicroModal.show('modal-3');
59
+ });
60
+ $('#edit-name-button').on('click', function (event) {
61
+ event.preventDefault();
62
+ $('#edit-name-form').submit();
63
+ });
64
+ $('#sendySignupForm').submit(function (e) {
65
+
66
+ e.preventDefault();
67
+ var $form = $(this),
68
+ name = $form.find('input[name="name"]').val(),
69
+ email = $form.find('input[name="email"]').val(),
70
+ action = 'qsm_send_data_sendy';
71
+ $form.find('#submit').attr('disabled', true);
72
+ $.post(ajaxurl, {name: name, email: email, action: action},
73
+ function (data) {
74
+ if (data)
75
+ {
76
+ $("#status").text('');
77
+ if (data == "Some fields are missing.")
78
+ {
79
+ $("#status").text("Please fill in your name and email.");
80
+ $("#status").css("color", "red");
81
+ } else if (data == "Invalid email address.")
82
+ {
83
+ $("#status").text("Your email address is invalid.");
84
+ $("#status").css("color", "red");
85
+ } else if (data == "Invalid list ID.")
86
+ {
87
+ $("#status").text("Your list ID is invalid.");
88
+ $("#status").css("color", "red");
89
+ } else if (data == "Already subscribed.")
90
+ {
91
+ $("#status").text("You're already subscribed!");
92
+ $("#status").css("color", "red");
93
+ } else
94
+ {
95
+ $("#status").text("Thanks, you are now subscribed to our mailing list!");
96
+ $("#status").css("color", "green");
97
+ }
98
+ $form.find('#submit').attr('disabled', false);
99
+ } else
100
+ {
101
+ alert("Sorry, unable to subscribe. Please try again later!");
102
+ }
103
+ }
104
+ );
105
+ });
106
+ });
107
  }(jQuery));
js/qsm-admin-contact.js CHANGED
@@ -6,7 +6,7 @@ var QSMContact;
6
  (function ($) {
7
  QSMContact = {
8
  load : function() {
9
- if(qsmContactObject.contactForm.length > 0){
10
  $.each( qsmContactObject.contactForm, function( i, val ) {
11
  QSMContact.addField( val );
12
  });
6
  (function ($) {
7
  QSMContact = {
8
  load : function() {
9
+ if($.isArray(qsmContactObject.contactForm) && qsmContactObject.contactForm.length > 0){
10
  $.each( qsmContactObject.contactForm, function( i, val ) {
11
  QSMContact.addField( val );
12
  });
js/qsm-admin-question.js CHANGED
@@ -3,6 +3,7 @@
3
  */
4
 
5
  var QSMQuestion;
 
6
  (function ($) {
7
  QSMQuestion = {
8
  question: Backbone.Model.extend({
@@ -65,18 +66,31 @@ var QSMQuestion;
65
  },
66
  questionBankLoadSuccess: function( questions ) {
67
  $( '#question-bank' ).empty();
 
68
  for ( var i = 0; i < questions.length; i++) {
69
  QSMQuestion.addQuestionToQuestionBank( questions[i] );
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
71
  },
72
  addQuestionToQuestionBank: function( question ) {
73
  var questionText = QSMQuestion.prepareQuestionText( question.name );
74
  var template = wp.template( 'single-question-bank-question' );
75
- $( '#question-bank' ).append( template( { id: question.id, question: questionText } ) );
76
  },
77
  addQuestionFromQuestionBank: function( questionID ) {
78
- MicroModal.close( 'modal-2' );
79
- QSMAdmin.displayAlert( 'Adding question...', 'info' );
80
  var model = new QSMQuestion.question( { id: questionID } );
81
  model.fetch({
82
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
@@ -88,9 +102,11 @@ var QSMQuestion;
88
  questionBankSuccess: function( model ) {
89
  var page = parseInt( $( '#add-question-bank-page' ).val(), 10 );
90
  model.set( 'page', page );
91
- QSMAdmin.displayAlert( 'Question added!', 'success' );
92
  QSMQuestion.questions.add( model );
93
  QSMQuestion.addQuestionToPage( model );
 
 
94
  },
95
  prepareCategories: function() {
96
  QSMQuestion.categories = [];
@@ -244,6 +260,7 @@ var QSMQuestion;
244
  var required = $( "#required" ).val();
245
  var category = $( ".category-radio:checked" ).val();
246
  var autofill = $( "#hide_autofill" ).val();
 
247
  if ( 'new_category' == category ) {
248
  category = $( '#new_category' ).val();
249
  }
@@ -281,7 +298,8 @@ var QSMQuestion;
281
  required: required,
282
  answers: answers,
283
  answer_editor: answerType,
284
- autofill: autofill
 
285
  },
286
  {
287
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
@@ -345,6 +363,11 @@ var QSMQuestion;
345
  if( disableAutofill === null || typeof disableAutofill === "undefined" ){
346
  disableAutofill = '0';
347
  }
 
 
 
 
 
348
  var al = 0;
349
  _.each( answers, function( answer ) {
350
  answer.push(al + 1);
@@ -359,6 +382,7 @@ var QSMQuestion;
359
  $( "#comments" ).val( question.get( 'comments' ) );
360
  $( "#required" ).val( question.get( 'required' ) );
361
  $( "#hide_autofill" ).val( disableAutofill );
 
362
  $( "#change-answer-editor" ).val( answerEditor );
363
  $( ".category-radio" ).removeAttr( 'checked' );
364
  $( "#edit-question-id" ).text('').text(questionID);
@@ -444,10 +468,13 @@ var QSMQuestion;
444
  var answer = [ '', '', 0, answer_length + 1, question_id, answerType];
445
  QSMQuestion.addNewAnswer( answer );
446
  });
447
-
448
  $( '.qsm-popup-bank' ).on( 'click', '.import-button', function( event) {
449
  event.preventDefault();
 
 
450
  QSMQuestion.addQuestionFromQuestionBank( $( this ).parents( '.question-bank-question' ).data( 'question-id' ) );
 
451
  });
452
 
453
  $( '.save-page-button' ).on( 'click', function( event ) {
@@ -519,5 +546,19 @@ var QSMQuestion;
519
  }
520
  });
521
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  });
523
  }(jQuery));
3
  */
4
 
5
  var QSMQuestion;
6
+ var import_button;
7
  (function ($) {
8
  QSMQuestion = {
9
  question: Backbone.Model.extend({
66
  },
67
  questionBankLoadSuccess: function( questions ) {
68
  $( '#question-bank' ).empty();
69
+ var category_arr = [];
70
  for ( var i = 0; i < questions.length; i++) {
71
  QSMQuestion.addQuestionToQuestionBank( questions[i] );
72
+ if(category_arr.indexOf(questions[i].category) == -1 && questions[i].category != ''){
73
+ category_arr.push(questions[i].category);
74
+ }
75
+ }
76
+ if(category_arr.length > 0){
77
+ $cat_html = '<select name="question-bank-cat" id="question-bank-cat">';
78
+ $cat_html += '<option value="">All Questions</option>';
79
+ $.each(category_arr, function(index, value){
80
+ $cat_html += '<option value="'+ value +'">'+ value +' Questions</option>';
81
+ });
82
+ $cat_html += '</select>';
83
+ $( '#question-bank' ).prepend($cat_html);
84
+ }
85
  },
86
  addQuestionToQuestionBank: function( question ) {
87
  var questionText = QSMQuestion.prepareQuestionText( question.name );
88
  var template = wp.template( 'single-question-bank-question' );
89
+ $( '#question-bank' ).append( template( { id: question.id, question: questionText, category: question.category, quiz_name: question.quiz_name } ) );
90
  },
91
  addQuestionFromQuestionBank: function( questionID ) {
92
+ //MicroModal.close( 'modal-2' );
93
+ //QSMAdmin.displayAlert( 'Adding question...', 'info' );
94
  var model = new QSMQuestion.question( { id: questionID } );
95
  model.fetch({
96
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
102
  questionBankSuccess: function( model ) {
103
  var page = parseInt( $( '#add-question-bank-page' ).val(), 10 );
104
  model.set( 'page', page );
105
+ //QSMAdmin.displayAlert( 'Question added!', 'success' );
106
  QSMQuestion.questions.add( model );
107
  QSMQuestion.addQuestionToPage( model );
108
+ $('.import-button').removeClass('disable_import');
109
+ import_button.html('').html('Add Question');
110
  },
111
  prepareCategories: function() {
112
  QSMQuestion.categories = [];
260
  var required = $( "#required" ).val();
261
  var category = $( ".category-radio:checked" ).val();
262
  var autofill = $( "#hide_autofill" ).val();
263
+ var limit_text = $( "#limit_text" ).val();
264
  if ( 'new_category' == category ) {
265
  category = $( '#new_category' ).val();
266
  }
298
  required: required,
299
  answers: answers,
300
  answer_editor: answerType,
301
+ autofill: autofill,
302
+ limit_text: limit_text
303
  },
304
  {
305
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
363
  if( disableAutofill === null || typeof disableAutofill === "undefined" ){
364
  disableAutofill = '0';
365
  }
366
+ //Get text limit value
367
+ var get_limit_text = question.get( 'limit_text' );
368
+ if( get_limit_text === null || typeof get_limit_text === "undefined" ){
369
+ get_limit_text = '0';
370
+ }
371
  var al = 0;
372
  _.each( answers, function( answer ) {
373
  answer.push(al + 1);
382
  $( "#comments" ).val( question.get( 'comments' ) );
383
  $( "#required" ).val( question.get( 'required' ) );
384
  $( "#hide_autofill" ).val( disableAutofill );
385
+ $( "#limit_text" ).val( get_limit_text );
386
  $( "#change-answer-editor" ).val( answerEditor );
387
  $( ".category-radio" ).removeAttr( 'checked' );
388
  $( "#edit-question-id" ).text('').text(questionID);
468
  var answer = [ '', '', 0, answer_length + 1, question_id, answerType];
469
  QSMQuestion.addNewAnswer( answer );
470
  });
471
+
472
  $( '.qsm-popup-bank' ).on( 'click', '.import-button', function( event) {
473
  event.preventDefault();
474
+ $(this).text('').text('Adding Question');
475
+ import_button = $(this);
476
  QSMQuestion.addQuestionFromQuestionBank( $( this ).parents( '.question-bank-question' ).data( 'question-id' ) );
477
+ $('.import-button').addClass('disable_import');
478
  });
479
 
480
  $( '.save-page-button' ).on( 'click', function( event ) {
546
  }
547
  });
548
  });
549
+ $(document).on('change','#question-bank-cat', function(){
550
+ var val = $(this).val();
551
+ if(val == ''){
552
+ $('.question-bank-question').show();
553
+ }else{
554
+ $('.question-bank-question').each(function (){
555
+ if($(this).attr("data-category-name") == val){
556
+ $(this).show();
557
+ }else{
558
+ $(this).hide();
559
+ }
560
+ });
561
+ }
562
+ });
563
  });
564
  }(jQuery));
js/qsm-admin-results.js CHANGED
@@ -45,6 +45,7 @@ var QSMAdminResults;
45
  } else {
46
  QSMAdmin.displayAlert( 'There was an error when saving the results pages. Please try again.', 'error' );
47
  }
 
48
  })
49
  .fail(QSMAdmin.displayjQueryError);
50
  },
@@ -114,7 +115,8 @@ var QSMAdminResults;
114
  });
115
  $( '.save-pages' ).on( 'click', function( event ) {
116
  event.preventDefault();
117
- QSMAdminResults.saveResults();
 
118
  });
119
  $( '#results-pages' ).on( 'click', '.new-condition', function( event ) {
120
  event.preventDefault();
45
  } else {
46
  QSMAdmin.displayAlert( 'There was an error when saving the results pages. Please try again.', 'error' );
47
  }
48
+ $('.save-pages').next('.spinner').removeClass('is-active');
49
  })
50
  .fail(QSMAdmin.displayjQueryError);
51
  },
115
  });
116
  $( '.save-pages' ).on( 'click', function( event ) {
117
  event.preventDefault();
118
+ $(this).next('.spinner').addClass('is-active');
119
+ QSMAdminResults.saveResults();
120
  });
121
  $( '#results-pages' ).on( 'click', '.new-condition', function( event ) {
122
  event.preventDefault();
js/qsm-quiz.js CHANGED
@@ -133,6 +133,13 @@ var QSM;
133
 
134
  var $quizForm = QSM.getQuizForm( quizID );
135
  $quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
 
 
 
 
 
 
 
136
  //document.quizForm.submit();
137
  return;
138
  }
@@ -358,7 +365,9 @@ function qmnClearField( field ) {
358
  }
359
 
360
  function qsmScrollTo( $element ) {
361
- jQuery( 'html, body' ).animate( { scrollTop: $element.offset().top - 150 }, 1000 );
 
 
362
  }
363
 
364
  function qmnDisplayError( message, field, quiz_form_id ) {
@@ -721,6 +730,57 @@ jQuery(function() {
721
  event.preventDefault();
722
  qmnFormSubmit( this.id );
723
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  });
725
 
726
  var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
133
 
134
  var $quizForm = QSM.getQuizForm( quizID );
135
  $quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
136
+ $quizForm.closest( '.qmn_quiz_container' ).prepend('<p style="color: red;">Quiz time is over</p>');
137
+ //$( ".qsm-submit-btn" ).remove();
138
+ if(qmn_ajax_object.enable_result_after_timer_end == 1){
139
+ $quizForm.closest( '.qmn_quiz_container' ).find('form').submit();
140
+ }else{
141
+ alert('You are not able to attemp remaining part of quiz but you can submit the quiz!')
142
+ }
143
  //document.quizForm.submit();
144
  return;
145
  }
365
  }
366
 
367
  function qsmScrollTo( $element ) {
368
+ if($element.length > 0){
369
+ jQuery( 'html, body' ).animate( { scrollTop: $element.offset().top - 150 }, 1000 );
370
+ }
371
  }
372
 
373
  function qmnDisplayError( message, field, quiz_form_id ) {
730
  event.preventDefault();
731
  qmnFormSubmit( this.id );
732
  });
733
+
734
+ jQuery(document).on('click','.btn-reload-quiz',function(e){
735
+ e.preventDefault();
736
+ var quiz_id = jQuery(this).data('quiz_id');
737
+ var parent_div = jQuery(this).parents('.qsm-quiz-container');
738
+ qsmDisplayLoading( parent_div );
739
+ jQuery.ajax({
740
+ type: 'POST',
741
+ url: qmn_ajax_object.ajaxurl,
742
+ data: {
743
+ action: "qsm_get_quiz_to_reload",
744
+ quiz_id: quiz_id,
745
+ },
746
+ success: function (response) {
747
+ parent_div.replaceWith(response);
748
+ QSM.initPagination( quiz_id );
749
+ },
750
+ error: function (errorThrown) {
751
+ alert(errorThrown);
752
+ }
753
+ });
754
+ });
755
+
756
+ jQuery(document).on('change','.qmn_radio_answers input',function(e){
757
+ if(qmn_ajax_object.enable_quick_result_mc == 1){
758
+ var question_id = jQuery(this).attr('name').split('question')[1],
759
+ value = jQuery(this).val(),
760
+ $this = jQuery(this).parents('.quiz_section');
761
+
762
+ jQuery.ajax({
763
+ type: 'POST',
764
+ url: qmn_ajax_object.ajaxurl,
765
+ data: {
766
+ action: "qsm_get_question_quick_result",
767
+ question_id: question_id,
768
+ answer: value,
769
+ },
770
+ success: function (response) {
771
+ $this.find('.quick-question-res-p').remove();
772
+ if(response == 'correct'){
773
+ $this.append('<p style="color: green" class="quick-question-res-p"><b>Correct!</b> You have selected correct answer.</p>')
774
+ }else if(response == 'incorrect'){
775
+ $this.append('<p style="color: red" class="quick-question-res-p"><b>Wrong!</b> You have selected wrong answer.</p>')
776
+ }
777
+ },
778
+ error: function (errorThrown) {
779
+ alert(errorThrown);
780
+ }
781
+ });
782
+ }
783
+ });
784
  });
785
 
786
  var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
mlw_quizmaster2.php CHANGED
@@ -2,14 +2,14 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 6.3.1
6
  * Author: QSM Team
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://quizandsurveymaster.com/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
- * @version 6.3.1
13
  * @package QSM
14
  */
15
 
@@ -34,7 +34,7 @@ class MLWQuizMasterNext {
34
  * @var string
35
  * @since 4.0.0
36
  */
37
- public $version = '6.3.1';
38
 
39
  /**
40
  * QSM Alert Manager Object
@@ -117,6 +117,7 @@ class MLWQuizMasterNext {
117
  $this->audit_manager = new QSM_Audit();
118
 
119
  if ( is_admin() ) {
 
120
  include 'php/admin/stats-page.php';
121
  include 'php/admin/quizzes-page.php';
122
  include 'php/admin/quiz-options-page.php';
@@ -275,7 +276,8 @@ class MLWQuizMasterNext {
275
  add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
276
  add_submenu_page( __FILE__, __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'qsm_quiz_tools', 'qsm_generate_quiz_tools' );
277
  add_submenu_page( __FILE__, __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
278
- add_submenu_page( __FILE__, __( 'Addon Settings', 'quiz-master-next' ), __( 'Addon Settings', 'quiz-master-next' ), 'moderate_comments', 'qmn_addons', 'qmn_addons_page' );
 
279
  add_submenu_page( __FILE__, __( 'QSM About', 'quiz-master-next' ), __( 'QSM About', 'quiz-master-next' ), 'moderate_comments', 'qsm_about_page', 'qsm_generate_about_page' );
280
  add_submenu_page( __FILE__, __( 'Help', 'quiz-master-next' ), __( 'Help', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_help', 'qsm_generate_help_page' );
281
  }
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 6.3.2
6
  * Author: QSM Team
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://quizandsurveymaster.com/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
+ * @version 6.3.2
13
  * @package QSM
14
  */
15
 
34
  * @var string
35
  * @since 4.0.0
36
  */
37
+ public $version = '6.3.2';
38
 
39
  /**
40
  * QSM Alert Manager Object
117
  $this->audit_manager = new QSM_Audit();
118
 
119
  if ( is_admin() ) {
120
+ include 'php/admin/functions.php';
121
  include 'php/admin/stats-page.php';
122
  include 'php/admin/quizzes-page.php';
123
  include 'php/admin/quiz-options-page.php';
276
  add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
277
  add_submenu_page( __FILE__, __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'qsm_quiz_tools', 'qsm_generate_quiz_tools' );
278
  add_submenu_page( __FILE__, __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
279
+ add_submenu_page( __FILE__, __( 'Addon Settings', 'quiz-master-next' ), '<span style="color:#f39c12;">' . __( 'Addon Settings', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qmn_addons', 'qmn_addons_page' );
280
+ add_submenu_page( __FILE__, __( 'Get a Free Addon', 'quiz-master-next' ), '<span style="color:#f39c12;">' . esc_html__( 'Get a Free Addon!', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qsm-free-addon', 'qsm_display_optin_page' );
281
  add_submenu_page( __FILE__, __( 'QSM About', 'quiz-master-next' ), __( 'QSM About', 'quiz-master-next' ), 'moderate_comments', 'qsm_about_page', 'qsm_generate_about_page' );
282
  add_submenu_page( __FILE__, __( 'Help', 'quiz-master-next' ), __( 'Help', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_help', 'qsm_generate_help_page' );
283
  }
php/admin/addons-page.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
  }
6
 
7
  /**
@@ -11,38 +10,38 @@ if ( ! defined( 'ABSPATH' ) ) {
11
  * @since 4.4.0
12
  */
13
  function qmn_addons_page() {
14
- if ( ! current_user_can( 'moderate_comments' ) ) {
15
- return;
16
- }
17
 
18
- global $mlwQuizMasterNext;
19
- $active_tab = strtolower( str_replace( " ", "-", isset( $_GET['tab'] ) ? $_GET['tab'] : __( 'Featured Addons', 'quiz-master-next' ) ) );
20
- $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
21
- ?>
22
- <div class="wrap">
23
- <h2>Quiz And Survey Master Addon Settings</h2>
24
- <h2 class="nav-tab-wrapper">
25
- <?php
26
- foreach ( $tab_array as $tab ) {
27
- $active_class = '';
28
- if ( $active_tab == $tab['slug'] ) {
29
- $active_class = 'nav-tab-active';
30
- }
31
- echo "<a href=\"?page=qmn_addons&tab={$tab['slug']}\" class=\"nav-tab $active_class\">{$tab['title']}</a>";
32
- }
33
- ?>
34
- </h2>
35
- <div>
36
- <?php
37
- foreach ( $tab_array as $tab ) {
38
- if ( $active_tab == $tab['slug'] ) {
39
- call_user_func( $tab['function'] );
40
- }
41
- }
42
- ?>
43
- </div>
44
- </div>
45
- <?php
46
  }
47
 
48
  /**
@@ -52,57 +51,68 @@ function qmn_addons_page() {
52
  * @since 4.4.0
53
  */
54
  function qsm_generate_featured_addons() {
55
- wp_enqueue_style( 'qsm_addons_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ) );
56
- ?>
57
- <p><?php esc_html_e( 'These addons extend the functionality of Quiz And Survey Master', 'quiz-master-next' ); ?></p>
58
- <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
59
- <div class="qsm-addons">
60
- <div class="qsm-info-widget">
61
- <h3>Landing Page</h3>
62
- <p >Display your quizzes and surveys in their own standalone page without distracting menus, themes, or other content from your site.</p>
63
- <a href="http://quizandsurveymaster.com/downloads/landing-page/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=landing-page&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
64
- </div>
65
- <div class="qsm-info-widget">
66
- <h3>Reporting and Analysis</h3>
67
- <p>Analyze your quiz's or survey's results to see the percentage of users who chose each answer displayed on useful charts. You can then filter that data or export it.</p>
68
- <a href="http://quizandsurveymaster.com/downloads/results-analysis/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=reporting-and-analysis&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
69
- </div>
70
- <div class="qsm-info-widget">
71
- <h3>Export Results</h3>
72
- <p>This addon gives you the ability to export your quiz results as a CSV file.</p>
73
- <a href="http://quizandsurveymaster.com/downloads/export-results/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=export-results&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
74
- </div>
75
- <div class="qsm-info-widget">
76
- <h3>Advertisement Be Gone</h3>
77
- <p>This addon will remove all services/addon advertisements throughout the plugin.</p>
78
- <a href="http://quizandsurveymaster.com/downloads/advertisement-gone/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=advertisement-be-gone&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
79
- </div>
80
- <div class="qsm-info-widget">
81
- <h3>MailChimp Integration</h3>
82
- <p>Grow your list of subscribers in MailChimp by using this addon to add users who take your quizzes and surveys!</p>
83
- <a href="http://quizandsurveymaster.com/downloads/mailchimp-integration/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=mailchimp-integration&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
84
- </div>
85
- <div class="qsm-info-widget">
86
- <h3>User Dashboard</h3>
87
- <p>This addon gives you the ability to set up a page where users can review their results from all the quizzes they have taken.</p>
88
- <a href="http://quizandsurveymaster.com/downloads/user-dashboard/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=user-dashboard&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
89
- </div>
90
- <div class="qsm-info-widget">
91
- <h3>Aweber Integration</h3>
92
- <p>Grow your list of subscribers in AWeber by using this addon to add users who take your quizzes!</p>
93
- <a href="http://quizandsurveymaster.com/downloads/aweber-integration/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=aweber-integration&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
94
- </div>
95
- <div class="qsm-info-widget">
96
- <h3>Extra Template Variables</h3>
97
- <p>This addon gives you several more template variables to use in your emails and results pages.</p>
98
- <a href="http://quizandsurveymaster.com/downloads/extra-template-variables/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=extra-template-variables&utm_campaign=qsm_plugin" target="_blank" class="button">Get This Addon</a>
99
- </div>
100
- </div>
101
- <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-bottom&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
102
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
105
-
106
  /**
107
  * This function registers the feature add ons tab.
108
  *
@@ -110,8 +120,70 @@ function qsm_generate_featured_addons() {
110
  * @since 4.4.0
111
  */
112
  function qsm_featured_addons_tab() {
113
- global $mlwQuizMasterNext;
114
- $mlwQuizMasterNext->pluginHelper->register_addon_settings_tab( __( 'Featured Addons', 'quiz-master-next' ), 'qsm_generate_featured_addons' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
- add_action( 'plugins_loaded', 'qsm_featured_addons_tab' );
117
  ?>
1
  <?php
2
+ if (!defined('ABSPATH')) {
3
+ exit;
 
4
  }
5
 
6
  /**
10
  * @since 4.4.0
11
  */
12
  function qmn_addons_page() {
13
+ if (!current_user_can('moderate_comments')) {
14
+ return;
15
+ }
16
 
17
+ global $mlwQuizMasterNext;
18
+ $active_tab = strtolower(str_replace(" ", "-", isset($_GET['tab']) ? $_GET['tab'] : __('Featured Addons', 'quiz-master-next')));
19
+ $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
20
+ ?>
21
+ <div class="wrap">
22
+ <h2>Quiz And Survey Master Addon Settings</h2>
23
+ <h2 class="nav-tab-wrapper">
24
+ <?php
25
+ foreach ($tab_array as $tab) {
26
+ $active_class = '';
27
+ if ($active_tab == $tab['slug']) {
28
+ $active_class = 'nav-tab-active';
29
+ }
30
+ echo "<a href=\"?page=qmn_addons&tab={$tab['slug']}\" class=\"nav-tab $active_class\">{$tab['title']}</a>";
31
+ }
32
+ ?>
33
+ </h2>
34
+ <div>
35
+ <?php
36
+ foreach ($tab_array as $tab) {
37
+ if ($active_tab == $tab['slug']) {
38
+ call_user_func($tab['function']);
39
+ }
40
+ }
41
+ ?>
42
+ </div>
43
+ </div>
44
+ <?php
45
  }
46
 
47
  /**
51
  * @since 4.4.0
52
  */
53
  function qsm_generate_featured_addons() {
54
+ wp_enqueue_style('qsm_addons_style', plugins_url('../../css/qsm-admin.css', __FILE__));
55
+ ?>
56
+ <p><?php esc_html_e('These addons extend the functionality of Quiz And Survey Master', 'quiz-master-next'); ?></p>
57
+ <div class="qsm-quiz-page-addon">
58
+ <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
59
+ <div class="qsm-addons">
60
+ <?php
61
+ $xml = qsm_fetch_data_from_xml();
62
+ $cateory_arr = array();
63
+ if (isset($xml->item) && $xml->item) {
64
+ foreach ($xml->item as $key => $value) {
65
+ $category_addon = trim($value->category);
66
+ if (!array_key_exists($category_addon, $cateory_arr)) {
67
+ $cateory_arr[$category_addon] = array();
68
+ }
69
+ $cateory_arr[$category_addon][] = $value;
70
+ }
71
+ }
72
+ if ($cateory_arr) {
73
+ foreach ($cateory_arr as $cat_name => $cat_value) {
74
+ ?>
75
+ <h3 class="addon_category_name"><?php echo $cat_name; ?></h3>
76
+ <?php foreach ($cat_value as $value) { ?>
77
+ <div class="qsm-info-widget">
78
+ <h3><?php echo $value->name; ?></h3>
79
+ <p><?php echo $value->desc; ?></p>
80
+ <button class="button button-default"><?php echo '$' . $value->price; ?></button>
81
+ <a href="<?php echo $value->link . '&utm_medium=plugin&utm_content=' . $value->slug . '&utm_campaign=qsm_plugin' ?>" target="_blank" class="button button-primary">Get This Addon</a>
82
+ </div>
83
+ <?php } ?>
84
+ <?php
85
+ }
86
+ }
87
+ ?>
88
+ </div>
89
+ <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-bottom&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
90
+ </div>
91
+ <div class="qsm-news-ads">
92
+ <h3 class="qsm-news-ads-title">QSM Bundle</h3>
93
+ <?php
94
+ if(isset($xml->qsm_bundle)){
95
+ ?>
96
+ <div class="qsm-info-widget">
97
+ <h3><?php echo $xml->qsm_bundle->starter_bundle->name; ?></h3>
98
+ <p><?php echo $xml->qsm_bundle->starter_bundle->desc; ?></p>
99
+ <button class="button button-default">$<?php echo $xml->qsm_bundle->starter_bundle->price; ?></button>
100
+ <a target="_blank" href="<?php echo $xml->qsm_bundle->starter_bundle->link; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary">Get Now</a>
101
+ </div>
102
+ <div class="qsm-info-widget">
103
+ <h3><?php echo $xml->qsm_bundle->premium_bundle->name; ?></h3>
104
+ <p><?php echo $xml->qsm_bundle->premium_bundle->desc; ?></p>
105
+ <button class="button button-default">$<?php echo $xml->qsm_bundle->premium_bundle->price; ?></button>
106
+ <a target="_blank" href="<?php echo $xml->qsm_bundle->premium_bundle->link; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary">Get Now</a>
107
+ </div>
108
+ <?php } ?>
109
+ <!-- <div class="remove-ads-adv-link">
110
+ <a target="_blank" href="https://quizandsurveymaster.com/downloads/advertisement-gone/"><span class="dashicons dashicons-no-alt"></span> Remove Ads</a>
111
+ </div> -->
112
+ </div>
113
+ <?php
114
  }
115
 
 
116
  /**
117
  * This function registers the feature add ons tab.
118
  *
120
  * @since 4.4.0
121
  */
122
  function qsm_featured_addons_tab() {
123
+ global $mlwQuizMasterNext;
124
+ $mlwQuizMasterNext->pluginHelper->register_addon_settings_tab(__('Featured Addons', 'quiz-master-next'), 'qsm_generate_featured_addons');
125
+ }
126
+
127
+ add_action('plugins_loaded', 'qsm_featured_addons_tab');
128
+
129
+ /**
130
+ * @version 3.2.0
131
+ * Display get a free addon page
132
+ */
133
+ function qsm_display_optin_page() {
134
+ wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
135
+ ?>
136
+ <div class="wrap about-wrap">
137
+
138
+ <h1><?php esc_html_e('Get Your Free Addon!', 'quiz-master-next'); ?></h1>
139
+
140
+ <div class="about-text"><?php esc_html_e('Wanna get more out of Quiz and Survey Master, but not yet ready to spend the cash? Get one free addon today!', 'quiz-master-next'); ?></div>
141
+
142
+ <div class="changelog">
143
+
144
+ <div class="row">
145
+ <!-- <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
146
+ <div class="about-body">
147
+ <img src="" alt="Improved Custom Fields">
148
+ </div>
149
+ </div> -->
150
+ <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
151
+ <div class="about-body">
152
+ <h3><?php esc_attr_e('Advertisment Be Gone', 'quiz-master-next'); ?></h3>
153
+ <p><?php esc_attr_e('The Quiz And Survey Master News widgets from the Quizzes/Surveys page as well as all the green bordered ads at the top of pages will disappear when you activate this addon!', 'quiz-master-next'); ?></p>
154
+ <p><a href="https://quizandsurveymaster.com/downloads/advertisement-gone/" target="_blank"><?php esc_attr_e('Read more about this addon on our site >', 'quiz-master-next'); ?></a></p>
155
+ </div>
156
+ </div>
157
+ </div>
158
+
159
+ <h2><?php esc_html_e('How to Get Your Free Addon', 'quiz-master-next'); ?></h2>
160
+
161
+ <p><?php echo sprintf(__('Getting your addon is dead simple: just subscribe to our newsletter and then you will get the free addon by e-mail. We will not spam you. We usually send out newsletters to talk about new features in Awesome Support, let you know when new or updated addons are being released and provide informative articles that show you how to use Awesome Support to its full potential. <a href="%s" %s>View our privacy policy</a>', 'quiz-master-next'), 'https://quizandsurveymaster.com/privacy-policy/', 'target="_blank"'); ?></p>
162
+
163
+ <div id="wpas-mailchimp-signup-form-wrapper">
164
+ <div id="status"></div>
165
+ <form id="sendySignupForm" action="http://sendy.expresstech.io/subscribe" method="POST" accept-charset="utf-8">
166
+ <table class="form-table">
167
+ <tr>
168
+ <td class="row-title"><label for="name">First Name</label> <input type="text" name="name" id="name"/></td>
169
+ <td class="row-title">
170
+ <label for="email">Email Address</label>
171
+ <input type="email" name="email" id="email"/>
172
+ <div style="display:none;">
173
+ <label for="hp">HP</label><br/>
174
+ <input type="text" name="hp" id="hp"/>
175
+ </div>
176
+ <input type="hidden" name="list" value="4v8zvoyXyTHSS80jeavOpg"/>
177
+ <input type="hidden" name="subform" value="yes"/>
178
+ <input type="submit" name="submit" id="submit" value="Subscribe" class="button-secondary"/>
179
+ </td>
180
+ </tr>
181
+ </table>
182
+ </form>
183
+ </div>
184
+ </div>
185
+
186
+ </div>
187
+ <?php
188
  }
 
189
  ?>
php/admin/functions.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function qsm_fetch_data_from_xml() {
4
+ $file = esc_url('https://quizandsurveymaster.com/addons.xml');
5
+ $response = wp_remote_post($file, array('sslverify' => false));
6
+
7
+ if (is_wp_error($response) || $response['response']['code'] === 404 ) {
8
+ return "<p>" . __('Something went wrong', 'quiz-master-next') . "</p>";
9
+ }else{
10
+ $body = wp_remote_retrieve_body($response);
11
+ return $xml = simplexml_load_string($body);
12
+ }
13
+ }
php/admin/options-page-email-tab.php CHANGED
@@ -96,13 +96,13 @@ function qsm_options_emails_tab_content() {
96
  <span class="template_name">%TIMER_MINUTES%</span> - <?php _e('The amount of time user spent on quiz in minutes', 'quiz-master-next'); ?>
97
  </div>
98
  <div class="template_variable">
99
- <span class="template_name">%CATEGORY_POINTS%%/CATEGORY_POINTS%</span> - <?php _e('The amount of points a specific category earned.', 'quiz-master-next'); ?>
100
  </div>
101
  <div class="template_variable">
102
- <spane class="template_name">%AVERAGE_CATEGORY_POINTS%%/AVERAGE_CATEGORY_POINTS%</span> - <?php _e('The average amount of points a specific category earned.', 'quiz-master-next'); ?>
103
  </div>
104
  <div class="template_variable">
105
- <span class="template_name">%CATEGORY_SCORE%%/CATEGORY_SCORE%</span> - <?php _e('The score a specific category earned.', 'quiz-master-next'); ?>
106
  </div>
107
  <div class="template_variable">
108
  <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
96
  <span class="template_name">%TIMER_MINUTES%</span> - <?php _e('The amount of time user spent on quiz in minutes', 'quiz-master-next'); ?>
97
  </div>
98
  <div class="template_variable">
99
+ <span class="template_name">%CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The amount of points a specific category earned.', 'quiz-master-next'); ?>
100
  </div>
101
  <div class="template_variable">
102
+ <span class="template_name">%AVERAGE_CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The average amount of points a specific category earned.', 'quiz-master-next'); ?>
103
  </div>
104
  <div class="template_variable">
105
+ <span class="template_name">%CATEGORY_SCORE_X%</span> - <?php _e('X: Category name - The score a specific category earned.', 'quiz-master-next'); ?>
106
  </div>
107
  <div class="template_variable">
108
  <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
php/admin/options-page-questions-tab.php CHANGED
@@ -107,7 +107,7 @@ function qsm_options_questions_tab_content() {
107
  <div id="question-bank"></div>
108
  </main>
109
  <footer class="qsm-popup__footer">
110
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window">Cancel</button>
111
  </footer>
112
  </div>
113
  </div>
@@ -191,6 +191,10 @@ function qsm_options_questions_tab_content() {
191
  <option value="1"><?php _e( 'Yes', 'quiz-master-next' ); ?></option>
192
  </select>
193
  </div>
 
 
 
 
194
  </div>
195
  </main>
196
  <footer class="qsm-popup__footer">
@@ -233,9 +237,10 @@ function qsm_options_questions_tab_content() {
233
 
234
  <!-- View for question in question bank -->
235
  <script type="text/template" id="tmpl-single-question-bank-question">
236
- <div class="question-bank-question" data-question-id="{{data.id}}">
237
- <div><a href="#" class="import-button button">Add This Question</a></div>
238
- <div><p>{{{data.question}}}</p></div>
 
239
  </div>
240
  </script>
241
 
@@ -319,4 +324,32 @@ function qsm_load_all_quiz_questions_ajax() {
319
  wp_die();
320
  }
321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  ?>
107
  <div id="question-bank"></div>
108
  </main>
109
  <footer class="qsm-popup__footer">
110
+ <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window">Close</button>
111
  </footer>
112
  </div>
113
  </div>
191
  <option value="1"><?php _e( 'Yes', 'quiz-master-next' ); ?></option>
192
  </select>
193
  </div>
194
+ <div id="required_area" class="qsm-row">
195
+ <label><?php _e( 'Limit Text( Works for text fields )', 'quiz-master-next' ); ?></label>
196
+ <input type="number" name="limit_text" value="" id="limit_text"/>
197
+ </div>
198
  </div>
199
  </main>
200
  <footer class="qsm-popup__footer">
237
 
238
  <!-- View for question in question bank -->
239
  <script type="text/template" id="tmpl-single-question-bank-question">
240
+ <div class="question-bank-question" data-question-id="{{data.id}}" data-category-name="{{data.category}}">
241
+ <div><p>{{{data.question}}}</p><p style="font-size: 12px;color: gray;font-style: italic;"><b>Quiz Name:</b> {{data.quiz_name}} <# if ( data.category != '' ) { #> <b>Category:</b> {{data.category}} <# } #></p>
242
+ </div>
243
+ <div><a href="#" class="import-button button">Add Question</a></div>
244
  </div>
245
  </script>
246
 
324
  wp_die();
325
  }
326
 
327
+ add_action( 'wp_ajax_qsm_send_data_sendy', 'qsm_send_data_sendy' );
328
+ add_action( 'wp_ajax_nopriv_qsm_send_data_sendy', 'qsm_send_data_sendy' );
329
+
330
+ /**
331
+ * @version 6.3.2
332
+ * Send data to sendy
333
+ */
334
+ function qsm_send_data_sendy(){
335
+ $sendy_url = 'http://sendy.expresstech.io';
336
+ $list = '4v8zvoyXyTHSS80jeavOpg';
337
+ $name = sanitize_text_field($_POST['name']);
338
+ $email = sanitize_email($_POST['email']);
339
+
340
+ //subscribe
341
+ $postdata = http_build_query(
342
+ array(
343
+ 'name' => $name,
344
+ 'email' => $email,
345
+ 'list' => $list,
346
+ 'boolean' => 'true'
347
+ )
348
+ );
349
+ $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
350
+ $context = stream_context_create($opts);
351
+ $result = file_get_contents($sendy_url.'/subscribe', false, $context);
352
+ echo $result;
353
+ exit;
354
+ }
355
  ?>
php/admin/options-page-results-page-tab.php CHANGED
@@ -94,13 +94,13 @@ function qsm_options_results_tab_content() {
94
  <span class="template_name">%TIMER%</span> - <?php _e('The amount of time user spent taking quiz in seconds', 'quiz-master-next'); ?>
95
  </div>
96
  <div class="template_variable">
97
- <span class="template_name">%CATEGORY_POINTS%%/CATEGORY_POINTS%</span> - <?php _e('The amount of points a specific category earned.', 'quiz-master-next'); ?>
98
  </div>
99
  <div class="template_variable">
100
- <spane class="template_name">%AVERAGE_CATEGORY_POINTS%%/AVERAGE_CATEGORY_POINTS%</span> - <?php _e('The average amount of points a specific category earned.', 'quiz-master-next'); ?>
101
  </div>
102
  <div class="template_variable">
103
- <span class="template_name">%CATEGORY_SCORE%%/CATEGORY_SCORE%</span> - <?php _e('The score a specific category earned.', 'quiz-master-next'); ?>
104
  </div>
105
  <div class="template_variable">
106
  <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
@@ -117,6 +117,9 @@ function qsm_options_results_tab_content() {
117
  <div class="template_variable">
118
  <span class="template_name">%POLL_RESULTS_X%</span> - <?php _e('X = Question ID Note: only supported for multiple choice answers', 'quiz-master-next'); ?>
119
  </div>
 
 
 
120
  <?php do_action('qmn_template_variable_list'); ?>
121
  </div>
122
  <div style="clear:both;"></div>
@@ -126,9 +129,11 @@ function qsm_options_results_tab_content() {
126
  <section>
127
  <h3>Your Pages</h3>
128
  <button class="save-pages button-primary"><?php esc_html_e( 'Save Results Pages', 'quiz-master-next' ); ?></button>
 
129
  <button class="add-new-page button"><?php esc_html_e( 'Add New Results Page', 'quiz-master-next' ); ?></button>
130
  <div id="results-pages"></div>
131
  <button class="save-pages button-primary"><?php esc_html_e( 'Save Results Pages', 'quiz-master-next' ); ?></button>
 
132
  <button class="add-new-page button"><?php esc_html_e( 'Add New Results Page', 'quiz-master-next' ); ?></button>
133
  </section>
134
 
94
  <span class="template_name">%TIMER%</span> - <?php _e('The amount of time user spent taking quiz in seconds', 'quiz-master-next'); ?>
95
  </div>
96
  <div class="template_variable">
97
+ <span class="template_name">%CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The amount of points a specific category earned.', 'quiz-master-next'); ?>
98
  </div>
99
  <div class="template_variable">
100
+ <span class="template_name">%AVERAGE_CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The average amount of points a specific category earned.', 'quiz-master-next'); ?>
101
  </div>
102
  <div class="template_variable">
103
+ <span class="template_name">%CATEGORY_SCORE_X%</span> - <?php _e('X: Category name - The score a specific category earned.', 'quiz-master-next'); ?>
104
  </div>
105
  <div class="template_variable">
106
  <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
117
  <div class="template_variable">
118
  <span class="template_name">%POLL_RESULTS_X%</span> - <?php _e('X = Question ID Note: only supported for multiple choice answers', 'quiz-master-next'); ?>
119
  </div>
120
+ <div class="template_variable">
121
+ <span class="template_name">%RESULT_ID%</span> - <?php _e('Show result id', 'quiz-master-next'); ?>
122
+ </div>
123
  <?php do_action('qmn_template_variable_list'); ?>
124
  </div>
125
  <div style="clear:both;"></div>
129
  <section>
130
  <h3>Your Pages</h3>
131
  <button class="save-pages button-primary"><?php esc_html_e( 'Save Results Pages', 'quiz-master-next' ); ?></button>
132
+ <span class="spinner" style="float: none;"></span>
133
  <button class="add-new-page button"><?php esc_html_e( 'Add New Results Page', 'quiz-master-next' ); ?></button>
134
  <div id="results-pages"></div>
135
  <button class="save-pages button-primary"><?php esc_html_e( 'Save Results Pages', 'quiz-master-next' ); ?></button>
136
+ <span class="spinner" style="float: none;"></span>
137
  <button class="add-new-page button"><?php esc_html_e( 'Add New Results Page', 'quiz-master-next' ); ?></button>
138
  </section>
139
 
php/admin/options-page-text-tab.php CHANGED
@@ -69,10 +69,10 @@ function mlw_options_text_tab_content() {
69
  <span class="template_name">%TIMER_MINUTES%</span> - <?php _e('The amount of time user spent on quiz in minutes', 'quiz-master-next'); ?>
70
  </div>
71
  <div class="template_variable">
72
- <span class="template_name">%CATEGORY_POINTS%%/CATEGORY_POINTS%</span> - <?php _e('The amount of points a specific category earned.', 'quiz-master-next'); ?>
73
  </div>
74
  <div class="template_variable">
75
- <span class="template_name">%CATEGORY_SCORE%%/CATEGORY_SCORE%</span> - <?php _e('The score a specific category earned.', 'quiz-master-next'); ?>
76
  </div>
77
  <div class="template_variable">
78
  <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
69
  <span class="template_name">%TIMER_MINUTES%</span> - <?php _e('The amount of time user spent on quiz in minutes', 'quiz-master-next'); ?>
70
  </div>
71
  <div class="template_variable">
72
+ <span class="template_name">%CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The amount of points a specific category earned.', 'quiz-master-next'); ?>
73
  </div>
74
  <div class="template_variable">
75
+ <span class="template_name">%CATEGORY_SCORE_X%</span> - <?php _e('X: Category name - The score a specific category earned.', 'quiz-master-next'); ?>
76
  </div>
77
  <div class="template_variable">
78
  <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
php/admin/quizzes-page.php CHANGED
@@ -190,26 +190,36 @@ function qsm_generate_quizzes_surveys_page() {
190
  <p>Easily monitor your WordPress sites to ensure they stay up, healthy, and secure with our new WordPress plugin, WP Health!</p>
191
  <a target="_blank" href="http://bit.ly/2Mr2SqC" class="button-primary"><?php esc_html_e( 'Learn More', 'quiz-master-next' ); ?></a>
192
  </div>-->
 
 
 
 
193
  <div class="qsm-info-widget">
194
- <h3><?php esc_html_e( 'Subscribe to our newsletter!', 'quiz-master-next' ); ?></h3>
195
- <p><?php esc_html_e( 'Join our mailing list to learn about our newest features, receive email-only promotions, receive tips and guides, and more!', 'quiz-master-next' ); ?></p>
196
- <a target="_blank" href="http://quizandsurveymaster.com/subscribe-to-our-newsletter/?utm_source=qsm-quizzes-page&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=subscribe-to-newsletter" class="button-primary"><?php _e( 'Subscribe Now', 'quiz-master-next' ); ?></a>
197
  </div>
198
  <?php
 
199
  $qmn_rss = array();
200
- $qmn_feed = fetch_feed( 'https://quizandsurveymaster.com/feed' );
201
- if ( ! is_wp_error( $qmn_feed ) ) {
202
- $qmn_feed_items = $qmn_feed->get_items( 0, 5 );
203
- foreach ( $qmn_feed_items as $feed_item ) {
204
- $qmn_rss[] = array(
205
- 'link' => $feed_item->get_link(),
206
- 'title' => $feed_item->get_title(),
207
- 'description' => $feed_item->get_description(),
208
- 'date' => $feed_item->get_date( 'F j Y' ),
209
- 'author' => $feed_item->get_author()->get_name(),
210
- );
211
- }
212
- }
 
 
 
 
 
213
  foreach ( $qmn_rss as $item ) {
214
  ?>
215
  <div class="qsm-info-widget">
190
  <p>Easily monitor your WordPress sites to ensure they stay up, healthy, and secure with our new WordPress plugin, WP Health!</p>
191
  <a target="_blank" href="http://bit.ly/2Mr2SqC" class="button-primary"><?php esc_html_e( 'Learn More', 'quiz-master-next' ); ?></a>
192
  </div>-->
193
+ <?php
194
+ $xml = qsm_fetch_data_from_xml();
195
+ if(isset($xml->qsm_news)){
196
+ ?>
197
  <div class="qsm-info-widget">
198
+ <h3><?php echo $xml->qsm_news->title; ?></h3>
199
+ <p><?php echo $xml->qsm_news->desc; ?></p>
200
+ <a target="_blank" href="<?php echo $xml->qsm_news->link; ?>?utm_source=qsm-quizzes-page&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=subscribe-to-newsletter" class="button-primary"><?php _e( 'Subscribe Now', 'quiz-master-next' ); ?></a>
201
  </div>
202
  <?php
203
+ }
204
  $qmn_rss = array();
205
+ if( false === get_transient('qsm_sidebar_feed_data') ){
206
+ $qmn_feed = fetch_feed( 'https://quizandsurveymaster.com/feed' );
207
+ if ( ! is_wp_error( $qmn_feed ) ) {
208
+ $qmn_feed_items = $qmn_feed->get_items( 0, 5 );
209
+ foreach ( $qmn_feed_items as $feed_item ) {
210
+ $qmn_rss[] = array(
211
+ 'link' => $feed_item->get_link(),
212
+ 'title' => $feed_item->get_title(),
213
+ 'description' => $feed_item->get_description(),
214
+ 'date' => $feed_item->get_date( 'F j Y' ),
215
+ 'author' => $feed_item->get_author()->get_name(),
216
+ );
217
+ }
218
+ }
219
+ set_transient( 'qsm_sidebar_feed_data', $qmn_rss, 60*60*24 );
220
+ }else{
221
+ $qmn_rss = get_transient('qsm_sidebar_feed_data');
222
+ }
223
  foreach ( $qmn_rss as $item ) {
224
  ?>
225
  <div class="qsm-info-widget">
php/adverts-generate.php CHANGED
@@ -23,30 +23,24 @@ function qsm_show_adverts() {
23
 
24
  global $mlwQuizMasterNext;
25
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
26
-
27
- $ad_text = '';
28
- $rand_int = rand( 0, 3 );
29
- switch ( $rand_int ) {
30
- case 0:
31
- // WP Health.
32
- // $ad_text = 'New content for ad.';
33
- // break;
34
- case 1:
35
- // Continued development 1.
36
- $ad_text = 'Are you finding this plugin very beneficial? Please consider checking out our premium addons which help support continued development of this plugin. Visit our <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-plugin-ads&utm_medium=plugin&utm_content=continued-development-1&utm_campaign=qsm_plugin">Addon Store</a> for details!';
37
- break;
38
- case 2:
39
- // Reporting and anaylsis 1.
40
- $ad_text = 'Are you receiving a lot of responses to your quizzes and surveys? Consider our Reporting and Anaylsis addon which analyzes the data for you and allows you to filter the data as well as export it! <a href="http://quizandsurveymaster.com/downloads/results-analysis/?utm_source=qsm-plugin-ads&utm_medium=plugin&utm_content=reporting-analysis-1&utm_campaign=qsm_plugin">Click here for more details!</a>';
41
- break;
42
- case 3:
43
- // Email marketing integrations.
44
- $ad_text = 'Want to grow your email list? Check out our addons for adding your quiz or survey takers to your email lists! <a href="http://bit.ly/2Bsw0Je" target="_blank">View our addon store</a>.';
45
- break;
46
- default:
47
- // Reporting and anaylsis 2.
48
- $ad_text = 'Are you receiving a lot of responses to your quizzes and surveys? Consider our Reporting and Anaylsis addon which analyzes the data for you, graphs the data, allows you to filter the data, and export the data! <a href="http://quizandsurveymaster.com/downloads/results-analysis/?utm_source=qsm-plugin-ads&utm_medium=plugin&utm_content=reporting-analysis-2&utm_campaign=qsm_plugin">Click here for more details!</a>';
49
- }
50
  ?>
51
  <div class="help-decide">
52
  <p><?php echo $ad_text . ' <a class="remove-adv-button" target="_blank" href="https://quizandsurveymaster.com/downloads/advertisement-gone/"><span class="dashicons dashicons-no-alt"></span> Remove Ads</a>'; ?></p>
23
 
24
  global $mlwQuizMasterNext;
25
  wp_enqueue_style( 'qsm_admin_style', plugins_url( '../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
26
+
27
+ if( false === get_transient('qsm_ads_data') ){
28
+ $xml = qsm_fetch_data_from_xml();
29
+ if(isset($xml->qsm_ads)){
30
+ $all_ads = $xml->qsm_ads;
31
+ $json_ads = json_encode($all_ads);
32
+ $all_ads = $array_into_ads = json_decode($json_ads,TRUE);
33
+ set_transient( 'qsm_ads_data', $array_into_ads, 60*60*24 );
34
+ }
35
+ }else{
36
+ $all_ads = get_transient('qsm_ads_data');
37
+ }
38
+ $count_ads = count($all_ads['ads']);
39
+ $ad_text = '';
40
+ $rand_int = rand( 0, $count_ads - 1 );
41
+ $link = '<a target="_blank" href="'. $all_ads['ads'][$rand_int]['link'] .'">'. $all_ads['ads'][$rand_int]['link_text'] .'</a>';
42
+ $link = str_replace('#38', '&', $link);
43
+ $ad_text = str_replace('[link]', $link, $all_ads['ads'][$rand_int]['text']);
 
 
 
 
 
 
44
  ?>
45
  <div class="help-decide">
46
  <p><?php echo $ad_text . ' <a class="remove-adv-button" target="_blank" href="https://quizandsurveymaster.com/downloads/advertisement-gone/"><span class="dashicons dashicons-no-alt"></span> Remove Ads</a>'; ?></p>
php/classes/class-qmn-plugin-helper.php CHANGED
@@ -380,6 +380,9 @@ class QMNPluginHelper {
380
  $display .= "<span class='mlw_qmn_question_number'>$qmn_total_questions. </span>";
381
  }
382
  }
 
 
 
383
  $display .= call_user_func($type['display'], intval($question_id), $question->question_name, $answers);
384
  }
385
  }
380
  $display .= "<span class='mlw_qmn_question_number'>$qmn_total_questions. </span>";
381
  }
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-manager.php CHANGED
@@ -39,8 +39,36 @@ class QMNQuizManager {
39
  public function add_hooks() {
40
  add_shortcode('mlw_quizmaster', array($this, 'display_shortcode'));
41
  add_shortcode('qsm', array($this, 'display_shortcode'));
 
42
  add_action('wp_ajax_qmn_process_quiz', array($this, 'ajax_submit_results'));
43
  add_action('wp_ajax_nopriv_qmn_process_quiz', array($this, 'ajax_submit_results'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
 
46
  /**
@@ -148,6 +176,41 @@ class QMNQuizManager {
148
  $return_display = apply_filters('qmn_end_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
149
  return $return_display;
150
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  /**
153
  * Loads Questions
@@ -302,7 +365,7 @@ class QMNQuizManager {
302
 
303
  wp_enqueue_script('progress-bar', plugins_url('../../js/progressbar.min.js', __FILE__));
304
  wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
305
- wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php')));
306
  wp_enqueue_script('math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML');
307
 
308
  global $qmn_total_questions;
@@ -334,7 +397,7 @@ class QMNQuizManager {
334
  /* Restore original Post Data */
335
  wp_reset_postdata();
336
  }
337
- $quiz_display .= apply_filters('qsm_display_before_form', $quiz_display);
338
  $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 >";
339
  $quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
340
  $quiz_display .= "<span id='mlw_top_of_quiz'></span>";
@@ -429,7 +492,7 @@ class QMNQuizManager {
429
  }
430
  foreach ($pages[0] as $question_id) {
431
  $question_list .= $question_id . 'Q';
432
- $question = $questions[$question_id];
433
  ?>
434
  <div class='quiz_section question-section-id-<?php echo esc_attr($question_id); ?>'>
435
  <?php
@@ -743,6 +806,16 @@ class QMNQuizManager {
743
  echo json_encode($this->submit_results($options, $data));
744
  die();
745
  }
 
 
 
 
 
 
 
 
 
 
746
 
747
  /**
748
  * Perform The Quiz/Survey Submission
@@ -814,7 +887,10 @@ class QMNQuizManager {
814
 
815
  $result_display .= $this->display_social($qmn_quiz_options, $qmn_array_for_variables);
816
  $result_display = apply_filters('qmn_after_social_media', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
817
-
 
 
 
818
  // If the store responses in database option is set to Yes.
819
  if (0 != $qmn_quiz_options->store_responses) {
820
 
39
  public function add_hooks() {
40
  add_shortcode('mlw_quizmaster', array($this, 'display_shortcode'));
41
  add_shortcode('qsm', array($this, 'display_shortcode'));
42
+ add_shortcode('qsm_result', array($this, 'shortcode_display_result'));
43
  add_action('wp_ajax_qmn_process_quiz', array($this, 'ajax_submit_results'));
44
  add_action('wp_ajax_nopriv_qmn_process_quiz', array($this, 'ajax_submit_results'));
45
+ add_action('wp_ajax_qsm_get_quiz_to_reload', array($this, 'qsm_get_quiz_to_reload'));
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
54
+ */
55
+ public function qsm_get_question_quick_result(){
56
+ global $wpdb;
57
+ $question_id = isset($_POST['question_id']) ? $_POST['question_id'] : 0;
58
+ $answer = isset($_POST['answer']) ? $_POST['answer'] : '';
59
+ $question_array = $wpdb->get_row( "SELECT answer_array FROM {$wpdb->prefix}mlw_questions WHERE question_id = ($question_id)", 'ARRAY_A' );
60
+ $answer_array = unserialize($question_array['answer_array']);
61
+ $got_ans = false;
62
+ if($answer_array && $got_ans === false){
63
+ foreach ($answer_array as $key => $value) {
64
+ if($value[0] == $answer && $value[2] == 1){
65
+ $got_ans = true;
66
+ break;
67
+ }
68
+ }
69
+ }
70
+ echo $got_ans ? 'correct' : 'incorrect';
71
+ exit;
72
  }
73
 
74
  /**
176
  $return_display = apply_filters('qmn_end_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
177
  return $return_display;
178
  }
179
+
180
+ public function shortcode_display_result($atts){
181
+ extract(shortcode_atts(array(
182
+ 'id' => 0,
183
+ ), $atts));
184
+ ob_start();
185
+ global $wpdb;
186
+ $result_data = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = {$id}", ARRAY_A);
187
+ $quiz_result = unserialize($result_data['quiz_results']);
188
+ $response_data = array(
189
+ 'quiz_id' => $result_data['quiz_id'],
190
+ 'quiz_name' => $result_data['quiz_name'],
191
+ 'quiz_system' => $result_data['quiz_system'],
192
+ 'quiz_payment_id' => '',
193
+ 'user_ip' => $result_data['user_ip'],
194
+ 'user_name' => $result_data['name'],
195
+ 'user_business' => $result_data['business'],
196
+ 'user_email' => $result_data['email'],
197
+ 'user_phone' => $result_data['phone'],
198
+ 'user_id' => $result_data['user'],
199
+ 'timer' => 0,
200
+ 'time_taken' => $result_data['time_taken'],
201
+ 'contact' => $quiz_result['contact'],
202
+ 'total_points' => $result_data['point_score'],
203
+ 'total_score' => $result_data['correct_score'],
204
+ 'total_correct' => $result_data['correct'],
205
+ 'total_questions' => $result_data['total'],
206
+ 'question_answers_array' => $quiz_result[1],
207
+ 'comments' => ''
208
+ );
209
+ $data = QSM_Results_Pages::generate_pages($response_data);
210
+ echo htmlspecialchars_decode($data['display']);
211
+ $content = ob_get_clean();
212
+ return $content;
213
+ }
214
 
215
  /**
216
  * Loads Questions
365
 
366
  wp_enqueue_script('progress-bar', plugins_url('../../js/progressbar.min.js', __FILE__));
367
  wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
368
+ 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 : ''));
369
  wp_enqueue_script('math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML');
370
 
371
  global $qmn_total_questions;
397
  /* Restore original Post Data */
398
  wp_reset_postdata();
399
  }
400
+ $quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
401
  $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 >";
402
  $quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
403
  $quiz_display .= "<span id='mlw_top_of_quiz'></span>";
492
  }
493
  foreach ($pages[0] as $question_id) {
494
  $question_list .= $question_id . 'Q';
495
+ $question = $questions[$question_id];
496
  ?>
497
  <div class='quiz_section question-section-id-<?php echo esc_attr($question_id); ?>'>
498
  <?php
806
  echo json_encode($this->submit_results($options, $data));
807
  die();
808
  }
809
+
810
+ /**
811
+ * @version 6.3.2
812
+ * Show quiz on button click
813
+ */
814
+ public function qsm_get_quiz_to_reload(){
815
+ $quiz_id = $_POST['quiz_id'];
816
+ echo do_shortcode('[qsm quiz="'. $quiz_id .'"]');
817
+ exit;
818
+ }
819
 
820
  /**
821
  * Perform The Quiz/Survey Submission
887
 
888
  $result_display .= $this->display_social($qmn_quiz_options, $qmn_array_for_variables);
889
  $result_display = apply_filters('qmn_after_social_media', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
890
+
891
+ if ( is_plugin_active( 'qsm-save-resume/qsm-save-resume.php' ) != 1 ) {
892
+ $result_display .= '<a style="float: right;" class="button btn-reload-quiz" data-quiz_id="'. $qmn_array_for_variables['quiz_id'] .'" href="#" >Retake Quiz</a>';
893
+ }
894
  // If the store responses in database option is set to Yes.
895
  if (0 != $qmn_quiz_options->store_responses) {
896
 
php/classes/class-qsm-contact-manager.php CHANGED
@@ -61,7 +61,7 @@ class QSM_Contact_Manager {
61
  }
62
  ?>
63
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->name_field_text, ENT_QUOTES ); ?></span>
64
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserName' value='<?php echo esc_attr( $name ); ?>' />
65
  <?php
66
  }
67
 
@@ -73,7 +73,7 @@ class QSM_Contact_Manager {
73
  }
74
  ?>
75
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->business_field_text, ENT_QUOTES ); ?></span>
76
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserComp' value='' />
77
  <?php
78
  }
79
 
@@ -85,7 +85,7 @@ class QSM_Contact_Manager {
85
  }
86
  ?>
87
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->email_field_text, ENT_QUOTES ); ?></span>
88
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='email' class='mlwEmail <?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserEmail' value='<?php echo esc_attr( $email ); ?>' />
89
  <?php
90
  }
91
 
@@ -97,7 +97,7 @@ class QSM_Contact_Manager {
97
  }
98
  ?>
99
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->phone_field_text, ENT_QUOTES ); ?></span>
100
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserPhone' value='' />
101
  <?php
102
  }
103
  } elseif ( ! empty( $fields ) && is_array( $fields ) ) {
@@ -126,7 +126,7 @@ class QSM_Contact_Manager {
126
  }
127
  ?>
128
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
129
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' />
130
  <?php
131
  break;
132
 
@@ -136,7 +136,7 @@ class QSM_Contact_Manager {
136
  }
137
  ?>
138
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
139
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='mlwEmail <?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' />
140
  <?php
141
  break;
142
 
@@ -276,7 +276,7 @@ class QSM_Contact_Manager {
276
  }
277
 
278
  if ( ! is_array( $fields ) || empty( $fields ) ) {
279
- return false;
280
  }
281
 
282
  $quiz_id = intval( $quiz_id );
61
  }
62
  ?>
63
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->name_field_text, ENT_QUOTES ); ?></span>
64
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserName' placeholder="<?php echo htmlspecialchars_decode( $options->name_field_text, ENT_QUOTES ); ?>" value='<?php echo esc_attr( $name ); ?>' />
65
  <?php
66
  }
67
 
73
  }
74
  ?>
75
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->business_field_text, ENT_QUOTES ); ?></span>
76
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserComp' placeholder="<?php echo htmlspecialchars_decode( $options->business_field_text, ENT_QUOTES ); ?>" value='' />
77
  <?php
78
  }
79
 
85
  }
86
  ?>
87
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->email_field_text, ENT_QUOTES ); ?></span>
88
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='email' class='mlwEmail <?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserEmail' placeholder="<?php echo htmlspecialchars_decode( $options->email_field_text, ENT_QUOTES ); ?>" value='<?php echo esc_attr( $email ); ?>' />
89
  <?php
90
  }
91
 
97
  }
98
  ?>
99
  <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->phone_field_text, ENT_QUOTES ); ?></span>
100
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserPhone' placeholder="<?php echo htmlspecialchars_decode( $options->phone_field_text, ENT_QUOTES ); ?>" value='' />
101
  <?php
102
  }
103
  } elseif ( ! empty( $fields ) && is_array( $fields ) ) {
126
  }
127
  ?>
128
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
129
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' placeholder="<?php echo $fields[ $i ]['label']; ?>" />
130
  <?php
131
  break;
132
 
136
  }
137
  ?>
138
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
139
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='mlwEmail <?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' placeholder="<?php echo $fields[ $i ]['label']; ?>" />
140
  <?php
141
  break;
142
 
276
  }
277
 
278
  if ( ! is_array( $fields ) || empty( $fields ) ) {
279
+ //return false;
280
  }
281
 
282
  $quiz_id = intval( $quiz_id );
php/classes/class-qsm-install.php CHANGED
@@ -124,6 +124,25 @@ class QSM_Install {
124
  'default' => 0
125
  );
126
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
  // Registers total_user_tries setting
129
  $field_array = array(
@@ -474,6 +493,44 @@ class QSM_Install {
474
  'default' => 0
475
  );
476
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
 
478
  // Registers message_before setting
479
  $field_array = array(
124
  'default' => 0
125
  );
126
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
127
+
128
+ // Settings for quick result
129
+ $field_array = array(
130
+ 'id' => 'enable_result_after_timer_end',
131
+ 'label' => __('Force submit after timer expiry?', 'quiz-master-next'),
132
+ 'type' => 'radio',
133
+ 'options' => array(
134
+ array(
135
+ 'label' => __('No', 'quiz-master-next'),
136
+ 'value' => 0
137
+ ),
138
+ array(
139
+ 'label' => __('Yes', 'quiz-master-next'),
140
+ 'value' => 1
141
+ )
142
+ ),
143
+ 'default' => 0
144
+ );
145
+ $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
146
 
147
  // Registers total_user_tries setting
148
  $field_array = array(
493
  'default' => 0
494
  );
495
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
496
+
497
+ // Registers show category on front setting
498
+ $field_array = array(
499
+ 'id' => 'show_category_on_front',
500
+ 'label' => __('Show category on front?', 'quiz-master-next'),
501
+ 'type' => 'radio',
502
+ 'options' => array(
503
+ array(
504
+ 'label' => __('No', 'quiz-master-next'),
505
+ 'value' => 0
506
+ ),
507
+ array(
508
+ 'label' => __('Yes', 'quiz-master-next'),
509
+ 'value' => 1
510
+ )
511
+ ),
512
+ 'default' => 0
513
+ );
514
+ $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
515
+
516
+ // Settings for quick result
517
+ $field_array = array(
518
+ 'id' => 'enable_quick_result_mc',
519
+ 'label' => __('Show live results for questions inline', 'quiz-master-next'),
520
+ 'type' => 'radio',
521
+ 'options' => array(
522
+ array(
523
+ 'label' => __('No', 'quiz-master-next'),
524
+ 'value' => 0
525
+ ),
526
+ array(
527
+ 'label' => __('Yes', 'quiz-master-next'),
528
+ 'value' => 1
529
+ )
530
+ ),
531
+ 'default' => 0
532
+ );
533
+ $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
534
 
535
  // Registers message_before setting
536
  $field_array = array(
php/classes/class-qsm-settings.php CHANGED
@@ -164,7 +164,7 @@ class QSM_Quiz_Settings {
164
 
165
  // Check if setting exists
166
  if ( isset( $this->settings[ $setting ] ) ) {
167
-
168
  // Try to unserialize it and then return it
169
  return maybe_unserialize( $this->settings[ $setting ] );
170
  } else {
164
 
165
  // Check if setting exists
166
  if ( isset( $this->settings[ $setting ] ) ) {
167
+
168
  // Try to unserialize it and then return it
169
  return maybe_unserialize( $this->settings[ $setting ] );
170
  } else {
php/question-types.php CHANGED
@@ -302,10 +302,12 @@ function qmn_small_open_display($id, $question, $answers)
302
  global $mlwQuizMasterNext;
303
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
304
  $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
305
- $autofill_att = $autofill ? "autocomplete='off'" : '';
 
 
306
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
307
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
308
- $question_display .= "<input ". $autofill_att ." type='text' class='mlw_answer_open_text $mlw_requireClass' name='question".$id."' />";
309
  return $question_display;
310
  }
311
 
@@ -889,9 +891,11 @@ function qmn_fill_blank_display($id, $question, $answers)
889
  global $mlwQuizMasterNext;
890
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
891
  $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
892
- $autofill_att = $autofill ? "autocomplete='off'" : '';
 
 
893
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
894
- $input_text = "<input ". $autofill_att ." type='text' class='qmn_fill_blank $mlw_requireClass' name='question".$id."' />";
895
  if (strpos($question, '%BLANK%') !== false)
896
  {
897
  $question = str_replace( "%BLANK%", $input_text, do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
302
  global $mlwQuizMasterNext;
303
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
304
  $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
305
+ $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_text');
306
+ $autofill_att = $autofill ? "autocomplete='off' " : '';
307
+ $limit_text_att = $limit_text ? "maxlength='". $limit_text ."' " : '';
308
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
309
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
310
+ $question_display .= "<input ". $autofill_att . $limit_text_att . " type='text' class='mlw_answer_open_text $mlw_requireClass' name='question".$id."' />";
311
  return $question_display;
312
  }
313
 
891
  global $mlwQuizMasterNext;
892
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
893
  $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
894
+ $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_text');
895
+ $autofill_att = $autofill ? "autocomplete='off' " : '';
896
+ $limit_text_att = $limit_text ? "maxlength='". $limit_text ."' " : '';
897
  if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
898
+ $input_text = "<input ". $autofill_att . $limit_text_att . " type='text' class='qmn_fill_blank $mlw_requireClass' name='question".$id."' />";
899
  if (strpos($question, '%BLANK%') !== false)
900
  {
901
  $question = str_replace( "%BLANK%", $input_text, do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
php/rest-api.php CHANGED
@@ -199,18 +199,20 @@ function qsm_rest_get_question( WP_REST_Request $request ) {
199
  */
200
  function qsm_rest_get_questions( WP_REST_Request $request ) {
201
  // Makes sure user is logged in.
202
- if ( is_user_logged_in() ) {
203
  $current_user = wp_get_current_user();
204
  if ( 0 !== $current_user ) {
205
  $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0;
206
  if ( 0 !== $quiz_id ) {
207
  $questions = QSM_Questions::load_questions_by_pages( $quiz_id );
208
  } else {
209
- $questions = QSM_Questions::load_questions( 0 );
210
  }
211
-
 
212
  $question_array = array();
213
  foreach ( $questions as $question ) {
 
214
  $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
215
  $question_array[] = array(
216
  'id' => $question['question_id'],
@@ -224,10 +226,12 @@ function qsm_rest_get_questions( WP_REST_Request $request ) {
224
  'required' => $question['settings']['required'],
225
  'answers' => $question['answers'],
226
  'page' => $question['page'],
227
- 'answerEditor' => $question['settings']['answerEditor'],
228
- 'autofill' => $question['settings']['autofill'],
 
 
229
  );
230
- }
231
  return $question_array;
232
  }
233
  }
@@ -318,7 +322,8 @@ function qsm_rest_save_question( WP_REST_Request $request ) {
318
  $settings = array(
319
  'required' => $request['required'],
320
  'answerEditor' => $request['answer_editor'],
321
- 'autofill' => $request['autofill']
 
322
  );
323
  $intial_answers = $request['answers'];
324
  $answers = array();
199
  */
200
  function qsm_rest_get_questions( WP_REST_Request $request ) {
201
  // Makes sure user is logged in.
202
+ if ( is_user_logged_in() ) {
203
  $current_user = wp_get_current_user();
204
  if ( 0 !== $current_user ) {
205
  $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0;
206
  if ( 0 !== $quiz_id ) {
207
  $questions = QSM_Questions::load_questions_by_pages( $quiz_id );
208
  } else {
209
+ $questions = QSM_Questions::load_questions( 0 );
210
  }
211
+ global $wpdb;
212
+ $quiz_table = $wpdb->prefix . 'mlw_quizzes';
213
  $question_array = array();
214
  foreach ( $questions as $question ) {
215
+ $quiz_name = $wpdb->get_row('SELECT quiz_name FROM '. $quiz_table . ' WHERE quiz_id = ' . $question['quiz_id'], ARRAY_A );
216
  $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
217
  $question_array[] = array(
218
  'id' => $question['question_id'],
226
  'required' => $question['settings']['required'],
227
  'answers' => $question['answers'],
228
  'page' => $question['page'],
229
+ 'answerEditor' => isset($question['settings']['answerEditor']) ? $question['settings']['answerEditor'] : 'text',
230
+ 'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
231
+ 'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
232
+ 'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
233
  );
234
+ }
235
  return $question_array;
236
  }
237
  }
322
  $settings = array(
323
  'required' => $request['required'],
324
  'answerEditor' => $request['answer_editor'],
325
+ 'autofill' => $request['autofill'],
326
+ 'limit_text' => $request['limit_text'],
327
  );
328
  $intial_answers = $request['answers'];
329
  $answers = array();
php/template-variables.php CHANGED
@@ -57,7 +57,8 @@ add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date',10,
57
  add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date_taken',10,2);
58
  add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_facebook_share',10,2);
59
  add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_twitter_share',10,2);
60
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_poll_result',10,2);
 
61
 
62
  add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
63
  add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_date',10,2);
@@ -68,18 +69,19 @@ add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user
68
  * @param str $content
69
  * @param arr $mlw_quiz_array
70
  */
71
- function qsm_variable_poll_result($content, $mlw_quiz_array){
72
- while ( false !== strpos($content, '%POLL_RESULTS_') ) {
73
- $question_id = mlw_qmn_get_string_between($content, '%POLL_RESULTS_', '%');
74
- $quiz_id = $mlw_quiz_array['quiz_id'];
75
  global $wpdb;
76
  $table_name = $wpdb->prefix . 'mlw_results';
77
  $table_question = $wpdb->prefix . 'mlw_questions';
78
  $total_query = $wpdb->get_row('SELECT count(*) AS total_count FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
79
  $total_result = $total_query['total_count'];
80
  $ser_answer = $wpdb->get_row('SELECT answer_array FROM ' . $table_question . ' WHERE question_id = ' . $question_id,ARRAY_A);
81
- $ser_answer_arry = unserialize($ser_answer['answer_array']);
82
- $total_quiz_results = $wpdb->get_results('SELECT quiz_results FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
 
83
  $answer_array = array();
84
  if($total_quiz_results){
85
  foreach ($total_quiz_results as $key => $value) {
@@ -89,13 +91,13 @@ function qsm_variable_poll_result($content, $mlw_quiz_array){
89
  $answer_array[] = isset($userdb[1][$key]) ? $userdb[1][$key][1] : '';
90
  }
91
  }
92
- }
93
  $vals = array_count_values($answer_array);
94
- $str = '';
95
  if($vals){
96
  $str .= '<h4>Poll Result:</h4>';
97
- foreach ($vals as $answer_str => $answer_count) {
98
- if($answer_str != ''){
99
  $percentage = number_format($answer_count / $total_result * 100,2) ;
100
  $str .= $answer_str . ' : ' . $percentage .'%<br/>';
101
  $str .= '<progress value="'. $percentage .'" max="100">'. $percentage .' %</progress><br/>';
@@ -103,7 +105,7 @@ function qsm_variable_poll_result($content, $mlw_quiz_array){
103
  }
104
  }
105
  $content = str_replace( "%POLL_RESULTS_". $question_id ."%" , $str, $content);
106
- }
107
  return $content;
108
  }
109
 
@@ -116,6 +118,17 @@ function mlw_qmn_get_string_between($string, $start, $end){
116
  return substr($string, $ini, $len);
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
119
  /**
120
  * Adds Facebook sharing link using the %FACEBOOK_SHARE% variable
121
  */
@@ -132,7 +145,8 @@ function qsm_variable_facebook_share( $content, $mlw_quiz_array ) {
132
  $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '' );
133
 
134
  $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
135
- $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."', '$facebook_app_id');\">Facebook</a>";
 
136
  $content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
137
  }
138
  return $content;
@@ -148,13 +162,26 @@ function qsm_variable_twitter_share( $content, $mlw_quiz_array ) {
148
  global $mlwQuizMasterNext;
149
  $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'twitter_sharing_text', '' );
150
  $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
151
-
152
- $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."');\">Twitter</a>";
153
  $content = str_replace( "%TWITTER_SHARE%" , $social_display, $content);
154
  }
155
  return $content;
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  function mlw_qmn_variable_point_score($content, $mlw_quiz_array)
159
  {
160
  $content = str_replace( "%POINT_SCORE%" , $mlw_quiz_array["total_points"], $content);
@@ -347,18 +374,28 @@ function mlw_qmn_variable_date_taken( $content, $results ) {
347
  function qmn_variable_category_points($content, $mlw_quiz_array)
348
  {
349
  $return_points = 0;
350
- while (strpos($content, '%CATEGORY_POINTS%') !== false)
351
  {
352
  $return_points = 0;
353
  preg_match("~%CATEGORY_POINTS%(.*?)%/CATEGORY_POINTS%~i",$content,$answer_text);
 
 
 
 
 
 
354
  foreach ($mlw_quiz_array['question_answers_array'] as $answer)
355
  {
356
- if ($answer["category"] == $answer_text[1])
357
  {
358
  $return_points += $answer["points"];
359
  }
360
  }
361
- $content = str_replace( $answer_text[0] , $return_points, $content);
 
 
 
 
362
  }
363
  return $content;
364
  }
@@ -375,12 +412,17 @@ function qmn_variable_category_points($content, $mlw_quiz_array)
375
  */
376
  function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
377
  $return_points = 0;
378
- while ( strpos( $content, '%AVERAGE_CATEGORY_POINTS%' ) !== false ) {
379
  $return_points = 0;
380
  $total_questions = 0;
381
  preg_match( "~%AVERAGE_CATEGORY_POINTS%(.*?)%/AVERAGE_CATEGORY_POINTS%~i", $content, $answer_text );
 
 
 
 
 
382
  foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
383
- if ( $answer["category"] == $answer_text[1] ) {
384
  $total_questions += 1;
385
  $return_points += $answer["points"];
386
  }
@@ -390,7 +432,11 @@ function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
390
  } else {
391
  $return_points = 0;
392
  }
393
- $content = str_replace( $answer_text[0], $return_points, $content );
 
 
 
 
394
  }
395
  return $content;
396
  }
@@ -410,15 +456,20 @@ function qmn_variable_category_score($content, $mlw_quiz_array)
410
  $return_score = 0;
411
  $total_questions = 0;
412
  $amount_correct = 0;
413
- while (strpos($content, '%CATEGORY_SCORE%') !== false)
414
- {
415
  $return_score = 0;
416
  $total_questions = 0;
417
  $amount_correct = 0;
418
  preg_match("~%CATEGORY_SCORE%(.*?)%/CATEGORY_SCORE%~i",$content,$answer_text);
 
 
 
 
 
419
  foreach ($mlw_quiz_array['question_answers_array'] as $answer)
420
  {
421
- if ($answer["category"] == $answer_text[1])
422
  {
423
  $total_questions += 1;
424
  if ($answer["correct"] == 'correct')
@@ -435,8 +486,13 @@ function qmn_variable_category_score($content, $mlw_quiz_array)
435
  {
436
  $return_score = 0;
437
  }
438
-
439
- $content = str_replace( $answer_text[0] , $return_score, $content);
 
 
 
 
 
440
  }
441
  return $content;
442
  }
57
  add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date_taken',10,2);
58
  add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_facebook_share',10,2);
59
  add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_twitter_share',10,2);
60
+ add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_result_id',10,2);
61
+ add_filter('qmn_end_results', 'qsm_variable_poll_result',10,3);
62
 
63
  add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
64
  add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_date',10,2);
69
  * @param str $content
70
  * @param arr $mlw_quiz_array
71
  */
72
+ function qsm_variable_poll_result($content, $mlw_quiz_array, $variables){
73
+ $quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
74
+ while ( false !== strpos($content, '%POLL_RESULTS_') ) {
75
+ $question_id = mlw_qmn_get_string_between($content, '%POLL_RESULTS_', '%');
76
  global $wpdb;
77
  $table_name = $wpdb->prefix . 'mlw_results';
78
  $table_question = $wpdb->prefix . 'mlw_questions';
79
  $total_query = $wpdb->get_row('SELECT count(*) AS total_count FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
80
  $total_result = $total_query['total_count'];
81
  $ser_answer = $wpdb->get_row('SELECT answer_array FROM ' . $table_question . ' WHERE question_id = ' . $question_id,ARRAY_A);
82
+ $ser_answer_arry = unserialize($ser_answer['answer_array']);
83
+ $ser_answer_arry_change = array_filter(array_merge(array(0), $ser_answer_arry));
84
+ $total_quiz_results = $wpdb->get_results('SELECT quiz_results FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
85
  $answer_array = array();
86
  if($total_quiz_results){
87
  foreach ($total_quiz_results as $key => $value) {
91
  $answer_array[] = isset($userdb[1][$key]) ? $userdb[1][$key][1] : '';
92
  }
93
  }
94
+ }
95
  $vals = array_count_values($answer_array);
96
+ $str = '';
97
  if($vals){
98
  $str .= '<h4>Poll Result:</h4>';
99
+ foreach ($vals as $answer_str => $answer_count) {
100
+ if($answer_str != '' && qsm_find_key_from_array($answer_str, $ser_answer_arry_change)){
101
  $percentage = number_format($answer_count / $total_result * 100,2) ;
102
  $str .= $answer_str . ' : ' . $percentage .'%<br/>';
103
  $str .= '<progress value="'. $percentage .'" max="100">'. $percentage .' %</progress><br/>';
105
  }
106
  }
107
  $content = str_replace( "%POLL_RESULTS_". $question_id ."%" , $str, $content);
108
+ }
109
  return $content;
110
  }
111
 
118
  return substr($string, $ini, $len);
119
  }
120
 
121
+ function qsm_find_key_from_array($search_value,$array){
122
+ if($array){
123
+ foreach ($array as $key => $value) {
124
+ if($value[0] == $search_value){
125
+ return true;
126
+ }
127
+ }
128
+ }
129
+ return false;
130
+ }
131
+
132
  /**
133
  * Adds Facebook sharing link using the %FACEBOOK_SHARE% variable
134
  */
145
  $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '' );
146
 
147
  $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
148
+ $fb_image = plugins_url('', dirname(__FILE__) ) . '/assets/facebook.png';
149
+ $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."', '$facebook_app_id');\"><img src='". $fb_image ."' alt='Facebbok Share' /></a>";
150
  $content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
151
  }
152
  return $content;
162
  global $mlwQuizMasterNext;
163
  $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'twitter_sharing_text', '' );
164
  $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
165
+ $tw_image = plugins_url('', dirname(__FILE__) ) . '/assets/twitter.png';
166
+ $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."');\"><img src='". $tw_image ."' alt='Twitter Share' /></a>";
167
  $content = str_replace( "%TWITTER_SHARE%" , $social_display, $content);
168
  }
169
  return $content;
170
  }
171
 
172
+ /**
173
+ * Adds result id using the %RESULT_ID% variable
174
+ */
175
+ function qsm_variable_result_id( $content, $mlw_quiz_array ) {
176
+ while ( false !== strpos($content, '%RESULT_ID%') ) {
177
+ global $wpdb;
178
+ $table_name = $wpdb->prefix . 'mlw_results';
179
+ $get_last_id = $wpdb->get_row("SELECT result_id FROM $table_name ORDER BY result_id DESC",ARRAY_A);
180
+ $content = str_replace( "%RESULT_ID%" , $get_last_id['result_id'], $content);
181
+ }
182
+ return $content;
183
+ }
184
+
185
  function mlw_qmn_variable_point_score($content, $mlw_quiz_array)
186
  {
187
  $content = str_replace( "%POINT_SCORE%" , $mlw_quiz_array["total_points"], $content);
374
  function qmn_variable_category_points($content, $mlw_quiz_array)
375
  {
376
  $return_points = 0;
377
+ while (strpos($content, '%CATEGORY_POINTS%') !== false || false !== strpos($content, '%CATEGORY_POINTS_'))
378
  {
379
  $return_points = 0;
380
  preg_match("~%CATEGORY_POINTS%(.*?)%/CATEGORY_POINTS%~i",$content,$answer_text);
381
+ if(empty($answer_text)){
382
+ $category_name = mlw_qmn_get_string_between($content, '%CATEGORY_POINTS_', '%');
383
+ }else{
384
+ $category_name = $answer_text[1];
385
+ }
386
+
387
  foreach ($mlw_quiz_array['question_answers_array'] as $answer)
388
  {
389
+ if ($answer["category"] == $category_name)
390
  {
391
  $return_points += $answer["points"];
392
  }
393
  }
394
+ if(empty($answer_text)){
395
+ $content = str_replace( '%CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
396
+ }else{
397
+ $content = str_replace( $answer_text[0] , $return_points, $content);
398
+ }
399
  }
400
  return $content;
401
  }
412
  */
413
  function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
414
  $return_points = 0;
415
+ while ( strpos( $content, '%AVERAGE_CATEGORY_POINTS%' ) !== false || false !== strpos($content, '%AVERAGE_CATEGORY_POINTS_') ) {
416
  $return_points = 0;
417
  $total_questions = 0;
418
  preg_match( "~%AVERAGE_CATEGORY_POINTS%(.*?)%/AVERAGE_CATEGORY_POINTS%~i", $content, $answer_text );
419
+ if(empty($answer_text)){
420
+ $category_name = mlw_qmn_get_string_between($content, '%AVERAGE_CATEGORY_POINTS_', '%');
421
+ }else{
422
+ $category_name = $answer_text[1];
423
+ }
424
  foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
425
+ if ( $answer["category"] == $category_name ) {
426
  $total_questions += 1;
427
  $return_points += $answer["points"];
428
  }
432
  } else {
433
  $return_points = 0;
434
  }
435
+ if(empty($answer_text)){
436
+ $content = str_replace( '%AVERAGE_CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
437
+ }else{
438
+ $content = str_replace( $answer_text[0] , $return_points, $content);
439
+ }
440
  }
441
  return $content;
442
  }
456
  $return_score = 0;
457
  $total_questions = 0;
458
  $amount_correct = 0;
459
+ while (strpos($content, '%CATEGORY_SCORE%') !== false || false !== strpos($content, '%CATEGORY_SCORE_'))
460
+ {
461
  $return_score = 0;
462
  $total_questions = 0;
463
  $amount_correct = 0;
464
  preg_match("~%CATEGORY_SCORE%(.*?)%/CATEGORY_SCORE%~i",$content,$answer_text);
465
+ if(empty($answer_text)){
466
+ $category_name = mlw_qmn_get_string_between($content, '%CATEGORY_SCORE_', '%');
467
+ }else{
468
+ $category_name = $answer_text[1];
469
+ }
470
  foreach ($mlw_quiz_array['question_answers_array'] as $answer)
471
  {
472
+ if ($answer["category"] == $category_name)
473
  {
474
  $total_questions += 1;
475
  if ($answer["correct"] == 'correct')
486
  {
487
  $return_score = 0;
488
  }
489
+
490
+ if(empty($answer_text)){
491
+ $content = str_replace( '%CATEGORY_SCORE_'.$category_name.'%' , $return_score, $content);
492
+ }else{
493
+ $content = str_replace( $answer_text[0] , $return_score, $content);
494
+ }
495
+
496
  }
497
  return $content;
498
  }
readme.txt CHANGED
@@ -1,17 +1,19 @@
1
- === Quiz And Survey Master - Best Quiz Plugin for WordPress ===
2
  Contributors: quizsurvey
3
- Tags: quiz, survey, lead, test, score, exam, questionnaire, question
4
  Requires at least: 4.9
5
- Tested up to: 5.2
6
  Requires PHP: 5.4
7
- Stable tag: 6.3.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Native quiz and surveys for your WordPress site. Easily and quickly add unlimited quizzes and surveys to your website. Customizable and professional quizzes are now at your finger tips.
12
 
13
  == Description ==
14
 
 
 
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
 
@@ -111,6 +113,19 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  = 6.3.1 (May 19, 2019) =
115
  * Closed Bug: Duplicate post issue ([Issue #758](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/758))
116
  * Closed Enhancement: Option to turn off autofill ([WP Issue](https://wordpress.org/support/topic/can-you-add-an-option-to-turn-off-autofill-on-galaxy-phones-and-other-devices/))
1
+ === Quiz And Survey Master - Quiz Plugin for WordPress ===
2
  Contributors: quizsurvey
3
+ Tags: wordpress quiz, quiz plugin, quiz, survey, lead, test, score, exam, questionnaire, question
4
  Requires at least: 4.9
5
+ Tested up to: 5.2.2
6
  Requires PHP: 5.4
7
+ Stable tag: 6.3.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Quiz and surveys plugin for your WordPress. Easily and quickly add unlimited native quizzes and surveys to your website. Customizable and professional quizzes are now at your finger tips.
12
 
13
  == Description ==
14
 
15
+ Quiz and Survey Master is the ultimate quiz plugin for WordPress. You can create native looking quizzes and surveys in matter of minutes for your WordPress site. Choose from variety of options to configure quizzes as per your requirements.
16
+
17
  = Demoes! =
18
  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)!
19
 
113
 
114
  == Changelog ==
115
 
116
+ = 6.3.2 (July 6, 2019) =
117
+
118
+ * Added Feature: UI Changes
119
+ * Added Feature: Addons Pricing Page Update
120
+ * Added Feature: Free Addon Page Added
121
+ * Added Feature: Show results of quiz in realtime - ([Issue #646](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/646))
122
+ * Added Feature: Timer Enhacements - Auto submit at expiry and show message on expiry
123
+ * Added Feature: Personality Quiz Enhancements - Show category on frontend and Show results per category
124
+ * Added Feature: Retake Quiz - ([Issue #661](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/661))
125
+ * Added Feature: Question Bank Enhacements - ([Issue #39](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/39))
126
+ * Added Feature: Facebook Button Icons
127
+
128
+
129
  = 6.3.1 (May 19, 2019) =
130
  * Closed Bug: Duplicate post issue ([Issue #758](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/758))
131
  * Closed Enhancement: Option to turn off autofill ([WP Issue](https://wordpress.org/support/topic/can-you-add-an-option-to-turn-off-autofill-on-galaxy-phones-and-other-devices/))
templates/qmn_primary.css CHANGED
@@ -105,6 +105,18 @@
105
  box-sizing: border-box;
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  .qsm_contact_div {
109
  margin: 10px 0;
110
  }
@@ -425,3 +437,10 @@ border: 1px solid #e3e3e3;
425
  .mlw_qmn_timer { top: 20px; }
426
 
427
  }
 
 
 
 
 
 
 
105
  box-sizing: border-box;
106
  }
107
 
108
+ /*.quiz_section > .mlw_qmn_question,
109
+ .quiz_section > .quiz-cat{
110
+ display: inline-block;
111
+ }*/
112
+
113
+ .quiz_section > .quiz-cat{
114
+ margin-left: 15px;
115
+ font-size: 14px;
116
+ font-weight: bold;
117
+ float: right;
118
+ }
119
+
120
  .qsm_contact_div {
121
  margin: 10px 0;
122
  }
437
  .mlw_qmn_timer { top: 20px; }
438
 
439
  }
440
+
441
+ .quick-question-res-p {
442
+ border: 2px solid;
443
+ padding: 5px 10px;
444
+ margin: 0;
445
+ border-radius: 5px;
446
+ }