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

Version Description

(August 18, 2020) = * Enhancement: Checked compatibility with WordPress 5.5. * Enhancement: Added option to customize the inline correct/incorrect messages. * Enhancement: Added video, audio, youtube and gallery support while displaying message before quiz. * Enhancement: Added support of template variables when redirecting to result page. * Enhancement: Added new template variable %MAXIMUM_POINTS% to display the maximum possible points per quiz. * Enhancement: Added option to select quiz in Gutenberg block editor. * Enhancement: Email and name fields will be captured automatically for logged in user. * Enhancement: Upgraded user interface of addons settinga page. * Bug: Fixed score calculation issues. * Bug: Fixed issues while editing quiz's text tab. * Bug: Fixed issue where question title not showing for Polar question type. * Bug: Fixed calculation issues while using Polar question type. * Bug: Fixed validation issues with phone field in contact tab. * Bug: Fixed issue where option to limit choices was not working for horizontal multiple response question type. * Bug: Fixed security vulnerability (discovered by NinTechNet). * Bug: Fixed issue where number of items per page was not working on Quizzes/Surveys page. * Bug: Fixed issue with required checkbox while editing questions. * Bug: Fixed extra contact field were not showing in admin result new template. * Bug: Fixed issues with the title while retaking a quiz. * Bug: Fixed issue where category not assigning while editing the question.

Download this release

Release Info

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

Code changes from version 7.0.1 to 7.0.2

assets/Premium Bundle.png ADDED
Binary file
assets/Starter Bundle.png ADDED
Binary file
blocks/block.js CHANGED
@@ -3,6 +3,7 @@ var el = wp.element.createElement,
3
  registerBlockType = wp.blocks.registerBlockType,
4
  ServerSideRender = wp.components.ServerSideRender,
5
  TextControl = wp.components.TextControl,
 
6
  InspectorControls = wp.editor.InspectorControls;
7
 
8
  /*
@@ -11,9 +12,10 @@ var el = wp.element.createElement,
11
  registerBlockType( 'qsm/main-block', {
12
  title: 'QSM Block',
13
  icon: 'feedback',
14
- category: 'widgets',
15
 
16
  edit: function( props ) {
 
17
  return [
18
  /*
19
  * The ServerSideRender element uses the REST API to automatically call
@@ -26,11 +28,14 @@ registerBlockType( 'qsm/main-block', {
26
  } ),
27
 
28
  el( InspectorControls, {},
29
- el( TextControl, {
30
- label: 'Quiz/Survey ID',
31
- value: props.attributes.quiz,
32
- onChange: ( value ) => { props.setAttributes( { quiz: value } ); },
33
- } )
 
 
 
34
  ),
35
  ];
36
  },
3
  registerBlockType = wp.blocks.registerBlockType,
4
  ServerSideRender = wp.components.ServerSideRender,
5
  TextControl = wp.components.TextControl,
6
+ SelectControl = wp.components.SelectControl,
7
  InspectorControls = wp.editor.InspectorControls;
8
 
9
  /*
12
  registerBlockType( 'qsm/main-block', {
13
  title: 'QSM Block',
14
  icon: 'feedback',
15
+ category: 'widgets',
16
 
17
  edit: function( props ) {
18
+ const quiz_arr = props.attributes.quiz_id;
19
  return [
20
  /*
21
  * The ServerSideRender element uses the REST API to automatically call
28
  } ),
29
 
30
  el( InspectorControls, {},
31
+ el( 'p', { style: { padding: '0 16px' } },
32
+ el( SelectControl, {
33
+ label: 'Quiz/Survey ID',
34
+ value: props.attributes.quiz,
35
+ options: quiz_arr,
36
+ onChange: ( value ) => { props.setAttributes( { quiz: value } ); },
37
+ } )
38
+ )
39
  ),
40
  ];
41
  },
blocks/block.php CHANGED
@@ -17,13 +17,17 @@ function qsm_block_init() {
17
  'qsm-quiz-block',
18
  plugins_url( 'block.js', __FILE__ ),
19
  array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' )
20
- );
21
  // Register our block, and explicitly define the attributes we accept.
22
  register_block_type( 'qsm/main-block', array(
23
  'attributes' => array(
24
  'quiz' => array(
25
- 'type' => 'string',
26
  ),
 
 
 
 
27
  ),
28
  'editor_script' => 'qsm-quiz-block',
29
  'render_callback' => 'qsm_block_render',
@@ -31,6 +35,31 @@ function qsm_block_init() {
31
  }
32
  add_action( 'init', 'qsm_block_init' );
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  /**
35
  * The block renderer.
36
  *
17
  'qsm-quiz-block',
18
  plugins_url( 'block.js', __FILE__ ),
19
  array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' )
20
+ );
21
  // Register our block, and explicitly define the attributes we accept.
22
  register_block_type( 'qsm/main-block', array(
23
  'attributes' => array(
24
  'quiz' => array(
25
+ 'type' => 'string',
26
  ),
27
+ 'quiz_id' => array(
28
+ 'type' => 'array',
29
+ 'default' => qsm_get_quizzes_list()
30
+ )
31
  ),
32
  'editor_script' => 'qsm-quiz-block',
33
  'render_callback' => 'qsm_block_render',
35
  }
36
  add_action( 'init', 'qsm_block_init' );
37
 
38
+ /**
39
+ * Get the quizzes list
40
+ *
41
+ * @since 7.0.2
42
+ * @global object $wpdb
43
+ * @return array
44
+ */
45
+ function qsm_get_quizzes_list(){
46
+ global $wpdb;
47
+ $quizzes = $wpdb->get_results( "SELECT quiz_id, quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE deleted='0'" );
48
+ $newslatter_provider_list[] = array(
49
+ 'label' => __('Select the quiz', 'quiz-master-next'),
50
+ 'value' => ''
51
+ );
52
+ if( $quizzes ){
53
+ foreach( $quizzes as $key=>$value) {
54
+ $newslatter_provider_list[] = array(
55
+ 'label' => $value->quiz_name,
56
+ 'value' => $value->quiz_id,
57
+ );
58
+ }
59
+ }
60
+ return $newslatter_provider_list;
61
+ }
62
+
63
  /**
64
  * The block renderer.
65
  *
css/common.css CHANGED
@@ -183,4 +183,9 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover{
183
  .question-type-polar-s{
184
  height: auto !important;
185
  }
 
 
 
 
 
186
  }
183
  .question-type-polar-s{
184
  height: auto !important;
185
  }
186
+ body .quiz_section .qmn_radio_answers label,
187
+ body .quiz_section .qmn_check_answers label,
188
+ body .quiz_section .qmn_accept_answers label{
189
+ font-size: 14px !important;
190
+ }
191
  }
css/qsm-admin.css CHANGED
@@ -127,31 +127,62 @@ span.qsm-quiz-name {
127
 
128
  .qsm-addon-browse-addons{
129
  background: #fff;
130
- padding: 15px 25px;
131
  width: 100%;
132
  display: inline-block;
133
- box-sizing: border-box;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
  .qsm-addon-browse-addons .qsm-addon-anchor-left{
136
  float: left;
137
  }
138
  .qsm-addon-browse-addons .qsm-addon-list-right{
139
  float: right;
 
 
140
  }
141
  .qsm-addon-browse-addons .qsm-addon-list-right > span{
142
  margin-right: 10px;
143
  font-size: 16px;
144
  }
145
- .qsm-addon-browse-addons .qsm-addon-anchor-left a.active{
146
- font-weight: bold;
147
- }
148
  .qsm-addon-browse-addons .qsm-addon-anchor-left a{
149
  display: inline-block;
150
  font-size: 16px;
151
  color: #474444;
152
  text-decoration: none;
153
- margin-top: 5px;
154
- margin-right: 30px;
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  }
156
  .qsm_popular_addons div.popuar-addon-ul{
157
  width: 100%;
@@ -159,15 +190,67 @@ span.qsm-quiz-name {
159
  }
160
  .qsm_popular_addons div.popuar-addon-ul > div{
161
  background: #fff;
162
- padding: 5px;
163
- width: 30%;
164
  margin-right: 2%;
165
  float: left;
166
  margin-bottom: 30px;
 
167
  }
168
  .qsm_popular_addons div.popuar-addon-ul > div:nth-child(3n+4){
169
  clear: both;
170
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  .qsm_popular_addons div.popuar-addon-ul > div .description-wrap{
172
  padding: 20px;
173
  }
@@ -184,47 +267,102 @@ span.qsm-quiz-name {
184
  .qsm-quiz-page-addon.qsm-addon-page-list{
185
  width: 75%;
186
  float: left;
187
- margin-top: 40px;
188
  }
189
  .qsm-addon-news-ads{
190
  width: 25%;
191
  float: right;
192
- background: #fff;
193
- padding: 7px;
194
  box-sizing: border-box;
195
- margin-top: 40px;
196
  }
197
  .qsm-addon-news-ads .qsm-news-ads-title{
198
  border-bottom: 0;
199
- margin-top: 25px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  }
201
  .qsm-addon-news-ads .qsm-info-widget{
202
  text-align: left;
203
  padding: 30px;
204
  }
205
  .qsm-addon-news-ads .qsm-info-widget h3{
206
- color: #fff;
207
- }
208
- .qsm-addon-news-ads .qsm-info-widget a.button-primary{
209
- margin-top: 0;
210
- background: #fff;
211
- color: #444;
212
  }
213
- .qsm-addon-news-ads .qsm-info-widget .button.button-default{
214
- background: #fff;
215
- color: #444;
216
  }
217
  .qsm-addon-news-ads .qsm-info-widget{
218
  transform: none !important;
219
  max-width: 100%;
 
 
 
 
220
  }
221
- .qsm-addon-news-ads .qsm-info-widget:nth-child(2){
222
- background: #00BB57;
223
- color: #fff;
 
 
 
 
 
 
 
 
 
 
224
  }
225
- .qsm-addon-news-ads .qsm-info-widget:nth-child(3){
226
- background: #0073AF;
227
  color: #fff;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  }
229
  .qsm-active-addons .installed_title{
230
  background: #fff;
@@ -233,11 +371,12 @@ span.qsm-quiz-name {
233
  border: 1px solid #ccd0d4;
234
  color: #007cba;
235
  font-size: 16px;
 
236
  }
237
  .qsm-active-addons .installed_addons_wrapper,
238
  .qsm-active-addons .no_addons_installed{
239
  border: 1px solid #ccd0d4;
240
- border-top: medium none;
241
  }
242
  .qsm-active-addons .no_addons_installed{
243
  padding: 30px 25%;
@@ -249,10 +388,11 @@ span.qsm-quiz-name {
249
  }
250
  .qsm-active-addons .installed_addons_wrapper .installed_addon{
251
  padding: 15px 15px 27px 15px;
252
- background: #FAFAFA;
253
- }
254
- .qsm-active-addons .installed_addons_wrapper .installed_addon:nth-child(2n){
255
  background: #fff;
 
 
 
 
256
  }
257
  .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_name{
258
  font-size: 14px;
@@ -263,6 +403,14 @@ span.qsm-quiz-name {
263
  .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link{
264
  float: right;
265
  }
 
 
 
 
 
 
 
 
266
  .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link span.dashicons{
267
  margin-top: 4px;
268
  }
@@ -327,7 +475,7 @@ Options Page
327
  Results Pages & Emails Tab
328
  *********************/
329
  .results-page,
330
- .email {
331
  width: 100%;
332
  background-color: #fff;
333
  margin: 20px 0;
@@ -336,7 +484,7 @@ Results Pages & Emails Tab
336
  }
337
 
338
  .results-page .results-page-content,
339
- .email .email-content{
340
  background: #fff;
341
  padding-right: 15px;
342
  padding-left: 15px;
@@ -345,7 +493,7 @@ Results Pages & Emails Tab
345
  }
346
 
347
  .results-page-header,
348
- .email-header {
349
  display: flex;
350
  align-items: center;
351
  justify-content: flex-end;
@@ -355,7 +503,7 @@ Results Pages & Emails Tab
355
  }
356
 
357
  .delete-page-button,
358
- .delete-email-button {
359
  background: none;
360
  border: none;
361
  color: #dc3232;
@@ -364,7 +512,7 @@ Results Pages & Emails Tab
364
  }
365
 
366
  .delete-page-button:hover,
367
- .delete-email-button:hover {
368
  transform: scale(1.2);
369
  }
370
 
127
 
128
  .qsm-addon-browse-addons{
129
  background: #fff;
130
+ padding: 0;
131
  width: 100%;
132
  display: inline-block;
133
+ box-sizing: border-box;
134
+ margin-bottom: 30px;
135
+ }
136
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon{
137
+ float: left;
138
+ }
139
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-add-addon{
140
+ padding-top: 9px;
141
+ padding-left: 30px;
142
+ }
143
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-add-addon a.active{
144
+ background: #222;
145
+ color: #fff;
146
+ outline: none;
147
+ box-shadow: none;
148
+ }
149
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-add-addon a{
150
+ padding: 7px 15px;
151
+ font-weight: normal;
152
+ border-radius: 5px;
153
  }
154
  .qsm-addon-browse-addons .qsm-addon-anchor-left{
155
  float: left;
156
  }
157
  .qsm-addon-browse-addons .qsm-addon-list-right{
158
  float: right;
159
+ padding-top: 15px;
160
+ padding-right: 30px;
161
  }
162
  .qsm-addon-browse-addons .qsm-addon-list-right > span{
163
  margin-right: 10px;
164
  font-size: 16px;
165
  }
 
 
 
166
  .qsm-addon-browse-addons .qsm-addon-anchor-left a{
167
  display: inline-block;
168
  font-size: 16px;
169
  color: #474444;
170
  text-decoration: none;
171
+ /*margin-top: 5px;*/
172
+ margin-right: 15px;
173
+ }
174
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon a{
175
+ background: #AAAAAA;
176
+ padding: 15px 25px;
177
+ color: #fff;
178
+ margin-right: -4px;
179
+ box-sizing: border-box;
180
+ }
181
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon a span.dashicons{
182
+ height: 15px;
183
+ }
184
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon a.active{
185
+ background: #007CBA;
186
  }
187
  .qsm_popular_addons div.popuar-addon-ul{
188
  width: 100%;
190
  }
191
  .qsm_popular_addons div.popuar-addon-ul > div{
192
  background: #fff;
193
+ padding: 10px;
194
+ width: 31%;
195
  margin-right: 2%;
196
  float: left;
197
  margin-bottom: 30px;
198
+ box-sizing: border-box;
199
  }
200
  .qsm_popular_addons div.popuar-addon-ul > div:nth-child(3n+4){
201
  clear: both;
202
  }
203
+ .qsm_popular_addons div.popuar-addon-ul .addon-itd-wrap {
204
+ width: 100%;
205
+ display: inline-block;
206
+ }
207
+ .qsm_popular_addons div.popuar-addon-ul .addon-image{
208
+ width: 100px;
209
+ height: 80px;
210
+ background-size: cover;
211
+ background-repeat: no-repeat;
212
+ background-position: center center;
213
+ background-color: #F0F0F0;
214
+ float: left;
215
+ }
216
+ .qsm_popular_addons div.popuar-addon-ul .addon-title-descption{
217
+ width: calc( 100% - 110px );
218
+ float: right;
219
+ }
220
+ .qsm_popular_addons div.popuar-addon-ul .description{
221
+ display: block;
222
+ margin-bottom: 5px;
223
+ }
224
+ .qsm_popular_addons div.popuar-addon-ul .addon-title{
225
+ font-size: 16px;
226
+ color: #222;
227
+ font-weight: bold;
228
+ text-decoration: none;
229
+ margin-bottom: 5px;
230
+ display: block;
231
+ }
232
+ .qsm_popular_addons div.popuar-addon-ul .addon-price {
233
+ border-top: 1px solid #f1f1f1;
234
+ padding-top: 10px;
235
+ margin-top: 15px;
236
+ }
237
+ .qsm_popular_addons div.popuar-addon-ul .addon-price-btn{
238
+ background: #fff;
239
+ border: #fff;
240
+ color: #007cba;
241
+ font-weight: bold;
242
+ font-size: 14px;
243
+ }
244
+ .qsm_popular_addons div.popuar-addon-ul .addon-get-link{
245
+ float: right;
246
+ background: #fff;
247
+ color: #007cba;
248
+ border-width: 2px;
249
+ font-weight: bold;
250
+ }
251
+ .qsm_popular_addons div.popuar-addon-ul .addon-get-link span.dashicons {
252
+ margin-top: 4px;
253
+ }
254
  .qsm_popular_addons div.popuar-addon-ul > div .description-wrap{
255
  padding: 20px;
256
  }
267
  .qsm-quiz-page-addon.qsm-addon-page-list{
268
  width: 75%;
269
  float: left;
270
+ margin-top: 0;
271
  }
272
  .qsm-addon-news-ads{
273
  width: 25%;
274
  float: right;
275
+ background: #007CBA;
276
+ padding: 10px 20px 30px 20px;
277
  box-sizing: border-box;
278
+ margin-top: 0;
279
  }
280
  .qsm-addon-news-ads .qsm-news-ads-title{
281
  border-bottom: 0;
282
+ margin-top: 20px;
283
+ background: #fff;
284
+ padding: 16px;
285
+ color: #007CBA;
286
+ font-weight: bold;
287
+ position: relative;
288
+ }
289
+ .qsm-addon-news-ads .qsm-news-ads-title:before,
290
+ .qsm-addon-news-ads .qsm-news-ads-title:after{
291
+ content: "";
292
+ position: absolute;
293
+ height: 0;
294
+ width: 0;
295
+ top: 0;
296
+ left: 0;
297
+ border-style: solid;
298
+ border-width: 25px;
299
+ }
300
+ .qsm-addon-news-ads .qsm-news-ads-title:before{
301
+ border-color: transparent transparent transparent #007CBA;
302
+ }
303
+ .qsm-addon-news-ads .qsm-news-ads-title:after{
304
+ right: 0;
305
+ left: auto;
306
+ border-color: transparent #007CBA transparent transparent;
307
  }
308
  .qsm-addon-news-ads .qsm-info-widget{
309
  text-align: left;
310
  padding: 30px;
311
  }
312
  .qsm-addon-news-ads .qsm-info-widget h3{
313
+ color: #222;
314
+ font-weight: bold;
315
+ margin-top: 20px;
316
+ margin-bottom: 15px;
 
 
317
  }
318
+ .qsm-addon-news-ads .qsm-info-widget p{
319
+ font-size: 14px;
 
320
  }
321
  .qsm-addon-news-ads .qsm-info-widget{
322
  transform: none !important;
323
  max-width: 100%;
324
+ position: relative;
325
+ background: #fff;
326
+ text-align: center;
327
+ margin-top: 70px;
328
  }
329
+ .qsm-addon-news-ads .qsm-info-widget .bundle-icon{
330
+ width: 40px;
331
+ height: 40px;
332
+ padding: 20px;
333
+ border-radius: 50%;
334
+ position: absolute;
335
+ top: -40px;
336
+ left: calc( 50% - 40px );
337
+ border: 2px solid #fff;
338
+ box-shadow: 0px 0px 5px 1px rgb(0 0 0 / 16%);
339
+ }
340
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(2) .bundle-icon{
341
+ background: #00B592;
342
  }
343
+ .qsm-addon-news-ads .qsm-info-widget .addon-bundle-btn{
 
344
  color: #fff;
345
+ width: 100%;
346
+ padding: 5px;
347
+ font-size: 14px;
348
+ position: relative;
349
+ margin-top: 0;
350
+ }
351
+ .qsm-addon-news-ads .qsm-info-widget .addon-bundle-btn span.dashicons{
352
+ position: absolute;
353
+ top: 10px;
354
+ right: 10px;
355
+ }
356
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(2) .addon-bundle-btn{
357
+ background: #00B592;
358
+ border-color: #00B592;
359
+ }
360
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(3) .bundle-icon{
361
+ background: #ED706F;
362
+ }
363
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(3) .addon-bundle-btn{
364
+ background: #ED706F;
365
+ border-color: #ED706F;
366
  }
367
  .qsm-active-addons .installed_title{
368
  background: #fff;
371
  border: 1px solid #ccd0d4;
372
  color: #007cba;
373
  font-size: 16px;
374
+ display: none;
375
  }
376
  .qsm-active-addons .installed_addons_wrapper,
377
  .qsm-active-addons .no_addons_installed{
378
  border: 1px solid #ccd0d4;
379
+ /*border-top: medium none;*/
380
  }
381
  .qsm-active-addons .no_addons_installed{
382
  padding: 30px 25%;
388
  }
389
  .qsm-active-addons .installed_addons_wrapper .installed_addon{
390
  padding: 15px 15px 27px 15px;
 
 
 
391
  background: #fff;
392
+ border-bottom: 1px solid #cdc7c7;
393
+ }
394
+ .qsm-active-addons .installed_addons_wrapper .installed_addon:last-child{
395
+ border-bottom: medium none;
396
  }
397
  .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_name{
398
  font-size: 14px;
403
  .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link{
404
  float: right;
405
  }
406
+ .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link a{
407
+ background: #fff;
408
+ border-width: 2px;
409
+ font-weight: 500;
410
+ font-size: 13px;
411
+ padding-left: 15px;
412
+ padding-right: 15px;
413
+ }
414
  .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link span.dashicons{
415
  margin-top: 4px;
416
  }
475
  Results Pages & Emails Tab
476
  *********************/
477
  .results-page,
478
+ #emails .email {
479
  width: 100%;
480
  background-color: #fff;
481
  margin: 20px 0;
484
  }
485
 
486
  .results-page .results-page-content,
487
+ #emails .email .email-content{
488
  background: #fff;
489
  padding-right: 15px;
490
  padding-left: 15px;
493
  }
494
 
495
  .results-page-header,
496
+ #emails .email-header {
497
  display: flex;
498
  align-items: center;
499
  justify-content: flex-end;
503
  }
504
 
505
  .delete-page-button,
506
+ #emails .delete-email-button {
507
  background: none;
508
  border: none;
509
  color: #dc3232;
512
  }
513
 
514
  .delete-page-button:hover,
515
+ #emails .delete-email-button:hover {
516
  transform: scale(1.2);
517
  }
518
 
js/admin.js CHANGED
@@ -211,7 +211,12 @@ var QSMAdmin;
211
  var data = jQuery.parseJSON( response );
212
  if( data.success === true ){
213
  var text_msg = data.text_message;
214
- text_msg = text_msg.replace(/\n/g,"<br>");
 
 
 
 
 
215
  tinyMCE.get( 'qsm_question_text_message' ).setContent( text_msg );
216
  jQuery( '.qsm-text-allowed-variables > .qsm-text-variable-wrap' ).html('').html( data.allowed_variable_text );
217
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').hide();
@@ -308,12 +313,25 @@ var QSMAdmin;
308
  this_par.text('').text(button_txt);
309
  }, 1000);
310
  });
311
- $(document).on('click', '.qsm-addon-anchor-left > a', function(e){
312
  e.preventDefault();
313
  var href = $(this).attr('href');
314
- $('.qsm-addon-anchor-left').find('a').removeClass('active');
315
  $(this).addClass('active');
316
- $('.qsm-quiz-page-addon > .qsm_popular_addons').hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  $( href ).show();
318
  });
319
  });
211
  var data = jQuery.parseJSON( response );
212
  if( data.success === true ){
213
  var text_msg = data.text_message;
214
+ if ($('#wp-qsm_question_text_message-wrap').hasClass('html-active')) {
215
+ jQuery( "#qsm_question_text_message" ).val( text_msg );
216
+ } else {
217
+ text_msg = text_msg.replace(/\n/g,"<br>");
218
+ tinyMCE.get( 'qsm_question_text_message' ).setContent( text_msg );
219
+ }
220
  tinyMCE.get( 'qsm_question_text_message' ).setContent( text_msg );
221
  jQuery( '.qsm-text-allowed-variables > .qsm-text-variable-wrap' ).html('').html( data.allowed_variable_text );
222
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').hide();
313
  this_par.text('').text(button_txt);
314
  }, 1000);
315
  });
316
+ $(document).on('click', '.qsm-addon-anchor-left .qsm-install-addon a', function(e){
317
  e.preventDefault();
318
  var href = $(this).attr('href');
319
+ $('.qsm-addon-anchor-left .qsm-install-addon').find('a').removeClass('active');
320
  $(this).addClass('active');
321
+ $('.qsm-addon-setting-wrap .qsm-primary-acnhor').hide();
322
+ $( href ).show();
323
+ if( href == '#qsm_add_addons' ){
324
+ $('.qsm-add-addon').css('display', 'inline-block');
325
+ }else{
326
+ $('.qsm-add-addon').css('display', 'none');
327
+ }
328
+ });
329
+ $(document).on('click', '.qsm-addon-anchor-left .qsm-add-addon a', function(e){
330
+ e.preventDefault();
331
+ var href = $(this).attr('href');
332
+ $('.qsm-addon-anchor-left .qsm-add-addon').find('a').removeClass('active');
333
+ $(this).addClass('active');
334
+ $('.qsm-addon-setting-wrap .qsm_popular_addons').hide();
335
  $( href ).show();
336
  });
337
  });
js/qsm-admin-question.js CHANGED
@@ -366,7 +366,7 @@ var import_button;
366
  var answerInfo = $( '#correct_answer_info' ).val();
367
  var type = $( "#question_type" ).val();
368
  var comments = $( "#comments" ).val();
369
- advanced_option['required'] = $("#required").attr("checked") ? 0 : 1;
370
  var category = $( ".category-radio:checked" ).val();
371
  var autofill = $( "#hide_autofill" ).val();
372
  var limit_text = $( "#limit_text" ).val();
@@ -869,10 +869,10 @@ var import_button;
869
  //Add new category
870
  $( document ).on('click', '#qsm-category-add-toggle', function(){
871
  if( $( '#qsm-category-add' ).is(":visible") ){
872
- $('#new_category_new').attr('checked', false);
873
  $( '#qsm-category-add' ).slideUp('slow');
874
  }else{
875
- $('#new_category_new').attr('checked', true);
876
  $( '#qsm-category-add' ).slideDown('slow');
877
  }
878
  });
366
  var answerInfo = $( '#correct_answer_info' ).val();
367
  var type = $( "#question_type" ).val();
368
  var comments = $( "#comments" ).val();
369
+ advanced_option['required'] = $(".questionElements input[name='required']").is(":checked") ? 0 : 1;
370
  var category = $( ".category-radio:checked" ).val();
371
  var autofill = $( "#hide_autofill" ).val();
372
  var limit_text = $( "#limit_text" ).val();
869
  //Add new category
870
  $( document ).on('click', '#qsm-category-add-toggle', function(){
871
  if( $( '#qsm-category-add' ).is(":visible") ){
872
+ $('.questionElements #new_category_new').attr('checked', false);
873
  $( '#qsm-category-add' ).slideUp('slow');
874
  }else{
875
+ $('.questionElements #new_category_new').attr('checked', true).prop('checked', 'checked');
876
  $( '#qsm-category-add' ).slideDown('slow');
877
  }
878
  });
js/qsm-admin.js CHANGED
@@ -102,6 +102,7 @@ var QSMQuizzesSurveys;
102
  icons: icons,
103
  heightStyle: "content"
104
  });
 
105
  jQuery('.template-list .template-list-inner:first-child').trigger('click');
106
  }
107
  });
@@ -112,6 +113,8 @@ var QSMQuizzesSurveys;
112
  var addons = $(this).data('addons');
113
  $('.template-list .template-list-inner').removeClass('selected-quiz-template');
114
  $(this).addClass('selected-quiz-template');
 
 
115
  $.post(ajaxurl, {settings: settings, addons: addons, action: action },
116
  function (data) {
117
  var diff_html = data.split('=====');
@@ -120,6 +123,14 @@ var QSMQuizzesSurveys;
120
  $('#recomm_addons_wrapper').html('');
121
  $('#recomm_addons_wrapper').html(diff_html[1]);
122
  $( "#accordion" ).accordion();
 
 
 
 
 
 
 
 
123
  }
124
  );
125
  });
@@ -127,6 +138,14 @@ var QSMQuizzesSurveys;
127
  event.preventDefault();
128
  MicroModal.show( 'modal-export-import' );
129
  });
 
 
 
 
 
 
 
 
130
  /*$( '#quiz_search' ).keyup( function() {
131
  QSMQuizzesSurveys.searchQuizzes( $( this ).val() );
132
  });*/
102
  icons: icons,
103
  heightStyle: "content"
104
  });
105
+ jQuery('#accordion h3.ui-accordion-header').next().slideDown();
106
  jQuery('.template-list .template-list-inner:first-child').trigger('click');
107
  }
108
  });
113
  var addons = $(this).data('addons');
114
  $('.template-list .template-list-inner').removeClass('selected-quiz-template');
115
  $(this).addClass('selected-quiz-template');
116
+ $('#quiz_settings_wrapper').html('').html('<div class="qsm-spinner-loader"></div>');
117
+ $('#recomm_addons_wrapper').html('').html('<div class="qsm-spinner-loader"></div>');
118
  $.post(ajaxurl, {settings: settings, addons: addons, action: action },
119
  function (data) {
120
  var diff_html = data.split('=====');
123
  $('#recomm_addons_wrapper').html('');
124
  $('#recomm_addons_wrapper').html(diff_html[1]);
125
  $( "#accordion" ).accordion();
126
+ $('#accordion h3.ui-accordion-header').next().slideDown();
127
+ $( '#quiz_settings_wrapper select' ).each(function(){
128
+ var name = $(this).attr('name');
129
+ var value = $(this).val();
130
+ if( $( '.' + name + '_' + value ).length > 0 ){
131
+ $( '.' + name + '_' + value ).show();
132
+ }
133
+ });
134
  }
135
  );
136
  });
138
  event.preventDefault();
139
  MicroModal.show( 'modal-export-import' );
140
  });
141
+ $(document).on('change', '.qsm_tab_content select, #quiz_settings_wrapper select', function(){
142
+ var name = $(this).attr('name');
143
+ var value = $(this).val();
144
+ $( '.qsm_hidden_tr' ).hide();
145
+ if( $( '.' + name + '_' + value ).length > 0 ){
146
+ $( '.' + name + '_' + value ).show();
147
+ }
148
+ });
149
  /*$( '#quiz_search' ).keyup( function() {
150
  QSMQuizzesSurveys.searchQuizzes( $( this ).val() );
151
  });*/
js/qsm-quiz.js CHANGED
@@ -658,14 +658,14 @@ function qmnResetError( quiz_form_id ) {
658
  jQuery( '#' + quiz_form_id + ' .quiz_section' ).removeClass( 'qmn_error' );
659
  }
660
 
661
- function qmnValidation( element, quiz_form_id ) {
662
  var result = true;
663
  var quiz_id = +jQuery( '#' + quiz_form_id ).find( '.qmn_quiz_id' ).val();
664
  var email_error = qmn_quiz_data[ quiz_id ].error_messages.email;
665
  var number_error = qmn_quiz_data[ quiz_id ].error_messages.number;
666
  var empty_error = qmn_quiz_data[ quiz_id ].error_messages.empty;
667
  var incorrect_error = qmn_quiz_data[ quiz_id ].error_messages.incorrect;
668
- qmnResetError( quiz_form_id );
669
  jQuery( element ).each(function(){
670
  if ( jQuery( this ).attr( 'class' )) {
671
  if( jQuery( this ).attr( 'class' ).indexOf( 'mlwEmail' ) !== -1 && this.value !== "" ) {
@@ -677,7 +677,7 @@ function qmnValidation( element, quiz_form_id ) {
677
  }
678
  }
679
  var by_pass = true;
680
- if( qmn_quiz_data[quiz_id].hasOwnProperty('skip_validation_time_expire') && qmn_quiz_data[quiz_id].skip_validation_time_expire == 0 ){
681
  by_pass = false;
682
  }
683
 
@@ -699,7 +699,7 @@ function qmnValidation( element, quiz_form_id ) {
699
  if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredAccept' ) > -1 && ! jQuery( this ).prop( 'checked' ) ) {
700
  qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
701
  result = false;
702
- }
703
  if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredRadio' ) > -1 ) {
704
  check_val = jQuery( this ).find( 'input:checked' ).val();
705
  if ( check_val == "No Answer Provided" ) {
@@ -1182,11 +1182,14 @@ jQuery(function() {
1182
  },
1183
  success: function (response) {
1184
  parent_div.replaceWith(response);
1185
- // Restart the timer for retake quiz.
1186
- setInterval( qmnTimeTakenTimer, 1000 );
 
 
1187
 
1188
- // Reset the timer clock on retake quiz.
1189
- QSM.initTimer( quiz_id );
 
1190
 
1191
  QSM.initPagination( quiz_id );
1192
  },
658
  jQuery( '#' + quiz_form_id + ' .quiz_section' ).removeClass( 'qmn_error' );
659
  }
660
 
661
+ function qmnValidation( element, quiz_form_id ) {
662
  var result = true;
663
  var quiz_id = +jQuery( '#' + quiz_form_id ).find( '.qmn_quiz_id' ).val();
664
  var email_error = qmn_quiz_data[ quiz_id ].error_messages.email;
665
  var number_error = qmn_quiz_data[ quiz_id ].error_messages.number;
666
  var empty_error = qmn_quiz_data[ quiz_id ].error_messages.empty;
667
  var incorrect_error = qmn_quiz_data[ quiz_id ].error_messages.incorrect;
668
+ qmnResetError( quiz_form_id );
669
  jQuery( element ).each(function(){
670
  if ( jQuery( this ).attr( 'class' )) {
671
  if( jQuery( this ).attr( 'class' ).indexOf( 'mlwEmail' ) !== -1 && this.value !== "" ) {
677
  }
678
  }
679
  var by_pass = true;
680
+ if( qmn_quiz_data[ quizID ].timer_limit_val > 0 && qmn_quiz_data[quiz_id].hasOwnProperty('skip_validation_time_expire') && qmn_quiz_data[quiz_id].skip_validation_time_expire == 0 ){
681
  by_pass = false;
682
  }
683
 
699
  if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredAccept' ) > -1 && ! jQuery( this ).prop( 'checked' ) ) {
700
  qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
701
  result = false;
702
+ }
703
  if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredRadio' ) > -1 ) {
704
  check_val = jQuery( this ).find( 'input:checked' ).val();
705
  if ( check_val == "No Answer Provided" ) {
1182
  },
1183
  success: function (response) {
1184
  parent_div.replaceWith(response);
1185
+
1186
+ if( qmn_quiz_data[ quiz_id ].timer_limit_val > 0 ){
1187
+ // Restart the timer for retake quiz.
1188
+ setInterval( qmnTimeTakenTimer, 1000 );
1189
 
1190
+ // Reset the timer clock on retake quiz.
1191
+ QSM.initTimer( quiz_id );
1192
+ }
1193
 
1194
  QSM.initPagination( quiz_id );
1195
  },
mlw_quizmaster2.php CHANGED
@@ -2,14 +2,14 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 7.0.1
6
  * Author: ExpressTech
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://expresstech.io/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
- * @version 7.0.1
13
  * @package QSM
14
  */
15
 
@@ -37,7 +37,7 @@ class MLWQuizMasterNext {
37
  * @var string
38
  * @since 4.0.0
39
  */
40
- public $version = '7.0.1';
41
 
42
  /**
43
  * QSM Alert Manager Object
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 7.0.2
6
  * Author: ExpressTech
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://expresstech.io/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
+ * @version 7.0.2
13
  * @package QSM
14
  */
15
 
37
  * @var string
38
  * @since 4.0.0
39
  */
40
+ public $version = '7.0.2';
41
 
42
  /**
43
  * QSM Alert Manager Object
php/admin/addons-page.php CHANGED
@@ -63,8 +63,25 @@ function qsm_generate_featured_addons() {
63
  global $mlwQuizMasterNext;
64
  wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
65
  $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
66
- ?>
67
- <div class="qsm-active-addons">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  <h2 class="installed_title"><?php _e('Installed Addons', 'quiz-master-next'); ?></h2>
69
  <?php
70
  if( $tab_array && count( $tab_array ) > 1 ){ ?>
@@ -93,18 +110,8 @@ function qsm_generate_featured_addons() {
93
  <?php }
94
  ?>
95
  </div>
96
- <div class="qsm-addon-browse-addons">
97
- <div class="qsm-addon-anchor-left">
98
- <a class="active" href="#qsm_popular_addons"><?php _e('Popular Addons', 'quiz-master-next'); ?></a>
99
- <a href="#qsm_onsale_addons"><?php _e('On Sale Addons', 'quiz-master-next'); ?></a>
100
- <a href="#qsm_new_addons"><?php _e('Recently Updated Addons', 'quiz-master-next'); ?></a>
101
- </div>
102
- <div class="qsm-addon-list-right">
103
- <span><?php _e('40+ addons available', 'quiz-master-next'); ?></span>
104
- <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
105
- </div>
106
- </div>
107
- <div class="qsm-quiz-page-addon qsm-addon-page-list">
108
  <?php
109
  $popular_addons = qsm_get_widget_data('popular_products');
110
  if( empty( $popular_addons ) ){
@@ -119,14 +126,24 @@ function qsm_generate_featured_addons() {
119
  foreach ( $popular_addons as $key => $single_arr ) {
120
  ?>
121
  <div>
122
- <a href="<?php echo $single_arr['link']; ?>" target="_blank">
123
- <img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
124
- </a>
125
- <div class="description-wrap">
126
- <span class="description"><?php echo $single_arr['description']; ?></span>
127
- <button class="button button-primary">$<?php echo array_values($single_arr['price'])[0]; ?></button>
128
- <a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button button-primary"><?php _e('Get This Addon', 'quiz-master-next'); ?></a>
129
- </div>
 
 
 
 
 
 
 
 
 
 
130
  </div>
131
  <?php
132
  }
@@ -148,14 +165,24 @@ function qsm_generate_featured_addons() {
148
  foreach ( $qsm_onsale_addons as $key => $single_arr ) {
149
  ?>
150
  <div>
151
- <a href="<?php echo $single_arr['link']; ?>" target="_blank">
152
- <img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
153
- </a>
154
- <div class="description-wrap">
155
- <span class="description"><?php echo $single_arr['description']; ?></span>
156
- <button class="button button-primary">$<?php echo array_values($single_arr['price'])[0]; ?></button>
157
- <a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button button-primary"><?php _e('Get This Addon', 'quiz-master-next'); ?></a>
158
- </div>
 
 
 
 
 
 
 
 
 
 
159
  </div>
160
  <?php
161
  }
@@ -180,16 +207,24 @@ function qsm_generate_featured_addons() {
180
  }
181
  ?>
182
  <div>
183
- <a href="<?php echo $single_arr['link']; ?>" target="_blank">
184
- <img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
185
- </a>
186
- <div class="description-wrap">
187
- <?php if( isset($single_arr['description']) && $single_arr['description'] != '' ){ ?>
188
- <span class="description"><?php echo $single_arr['description']; ?></span>
189
- <?php } ?>
190
- <button class="button button-primary">$<?php echo array_values($single_arr['price'])[0]; ?></button>
191
- <a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button button-primary"><?php _e('Get This Addon', 'quiz-master-next'); ?></a>
192
- </div>
 
 
 
 
 
 
 
 
193
  </div>
194
  <?php
195
  }
@@ -212,17 +247,25 @@ function qsm_generate_featured_addons() {
212
  <h3 class="qsm-news-ads-title"><?php _e('SAVE WITH OUR BUNDLES', 'quiz-master-next'); ?></h3>
213
  <?php
214
  foreach ($bundles as $key => $bundles_arr) { ?>
215
- <div class="qsm-info-widget" style="background-color: <?php echo $bundles_arr['background']; ?>">
216
- <h3><?php echo $bundles_arr['name']; ?></h3>
217
- <p><?php echo $bundles_arr['desc']; ?></p>
218
- <button class="button button-default">$<?php echo array_values($bundles_arr['price'])[0]; ?></button>
219
- <a target="_blank" href="<?php echo $bundles_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary"><?php _e('Get Now', 'quiz-master-next'); ?></a>
 
 
 
 
 
 
 
220
  </div>
221
  <?php
222
  }
223
  }
224
  ?>
225
  </div>
 
226
  <?php
227
  }
228
 
63
  global $mlwQuizMasterNext;
64
  wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
65
  $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
66
+ ?>
67
+ <div class="qsm-addon-browse-addons">
68
+ <div class="qsm-addon-anchor-left">
69
+ <div class="qsm-install-addon">
70
+ <a class="active" href="#qsm_installed_addons"><?php _e('Installed Addons', 'quiz-master-next'); ?></a>
71
+ <a href="#qsm_add_addons"><?php _e('Add Addons', 'quiz-master-next'); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a>
72
+ </div>
73
+ <div class="qsm-add-addon" style="display: none;">
74
+ <a class="active" href="#qsm_popular_addons"><?php _e('Popular Addons', 'quiz-master-next'); ?></a>
75
+ <a href="#qsm_onsale_addons"><?php _e('On Sale Addons', 'quiz-master-next'); ?></a>
76
+ <a href="#qsm_new_addons"><?php _e('Recently Updated Addons', 'quiz-master-next'); ?></a>
77
+ </div>
78
+ </div>
79
+ <div class="qsm-addon-list-right">
80
+ <span><?php _e('40+ addons available', 'quiz-master-next'); ?></span>
81
+ <a style="text-decoration: none; font-size: 15px;" href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
82
+ </div>
83
+ </div>
84
+ <div id="qsm_installed_addons" class="qsm-active-addons qsm-primary-acnhor">
85
  <h2 class="installed_title"><?php _e('Installed Addons', 'quiz-master-next'); ?></h2>
86
  <?php
87
  if( $tab_array && count( $tab_array ) > 1 ){ ?>
110
  <?php }
111
  ?>
112
  </div>
113
+ <div id="qsm_add_addons" class="qsm-primary-acnhor" style="display: none;">
114
+ <div class="qsm-quiz-page-addon qsm-addon-page-list">
 
 
 
 
 
 
 
 
 
 
115
  <?php
116
  $popular_addons = qsm_get_widget_data('popular_products');
117
  if( empty( $popular_addons ) ){
126
  foreach ( $popular_addons as $key => $single_arr ) {
127
  ?>
128
  <div>
129
+ <div class="addon-itd-wrap">
130
+ <div class="addon-image" style="background-image: url('<?php echo $single_arr['img']; ?>')"></div>
131
+ <div class="addon-title-descption">
132
+ <a class="addon-title" href="<?php echo $single_arr['link']; ?>" target="_blank">
133
+ <?php echo $single_arr['name']; ?>
134
+ </a>
135
+ <span class="description">
136
+ <?php echo wp_trim_words($single_arr['description'], 8); ?>
137
+ </span>
138
+ <?php if(str_word_count($single_arr['description']) > 9 ){
139
+ echo '<a class="read-more" href="'. $single_arr['link'] .'">'. __('Show more', 'quiz-master-next') .'</a>';
140
+ } ?>
141
+ </div>
142
+ </div>
143
+ <div class="addon-price">
144
+ <button class="button button-primary addon-price-btn"><?php _e('Price: ' , 'quiz-master-next'); ?>$<?php echo array_values($single_arr['price'])[0]; ?></button>
145
+ <a class="button button-primary addon-get-link" href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank"><?php _e('Get This Addon', 'quiz-master-next'); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a>
146
+ </div>
147
  </div>
148
  <?php
149
  }
165
  foreach ( $qsm_onsale_addons as $key => $single_arr ) {
166
  ?>
167
  <div>
168
+ <div class="addon-itd-wrap">
169
+ <div class="addon-image" style="background-image: url('<?php echo $single_arr['img']; ?>')"></div>
170
+ <div class="addon-title-descption">
171
+ <a class="addon-title" href="<?php echo $single_arr['link']; ?>" target="_blank">
172
+ <?php echo $single_arr['name']; ?>
173
+ </a>
174
+ <span class="description">
175
+ <?php echo wp_trim_words($single_arr['description'], 8); ?>
176
+ </span>
177
+ <?php if(str_word_count($single_arr['description']) > 9 ){
178
+ echo '<a class="read-more" href="'. $single_arr['link'] .'">'. __('Show more', 'quiz-master-next') .'</a>';
179
+ } ?>
180
+ </div>
181
+ </div>
182
+ <div class="addon-price">
183
+ <button class="button button-primary addon-price-btn"><?php _e('Price: ' , 'quiz-master-next'); ?>$<?php echo array_values($single_arr['price'])[0]; ?></button>
184
+ <a class="button button-primary addon-get-link" href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank"><?php _e('Get This Addon', 'quiz-master-next'); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a>
185
+ </div>
186
  </div>
187
  <?php
188
  }
207
  }
208
  ?>
209
  <div>
210
+ <div class="addon-itd-wrap">
211
+ <div class="addon-image" style="background-image: url('<?php echo $single_arr['img']; ?>')"></div>
212
+ <div class="addon-title-descption">
213
+ <a class="addon-title" href="<?php echo $single_arr['link']; ?>" target="_blank">
214
+ <?php echo $single_arr['name']; ?>
215
+ </a>
216
+ <span class="description">
217
+ <?php echo wp_trim_words($single_arr['description'], 8); ?>
218
+ </span>
219
+ <?php if(str_word_count($single_arr['description']) > 9 ){
220
+ echo '<a class="read-more" href="'. $single_arr['link'] .'">'. __('Show more', 'quiz-master-next') .'</a>';
221
+ } ?>
222
+ </div>
223
+ </div>
224
+ <div class="addon-price">
225
+ <button class="button button-primary addon-price-btn"><?php _e('Price: ' , 'quiz-master-next'); ?>$<?php echo array_values($single_arr['price'])[0]; ?></button>
226
+ <a class="button button-primary addon-get-link" href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank"><?php _e('Get This Addon', 'quiz-master-next'); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a>
227
+ </div>
228
  </div>
229
  <?php
230
  }
247
  <h3 class="qsm-news-ads-title"><?php _e('SAVE WITH OUR BUNDLES', 'quiz-master-next'); ?></h3>
248
  <?php
249
  foreach ($bundles as $key => $bundles_arr) { ?>
250
+ <div class="qsm-info-widget">
251
+ <div class="bundle-icon">
252
+ <?php
253
+ echo '<img src="'. QSM_PLUGIN_URL .'assets/'. $bundles_arr['name'] .'.png" />';
254
+ ?>
255
+ </div>
256
+ <h3><?php echo $bundles_arr['name']; ?></h3>
257
+ <p><?php echo $bundles_arr['desc']; ?></p>
258
+ <a href="<?php echo $bundles_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button button-primary addon-bundle-btn">
259
+ <?php echo _e('Get now', 'quiz-master-next'); ?> $<?php echo array_values($bundles_arr['price'])[0]; ?>
260
+ <span class="dashicons dashicons-arrow-right-alt2"></span>
261
+ </a>
262
  </div>
263
  <?php
264
  }
265
  }
266
  ?>
267
  </div>
268
+ </div>
269
  <?php
270
  }
271
 
php/admin/admin-dashboard.php CHANGED
@@ -1,25 +1,21 @@
1
  <?php
2
  /**
3
  * @since 7.0
 
4
  * @param string $name
5
  */
6
  function qsm_get_widget_data( $name ){
7
- $get_dashboard_data = get_transient( 'qsm_admin_dashboard_data' );
8
- if($get_dashboard_data !== false && !empty( $get_dashboard_data ) ){
9
- $qsm_admin_dd = $get_dashboard_data;
10
- }else{
11
- $qsm_admin_dd = qsm_fetch_data_from_script();
12
- set_transient( 'qsm_admin_dashboard_data', $qsm_admin_dd, 24*60*60 );
13
- }
14
  return isset( $qsm_admin_dd[$name] ) ? $qsm_admin_dd[$name] : array();
15
  }
16
 
 
17
  function qsm_fetch_data_from_script(){
18
  $args = array(
19
  'timeout' => 10,
20
  'sslverify' => false
21
  );
22
- $fetch_api_data = wp_remote_get('https://quizandsurveymaster.com/wp-json/qsmps/get-data', $args);
23
  if( is_array( $fetch_api_data ) && isset( $fetch_api_data['response'] ) && isset( $fetch_api_data['response']['code'] ) && $fetch_api_data['response']['code'] == 200 ){
24
  $qsm_admin_dd = wp_remote_retrieve_body( $fetch_api_data );
25
  return json_decode( $qsm_admin_dd, true );
1
  <?php
2
  /**
3
  * @since 7.0
4
+ * @since 7.0.2 Removed the transient
5
  * @param string $name
6
  */
7
  function qsm_get_widget_data( $name ){
8
+ $qsm_admin_dd = qsm_fetch_data_from_script();
 
 
 
 
 
 
9
  return isset( $qsm_admin_dd[$name] ) ? $qsm_admin_dd[$name] : array();
10
  }
11
 
12
+
13
  function qsm_fetch_data_from_script(){
14
  $args = array(
15
  'timeout' => 10,
16
  'sslverify' => false
17
  );
18
+ $fetch_api_data = wp_remote_get('https://t6k8i7j6.stackpathcdn.com/wp-content/parsing_script.json', $args);
19
  if( is_array( $fetch_api_data ) && isset( $fetch_api_data['response'] ) && isset( $fetch_api_data['response']['code'] ) && $fetch_api_data['response']['code'] == 200 ){
20
  $qsm_admin_dd = wp_remote_retrieve_body( $fetch_api_data );
21
  return json_decode( $qsm_admin_dd, true );
php/admin/admin-results-details-page.php CHANGED
@@ -110,17 +110,24 @@ function qsm_generate_results_details_tab() {
110
  $new_template_result_detail = esc_attr( $settings['new_template_result_detail'] );
111
  }
112
  if( $new_template_result_detail == 1 ){
113
- $template = '';
114
- if ( is_serialized( $results_data->quiz_results ) && is_array( @unserialize( $results_data->quiz_results ) ) ) {
 
115
  $template .= '<div class="overview-main-wrapper">';
116
  //User detail
117
  $template .= '<div class="candidate-detail-wrap overview-inner-wrap">';
118
  $template .= '<div id="submitdiv" class="postbox "><h2 class="hndle ui-sortable-handle"><span>User Detail</span></h2>';
119
- $template .= '<div class="inside">';
120
- $template .= '<span class="result-candidate-span"><label>'. __( 'Name:', 'quiz-master-next' ) .'</label><span>'. $results_data->name .'</span></span>';
121
- $template .= '<span class="result-candidate-span"><label>'. __( 'Business:', 'quiz-master-next' ) .'</label><span>'. $results_data->business .'</span></span>';
122
- $template .= '<span class="result-candidate-span"><label>'. __( 'Phone:', 'quiz-master-next' ) .'</label><span>'. $results_data->phone .'</span></span>';
123
- $template .= '<span class="result-candidate-span"><label>'. __( 'Email:', 'quiz-master-next' ) .'</label><span>'. $results_data->email .'</span></span>';
 
 
 
 
 
 
124
  $template .= '</div>';
125
  $template .= '</div>';
126
  $template .= '</div>';
@@ -221,8 +228,10 @@ function qsm_generate_results_details_tab() {
221
  }
222
 
223
  // Prepare responses array.
 
224
  if ( is_serialized( $results_data->quiz_results ) && is_array( @unserialize( $results_data->quiz_results ) ) ) {
225
  $results = unserialize($results_data->quiz_results);
 
226
  if ( ! isset( $results["contact"] ) ) {
227
  $results["contact"] = array();
228
  }
@@ -254,7 +263,7 @@ function qsm_generate_results_details_tab() {
254
  'total_points' => $results_data->point_score,
255
  'total_score' => $results_data->correct_score,
256
  'total_correct' => $results_data->correct,
257
- 'total_questions' => $results_data->total,
258
  'comments' => isset( $results[2] ) ? $results[2] : '',
259
  'question_answers_array' => isset( $results[1] ) ? $results[1] : array(),
260
  'contact' => $results["contact"],
110
  $new_template_result_detail = esc_attr( $settings['new_template_result_detail'] );
111
  }
112
  if( $new_template_result_detail == 1 ){
113
+ $template = '';
114
+ if ( is_serialized( $results_data->quiz_results ) && is_array( @unserialize( $results_data->quiz_results ) ) ) {
115
+ $results_contact = unserialize($results_data->quiz_results);
116
  $template .= '<div class="overview-main-wrapper">';
117
  //User detail
118
  $template .= '<div class="candidate-detail-wrap overview-inner-wrap">';
119
  $template .= '<div id="submitdiv" class="postbox "><h2 class="hndle ui-sortable-handle"><span>User Detail</span></h2>';
120
+ $template .= '<div class="inside">';
121
+ if( isset( $results_contact['contact'] ) && is_array( $results_contact['contact'] ) && !empty( $results_contact['contact'] ) ){
122
+ for ( $i = 0; $i < count( $results_contact["contact"] ); $i++ ) {
123
+ $template .= '<span class="result-candidate-span"><label>'. $results_contact["contact"][ $i ]["label"] .'</label><span>'. $results_contact["contact"][ $i ]["value"] .'</span></span>';
124
+ }
125
+ }else{
126
+ $template .= '<span class="result-candidate-span"><label>'. __( 'Name:', 'quiz-master-next' ) .'</label><span>'. $results_data->name .'</span></span>';
127
+ $template .= '<span class="result-candidate-span"><label>'. __( 'Business:', 'quiz-master-next' ) .'</label><span>'. $results_data->business .'</span></span>';
128
+ $template .= '<span class="result-candidate-span"><label>'. __( 'Phone:', 'quiz-master-next' ) .'</label><span>'. $results_data->phone .'</span></span>';
129
+ $template .= '<span class="result-candidate-span"><label>'. __( 'Email:', 'quiz-master-next' ) .'</label><span>'. $results_data->email .'</span></span>';
130
+ }
131
  $template .= '</div>';
132
  $template .= '</div>';
133
  $template .= '</div>';
228
  }
229
 
230
  // Prepare responses array.
231
+ $total_hidden_questions = 0;
232
  if ( is_serialized( $results_data->quiz_results ) && is_array( @unserialize( $results_data->quiz_results ) ) ) {
233
  $results = unserialize($results_data->quiz_results);
234
+ $total_hidden_questions = isset($results['hidden_questions']) ? count($results['hidden_questions']) : 0;
235
  if ( ! isset( $results["contact"] ) ) {
236
  $results["contact"] = array();
237
  }
263
  'total_points' => $results_data->point_score,
264
  'total_score' => $results_data->correct_score,
265
  'total_correct' => $results_data->correct,
266
+ 'total_questions' => $results_data->total - $total_hidden_questions,
267
  'comments' => isset( $results[2] ) ? $results[2] : '',
268
  'question_answers_array' => isset( $results[1] ) ? $results[1] : array(),
269
  'contact' => $results["contact"],
php/admin/admin-results-page.php CHANGED
@@ -343,6 +343,7 @@ function qsm_results_overview_tab_content() {
343
  }
344
  $mlw_complete_time = '';
345
  $mlw_qmn_results_array = @unserialize($mlw_quiz_info->quiz_results);
 
346
  if ( is_array( $mlw_qmn_results_array ) ) {
347
  $mlw_complete_hours = floor($mlw_qmn_results_array[0] / 3600);
348
  if ( $mlw_complete_hours > 0 ) {
@@ -355,7 +356,8 @@ function qsm_results_overview_tab_content() {
355
  $mlw_complete_seconds = $mlw_qmn_results_array[0] % 60;
356
  $mlw_complete_time .= "$mlw_complete_seconds seconds";
357
  }
358
-
 
359
  $quotes_list .= "<tr{$alternate}>";
360
  $quotes_list .= "<td><input type='checkbox' class='qmn_delete_checkbox' name='delete_results[]' value='".$mlw_quiz_info->result_id. "' /></td>";
361
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name . "</span><div class='row-actions'><span style='color:green;font-size:16px;'><a href='admin.php?page=qsm_quiz_result_details&&result_id=".$mlw_quiz_info->result_id."'>View</a> | <a style='color: red;' onclick=\"deleteResults('".$mlw_quiz_info->result_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='#'>Delete</a></span></div></td>";
@@ -364,7 +366,7 @@ function qsm_results_overview_tab_content() {
364
  $quotes_list .= "<td><span style='font-size:16px;'>".__('Not Graded','quiz-master-next' )."</span></td>";
365
  } else {
366
  if ( $mlw_quiz_info->quiz_system == 0 ) {
367
- $quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_quiz_info->correct ." out of ".$mlw_quiz_info->total." or ".$mlw_quiz_info->correct_score."%</span></td>";
368
  }
369
  if ( $mlw_quiz_info->quiz_system == 1 ) {
370
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->point_score . " Points</span></td>";
343
  }
344
  $mlw_complete_time = '';
345
  $mlw_qmn_results_array = @unserialize($mlw_quiz_info->quiz_results);
346
+ $hidden_questions = isset($mlw_qmn_results_array['hidden_questions']) ? count($mlw_qmn_results_array['hidden_questions']): 0;
347
  if ( is_array( $mlw_qmn_results_array ) ) {
348
  $mlw_complete_hours = floor($mlw_qmn_results_array[0] / 3600);
349
  if ( $mlw_complete_hours > 0 ) {
356
  $mlw_complete_seconds = $mlw_qmn_results_array[0] % 60;
357
  $mlw_complete_time .= "$mlw_complete_seconds seconds";
358
  }
359
+
360
+ $out_of_q = $mlw_quiz_info->total - $hidden_questions;
361
  $quotes_list .= "<tr{$alternate}>";
362
  $quotes_list .= "<td><input type='checkbox' class='qmn_delete_checkbox' name='delete_results[]' value='".$mlw_quiz_info->result_id. "' /></td>";
363
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name . "</span><div class='row-actions'><span style='color:green;font-size:16px;'><a href='admin.php?page=qsm_quiz_result_details&&result_id=".$mlw_quiz_info->result_id."'>View</a> | <a style='color: red;' onclick=\"deleteResults('".$mlw_quiz_info->result_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='#'>Delete</a></span></div></td>";
366
  $quotes_list .= "<td><span style='font-size:16px;'>".__('Not Graded','quiz-master-next' )."</span></td>";
367
  } else {
368
  if ( $mlw_quiz_info->quiz_system == 0 ) {
369
+ $quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_quiz_info->correct ." out of ".$out_of_q." or ".$mlw_quiz_info->correct_score."%</span></td>";
370
  }
371
  if ( $mlw_quiz_info->quiz_system == 1 ) {
372
  $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->point_score . " Points</span></td>";
php/admin/functions.php CHANGED
@@ -384,8 +384,8 @@ function qsm_create_new_quiz_wizard(){ ?>
384
  'option_name' => 'Require User Login',
385
  'value' => 0
386
  ),
387
- 'enable_result_after_timer_end' => array(
388
- 'option_name' => 'Force Submit',
389
  'value' => 0
390
  )
391
  ),
@@ -546,6 +546,7 @@ function qsm_create_new_quiz_wizard(){ ?>
546
  function qsm_text_template_variable_list(){
547
  $variable_list = array(
548
  '%POINT_SCORE%' => __('Score for the quiz when using points', 'quiz-master-next'),
 
549
  '%AVERAGE_POINT%' => __('The average amount of points user had per question', 'quiz-master-next'),
550
  '%AMOUNT_CORRECT%' => __('The number of correct answers the user had', 'quiz-master-next'),
551
  '%TOTAL_QUESTIONS%' => __('The total number of questions in the quiz', 'quiz-master-next'),
384
  'option_name' => 'Require User Login',
385
  'value' => 0
386
  ),
387
+ 'progress_bar' => array(
388
+ 'option_name' => 'Show progress bar',
389
  'value' => 0
390
  )
391
  ),
546
  function qsm_text_template_variable_list(){
547
  $variable_list = array(
548
  '%POINT_SCORE%' => __('Score for the quiz when using points', 'quiz-master-next'),
549
+ '%MAXIMUM_POINTS%' => __('Maximum possible points one can score', 'quiz-master-next'),
550
  '%AVERAGE_POINT%' => __('The average amount of points user had per question', 'quiz-master-next'),
551
  '%AMOUNT_CORRECT%' => __('The number of correct answers the user had', 'quiz-master-next'),
552
  '%TOTAL_QUESTIONS%' => __('The total number of questions in the quiz', 'quiz-master-next'),
php/admin/quizzes-page.php CHANGED
@@ -641,6 +641,7 @@ function qsm_generate_quizzes_surveys_page_screen_options(){
641
  }
642
 
643
  add_filter('set-screen-option', 'qsm_set_screen_option', 10, 3);
 
644
  /**
645
  * @since 7.0
646
  * @param str $status
641
  }
642
 
643
  add_filter('set-screen-option', 'qsm_set_screen_option', 10, 3);
644
+ add_filter('set_screen_option_qsm_per_page', 'qsm_set_screen_option', 10, 3);
645
  /**
646
  * @since 7.0
647
  * @param str $status
php/classes/class-qmn-quiz-manager.php CHANGED
@@ -87,8 +87,9 @@ class QMNQuizManager {
87
  }
88
  }
89
  }
90
- $json = array();
91
- $validate_file = wp_check_filetype( $_FILES["file"]["name"]);
 
92
  if ( isset( $validate_file['type'] ) && in_array($validate_file['type'], $mimes)) {
93
  if($_FILES["file"]['size'] >= $file_upload_limit * 1024 * 1024){
94
  $json['type']= 'error';
@@ -98,7 +99,7 @@ class QMNQuizManager {
98
  }
99
  $upload_dir = wp_upload_dir();
100
  $datafile = $_FILES["file"]["tmp_name"];
101
- $file_name = $_FILES["file"]["name"];
102
  $extension = pathinfo($file_name, PATHINFO_EXTENSION);
103
  $rawBaseName = 'qsmfileupload_' . md5( date('Y-m-d H:i:s') ) . '_' . pathinfo($file_name, PATHINFO_FILENAME);
104
  $new_fname = $rawBaseName . '.' . $extension;
@@ -286,7 +287,8 @@ class QMNQuizManager {
286
  'progress_bar' => $qmn_quiz_options->progress_bar,
287
  'contact_info_location' => $qmn_quiz_options->contact_info_location,
288
  'qpages' => $qpages,
289
- 'skip_validation_time_expire' => $qmn_quiz_options->skip_validation_time_expire
 
290
  );
291
 
292
  $return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
@@ -514,7 +516,7 @@ class QMNQuizManager {
514
  wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
515
  wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
516
  wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
517
- wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'enable_quick_result_mc' => isset($options->enable_quick_result_mc) ? $options->enable_quick_result_mc : '','enable_result_after_timer_end' => isset($options->enable_result_after_timer_end) ? $options->enable_result_after_timer_end : '', 'quick_result_correct_text' => sprintf('<b>%s</b> %s', __( 'Correct!', 'quiz-master-next' ), __('You have selected correct answer.', 'quiz-master-next')), 'quick_result_wrong_text' => sprintf('<b>%s</b> %s', __( 'Wrong!', 'quiz-master-next' ), __('You have selected wrong answer.', 'quiz-master-next')) ));
518
  wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
519
  global $qmn_total_questions;
520
  $qmn_total_questions = 0;
@@ -546,9 +548,9 @@ class QMNQuizManager {
546
  wp_reset_postdata();
547
  }
548
  $quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
549
- $quiz_display .= "<form name='quizForm{$quiz_data['quiz_id']}' id='quizForm{$quiz_data['quiz_id']}' action='' method='POST' class='qsm-quiz-form qmn_quiz_form mlw_quiz_form' novalidate enctype='multipart/form-data'>";
550
  $quiz_display .= "<input type='hidden' name='qsm_hidden_questions' id='qsm_hidden_questions' value=''>";
551
- $quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
552
  $quiz_display .= "<span id='mlw_top_of_quiz'></span>";
553
  $quiz_display = apply_filters('qmn_begin_quiz_form', $quiz_display, $options, $quiz_data);
554
 
@@ -569,7 +571,7 @@ class QMNQuizManager {
569
  $quiz_display .= $this->display_end_section($options, $quiz_data);
570
  }
571
  $quiz_display = apply_filters('qmn_before_error_message', $quiz_display, $options, $quiz_data);
572
- $quiz_display .= "<div name='mlw_error_message_bottom' id='mlw_error_message_bottom' class='qsm-error-message qmn_error_message_section'></div>";
573
  $quiz_display .= "<input type='hidden' name='total_questions' id='total_questions' value='$qmn_total_questions'/>";
574
  $quiz_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
575
  $quiz_display .= "<input type='hidden' name='timer_ms' id='timer_ms' value='0'/>";
@@ -612,7 +614,11 @@ class QMNQuizManager {
612
  ?>
613
  <section class="qsm-page <?php echo $animation_effect; ?>">
614
  <div class="quiz_section quiz_begin">
615
- <div class='qsm-before-message mlw_qmn_message_before'><?php echo $message_before; ?></div>
 
 
 
 
616
  <?php
617
  if (0 == $options->contact_info_location) {
618
  echo QSM_Contact_Manager::display_fields($options);
@@ -634,9 +640,13 @@ class QMNQuizManager {
634
  $message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $quiz_data);
635
  ?>
636
  <div class="quiz_section quiz_begin">
637
- <div class='qsm-before-message mlw_qmn_message_before'><?php echo $message_before; ?></div>
638
- <?php
639
- if (0 == $options->contact_info_location) {
 
 
 
 
640
  echo QSM_Contact_Manager::display_fields($options);
641
  }
642
  ?>
@@ -651,7 +661,7 @@ class QMNQuizManager {
651
  <?php
652
  echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
653
  if (0 == $question['comments']) {
654
- echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' x-webkit-speech id='mlwComment$question_id' name='mlwComment$question_id' value='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
655
  }
656
  if (2 == $question['comments']) {
657
  echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' onclick='qmnClearField(this)'>" . htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES) . "</textarea>";
@@ -711,7 +721,7 @@ class QMNQuizManager {
711
  <?php
712
  echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
713
  if (0 == $question['comments']) {
714
- echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' x-webkit-speech id='mlwComment$question_id' name='mlwComment$question_id' value='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
715
  }
716
  if (2 == $question['comments']) {
717
  echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' onclick='qmnClearField(this)'>" . htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES) . "</textarea>";
@@ -813,7 +823,7 @@ class QMNQuizManager {
813
  $message_before = wpautop(htmlspecialchars_decode($qmn_quiz_options->message_before, ENT_QUOTES));
814
  $message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $qmn_array_for_variables);
815
 
816
- $section_display .= "<div class='mlw_qmn_message_before'>$message_before</div>";
817
  if (0 == $qmn_quiz_options->contact_info_location) {
818
  $section_display .= QSM_Contact_Manager::display_fields($qmn_quiz_options);
819
  }
@@ -859,7 +869,7 @@ class QMNQuizManager {
859
  $question_display .= $mlwQuizMasterNext->pluginHelper->display_question($mlw_question->question_type_new, $mlw_question->question_id, $qmn_quiz_options);
860
 
861
  if (0 == $mlw_question->comments) {
862
- $question_display .= "<input type='text' class='mlw_qmn_question_comment' x-webkit-speech id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "' value='" . esc_attr(htmlspecialchars_decode($qmn_quiz_options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
863
  $question_display .= "<br />";
864
  }
865
  if (2 == $mlw_question->comments) {
@@ -1067,7 +1077,16 @@ class QMNQuizManager {
1067
  }
1068
  }
1069
  }
1070
-
 
 
 
 
 
 
 
 
 
1071
  $mlw_qmn_pagetime = isset($_POST["pagetime"]) ? $_POST["pagetime"] : array();
1072
  $mlw_qmn_timer = isset($_POST["timer"]) ? sanitize_text_field(intval($_POST["timer"])) : 0;
1073
  $mlw_qmn_timer_ms = isset($_POST["timer_ms"]) ? sanitize_text_field(intval($_POST["timer_ms"])) : 0;
@@ -1080,7 +1099,7 @@ class QMNQuizManager {
1080
 
1081
  if (!isset($_POST["mlw_code_captcha"]) || ( isset($_POST["mlw_code_captcha"]) && $_POST["mlw_user_captcha"] == $_POST["mlw_code_captcha"] )) {
1082
 
1083
- $qmn_array_for_variables = array_merge($qmn_array_for_variables, $this->check_answers($qmn_quiz_options, $qmn_array_for_variables));
1084
  $result_display = apply_filters('qmn_after_check_answers', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
1085
  $qmn_array_for_variables['comments'] = $this->check_comment_section($qmn_quiz_options, $qmn_array_for_variables);
1086
  $result_display = apply_filters('qmn_after_check_comments', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
@@ -1103,6 +1122,7 @@ class QMNQuizManager {
1103
  if(isset($results_array['parameters'])) {
1104
  $qmn_array_for_variables['parameters'] = $results_array['parameters'];
1105
  }
 
1106
  $serialized_results = serialize($results_array);
1107
 
1108
  // Inserts the responses in the database.
@@ -1153,6 +1173,7 @@ class QMNQuizManager {
1153
  );
1154
  $results_id = $wpdb->insert_id;
1155
  }
 
1156
 
1157
  // Determines redirect/results page.
1158
  $results_pages = $this->display_results_text($qmn_quiz_options, $qmn_array_for_variables);
@@ -1215,7 +1236,7 @@ class QMNQuizManager {
1215
  // Prepares data to be sent back to front-end.
1216
  $return_array = array(
1217
  'display' => htmlspecialchars_decode($result_display),
1218
- 'redirect' => $results_pages['redirect'],
1219
  );
1220
 
1221
  return $return_array;
@@ -1257,6 +1278,7 @@ class QMNQuizManager {
1257
  $correct_status = "incorrect";
1258
  $answer_points = 0;
1259
  $question_data = array();
 
1260
 
1261
  // Question types to calculate result on
1262
  $result_question_types = array(
@@ -1270,6 +1292,7 @@ class QMNQuizManager {
1270
  5, // Large Open Answer
1271
  7, // Number
1272
  14, // Fill In The Blank
 
1273
  );
1274
 
1275
  // If deprecated pagination setting is not used, use new system...
@@ -1281,47 +1304,64 @@ class QMNQuizManager {
1281
  // Cycle through each question on a page
1282
  foreach ($page as $page_question_id) {
1283
 
1284
- // Cycle through each question that appeared to the user
1285
  foreach ($question_list as $question_id) {
1286
 
1287
  // When the questions are the same...
1288
  if ($page_question_id == $question_id) {
1289
 
1290
- $question = $questions[$page_question_id];
1291
  // Ignore non points questions from result
1292
  $question_type_new = $question['question_type_new'];
1293
- if(!in_array($question_type_new,$result_question_types)) {
1294
- $total_questions--;
1295
- }
1296
- if(in_array($question_id,$quiz_data['hidden_questions'])) {
1297
- $total_questions--;
1298
- continue;
1299
- }
1300
 
1301
  // Reset question-specific variables
1302
  $user_answer = "";
1303
  $correct_answer = "";
1304
  $correct_status = "incorrect";
1305
  $answer_points = 0;
1306
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1307
  // Send question to our grading function
1308
- $results_array = apply_filters('qmn_results_array', $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']));
1309
- if($results_array['question_type'] == 'file_upload') {
1310
- $results_array['user_text'] = '<a target="_blank" href="'.$results_array['user_text'].'">Click here to view</a>';
1311
  }
1312
  // If question was graded correctly.
1313
  if (!isset($results_array["null_review"])) {
1314
  if(in_array($question_type_new,$result_question_types)) {
1315
- $points_earned += $results_array["points"];
1316
- $answer_points += $results_array["points"];
 
 
1317
  }
1318
 
1319
 
1320
  // If the user's answer was correct
1321
  if ('correct' == $results_array["correct"]) {
1322
  if(in_array($question_type_new,$result_question_types)) {
1323
- $total_correct += 1;
1324
- $correct_status = "correct";
 
 
1325
  }
1326
 
1327
  }
@@ -1375,7 +1415,24 @@ class QMNQuizManager {
1375
  $correct_answer = "";
1376
  $correct_status = "incorrect";
1377
  $answer_points = 0;
1378
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1379
  // Send question to our grading function
1380
  $results_array = $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']);
1381
 
@@ -1440,6 +1497,7 @@ class QMNQuizManager {
1440
  'total_questions' => $total_questions,
1441
  'question_answers_display' => '', // Kept for backwards compatibility
1442
  'question_answers_array' => $question_data,
 
1443
  );
1444
  }
1445
 
@@ -1808,6 +1866,20 @@ class QMNQuizManager {
1808
  require_once plugin_dir_path( __FILE__ ) . 'class-qmn-background-process.php';
1809
  $this->qsm_background_email = new QSM_Background_Request();
1810
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1811
  }
1812
 
1813
  global $qmnQuizManager;
87
  }
88
  }
89
  }
90
+ $json = array();
91
+ $file_name = sanitize_file_name( $_FILES["file"]["name"] );
92
+ $validate_file = wp_check_filetype( $file_name );
93
  if ( isset( $validate_file['type'] ) && in_array($validate_file['type'], $mimes)) {
94
  if($_FILES["file"]['size'] >= $file_upload_limit * 1024 * 1024){
95
  $json['type']= 'error';
99
  }
100
  $upload_dir = wp_upload_dir();
101
  $datafile = $_FILES["file"]["tmp_name"];
102
+ //$file_name = $_FILES["file"]["name"];
103
  $extension = pathinfo($file_name, PATHINFO_EXTENSION);
104
  $rawBaseName = 'qsmfileupload_' . md5( date('Y-m-d H:i:s') ) . '_' . pathinfo($file_name, PATHINFO_FILENAME);
105
  $new_fname = $rawBaseName . '.' . $extension;
287
  'progress_bar' => $qmn_quiz_options->progress_bar,
288
  'contact_info_location' => $qmn_quiz_options->contact_info_location,
289
  'qpages' => $qpages,
290
+ 'skip_validation_time_expire' => $qmn_quiz_options->skip_validation_time_expire,
291
+ 'timer_limit_val' => $qmn_quiz_options->timer_limit
292
  );
293
 
294
  $return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
516
  wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
517
  wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
518
  wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
519
+ wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'enable_quick_result_mc' => isset($options->enable_quick_result_mc) ? $options->enable_quick_result_mc : '','enable_result_after_timer_end' => isset($options->enable_result_after_timer_end) ? $options->enable_result_after_timer_end : '', 'quick_result_correct_text' => $options->quick_result_correct_answer_text, 'quick_result_wrong_text' => $options->quick_result_wrong_answer_text ));
520
  wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
521
  global $qmn_total_questions;
522
  $qmn_total_questions = 0;
548
  wp_reset_postdata();
549
  }
550
  $quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
551
+ $quiz_display .= "<form name='quizForm{$quiz_data['quiz_id']}' id='quizForm{$quiz_data['quiz_id']}' action='".$_SERVER['REQUEST_URI']."' method='POST' class='qsm-quiz-form qmn_quiz_form mlw_quiz_form' novalidate enctype='multipart/form-data'>";
552
  $quiz_display .= "<input type='hidden' name='qsm_hidden_questions' id='qsm_hidden_questions' value=''>";
553
+ $quiz_display .= "<div id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
554
  $quiz_display .= "<span id='mlw_top_of_quiz'></span>";
555
  $quiz_display = apply_filters('qmn_begin_quiz_form', $quiz_display, $options, $quiz_data);
556
 
571
  $quiz_display .= $this->display_end_section($options, $quiz_data);
572
  }
573
  $quiz_display = apply_filters('qmn_before_error_message', $quiz_display, $options, $quiz_data);
574
+ $quiz_display .= "<div id='mlw_error_message_bottom' class='qsm-error-message qmn_error_message_section'></div>";
575
  $quiz_display .= "<input type='hidden' name='total_questions' id='total_questions' value='$qmn_total_questions'/>";
576
  $quiz_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
577
  $quiz_display .= "<input type='hidden' name='timer_ms' id='timer_ms' value='0'/>";
614
  ?>
615
  <section class="qsm-page <?php echo $animation_effect; ?>">
616
  <div class="quiz_section quiz_begin">
617
+ <div class='qsm-before-message mlw_qmn_message_before'>
618
+ <?php
619
+ echo $this->qsm_convert_editor_text_to_shortcode( $message_before );
620
+ ?>
621
+ </div>
622
  <?php
623
  if (0 == $options->contact_info_location) {
624
  echo QSM_Contact_Manager::display_fields($options);
640
  $message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $quiz_data);
641
  ?>
642
  <div class="quiz_section quiz_begin">
643
+ <div class='qsm-before-message mlw_qmn_message_before'>
644
+ <?php
645
+ echo $this->qsm_convert_editor_text_to_shortcode( $message_before );
646
+ ?>
647
+ </div>
648
+ <?php
649
+ if (0 == $options->contact_info_location) {
650
  echo QSM_Contact_Manager::display_fields($options);
651
  }
652
  ?>
661
  <?php
662
  echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
663
  if (0 == $question['comments']) {
664
+ echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' value='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
665
  }
666
  if (2 == $question['comments']) {
667
  echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' onclick='qmnClearField(this)'>" . htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES) . "</textarea>";
721
  <?php
722
  echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
723
  if (0 == $question['comments']) {
724
+ echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' value='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
725
  }
726
  if (2 == $question['comments']) {
727
  echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' onclick='qmnClearField(this)'>" . htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES) . "</textarea>";
823
  $message_before = wpautop(htmlspecialchars_decode($qmn_quiz_options->message_before, ENT_QUOTES));
824
  $message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $qmn_array_for_variables);
825
 
826
+ $section_display .= "<div class='mlw_qmn_message_before'>". $this->qsm_convert_editor_text_to_shortcode( $message_before ) ."</div>";
827
  if (0 == $qmn_quiz_options->contact_info_location) {
828
  $section_display .= QSM_Contact_Manager::display_fields($qmn_quiz_options);
829
  }
869
  $question_display .= $mlwQuizMasterNext->pluginHelper->display_question($mlw_question->question_type_new, $mlw_question->question_id, $qmn_quiz_options);
870
 
871
  if (0 == $mlw_question->comments) {
872
+ $question_display .= "<input type='text' class='mlw_qmn_question_comment' id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "' value='" . esc_attr(htmlspecialchars_decode($qmn_quiz_options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
873
  $question_display .= "<br />";
874
  }
875
  if (2 == $mlw_question->comments) {
1077
  }
1078
  }
1079
  }
1080
+
1081
+ if( is_user_logged_in() ){
1082
+ $current_user = wp_get_current_user();
1083
+ if( $qmn_array_for_variables['user_email'] == 'None' )
1084
+ $qmn_array_for_variables['user_email'] = esc_html( $current_user->user_email );
1085
+
1086
+ if( $qmn_array_for_variables['user_name'] == 'None' )
1087
+ $qmn_array_for_variables['user_name'] = esc_html( $current_user->display_name );
1088
+ }
1089
+
1090
  $mlw_qmn_pagetime = isset($_POST["pagetime"]) ? $_POST["pagetime"] : array();
1091
  $mlw_qmn_timer = isset($_POST["timer"]) ? sanitize_text_field(intval($_POST["timer"])) : 0;
1092
  $mlw_qmn_timer_ms = isset($_POST["timer_ms"]) ? sanitize_text_field(intval($_POST["timer_ms"])) : 0;
1099
 
1100
  if (!isset($_POST["mlw_code_captcha"]) || ( isset($_POST["mlw_code_captcha"]) && $_POST["mlw_user_captcha"] == $_POST["mlw_code_captcha"] )) {
1101
 
1102
+ $qmn_array_for_variables = array_merge($qmn_array_for_variables, $this->check_answers($qmn_quiz_options, $qmn_array_for_variables));
1103
  $result_display = apply_filters('qmn_after_check_answers', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
1104
  $qmn_array_for_variables['comments'] = $this->check_comment_section($qmn_quiz_options, $qmn_array_for_variables);
1105
  $result_display = apply_filters('qmn_after_check_comments', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
1122
  if(isset($results_array['parameters'])) {
1123
  $qmn_array_for_variables['parameters'] = $results_array['parameters'];
1124
  }
1125
+ $results_array['hidden_questions'] = $qmn_array_for_variables['hidden_questions'];
1126
  $serialized_results = serialize($results_array);
1127
 
1128
  // Inserts the responses in the database.
1173
  );
1174
  $results_id = $wpdb->insert_id;
1175
  }
1176
+ $qmn_array_for_variables['result_id'] = $results_id;
1177
 
1178
  // Determines redirect/results page.
1179
  $results_pages = $this->display_results_text($qmn_quiz_options, $qmn_array_for_variables);
1236
  // Prepares data to be sent back to front-end.
1237
  $return_array = array(
1238
  'display' => htmlspecialchars_decode($result_display),
1239
+ 'redirect' => apply_filters('mlw_qmn_template_variable_results_page', $results_pages['redirect'], $qmn_array_for_variables),
1240
  );
1241
 
1242
  return $return_array;
1278
  $correct_status = "incorrect";
1279
  $answer_points = 0;
1280
  $question_data = array();
1281
+ $total_possible_points = 0;
1282
 
1283
  // Question types to calculate result on
1284
  $result_question_types = array(
1292
  5, // Large Open Answer
1293
  7, // Number
1294
  14, // Fill In The Blank
1295
+ 13 //Polar.
1296
  );
1297
 
1298
  // If deprecated pagination setting is not used, use new system...
1304
  // Cycle through each question on a page
1305
  foreach ($page as $page_question_id) {
1306
 
1307
+ // Cycle through each question that appeared to the user
1308
  foreach ($question_list as $question_id) {
1309
 
1310
  // When the questions are the same...
1311
  if ($page_question_id == $question_id) {
1312
 
1313
+ $question = $questions[$page_question_id];
1314
  // Ignore non points questions from result
1315
  $question_type_new = $question['question_type_new'];
1316
+ $hidden_questions = is_array($quiz_data['hidden_questions']) ? $quiz_data['hidden_questions']: array();
 
 
 
 
 
 
1317
 
1318
  // Reset question-specific variables
1319
  $user_answer = "";
1320
  $correct_answer = "";
1321
  $correct_status = "incorrect";
1322
  $answer_points = 0;
1323
+
1324
+ //Get total correct points
1325
+ if( ( $options->system == 3 || $options->system == 1 ) && isset($question['answers']) && !empty( $question['answers'] ) ){
1326
+ if(!in_array($question_id,$hidden_questions)) {
1327
+ if( $question_type_new == 4 || $question_type_new == 10 ){
1328
+ foreach ($question['answers'] as $single_answerk_key => $single_answer_arr) {
1329
+ if ( $options->system == 1 && isset( $single_answer_arr[1] ) ){
1330
+ $total_possible_points = $total_possible_points + $single_answer_arr[1];
1331
+ }
1332
+ if( $options->system == 3 && isset( $single_answer_arr[2] ) && $single_answer_arr[2] == 1 ){
1333
+ $total_possible_points = $total_possible_points + $single_answer_arr[1];
1334
+ }
1335
+ }
1336
+ }else{
1337
+ $max_value = max(array_column($question['answers'], '1'));
1338
+ $total_possible_points = $total_possible_points + $max_value;
1339
+ }
1340
+ }
1341
+ }
1342
+
1343
  // Send question to our grading function
1344
+ $results_array = apply_filters('qmn_results_array', $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']));
1345
+ if( isset($results_array['question_type']) && $results_array['question_type'] == 'file_upload') {
1346
+ $results_array['user_text'] = '<a target="_blank" href="'.$results_array['user_text'].'">' . __('Click here to view', 'quiz-master-next') . '</a>';
1347
  }
1348
  // If question was graded correctly.
1349
  if (!isset($results_array["null_review"])) {
1350
  if(in_array($question_type_new,$result_question_types)) {
1351
+ if(!in_array($question_id,$hidden_questions)) {
1352
+ $points_earned += $results_array["points"];
1353
+ $answer_points += $results_array["points"];
1354
+ }
1355
  }
1356
 
1357
 
1358
  // If the user's answer was correct
1359
  if ('correct' == $results_array["correct"]) {
1360
  if(in_array($question_type_new,$result_question_types)) {
1361
+ if(!in_array($question_id,$hidden_questions)) {
1362
+ $total_correct += 1;
1363
+ $correct_status = "correct";
1364
+ }
1365
  }
1366
 
1367
  }
1415
  $correct_answer = "";
1416
  $correct_status = "incorrect";
1417
  $answer_points = 0;
1418
+
1419
+ //Get total correct points
1420
+ if( ( $options->system == 3 || $options->system == 1 ) && isset($question['answers']) && !empty( $question['answers'] ) ){
1421
+ if( $question_type_new == 4 || $question_type_new == 10 ){
1422
+ foreach ($question['answers'] as $single_answerk_key => $single_answer_arr) {
1423
+ if ( $options->system == 1 && isset( $single_answer_arr[1] ) ){
1424
+ $total_possible_points = $total_possible_points + $single_answer_arr[1];
1425
+ }
1426
+ if( $options->system == 3 && isset( $single_answer_arr[2] ) && $single_answer_arr[2] == 1 ){
1427
+ $total_possible_points = $total_possible_points + $single_answer_arr[1];
1428
+ }
1429
+ }
1430
+ }else{
1431
+ $max_value = max(array_column($question['answers'], '1'));
1432
+ $total_possible_points = $total_possible_points + $max_value;
1433
+ }
1434
+ }
1435
+
1436
  // Send question to our grading function
1437
  $results_array = $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']);
1438
 
1497
  'total_questions' => $total_questions,
1498
  'question_answers_display' => '', // Kept for backwards compatibility
1499
  'question_answers_array' => $question_data,
1500
+ 'total_possible_points' => $total_possible_points
1501
  );
1502
  }
1503
 
1866
  require_once plugin_dir_path( __FILE__ ) . 'class-qmn-background-process.php';
1867
  $this->qsm_background_email = new QSM_Background_Request();
1868
  }
1869
+
1870
+ /**
1871
+ * Convert editor text into respective shortcodes
1872
+ *
1873
+ * @since 7.0.2
1874
+ * @param string $editor_text
1875
+ */
1876
+ public function qsm_convert_editor_text_to_shortcode( $editor_text ){
1877
+ global $wp_embed;
1878
+ $editor_text = $wp_embed->run_shortcode( $editor_text );
1879
+ $editor_text = preg_replace("/\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i","<iframe width=\"420\" height=\"315\" src=\"//www.youtube.com/embed/$1\" frameborder=\"0\" allowfullscreen></iframe>",$editor_text);
1880
+ $allowed_html = wp_kses_allowed_html( 'post' );
1881
+ return do_shortcode( wp_kses( $editor_text, $allowed_html ) );
1882
+ }
1883
  }
1884
 
1885
  global $qmnQuizManager;
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' placeholder="<?php echo htmlspecialchars_decode( $options->name_field_text, ENT_QUOTES ); ?>" 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' placeholder="<?php echo htmlspecialchars_decode( $options->business_field_text, ENT_QUOTES ); ?>" 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' placeholder="<?php echo htmlspecialchars_decode( $options->email_field_text, ENT_QUOTES ); ?>" 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='number' 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 ) ) {
@@ -124,12 +124,12 @@ class QSM_Contact_Manager {
124
  if ( ( 'true' === $fields[ $i ]["required"] || true === $fields[ $i ]["required"] ) && ! $fields_hidden ) {
125
  $class = 'mlwRequiredText qsm_required_text';
126
  }
127
- if($fields[ $i ]['use'] == 'phone'){
128
  $class = 'mlwRequiredNumber qsm_required_text';
129
  }
130
  ?>
131
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
132
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='<?php echo $fields[ $i ]['use'] == 'phone' ? 'number' : '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']; ?>" />
133
  <?php
134
  break;
135
 
@@ -139,7 +139,7 @@ class QSM_Contact_Manager {
139
  }
140
  ?>
141
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
142
- <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']; ?>" />
143
  <?php
144
  break;
145
 
@@ -148,7 +148,7 @@ class QSM_Contact_Manager {
148
  $class = 'mlwRequiredAccept qsm_required_accept';
149
  }
150
  ?>
151
- <input type='checkbox' id='contact_field_<?php echo $i; ?>' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='checked' />
152
  <label class='mlw_qmn_question qsm_question' for='contact_field_<?php echo $i; ?>'><?php echo $fields[ $i ]['label']; ?></label>
153
  <?php
154
  break;
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 ); ?>' 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 ); ?>' 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 ); ?>' 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='number' class='<?php echo esc_attr( $class ); ?>' name='mlwUserPhone' placeholder="<?php echo htmlspecialchars_decode( $options->phone_field_text, ENT_QUOTES ); ?>" value='' />
101
  <?php
102
  }
103
  } elseif ( ! empty( $fields ) && is_array( $fields ) ) {
124
  if ( ( 'true' === $fields[ $i ]["required"] || true === $fields[ $i ]["required"] ) && ! $fields_hidden ) {
125
  $class = 'mlwRequiredText qsm_required_text';
126
  }
127
+ if($fields[ $i ]['use'] == 'phone' && 'true' === $fields[ $i ]["required"] || true === $fields[ $i ]["required"] ){
128
  $class = 'mlwRequiredNumber qsm_required_text';
129
  }
130
  ?>
131
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
132
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='<?php echo $fields[ $i ]['use'] == 'phone' ? 'number' : 'text'; ?>' <?php if( $fields[ $i ]['use'] == 'phone' ){ ?> onkeydown="return event.keyCode !== 69" <?php } ?> class='<?php echo esc_attr( $class ); ?>' name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' placeholder="<?php echo $fields[ $i ]['label']; ?>" />
133
  <?php
134
  break;
135
 
139
  }
140
  ?>
141
  <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
142
+ <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='mlwEmail <?php echo esc_attr( $class ); ?>' name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' placeholder="<?php echo $fields[ $i ]['label']; ?>" />
143
  <?php
144
  break;
145
 
148
  $class = 'mlwRequiredAccept qsm_required_accept';
149
  }
150
  ?>
151
+ <input type='checkbox' id='contact_field_<?php echo $i; ?>' class='<?php echo esc_attr( $class ); ?>' name='contact_field_<?php echo $i; ?>' value='checked' />
152
  <label class='mlw_qmn_question qsm_question' for='contact_field_<?php echo $i; ?>'><?php echo $fields[ $i ]['label']; ?></label>
153
  <?php
154
  break;
php/classes/class-qsm-install.php CHANGED
@@ -1003,6 +1003,26 @@ class QSM_Install {
1003
  'default' => 'Hint'
1004
  );
1005
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1006
 
1007
  //Setting for animation
1008
  $field_array = array(
1003
  'default' => 'Hint'
1004
  );
1005
  $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
1006
+
1007
+ // Registers quick result correct answer setting
1008
+ $field_array = array(
1009
+ 'id' => 'quick_result_correct_answer_text',
1010
+ 'label' => __('Correct answer message', 'quiz-master-next'),
1011
+ 'type' => 'text',
1012
+ 'default' => 'Correct! You have selected correct answer.',
1013
+ 'tooltip' => __('Text to show when the selected option is correct answer.', 'quiz-master-next')
1014
+ );
1015
+ $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
1016
+
1017
+ // Registers quick result wrong answer setting
1018
+ $field_array = array(
1019
+ 'id' => 'quick_result_wrong_answer_text',
1020
+ 'label' => __('Incorrect answer message', 'quiz-master-next'),
1021
+ 'type' => 'text',
1022
+ 'default' => 'Wrong! You have selected wrong answer.',
1023
+ 'tooltip' => __('Text to show when the selected option is wrong answer.', 'quiz-master-next')
1024
+ );
1025
+ $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
1026
 
1027
  //Setting for animation
1028
  $field_array = array(
php/question-types.php CHANGED
@@ -122,7 +122,7 @@ function qmn_multiple_choice_display($id, $question, $answers)
122
  if($answerEditor === 'rich'){
123
  $question_display .= "<div class='qmn_mc_answer_wrap' id='question$id-$mlw_answer_total'>";
124
  }else{
125
- $question_display .= "<div class='qmn_mc_answer_wrap' id='question".$id."-".esc_attr($answer[0])."'>";
126
  }
127
  $question_display .= "<input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='". trim( htmlentities(esc_attr($answer[0])) ) ."' /> <label for='question".$id."_".$mlw_answer_total."'>". trim( htmlspecialchars_decode($answer[0], ENT_QUOTES) ) ."</label>";
128
  $question_display .= "</div>";
@@ -948,6 +948,10 @@ function qmn_horizontal_multiple_response_display($id, $question, $answers)
948
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
949
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
950
  //$question_title = apply_filters('the_content', $question);
 
 
 
 
951
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
952
  $question_display .= qsm_question_title_func($question, '', $new_question_title);
953
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
@@ -960,7 +964,7 @@ function qmn_horizontal_multiple_response_display($id, $question, $answers)
960
  if ($answer[0] != "")
961
  {
962
  $question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
963
- $question_display .= "<span class='mlw_horizontal_multiple'><input type='checkbox' name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."&nbsp;</label></span>";
964
  }
965
  }
966
  }
@@ -1224,7 +1228,9 @@ function qmn_polar_display($id, $question, $answers) {
1224
  } else {
1225
  $mlw_requireClass = "";
1226
  }
1227
- $question_title = "<div class='mlw_qmn_question polar-question-title'>". do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)) ."</div>";
 
 
1228
  $input_text .= "<div class='left-polar-title'>" . $answers[0][0] ."</div>";
1229
  $input_text .= "<div class='slider-main-wrapper'><input type='hidden' class='qmn_polar $mlw_requireClass' id='question" . $id . "' name='question" . $id . "' />";
1230
  $input_text .= '<div id="slider-'. $id .'"></div></div>';
@@ -1258,19 +1264,19 @@ function qmn_polar_review($id, $question, $answers) {
1258
  $return_array['question_text'] = str_replace("%POLAR_SLIDER%", "__________", do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
1259
  }
1260
  if (isset($_POST["question" . $id])) {
1261
- $decode_user_answer = sanitize_textarea_field(strval(stripslashes(htmlspecialchars_decode($_POST["question" . $id], ENT_QUOTES))));
1262
  $mlw_user_answer = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $decode_user_answer)));
1263
  } else {
1264
  $mlw_user_answer = " ";
1265
  }
1266
  $return_array['user_text'] = $mlw_user_answer;
1267
-
1268
  foreach($answers as $answer) {
1269
- $decode_correct_text = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
1270
- if (mb_strtoupper($return_array['user_text']) == mb_strtoupper( trim ($decode_correct_text) ) ) {
1271
- $return_array['correct'] = "correct";
1272
- $return_array['points'] = $answer[1];
1273
- break;
1274
  }
1275
  }
1276
  return $return_array;
122
  if($answerEditor === 'rich'){
123
  $question_display .= "<div class='qmn_mc_answer_wrap' id='question$id-$mlw_answer_total'>";
124
  }else{
125
+ $question_display .= "<div class='qmn_mc_answer_wrap' id='question".$id."-".str_replace(" ","-",esc_attr($answer[0]))."'>";
126
  }
127
  $question_display .= "<input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='". trim( htmlentities(esc_attr($answer[0])) ) ."' /> <label for='question".$id."_".$mlw_answer_total."'>". trim( htmlspecialchars_decode($answer[0], ENT_QUOTES) ) ."</label>";
128
  $question_display .= "</div>";
948
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
949
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
950
  //$question_title = apply_filters('the_content', $question);
951
+ $limit_multiple_response = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_multiple_response');
952
+ $limit_mr_text = '';
953
+ if($limit_multiple_response > 0)
954
+ $limit_mr_text = 'onchange="qsmCheckMR(this,'. $limit_multiple_response .')"';
955
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
956
  $question_display .= qsm_question_title_func($question, '', $new_question_title);
957
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
964
  if ($answer[0] != "")
965
  {
966
  $question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
967
+ $question_display .= "<span class='mlw_horizontal_multiple'><input type='checkbox' " . $limit_mr_text ." name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."&nbsp;</label></span>";
968
  }
969
  }
970
  }
1228
  } else {
1229
  $mlw_requireClass = "";
1230
  }
1231
+ $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
1232
+ $question_title = qsm_question_title_func($question, '', $new_question_title);
1233
+ //$question_title = "<div class='mlw_qmn_question polar-question-title'>". do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)) ."</div>";
1234
  $input_text .= "<div class='left-polar-title'>" . $answers[0][0] ."</div>";
1235
  $input_text .= "<div class='slider-main-wrapper'><input type='hidden' class='qmn_polar $mlw_requireClass' id='question" . $id . "' name='question" . $id . "' />";
1236
  $input_text .= '<div id="slider-'. $id .'"></div></div>';
1264
  $return_array['question_text'] = str_replace("%POLAR_SLIDER%", "__________", do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
1265
  }
1266
  if (isset($_POST["question" . $id])) {
1267
+ $decode_user_answer = sanitize_textarea_field( $_POST["question" . $id] );
1268
  $mlw_user_answer = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $decode_user_answer)));
1269
  } else {
1270
  $mlw_user_answer = " ";
1271
  }
1272
  $return_array['user_text'] = $mlw_user_answer;
1273
+ $return_array['points'] = $mlw_user_answer;
1274
  foreach($answers as $answer) {
1275
+ $decode_correct_text = $answer[1];
1276
+ $return_array['correct_text'] = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_correct_text ) ) );
1277
+ if ( $return_array['user_text'] == trim ($decode_correct_text) && isset($answer[2]) && $answer[2] == 1 ) {
1278
+ $return_array['correct'] = "correct";
1279
+ break;
1280
  }
1281
  }
1282
  return $return_array;
php/rest-api.php CHANGED
@@ -17,49 +17,66 @@ function qsm_register_rest_routes() {
17
  register_rest_route( 'quiz-survey-master/v1', '/questions/', array(
18
  'methods' => WP_REST_Server::READABLE,
19
  'callback' => 'qsm_rest_get_questions',
 
20
  ) );
21
  register_rest_route( 'quiz-survey-master/v1', '/questions/', array(
22
  'methods' => WP_REST_Server::CREATABLE,
23
  'callback' => 'qsm_rest_create_question',
 
 
 
24
  ) );
25
  register_rest_route( 'quiz-survey-master/v1', '/questions/(?P<id>\d+)', array(
26
  'methods' => WP_REST_Server::EDITABLE,
27
  'callback' => 'qsm_rest_save_question',
 
28
  ) );
29
  register_rest_route( 'quiz-survey-master/v1', '/questions/(?P<id>\d+)', array(
30
  'methods' => WP_REST_Server::READABLE,
31
  'callback' => 'qsm_rest_get_question',
 
32
  ) );
33
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/results', array(
34
  'methods' => WP_REST_Server::READABLE,
35
  'callback' => 'qsm_rest_get_results',
 
36
  ) );
37
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/results', array(
38
  'methods' => WP_REST_Server::EDITABLE,
39
  'callback' => 'qsm_rest_save_results',
 
40
  ) );
41
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/emails', array(
42
  'methods' => WP_REST_Server::READABLE,
43
  'callback' => 'qsm_rest_get_emails',
 
44
  ) );
45
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/emails', array(
46
  'methods' => WP_REST_Server::EDITABLE,
47
  'callback' => 'qsm_rest_save_emails',
 
 
 
48
  ) );
49
  //Register rest api to get quiz list
50
  register_rest_route('qsm', '/list_quiz', array(
51
  'methods' => 'GET',
52
  'callback' => 'qsm_get_basic_info_quiz',
 
53
  ));
54
  //Register rest api to get result of quiz
55
  register_rest_route('qsm', '/list_results/(?P<id>\d+)', array(
56
  'methods' => 'GET',
57
  'callback' => 'qsm_get_result_of_quiz',
 
58
  ));
59
  //Get questions for question bank
60
  register_rest_route( 'quiz-survey-master/v1', '/bank_questions/(?P<id>\d+)', array(
61
  'methods' => WP_REST_Server::READABLE,
62
  'callback' => 'qsm_rest_get_bank_questions',
 
 
 
63
  ) );
64
  }
65
 
17
  register_rest_route( 'quiz-survey-master/v1', '/questions/', array(
18
  'methods' => WP_REST_Server::READABLE,
19
  'callback' => 'qsm_rest_get_questions',
20
+ 'permission_callback' => '__return_true',
21
  ) );
22
  register_rest_route( 'quiz-survey-master/v1', '/questions/', array(
23
  'methods' => WP_REST_Server::CREATABLE,
24
  'callback' => 'qsm_rest_create_question',
25
+ 'permission_callback' => function () {
26
+ return current_user_can( 'edit_posts' );
27
+ }
28
  ) );
29
  register_rest_route( 'quiz-survey-master/v1', '/questions/(?P<id>\d+)', array(
30
  'methods' => WP_REST_Server::EDITABLE,
31
  'callback' => 'qsm_rest_save_question',
32
+ 'permission_callback' => '__return_true',
33
  ) );
34
  register_rest_route( 'quiz-survey-master/v1', '/questions/(?P<id>\d+)', array(
35
  'methods' => WP_REST_Server::READABLE,
36
  'callback' => 'qsm_rest_get_question',
37
+ 'permission_callback' => '__return_true',
38
  ) );
39
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/results', array(
40
  'methods' => WP_REST_Server::READABLE,
41
  'callback' => 'qsm_rest_get_results',
42
+ 'permission_callback' => '__return_true',
43
  ) );
44
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/results', array(
45
  'methods' => WP_REST_Server::EDITABLE,
46
  'callback' => 'qsm_rest_save_results',
47
+ 'permission_callback' => '__return_true',
48
  ) );
49
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/emails', array(
50
  'methods' => WP_REST_Server::READABLE,
51
  'callback' => 'qsm_rest_get_emails',
52
+ 'permission_callback' => '__return_true',
53
  ) );
54
  register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/emails', array(
55
  'methods' => WP_REST_Server::EDITABLE,
56
  'callback' => 'qsm_rest_save_emails',
57
+ 'permission_callback' => function () {
58
+ return current_user_can( 'edit_posts' );
59
+ }
60
  ) );
61
  //Register rest api to get quiz list
62
  register_rest_route('qsm', '/list_quiz', array(
63
  'methods' => 'GET',
64
  'callback' => 'qsm_get_basic_info_quiz',
65
+ 'permission_callback' => '__return_true',
66
  ));
67
  //Register rest api to get result of quiz
68
  register_rest_route('qsm', '/list_results/(?P<id>\d+)', array(
69
  'methods' => 'GET',
70
  'callback' => 'qsm_get_result_of_quiz',
71
+ 'permission_callback' => '__return_true',
72
  ));
73
  //Get questions for question bank
74
  register_rest_route( 'quiz-survey-master/v1', '/bank_questions/(?P<id>\d+)', array(
75
  'methods' => WP_REST_Server::READABLE,
76
  'callback' => 'qsm_rest_get_bank_questions',
77
+ 'permission_callback' => function () {
78
+ return current_user_can( 'edit_posts' );
79
+ }
80
  ) );
81
  }
82
 
php/shortcodes.php CHANGED
@@ -230,11 +230,11 @@ function qsm_display_popup_div( $return_display, $qmn_quiz_options, $qmn_array_f
230
  if($qmn_quiz_options->enable_result_after_timer_end == 0){
231
  $return_display .= '<div style="display: none;" class="qsm-popup qsm-popup-slide" id="modal-3" aria-hidden="false">';
232
  $return_display .= '<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close="">';
233
- $return_display .= '<div class="qsm-popup__container qmn_quiz_container" role="dialog" aria-modal="true" aria-labelledby="modal-3-title">';
234
- $return_display .= '<main class="qsm-popup__content">';
235
- $return_display .= '<img src="' . QSM_PLUGIN_URL . '/assets/clock.png' .'"/>';
236
  $return_display .= '<p class="qsm-time-up-text">Time is Up!</p>';
237
- $return_display .= '</main>';
238
  $return_display .= '<footer class="qsm-popup__footer"><button class="qsm-popup-secondary-button qmn_btn" data-micromodal-close="" aria-label="Close this dialog window">Cancel</button><button data-quiz_id="'. $qmn_quiz_options->quiz_id .'" class="submit-the-form qmn_btn">Submit Quiz</button></footer>';
239
  $return_display .= '</div>';
240
  $return_display .= '</div>';
230
  if($qmn_quiz_options->enable_result_after_timer_end == 0){
231
  $return_display .= '<div style="display: none;" class="qsm-popup qsm-popup-slide" id="modal-3" aria-hidden="false">';
232
  $return_display .= '<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close="">';
233
+ $return_display .= '<div class="qsm-popup__container qmn_quiz_container" role="dialog" aria-modal="true">';
234
+ $return_display .= '<div class="qsm-popup__content">';
235
+ $return_display .= '<img src="' . QSM_PLUGIN_URL . 'assets/clock.png' .'" alt="clock.png"/>';
236
  $return_display .= '<p class="qsm-time-up-text">Time is Up!</p>';
237
+ $return_display .= '</div>';
238
  $return_display .= '<footer class="qsm-popup__footer"><button class="qsm-popup-secondary-button qmn_btn" data-micromodal-close="" aria-label="Close this dialog window">Cancel</button><button data-quiz_id="'. $qmn_quiz_options->quiz_id .'" class="submit-the-form qmn_btn">Submit Quiz</button></footer>';
239
  $return_display .= '</div>';
240
  $return_display .= '</div>';
php/template-variables.php CHANGED
@@ -59,6 +59,7 @@ add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_facebook_shar
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('mlw_qmn_template_variable_results_page', 'qsm_variable_single_question_answer',10,2);
 
62
  add_filter('qmn_end_results', 'qsm_variable_poll_result',10,3);
63
 
64
  add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
@@ -130,6 +131,22 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
130
  return $content;
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  /**
134
  * Show poll result
135
  * @param str $content
@@ -361,6 +378,9 @@ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
361
  $logic_rules = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'logic_rules' );
362
  $logic_rules = unserialize( $logic_rules );
363
  $hidden_questions = isset($mlw_quiz_array['hidden_questions']) ? $mlw_quiz_array['hidden_questions'] : array();
 
 
 
364
 
365
  // Checks if the variable is present in the content.
366
  while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false ) {
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('mlw_qmn_template_variable_results_page', 'qsm_variable_single_question_answer',10,2);
62
+ add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_total_possible_points',10,2);
63
  add_filter('qmn_end_results', 'qsm_variable_poll_result',10,3);
64
 
65
  add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
131
  return $content;
132
  }
133
 
134
+ /**
135
+ * Replace total_possible_points variable with actual points
136
+ *
137
+ * @since 7.0.2
138
+ *
139
+ * @param string $content
140
+ * @param array $mlw_quiz_array
141
+ * @return string $content
142
+ */
143
+ function qsm_variable_total_possible_points( $content, $mlw_quiz_array ){
144
+ if( isset( $mlw_quiz_array["total_possible_points"] ) ){
145
+ $content = str_replace( "%MAXIMUM_POINTS%" , $mlw_quiz_array["total_possible_points"], $content);
146
+ }
147
+ return $content;
148
+ }
149
+
150
  /**
151
  * Show poll result
152
  * @param str $content
378
  $logic_rules = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'logic_rules' );
379
  $logic_rules = unserialize( $logic_rules );
380
  $hidden_questions = isset($mlw_quiz_array['hidden_questions']) ? $mlw_quiz_array['hidden_questions'] : array();
381
+ if(is_admin()) {
382
+ $hidden_questions = isset($mlw_quiz_array['results']['hidden_questions']) ? $mlw_quiz_array['results']['hidden_questions'] : array();
383
+ }
384
 
385
  // Checks if the variable is present in the content.
386
  while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false ) {
readme.txt CHANGED
@@ -1,42 +1,54 @@
1
- === Quiz And Survey Master - Best Quiz, Exam and Survey Plugin for WordPress ===
2
  Contributors: quizsurvey,expresstech
3
- Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress quiz plugin
4
  Requires at least: 4.9
5
  Tested up to: 5.5
6
  Requires PHP: 5.4
7
- Stable tag: 7.0.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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
 
18
- [youtube https://www.youtube.com/watch?v=DyiCCNnDpHk]
 
19
 
20
- = Easily Create Surveys For Your Users =
21
- You can easily create surveys for your users. Everything from customer satisfaction surveys to employee surveys.
22
 
23
- = Customize Your Text =
24
- All the text your users see can be **customized**. Everything from the text blocks throughout the quiz or survey to the submit button.
25
 
26
- = Different Types Of Questions =
27
- You can have **multiple choice** (radio buttons), **true and false**, **open answer** question, **drop down**, **multiple response** (checkboxes), **fill in the blank**, **number**, **captcha**, and **accept**. More types are being supported in future updates!
28
 
29
- = Multiple Results Pages For Each Quiz =
30
- Each quiz or survey can have **unlimited** results pages that can be customized with your text. Show different results pages based on the users score!
31
 
32
- = Emails After Completion Of Quiz And Survey =
33
  After the user takes a quiz or survey, you can have the plugin email you and the user with results. This too can be customized with your own text.
34
 
35
- = Very Flexible =
36
  Your quiz or survey can be graded with an incorrect/correct system or a points-based system. Or not at all. You ask for contact information at the beginning or the end and you decide which contact fields are required. You can decide to use all the questions or only a select few chosen at random. You can also set the number of questions per page or have all the questions on one page.
37
 
38
  = Categories =
39
- You can assign categories to your questions. You can then show the user their score in a **particular** category or an average score of the categories.
 
 
 
 
 
 
40
 
41
  = Other Useful Features =
42
 
@@ -56,11 +68,8 @@ You can assign categories to your questions. You can then show the user their sc
56
  * Create and display math formulas
57
  * And **Much** More...
58
 
59
- = Make Suggestions Or Contribute =
60
- Quiz And Survey Master is on [GitHub](https://github.com/QuizandSurveyMaster/quiz_master_next/)!
61
-
62
- = Quiz And Survey Master Add-ons =
63
- While Quiz And Survey Master is fully functional and is packed full of features that will meet the needs of most, we do offer various extra features including:
64
 
65
  **Free Add-ons**
66
 
@@ -79,11 +88,16 @@ While Quiz And Survey Master is fully functional and is packed full of features
79
  * [MailChimp Integration](https://quizandsurveymaster.com/downloads/mailchimp-integration/?utm_source=readme&utm_medium=plugin&utm_content=mailchimp-integration&utm_campaign=qsm_plugin)
80
  * And **many** more available in our [Quiz And Survey Master Addon Store](https://quizandsurveymaster.com/addons/?utm_source=readme&utm_medium=plugin&utm_content=all-addons&utm_campaign=qsm_plugin)
81
 
82
- **About Us**
83
- QSM is a WordPress Quiz Plugin which is owned completely by [ExpressTech](https://expresstech.io)
 
 
 
 
 
 
 
84
 
85
- **Facebook Group**
86
- Join our [offical FB group](https://www.facebook.com/groups/516958552587745) for quicker response time on your technical queries
87
 
88
  == Installation ==
89
 
@@ -121,6 +135,28 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
121
 
122
  == Changelog ==
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  = 7.0.1 (August 05, 2020) =
125
  * Enhancement: Added option to set items per page while adding questions from question bank.
126
  * Enhancement: Hide question description by default or when empty.
1
+ === WordPress Quiz Plugin - Quiz And Survey Master ===
2
  Contributors: quizsurvey,expresstech
3
+ Tags: quiz, survey, wordpress quiz plugin, exam, quiz builder
4
  Requires at least: 4.9
5
  Tested up to: 5.5
6
  Requires PHP: 5.4
7
+ Stable tag: 7.0.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Create user-friendly and beautiful quizzes and surveys using Wordpress Quiz Plugin. Boost traffic and social shares on your website.
12
 
13
  == Description ==
14
 
15
  = Demoes! =
16
+ * [Sample Quiz](https://quizandsurveymaster.com/quiz/sample-quiz/?utm_source=readme&utm_medium=plugin&utm_content=sample-quiz&utm_campaign=qsm_plugin)
17
+ * [Sample Survey](https://quizandsurveymaster.com/quiz/sample-survey/?utm_source=readme&utm_medium=plugin&utm_content=sample-survey&utm_campaign=qsm_plugin)
18
+ * [Personality Quiz](https://quizandsurveymaster.com/quiz/personality-quiz/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin)
19
+ * [Quiz with Leaderboard](https://demo.quizandsurveymaster.com/advanced-leaderboard-demo/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin)
20
+ * [Popup Quiz](https://quizandsurveymaster.com/simple-popup-demo/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin)
21
+ * [Flashcards](https://demo.quizandsurveymaster.com/flash-card-demo/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin)
22
+ * [Paid Quiz](https://demo.quizandsurveymaster.com/payment-integration-demo/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin)
23
 
24
+ = Easily Create Quiz or Surveys For Your Users =
25
+ Quiz and Survey Master is the easiest [WordPress Quiz Plugin](https://quizandsurveymaster.com/) which can be used to create engaging content to drive traffic and increase user engagement. Everything from viral quiz, trivia quiz, customer satisfaction surveys to employee surveys. This plugin is the ultimate marketing tool for your website.
26
 
27
+ [youtube https://www.youtube.com/watch?v=DyiCCNnDpHk]
 
28
 
29
+ = Customize Text =
30
+ You can customized anything your users will see and engage with. Everything from the text blocks throughout the quiz or survey to the submit button. You can even "template variables" to generate personalized text for your users.
31
 
32
+ = Question Types =
33
+ You can have **multiple choice** (radio buttons), **true and false**, **open answer** question, **drop down**, **multiple response** (checkboxes), **fill in the blank**, **number**, **captcha**, **polar** (slider) and **accept**. We release more questions types with every major release.
34
 
35
+ = Customize Results Based on Score =
36
+ Using our quiz builder plugin, you can customize the results page based on the user's score.
37
 
38
+ = Emails After Quiz =
39
  After the user takes a quiz or survey, you can have the plugin email you and the user with results. This too can be customized with your own text.
40
 
41
+ = Flexibility =
42
  Your quiz or survey can be graded with an incorrect/correct system or a points-based system. Or not at all. You ask for contact information at the beginning or the end and you decide which contact fields are required. You can decide to use all the questions or only a select few chosen at random. You can also set the number of questions per page or have all the questions on one page.
43
 
44
  = Categories =
45
+ You can assign categories to your questions using our quiz maker plugin. You can then show the user their score in a **particular** category or an average score of the categories.
46
+
47
+ = Countdown Timer =
48
+ Add countdown timer to your quizzes and effectively create skills assessment or online exams on your website.
49
+
50
+ = Integrations =
51
+ You can integrate Mailchimp, Activecampaign, Zapier, Campaign Monitor, Get Response to your quiz or surveys in order to create drip email campaigns and reachout to your audience. Checkout our [integrations](https://quizandsurveymaster.com/downloads/category/integrations/).
52
 
53
  = Other Useful Features =
54
 
68
  * Create and display math formulas
69
  * And **Much** More...
70
 
71
+ = Pro Addons =
72
+ Quiz And Survey Master is fully functional and is packed with tons of features that will meet the needs of most, we do offer various extra features including:
 
 
 
73
 
74
  **Free Add-ons**
75
 
88
  * [MailChimp Integration](https://quizandsurveymaster.com/downloads/mailchimp-integration/?utm_source=readme&utm_medium=plugin&utm_content=mailchimp-integration&utm_campaign=qsm_plugin)
89
  * And **many** more available in our [Quiz And Survey Master Addon Store](https://quizandsurveymaster.com/addons/?utm_source=readme&utm_medium=plugin&utm_content=all-addons&utm_campaign=qsm_plugin)
90
 
91
+ **Reachout to us**
92
+ * You can contact our pro support via our [Contact Form](https://quizandsurveymaster.com/contact-support/) or use the WordPress form for free plugin support. We are equally active on both places.
93
+ * Join our [official FB group](https://www.facebook.com/groups/516958552587745).
94
+ * Quiz And Survey Master on [GitHub](https://github.com/QuizandSurveyMaster/quiz_master_next/)!
95
+
96
+ = Comparison with other Quiz Plugins =
97
+ * Quiz cat (quizcat) - We offer a lot more questions types than just viral quiz and multiple choice. We provide a tons of integrations to help you automate your marketing campaign.
98
+ * HD Quiz - Mainly used for viral and trivial questions types. We are in process of creating these question types.
99
+ * WP Quiz Plugin - Again, mainly used for viral question types. We will release this by the end of this month.
100
 
 
 
101
 
102
  == Installation ==
103
 
135
 
136
  == Changelog ==
137
 
138
+ = 7.0.2 (August 18, 2020) =
139
+ * Enhancement: Checked compatibility with WordPress 5.5.
140
+ * Enhancement: Added option to customize the inline correct/incorrect messages.
141
+ * Enhancement: Added video, audio, youtube and gallery support while displaying message before quiz.
142
+ * Enhancement: Added support of template variables when redirecting to result page.
143
+ * Enhancement: Added new template variable %MAXIMUM_POINTS% to display the maximum possible points per quiz.
144
+ * Enhancement: Added option to select quiz in Gutenberg block editor.
145
+ * Enhancement: Email and name fields will be captured automatically for logged in user.
146
+ * Enhancement: Upgraded user interface of addons settinga page.
147
+ * Bug: Fixed score calculation issues.
148
+ * Bug: Fixed issues while editing quiz's text tab.
149
+ * Bug: Fixed issue where question title not showing for Polar question type.
150
+ * Bug: Fixed calculation issues while using Polar question type.
151
+ * Bug: Fixed validation issues with phone field in contact tab.
152
+ * Bug: Fixed issue where option to limit choices was not working for horizontal multiple response question type.
153
+ * Bug: Fixed security vulnerability (discovered by NinTechNet).
154
+ * Bug: Fixed issue where number of items per page was not working on Quizzes/Surveys page.
155
+ * Bug: Fixed issue with required checkbox while editing questions.
156
+ * Bug: Fixed extra contact field were not showing in admin result new template.
157
+ * Bug: Fixed issues with the title while retaking a quiz.
158
+ * Bug: Fixed issue where category not assigning while editing the question.
159
+
160
  = 7.0.1 (August 05, 2020) =
161
  * Enhancement: Added option to set items per page while adding questions from question bank.
162
  * Enhancement: Hide question description by default or when empty.