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

Version Description

(June 21, 2021) = * Feature: Introduced QSM Themes. * Feature: Introduced image type answers. * Bug: Fixed issue where there is an empty last page while using auto pagination.

Download this release

Release Info

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

Code changes from version 7.1.19 to 7.2.0

assets/screenshot-default-theme.png ADDED
Binary file
css/admin-dashboard.css CHANGED
@@ -1,495 +1,1136 @@
1
  .welcome-panel-column .dashicons {
2
- /* font-size: 30px; */
3
- color: #606a73;
4
- font-size: 23px;
5
- margin-right: 5px;
6
- position: relative;
7
- top: -3px;
8
- }
9
- .welcome-panel .qsm-welcome-panel-close{
10
- position: absolute;
11
- top: -20px;
12
- right: 10px;
13
- padding: 10px 15px 10px 21px;
14
- font-size: 13px;
15
- line-height: 1.23076923;
16
- text-decoration: none;
17
- }
18
- .welcome-panel .qsm-welcome-panel-dismiss{
19
- position: absolute;
20
- bottom: 10px;
21
- right: 10px;
22
- padding: 10px 15px 10px 21px;
23
- font-size: 13px;
24
- line-height: 1.23076923;
25
- text-decoration: none;
26
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  .welcome-panel .qsm-welcome-panel-dismiss:before {
28
- background: 0 0;
29
- color: #72777c;
30
- content: "\f153";
31
- display: block;
32
- font: normal 16px/20px dashicons;
33
- speak: none;
34
- height: 20px;
35
- text-align: center;
36
- width: 20px;
37
- -webkit-font-smoothing: antialiased;
38
- -moz-osx-font-smoothing: grayscale;
39
- position: absolute;
40
- top: 9px;
41
- left: 0;
42
- transition: all .1s ease-in-out;
43
  }
 
44
  .welcome-panel .qsm-welcome-panel-dismiss:hover:before {
45
- color: #c00;
46
  }
47
- .welcome-panel .qsm-welcome-panel-close img{
48
- width: 100px;
 
49
  }
50
- .welcome-panel .welcome-panel-close:before{
51
- content: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
- .welcome-panel .current_version{
54
- color: #344AD4;
55
- text-align: center;
56
- font-size: 16px;
57
- font-weight: bold;
58
- margin: 0;
59
- padding: 0;
60
- position: relative;
61
- top: -30px;
62
  }
63
- .popuar-addon-ul{
64
- columns: 2;
65
- -webkit-columns: 2;
66
- -moz-columns: 2;
 
67
  }
68
- .popuar-addon-ul li img{
69
- max-width: 100%;
 
70
  }
 
71
  .pa-all-addon {
72
- text-align: right;
73
- margin-bottom: 10px;
74
  }
75
- .pa-all-addon a{
76
- text-decoration: none;
77
- font-size: 14px;
78
- font-weight: bold;
 
79
  }
 
80
  .what-new-ul li {
81
- margin-bottom: 20px;
82
- border-bottom: 1px solid #ccbfbf;
83
- padding-bottom: 20px;
84
- }
85
- .what-new-ul li:last-child{
86
- border-bottom: medium none;
87
- margin-bottom: 0;
88
- padding-bottom: 0;
89
- }
90
- .what-new-ul li a{
91
- font-size: 14px;
92
- color: #222;
93
- font-weight: 500;
94
- transition: 0.2 all;
95
- -webkit-transition: 0.2 all;
96
- -ms-transition: 0.2 all;
97
- }
98
- .what-new-ul li a:hover{
99
- color: #0073aa;
100
- }
101
- .what-new-ul li .post-description{
102
- margin-top: 10px;
103
- }
104
- .what-new-ul li .post-description p{
105
- margin: 0;
106
- padding: 0;
107
- }
108
- .changelog-ul li{
109
- border-bottom: 1px solid #ede8e8;
110
- padding-bottom: 10px;
111
- margin-bottom: 10px;
112
- }
113
- .changelog-ul li:last-child{
114
- border-bottom: medium none;
115
- padding-bottom: 0;
116
- margin-bottom: 0;
117
- }
118
- .changelog-ul li span{
119
- padding: 3px 5px;
120
- border-radius: 5px;
121
- display: inline-block;
122
- color: #fff;
123
- }
124
- .changelog-ul li .enhancement{
125
- background: #FEB325;
126
- }
127
- .changelog-ul li .bug{
128
- background: #FE2525;
129
- }
130
- .changelog-ul li .feature{
131
- background: #25BDFE;
132
- }
133
- .recently-taken-quiz-ul li{
134
- position: relative;
135
- min-height: 50px;
136
- margin: 0;
137
- border-bottom: 1px solid #ede8e8;
138
- padding: 0 12px 12px 0;
139
- margin-bottom: 20px;
140
- }
141
- .recently-taken-quiz-ul li:last-child{
142
- margin-bottom: 0;
143
- border-bottom: medium none;
144
- padding-bottom: 0;
145
- }
146
- .recently-taken-quiz-ul li img.avatar{
147
- position: absolute;
148
- top: 0px;
149
- width: 60px;
150
- }
151
- .recently-taken-quiz-ul li .row-actions-c{
152
- margin: 0;
153
- padding: 0;
154
- visibility: hidden;
155
- }
156
- .recently-taken-quiz-ul li .row-actions-c .rtq-delete-result{
157
- color: #a00;
158
- }
159
- .recently-taken-quiz-ul li:hover .row-actions-c{
160
- visibility: visible;
161
- }
162
- .recently-taken-quiz-ul li .rtq-main-wrapper{
163
- padding-left: 75px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
 
165
  .recently-taken-quiz-ul li .rtq-main-wrapper .rtq_user_info,
166
- .recently-taken-quiz-ul li .rtq-main-wrapper .rtq-result-info{
167
- display: block;
168
- margin-bottom: 3px;
169
  }
 
170
  .recently-taken-quiz-ul li .rtq-main-wrapper span {
171
- font-size: 14px;
172
- color: #837878;
173
  }
174
- .recently-taken-quiz-ul li .rtq-main-wrapper .rtq_user_info a:first-child{
175
- text-transform: capitalize;
 
176
  }
177
 
178
  /**
179
  * QSM Quiz Wizard
180
  */
181
- #model-wizard .qsm-popup__container{
182
- padding: 0;
183
- background: #F3F3F3;
184
- min-width: 70vw;
185
- max-width: 1040px;
186
- border-radius: 0;
187
- max-height: 85vh;
188
- overflow: hidden;
189
- position: relative;
190
- }
191
- #model-wizard .qsm-popup__content{
192
- margin: 0;
193
- max-height: 65vh;
194
- overflow-y: auto;
195
- padding-bottom: 59px;
196
- }
197
- #model-wizard .qsm-popup__header{
198
- background: #fff;
199
- padding: 20px 10px 20px 10px;
200
- border-bottom: 1px solid #dfd4d4;
201
- }
202
- #model-wizard .qsm-popup__title{
203
- font-size: 24px;
204
- color: #515559;
205
- font-weight: normal;
206
- }
207
- #model-wizard .qsm-popup__content .qsm-wizard-template-section{
208
- width: 65%;
209
- padding: 35px 20px 20px 20px;
210
- border-right: 1px solid #dfd4d4;
211
- float: left;
212
- box-sizing: border-box;
213
- }
214
- #model-wizard .qsm-popup__content .quiz_name{
215
- width: 100%;
216
- padding: 5px 10px 5px 10px;
217
- border-radius: 0;
218
- border: 1px solid #dfd4d4;
219
- }
220
- #model-wizard .qsm-popup__content .quiz_name.qsm-required{
221
- border-color: #ff0000;
222
- outline: none !important;
223
- box-shadow: none;
224
- }
225
- #model-wizard .qsm-popup__content .template-inner-wrap h6{
226
- font-size: 15px;
227
- margin-top: 30px;
228
- margin-bottom: 10px;
229
- text-transform: uppercase;
230
- }
231
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list{
232
- width: 100%;
233
- display: inline-block;
234
- }
235
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner{
236
- width: 31%;
237
- margin-right: 2%;
238
- float: left;
239
- border: 1px solid #dfd4d4;
240
- height: 210px;
241
- text-align: center;
242
- margin-bottom: 2%;
243
- position: relative;
244
- cursor: pointer;
245
- box-sizing: border-box;
246
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:hover,
248
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.selected-quiz-template{
249
- border-color: #1E8CBE;
250
- -webkit-box-shadow: -2px -1px 13px -1px rgba(30,140,190,1);
251
- -moz-box-shadow: -2px -1px 13px -1px rgba(30,140,190,1);
252
- box-shadow: -2px -1px 13px -1px rgba(30,140,190,1);
253
- transition: 0.2s all;
254
- -ms-transition: 0.2s all;
255
- -o-transition: 0.2s all;
256
- -webkit-transition: 0.2s all;
257
- }
258
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n+3){
259
- width: 33%;
260
- margin-right: 0%;
261
- }
262
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .template-center-vertical{
263
- /*position: absolute;
 
 
264
  top: 50%;
265
  left: 50%;
266
  -ms-transform: translate(-50%, -50%);
267
  transform: translate(-50%, -50%); */
268
- margin-top: 21px;
269
- height: 96px;
270
  }
271
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:first-child .template-center-vertical{
272
- height: auto;
273
- position: absolute;
274
- top: 50%;
275
- left: 50%;
276
- -ms-transform: translate(-50%, -50%);
277
- transform: translate(-50%, -50%);
278
- margin-top: 0;
279
- }
280
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .dashicons{
281
- font-size: 75px;
282
- color: #9EA3A8;
283
- display: inline-block;
284
- height: auto;
285
- width: auto;
286
- }
287
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner p.start_scratch{
288
- font-size: 14px;
289
- text-transform: uppercase;
290
- letter-spacing: 1px;
291
- color: #9EA3A8;
292
- }
293
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner h3{
294
- margin: 0;
295
- padding: 10px;
296
- border-top: 1px solid #dfd4d4;
297
- font-size: 15px;
298
- position: absolute;
299
- width: 100%;
300
- box-sizing: border-box;
301
- bottom: 0;
302
- }
303
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.inner-json{
304
- background: #fff;
305
- }
306
- #model-wizard .qsm-popup__footer{
307
- text-align: right;
308
- background: #fff;
309
- padding: 15px;
310
- border-top: 1px solid #dfd4d4;
311
- margin-top: -4px;
312
- position: absolute;
313
- bottom: 0;
314
- width: 100%;
315
- box-sizing: border-box;
316
- }
317
- #model-wizard .qsm-popup__close{
318
- cursor: pointer;
319
- font-size: 20px;
320
- color: #515559;
321
- margin-right: 10px;
322
- }
323
- #model-wizard .qsm-wizard-setting-section{
324
- background: #fff;
325
- width: 35%;
326
- float: left;
327
- }
328
- #new-quiz-form{
329
- display: inline-block;
330
- width: 100%;
331
- }
332
- #model-wizard .qsm-wizard-setting-section .ui-accordion .ui-accordion-header{
333
- background: #fff;
334
- color: #000;
335
- border-radius: 0;
336
- border: none;
337
- font-size: 16px;
338
- font-weight: bold;
339
- padding-left: 20px;
340
- border-bottom: 1px solid #dfd4d4;
341
- padding-right: 20px;
342
- outline: 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  }
 
 
 
 
 
 
 
 
 
 
344
  #accordion .ui-accordion-header-icon {
345
- position: absolute;
346
- right: 24px;
347
- top: 15px;
348
  }
349
- #accordion.ui-accordion .ui-accordion-content{
350
- border: medium none;
351
- border-bottom: 1px solid #dfd4d4;
352
- padding: 20px;
 
353
  }
 
354
  #accordion .ui-icon.iconOpen {
355
- background:url('../assets/up-1.png') no-repeat !important;
356
- background-size: cover !important;
357
  }
 
358
  #accordion .ui-icon.iconClosed {
359
- background: url(../assets/down-1.png) no-repeat !important;
360
- background-size: cover !important;
361
  }
 
362
  #accordion .ui-accordion-header:focus {
363
- outline:0 !important;
364
- border: none !important;
365
  }
366
- #quiz_settings_wrapper tr{
367
- /*display: inline-block;*/
368
- width: 100%;
 
369
  }
 
370
  #quiz_settings_wrapper tr th,
371
- #quiz_settings_wrapper tr td{
372
- width: 100%;
373
- display: inline-block;
374
- box-sizing: border-box;
375
- clear: both;
376
- text-align: left;
377
  }
378
- #quiz_settings_wrapper tr td{
379
- padding: 10px 0 20px 0;
 
380
  }
 
381
  #quiz_settings_wrapper tr:last-child td {
382
- padding-bottom: 0;
383
  }
384
- #quiz_settings_wrapper tr td label{
385
- margin-right: 15px;
386
- font-size: 14px;
 
387
  }
388
- #quiz_settings_wrapper tr th label{
389
- font-size: 14px;
390
- font-weight: bold;
 
391
  }
392
- #recomm_addons_wrapper ul{
393
- columns: 2;
394
- -webkit-columns: 2;
395
- -moz-columns: 2;
 
396
  }
397
- #recomm_addons_wrapper ul li{
398
- position: relative;
 
399
  }
400
- #recomm_addons_wrapper ul li span.ra-attr{
401
- position: absolute;
402
- right: 0;
403
- padding: 5px;
404
- font-size: 10px;
405
- color: #fff;
406
- background: gray;
407
- border-radius: 5px;
408
- top: 0;
409
- text-transform: capitalize;
 
410
  }
411
- #recomm_addons_wrapper ul li span.ra-attr.qra-att-recommended{
412
- background: #25BDFE;
 
413
  }
414
- #recomm_addons_wrapper ul li span.ra-attr.qra-att-required{
415
- background: #31B400;
 
416
  }
417
- #recomm_addons_wrapper ul li img{
418
- max-width: 100%;
 
419
  }
420
- #quiz_settings_wrapper .qsm-opt-tr .qsm-tooltips-icon{
421
- display: none;
 
422
  }
 
423
  div#quiz_settings_wrapper #timer_limit {
424
- width: 100px;
425
  }
426
- .postbox .handlediv{
427
- position: absolute;
428
- right: 0;
 
429
  }
 
430
  h2.hndle.ui-sortable-handle {
431
- border-bottom: 1px solid #ccd0d4;
432
- }
433
- @media screen and (min-width: 1200px){
434
- #quiz_settings_wrapper tr td fieldset > br{
435
- display: none;
436
- }
437
- }
438
- @media (min-width: 768px) and (max-width: 1200px){
439
- #quiz_settings_wrapper tr td label{
440
- vertical-align: top;
441
- margin-bottom: 15px;
442
- display: inline-block;
443
- }
444
- #model-wizard .qsm-popup__container{
445
- width: 90%;
446
- }
447
- }
448
- @media (min-width: 768px) and (max-width: 991px){
449
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner{
450
- width: 48%;
451
- }
452
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n+2){
453
- margin-right: 0;
454
- width: 50%;
455
- }
456
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n+3){
457
- margin-right: 2%;
458
- width: 48%;
459
- }
460
- }
461
- @media screen and (max-width: 767px){
462
- #model-wizard .qsm-popup__container{
463
- width: 90%;
464
- }
465
- #model-wizard .qsm-popup__content .qsm-wizard-template-section{
466
- width: 100%;
467
- }
468
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n+2),
469
- #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner{
470
- width: 100% !important;
471
- }
472
- #model-wizard .qsm-wizard-setting-section{
473
- width: 100%;
474
- height: auto !important;
475
- }
476
- #quiz_settings_wrapper tr td label{
477
- margin-bottom: 20px;
478
- display: inline-block;
479
- vertical-align: top;
480
- }
481
- #model-wizard .qsm-popup__title{
482
- font-size: 16px;
483
- }
484
- .welcome-panel h2{
485
- width: calc(100% - 100px);
486
- }
487
- }
488
- @media only screen and (max-width: 1800px) and (min-width: 1500px){
489
- #wpbody-content #dashboard-widgets #postbox-container-1 {
490
- width: 50%;
491
- }
492
- #wpbody-content #dashboard-widgets #postbox-container-2 {
493
- width: 50%;
494
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  }
1
  .welcome-panel-column .dashicons {
2
+ /* font-size: 30px; */
3
+ color: #606a73;
4
+ font-size: 23px;
5
+ margin-right: 5px;
6
+ position: relative;
7
+ top: -3px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
+
10
+ .welcome-panel .qsm-welcome-panel-close {
11
+ position: absolute;
12
+ top: -20px;
13
+ right: 10px;
14
+ padding: 10px 15px 10px 21px;
15
+ font-size: 13px;
16
+ line-height: 1.23076923;
17
+ text-decoration: none;
18
+ }
19
+
20
+ .welcome-panel .qsm-welcome-panel-dismiss {
21
+ position: absolute;
22
+ bottom: 10px;
23
+ right: 10px;
24
+ padding: 10px 15px 10px 21px;
25
+ font-size: 13px;
26
+ line-height: 1.23076923;
27
+ text-decoration: none;
28
+ }
29
+
30
  .welcome-panel .qsm-welcome-panel-dismiss:before {
31
+ background: 0 0;
32
+ color: #72777c;
33
+ content: "\f153";
34
+ display: block;
35
+ font: normal 16px/20px dashicons;
36
+ speak: none;
37
+ height: 20px;
38
+ text-align: center;
39
+ width: 20px;
40
+ -webkit-font-smoothing: antialiased;
41
+ -moz-osx-font-smoothing: grayscale;
42
+ position: absolute;
43
+ top: 9px;
44
+ left: 0;
45
+ transition: all 0.1s ease-in-out;
46
  }
47
+
48
  .welcome-panel .qsm-welcome-panel-dismiss:hover:before {
49
+ color: #c00;
50
  }
51
+
52
+ .welcome-panel .qsm-welcome-panel-close img {
53
+ width: 100px;
54
  }
55
+
56
+ .welcome-panel .welcome-panel-close:before {
57
+ content: none !important;
58
+ }
59
+
60
+ .welcome-panel .current_version {
61
+ color: #344ad4;
62
+ text-align: center;
63
+ font-size: 16px;
64
+ font-weight: bold;
65
+ margin: 0;
66
+ padding: 0;
67
+ position: relative;
68
+ top: -30px;
69
  }
70
+
71
+ .popuar-addon-ul {
72
+ columns: 2;
73
+ -webkit-columns: 2;
74
+ -moz-columns: 2;
 
 
 
 
75
  }
76
+
77
+ .qsm-popup .popuar-addon-ul {
78
+ columns: 1;
79
+ -webkit-columns: 1;
80
+ -moz-columns: 1;
81
  }
82
+
83
+ .popuar-addon-ul li img {
84
+ max-width: 100%;
85
  }
86
+
87
  .pa-all-addon {
88
+ text-align: right;
89
+ margin-bottom: 10px;
90
  }
91
+
92
+ .pa-all-addon a {
93
+ text-decoration: none;
94
+ font-size: 14px;
95
+ font-weight: bold;
96
  }
97
+
98
  .what-new-ul li {
99
+ margin-bottom: 20px;
100
+ border-bottom: 1px solid #ccbfbf;
101
+ padding-bottom: 20px;
102
+ }
103
+
104
+ .what-new-ul li:last-child {
105
+ border-bottom: medium none;
106
+ margin-bottom: 0;
107
+ padding-bottom: 0;
108
+ }
109
+
110
+ .what-new-ul li a {
111
+ font-size: 14px;
112
+ color: #222;
113
+ font-weight: 500;
114
+ transition: 0.2 all;
115
+ -webkit-transition: 0.2 all;
116
+ -ms-transition: 0.2 all;
117
+ }
118
+
119
+ .what-new-ul li a:hover {
120
+ color: #0073aa;
121
+ }
122
+
123
+ .what-new-ul li .post-description {
124
+ margin-top: 10px;
125
+ }
126
+
127
+ .what-new-ul li .post-description p {
128
+ margin: 0;
129
+ padding: 0;
130
+ }
131
+
132
+ .changelog-ul li {
133
+ border-bottom: 1px solid #ede8e8;
134
+ padding-bottom: 10px;
135
+ margin-bottom: 10px;
136
+ }
137
+
138
+ .changelog-ul li:last-child {
139
+ border-bottom: medium none;
140
+ padding-bottom: 0;
141
+ margin-bottom: 0;
142
+ }
143
+
144
+ .changelog-ul li span {
145
+ padding: 3px 5px;
146
+ border-radius: 5px;
147
+ display: inline-block;
148
+ color: #fff;
149
+ }
150
+
151
+ .changelog-ul li .enhancement {
152
+ background: #feb325;
153
+ }
154
+
155
+ .changelog-ul li .bug {
156
+ background: #fe2525;
157
+ }
158
+
159
+ .changelog-ul li .feature {
160
+ background: #25bdfe;
161
+ }
162
+
163
+ .recently-taken-quiz-ul li {
164
+ position: relative;
165
+ min-height: 50px;
166
+ margin: 0;
167
+ border-bottom: 1px solid #ede8e8;
168
+ padding: 0 12px 12px 0;
169
+ margin-bottom: 20px;
170
+ }
171
+
172
+ .recently-taken-quiz-ul li:last-child {
173
+ margin-bottom: 0;
174
+ border-bottom: medium none;
175
+ padding-bottom: 0;
176
+ }
177
+
178
+ .recently-taken-quiz-ul li img.avatar {
179
+ position: absolute;
180
+ top: 0px;
181
+ width: 60px;
182
+ }
183
+
184
+ .recently-taken-quiz-ul li .row-actions-c {
185
+ margin: 0;
186
+ padding: 0;
187
+ visibility: hidden;
188
+ }
189
+
190
+ .recently-taken-quiz-ul li .row-actions-c .rtq-delete-result {
191
+ color: #a00;
192
+ }
193
+
194
+ .recently-taken-quiz-ul li:hover .row-actions-c {
195
+ visibility: visible;
196
+ }
197
+
198
+ .recently-taken-quiz-ul li .rtq-main-wrapper {
199
+ padding-left: 75px;
200
  }
201
+
202
  .recently-taken-quiz-ul li .rtq-main-wrapper .rtq_user_info,
203
+ .recently-taken-quiz-ul li .rtq-main-wrapper .rtq-result-info {
204
+ display: block;
205
+ margin-bottom: 3px;
206
  }
207
+
208
  .recently-taken-quiz-ul li .rtq-main-wrapper span {
209
+ font-size: 14px;
210
+ color: #837878;
211
  }
212
+
213
+ .recently-taken-quiz-ul li .rtq-main-wrapper .rtq_user_info a:first-child {
214
+ text-transform: capitalize;
215
  }
216
 
217
  /**
218
  * QSM Quiz Wizard
219
  */
220
+ #model-wizard .qsm-popup__container {
221
+ padding: 0;
222
+ background: #f3f3f3;
223
+ min-width: 70vw;
224
+ /* max-width: 1040px; */
225
+ border-radius: 0;
226
+ max-height: 85vh;
227
+ overflow: hidden;
228
+ position: relative;
229
+ }
230
+
231
+ #model-wizard .qsm-popup__content {
232
+ margin: 0;
233
+ max-height: 75vh;
234
+ overflow-y: auto;
235
+ /* padding-bottom: 59px; */
236
+ }
237
+
238
+ #model-wizard .qsm-popup__header {
239
+ background: #fff;
240
+ padding: 20px 10px 20px 10px;
241
+ border-bottom: 1px solid #dfd4d4;
242
+ display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  }
244
+
245
+ #model-wizard .qsm-popup__title {
246
+ font-size: 24px;
247
+ color: #515559;
248
+ font-weight: normal;
249
+ }
250
+
251
+ #model-wizard .qsm-popup__content .qsm-wizard-template-section {
252
+ width: 65%;
253
+ padding: 35px 20px 20px 20px;
254
+ border-right: 1px solid #dfd4d4;
255
+ float: left;
256
+ box-sizing: border-box;
257
+ }
258
+
259
+ #model-wizard .qsm-popup__content .quiz_name {
260
+ width: 100%;
261
+ padding: 5px 10px 5px 10px;
262
+ border-radius: 0;
263
+ border: 1px solid #dfd4d4;
264
+ }
265
+
266
+ #model-wizard .qsm-popup__content .quiz_name.qsm-required {
267
+ border-color: #ff0000;
268
+ outline: none !important;
269
+ box-shadow: none;
270
+ }
271
+
272
+ #model-wizard .qsm-popup__content .template-inner-wrap h6 {
273
+ font-size: 15px;
274
+ margin-top: 30px;
275
+ margin-bottom: 10px;
276
+ text-transform: uppercase;
277
+ }
278
+
279
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list {
280
+ width: 100%;
281
+ display: inline-block;
282
+ }
283
+
284
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner {
285
+ width: 31%;
286
+ margin-right: 2%;
287
+ float: left;
288
+ border: 1px solid #dfd4d4;
289
+ height: 210px;
290
+ text-align: center;
291
+ margin-bottom: 2%;
292
+ position: relative;
293
+ cursor: pointer;
294
+ box-sizing: border-box;
295
+ }
296
+
297
  #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:hover,
298
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.selected-quiz-template {
299
+ border-color: #1e8cbe;
300
+ -webkit-box-shadow: -2px -1px 13px -1px rgba(30, 140, 190, 1);
301
+ -moz-box-shadow: -2px -1px 13px -1px rgba(30, 140, 190, 1);
302
+ box-shadow: -2px -1px 13px -1px rgba(30, 140, 190, 1);
303
+ transition: 0.2s all;
304
+ -ms-transition: 0.2s all;
305
+ -o-transition: 0.2s all;
306
+ -webkit-transition: 0.2s all;
307
+ }
308
+
309
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n + 3) {
310
+ width: 33%;
311
+ margin-right: 0%;
312
+ }
313
+
314
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .template-center-vertical {
315
+ /*position: absolute;
316
  top: 50%;
317
  left: 50%;
318
  -ms-transform: translate(-50%, -50%);
319
  transform: translate(-50%, -50%); */
320
+ margin-top: 21px;
321
+ height: 96px;
322
  }
323
+
324
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:first-child .template-center-vertical {
325
+ height: auto;
326
+ position: absolute;
327
+ top: 50%;
328
+ left: 50%;
329
+ -ms-transform: translate(-50%, -50%);
330
+ transform: translate(-50%, -50%);
331
+ margin-top: 0;
332
+ }
333
+
334
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner .dashicons {
335
+ font-size: 75px;
336
+ color: #9ea3a8;
337
+ display: inline-block;
338
+ height: auto;
339
+ width: auto;
340
+ }
341
+
342
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner p.start_scratch {
343
+ font-size: 14px;
344
+ text-transform: uppercase;
345
+ letter-spacing: 1px;
346
+ color: #9ea3a8;
347
+ }
348
+
349
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner h3 {
350
+ margin: 0;
351
+ padding: 10px;
352
+ border-top: 1px solid #dfd4d4;
353
+ font-size: 15px;
354
+ position: absolute;
355
+ width: 100%;
356
+ box-sizing: border-box;
357
+ bottom: 0;
358
+ }
359
+
360
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner.inner-json {
361
+ background: #fff;
362
+ }
363
+
364
+ #model-wizard .qsm-popup__footer {
365
+ text-align: right;
366
+ background: #fff;
367
+ padding: 10px;
368
+ border-top: 1px solid #dfd4d4;
369
+ margin-top: -4px;
370
+ position: absolute;
371
+ bottom: 0;
372
+ width: 100%;
373
+ box-sizing: border-box;
374
+ }
375
+
376
+ #model-wizard .qsm-popup__footer button {
377
+ padding: 3px 20px;
378
+ }
379
+
380
+ #model-wizard .qsm-popup__footer .qsm-wizard-borderless {
381
+ border: none;
382
+ background: transparent;
383
+ }
384
+
385
+ #model-wizard .qsm-popup__footer #prev-theme-button,
386
+ #model-wizard .qsm-popup__footer #prev-quiz-button {
387
+ float: left;
388
+ display: none;
389
+ }
390
+
391
+ #model-wizard .qsm-popup__footer #create-quiz-button,
392
+ #model-wizard .qsm-popup__footer #choose-addons-button {
393
+ display: none;
394
+ }
395
+
396
+ #model-wizard .qsm-popup__footer .dashicons {
397
+ font-size: 18px;
398
+ vertical-align: middle;
399
+ }
400
+
401
+ #model-wizard .qsm-popup__footer .left-icons {
402
+ margin-left: -9px;
403
+ }
404
+
405
+ #model-wizard .qsm-popup__footer .right-icons {
406
+ margin-right: -9px;
407
+ margin-left: 3px;
408
+ }
409
+
410
+ #model-wizard .qsm-popup__close {
411
+ cursor: pointer;
412
+ font-size: 20px;
413
+ color: #515559;
414
+ margin-right: 10px;
415
+ }
416
+
417
+ #model-wizard .qsm-wizard-setting-section {
418
+ background: #fff;
419
+ width: 35%;
420
+ float: left;
421
+ }
422
+
423
+ #model-wizard #quiz_settings .input-group:nth-child(5),
424
+ #model-wizard #quiz_settings .input-group:nth-child(6),
425
+ #model-wizard #quiz_settings .input-group:nth-child(8),
426
+ #model-wizard #quiz_settings .input-group:nth-child(10) {
427
+ display: none;
428
+ }
429
+
430
+ #new-quiz-form {
431
+ display: inline-block;
432
+ width: 100%;
433
+ }
434
+
435
+ #model-wizard .qsm-wizard-setting-section .ui-accordion .ui-accordion-header {
436
+ background: #fff;
437
+ color: #000;
438
+ border-radius: 0;
439
+ border: none;
440
+ font-size: 16px;
441
+ font-weight: bold;
442
+ padding-left: 20px;
443
+ border-bottom: 1px solid #dfd4d4;
444
+ padding-right: 20px;
445
+ outline: 0 !important;
446
+ }
447
+
448
+ #model-wizard .qsm-quiz-page-addon.qsm-addon-page-list {
449
+ width: 100%;
450
+ }
451
+
452
+ #model-wizard .qsm-addon-browse-addons {
453
+ min-height: 60px;
454
+ }
455
+
456
+ #model-wizard .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-add-addon a.active {
457
+ background: #2271b1;
458
+ }
459
+
460
+ #model-wizard .qsm-addon-news-ads {
461
+ width: 100%;
462
+ }
463
+
464
+ #model-wizard .qsm-addon-news-ads .qsm-news-ads-title {
465
+ padding: 10px;
466
+ margin-top: 10px;
467
+ font-size: 1em;
468
+ }
469
+
470
+ #model-wizard .qsm-addon-news-ads .qsm-info-widget {
471
+ max-width: 30%;
472
+ display: inline-block;
473
+ margin-top: 50px;
474
+ padding: 10px;
475
+ }
476
+
477
+ #model-wizard .qsm-addon-news-ads .qsm-info-widget h3 {
478
+ font-size: 14px;
479
+ line-height: 14px;
480
+ margin-top: 40px;
481
+ margin-bottom: 10px;
482
+ }
483
+
484
+ #model-wizard .qsm-addon-news-ads .qsm-info-widget p {
485
+ font-size: 12px;
486
+ overflow: hidden;
487
+ text-overflow: ellipsis;
488
+ display: -webkit-box;
489
+ -webkit-line-clamp: 4;
490
+ -webkit-box-orient: vertical;
491
+ }
492
+
493
+ #model-wizard .qsm-addon-news-ads .qsm-info-widget .bundle-icon {
494
+ width: 30px;
495
+ height: 30px;
496
+ padding: 20px;
497
+ border-radius: 50%;
498
+ position: absolute;
499
+ top: -40px;
500
+ left: calc(50% - 30px);
501
+ }
502
+
503
+ #model-wizard .qsm-addon-news-ads .qsm-info-widget .bundle-icon img {
504
+ width: 30px;
505
+ }
506
+
507
+ #model-wizard .qsm_popular_addons div.popuar-addon-ul .addon-price {
508
+ border: none;
509
+ padding-top: 0px;
510
+ margin: 0;
511
+ text-align: center;
512
+ }
513
+
514
+ #model-wizard .qsm_popular_addons div.popuar-addon-ul .addon-get-link {
515
+ float: none;
516
+ background: transparent;
517
+ color: #007cba;
518
+ font-weight: bold;
519
+ width: 100%;
520
+ border: 0px;
521
+ text-decoration: none;
522
+ text-align: center;
523
+ }
524
+
525
+ #model-wizard .qsm_popular_addons div.popuar-addon-ul .addon-get-link span {
526
+ vertical-align: bottom;
527
+ }
528
+
529
+ #model-wizard .qsm_popular_addons div.popuar-addon-ul>div {
530
+ margin-bottom: 2%;
531
+ box-shadow: 0px 0px 3px rgba(10, 10, 10, 0.2);
532
+ width: 23%;
533
+ }
534
+
535
+ #model-wizard .qsm_popular_addons div.popuar-addon-ul>div>a {
536
+ display: block;
537
+ width: 100%;
538
+ height: 100%;
539
+ }
540
+
541
+ #model-wizard .qsm_popular_addons a:active,
542
+ #model-wizard .qsm_popular_addons a:focus {
543
+ outline: 0;
544
+ box-shadow: none;
545
+ }
546
+
547
+ #model-wizard .qsm-addon-list-right {
548
+ padding-right: 20px;
549
+ }
550
+
551
+ #model-wizard .market-theme .market-theme-url,
552
+ #model-wizard .downloaded-theme-button {
553
+ position: absolute;
554
+ left: 50%;
555
+ top: 60%;
556
+ transform: translate(-50%, -50%);
557
+ opacity: 0;
558
+ transition: all 200ms ease-in-out;
559
+ text-align: center;
560
+ }
561
+
562
+ #model-wizard .market-theme .market-theme-url a,
563
+ #model-wizard .downloaded-theme-button span {
564
+ margin: 5px;
565
+ width: 100px;
566
+ display: inline-block;
567
+ }
568
+
569
+ #model-wizard .market-theme:hover .market-theme-url,
570
+ #model-wizard .theme:hover .downloaded-theme-button {
571
+ opacity: 1;
572
+ top: 50%
573
  }
574
+
575
+ #model-wizard div.popuar-addon-ul>div:nth-child(3n + 4) {
576
+ clear: none;
577
+ }
578
+
579
+ #model-wizard .theme:focus .theme-screenshot img,
580
+ #model-wizard .theme:hover .theme-screenshot img {
581
+ opacity: 0.1;
582
+ }
583
+
584
  #accordion .ui-accordion-header-icon {
585
+ position: absolute;
586
+ right: 24px;
587
+ top: 15px;
588
  }
589
+
590
+ #accordion.ui-accordion .ui-accordion-content {
591
+ border: medium none;
592
+ border-bottom: 1px solid #dfd4d4;
593
+ padding: 20px;
594
  }
595
+
596
  #accordion .ui-icon.iconOpen {
597
+ background: url("../assets/up-1.png") no-repeat !important;
598
+ background-size: cover !important;
599
  }
600
+
601
  #accordion .ui-icon.iconClosed {
602
+ background: url(../assets/down-1.png) no-repeat !important;
603
+ background-size: cover !important;
604
  }
605
+
606
  #accordion .ui-accordion-header:focus {
607
+ outline: 0 !important;
608
+ border: none !important;
609
  }
610
+
611
+ #quiz_settings_wrapper tr {
612
+ /*display: inline-block;*/
613
+ width: 100%;
614
  }
615
+
616
  #quiz_settings_wrapper tr th,
617
+ #quiz_settings_wrapper tr td {
618
+ width: 100%;
619
+ display: inline-block;
620
+ box-sizing: border-box;
621
+ clear: both;
622
+ text-align: left;
623
  }
624
+
625
+ #quiz_settings_wrapper tr td {
626
+ padding: 10px 0 20px 0;
627
  }
628
+
629
  #quiz_settings_wrapper tr:last-child td {
630
+ padding-bottom: 0;
631
  }
632
+
633
+ #quiz_settings_wrapper tr td label {
634
+ margin-right: 15px;
635
+ font-size: 14px;
636
  }
637
+
638
+ #quiz_settings_wrapper tr th label {
639
+ font-size: 14px;
640
+ font-weight: bold;
641
  }
642
+
643
+ #addons_list ul {
644
+ columns: 2;
645
+ -webkit-columns: 2;
646
+ -moz-columns: 2;
647
  }
648
+
649
+ #addons_list ul li {
650
+ position: relative;
651
  }
652
+
653
+ #addons_list ul li span.ra-attr {
654
+ position: absolute;
655
+ right: 0;
656
+ padding: 5px;
657
+ font-size: 10px;
658
+ color: #fff;
659
+ background: gray;
660
+ border-radius: 5px;
661
+ top: 0;
662
+ text-transform: capitalize;
663
  }
664
+
665
+ #addons_list ul li span.ra-attr.qra-att-recommended {
666
+ background: #25bdfe;
667
  }
668
+
669
+ #addons_list ul li span.ra-attr.qra-att-required {
670
+ background: #31b400;
671
  }
672
+
673
+ #addons_list ul li img {
674
+ max-width: 100%;
675
  }
676
+
677
+ #quiz_settings_wrapper .qsm-opt-tr .qsm-tooltips-icon {
678
+ display: none;
679
  }
680
+
681
  div#quiz_settings_wrapper #timer_limit {
682
+ width: 100px;
683
  }
684
+
685
+ .postbox .handlediv {
686
+ position: absolute;
687
+ right: 0;
688
  }
689
+
690
  h2.hndle.ui-sortable-handle {
691
+ border-bottom: 1px solid #ccd0d4;
692
+ }
693
+
694
+ #modal-2-content .qsm-new_menu_tab_items {
695
+ width: 40%;
696
+ border: unset;
697
+ border-right: 2px solid #dddddd;
698
+ min-width: 300px;
699
+ display: flex;
700
+ flex-direction: column;
701
+ padding: 20px !important;
702
+ }
703
+
704
+ #modal-2-content .qsm-new_menu_tab_items li {
705
+ margin-bottom: 20px;
706
+ }
707
+
708
+ #modal-2-content .qsm-new_menu_tab_items li {
709
+ padding: 0;
710
+ margin: 0;
711
+ border: solid 1px #dddddd;
712
+ width: 100%;
713
+ white-space: normal;
714
+ }
715
+
716
+ #modal-2-content .qsm-new_menu_tab_items li .nav-item-label {
717
+ padding: 10px 15px;
718
+ display: flex;
719
+ align-items: center;
720
+ line-height: 1.3;
721
+ }
722
+
723
+ #model-wizard .qsm-new_menu_tab_items li.active a {
724
+ color: white;
725
+ background: #0085ba;
726
+ transition: all 500ms linear;
727
+ }
728
+
729
+ #model-wizard .qsm-new_menu_tab_items li a {
730
+ background: #fff;
731
+ color: #2d405a;
732
+ font-weight: normal;
733
+ font-size: 12px;
734
+ text-decoration: none;
735
+ float: left;
736
+ width: 100%;
737
+ }
738
+
739
+ #model-wizard .qsm-new_menu_tab_items .nav-item-label-icon {
740
+ font-size: 32px;
741
+ margin-right: 20px;
742
+ line-height: 20px;
743
+ }
744
+
745
+ #model-wizard .nav-item-label .nav-item-label-content h4 {
746
+ padding: 0;
747
+ margin: 0;
748
+ }
749
+
750
+ #model-wizard .nav-item-label .nav-item-label-content span {
751
+ font-size: 12px;
752
+ font-weight: normal;
753
+ }
754
+
755
+ #model-wizard .qsm-new-menu-elements {
756
+ width: 97%;
757
+ padding: 2%;
758
+ margin-bottom: 40px;
759
+ margin-top: 55px;
760
+ height: 100%;
761
+ min-height: 45vh;
762
+ }
763
+
764
+ #model-wizard #modal-2-content {
765
+ background: #f3f3f3;
766
+ overflow-y: scroll;
767
+ margin-left: 15px;
768
+ margin: 0;
769
+ }
770
+
771
+ #model-wizard #modal-2-content::-webkit-scrollbar-track {
772
+ -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
773
+ background-color: #f5f5f5;
774
+ border-radius: 5px;
775
+ }
776
+
777
+ #model-wizard #modal-2-content::-webkit-scrollbar {
778
+ width: 5px;
779
+ background-color: #f5f5f5;
780
+ }
781
+
782
+ #model-wizard #modal-2-content::-webkit-scrollbar-thumb {
783
+ background-color: #3b81b9;
784
+ border-radius: 5px;
785
+ }
786
+
787
+ #model-wizard .qsm-new-menu-elements .input-group {
788
+ width: 75%;
789
+ margin: 0 auto;
790
+ margin-bottom: 10px;
791
+ background: #ffffff60;
792
+ padding: 20px;
793
+ position: relative;
794
+ }
795
+
796
+ #model-wizard .qsm-new-menu-elements .input-group .qsm-tooltips-icon {
797
+ display: none;
798
+ }
799
+
800
+ #model-wizard .qsm-new-menu-elements .input-group .qsm-opt-desc {
801
+ color: #666;
802
+ font-size: 12px;
803
+ display: block;
804
+ text-align: left;
805
+ }
806
+
807
+ #model-wizard .qsm-new-menu-elements .input-group>label {
808
+ /* color: #888; */
809
+ display: inline-block;
810
+ font-size: 16px;
811
+ margin-bottom: 5px;
812
+ font-family: inherit;
813
+ width: 30%;
814
+ text-align: left;
815
+ margin-right: 20px;
816
+ vertical-align: top;
817
+ }
818
+
819
+ #model-wizard .qsm-new-menu-elements input[type="text"],
820
+ #model-wizard .qsm-new-menu-elements select {
821
+ width: 60%;
822
+ max-width: 100%;
823
+ height: 35px;
824
+ border: solid 1px #dddddd;
825
+ box-shadow: 0px 0px 5px rgba(10, 10, 10, 0.3);
826
+ border-radius: 0;
827
+ }
828
+
829
+ #model-wizard .qsm-new-menu-elements fieldset {
830
+ width: 60%;
831
+ max-width: 100%;
832
+ display: inline-block;
833
+ }
834
+
835
+ #model-wizard #qsm_span {
836
+ width: 60%;
837
+ display: inline-block;
838
+ }
839
+
840
+ #model-wizard #qsm_span .quiz_featured_image {
841
+ width: 100%;
842
+ margin-bottom: 10px;
843
+ }
844
+
845
+ #model-wizard .featured_image {
846
+ display: none;
847
+ }
848
+
849
+ #model-wizard .empty-market-place {
850
+ position: absolute;
851
+ top: 45%;
852
+ margin: 0 auto;
853
+ text-align: center;
854
+ width: 100%;
855
+ }
856
+
857
+ #model-wizard .empty-market-place span {
858
+ color: #ccc;
859
+ margin: 0 auto;
860
+ }
861
+
862
+ #model-wizard .empty-market-place span.dashicons {
863
+ font-size: 50px;
864
+ margin-bottom: 10px;
865
+ display: contents;
866
+ }
867
+
868
+ #model-wizard .empty-market-place span.no-themes-message {
869
+ font-size: 20px;
870
+ }
871
+
872
+ #select_themes .theme {
873
+ width: 23%;
874
+ margin: 0 2% 2% 0;
875
+ }
876
+
877
+ #select_themes .theme .theme-name {
878
+ padding: 10px 15px;
879
+ display: none;
880
+ margin-top: -38px;
881
+ }
882
+
883
+ #select_themes .theme.active .theme-name {
884
+ display: block;
885
+ box-shadow: 0 1px 1px rgb(0 0 0 / 50%);
886
+ transition: all 0.5s ease !important;
887
+ }
888
+
889
+ #select_themes #qsm-theme-screenshot:after {
890
+ content: "";
891
+ display: block;
892
+ padding-top: 100%;
893
+ }
894
+
895
+ #select_themes .theme:nth-child(4n) {
896
+ margin-right: 0;
897
+ }
898
+
899
+ #addons_list ul {
900
+ columns: 3;
901
+ -webkit-columns: 3;
902
+ -moz-columns: 3;
903
+ }
904
+
905
+ #addons_list ul li {
906
+ position: relative;
907
+ border: 1px solid #c4c4c4;
908
+ }
909
+
910
+ #addons_list ul li span.ra-attr {
911
+ position: absolute;
912
+ right: 0;
913
+ padding: 5px;
914
+ font-size: 10px;
915
+ color: #fff;
916
+ background: gray;
917
+ border-radius: 0 0 0 10px;
918
+ top: 0;
919
+ text-transform: capitalize;
920
+ }
921
+
922
+ #addons_list ul li span.ra-attr.qra-att-recommended {
923
+ background: #25bdfe;
924
+ }
925
+
926
+ #addons_list ul li span.ra-attr.qra-att-required {
927
+ background: #31b400;
928
+ }
929
+
930
+ #addons_list ul li img {
931
+ max-width: 100%;
932
+ }
933
+
934
+ /*
935
+ * New wizard style
936
+ */
937
+ .qsm-wizard-menu {
938
+ width: 100%;
939
+ display: flex;
940
+ background: #fff;
941
+ position: absolute;
942
+ z-index: 1;
943
+ border-bottom: 1px solid #dfd4d4;
944
+ justify-content: center;
945
+ }
946
+
947
+ .qsm-wizard-menu .qsm-logo {
948
+ position: absolute;
949
+ top: 0px;
950
+ left: 15px;
951
+ }
952
+
953
+ .qsm-wizard-menu .qsm-logo img {
954
+ height: 80px;
955
+ margin-top: -10px;
956
+ }
957
+
958
+ .qsm-wizard-menu .qsm-wizard-wrap {
959
+ padding: 15px;
960
+ transition: border 0.5s ease;
961
+ border-bottom: 3px solid #3b81b9;
962
+ cursor: pointer;
963
+ }
964
+
965
+ .qsm-wizard-menu .qsm-wizard-wrap:not(.active) {
966
+ opacity: 0.5;
967
+ border-color: white;
968
+ border-image: none;
969
+ }
970
+
971
+ .qsm-wizard-menu .qsm-wizard-step-number {
972
+ background: #0085ba;
973
+ border-radius: 50%;
974
+ width: 40px;
975
+ height: 40px;
976
+ line-height: 40px;
977
+ display: inline-block;
978
+ text-align: center;
979
+ color: #fff;
980
+ font-weight: bold;
981
+ font-size: 18px;
982
+ margin-right: 10px;
983
+ }
984
+
985
+ .qsm-wizard-menu .qsm-wizard-step-text {
986
+ display: inline-block;
987
+ font-size: 16px;
988
+ text-transform: capitalize;
989
+ position: relative;
990
+ top: 3px;
991
+ }
992
+
993
+ .qsm-wizard-menu .qsm-wizard-step-text-optional {
994
+ padding: 2px 5px;
995
+ border-radius: 3px;
996
+ font-size: 11px;
997
+ font-weight: bold;
998
+ position: relative;
999
+ top: 19px;
1000
+ opacity: 0.7;
1001
+ left: -17px;
1002
+ color: #a6a6a6;
1003
+ }
1004
+
1005
+ .theme-sub-menu {
1006
+ margin: 0 0 15px 0;
1007
+ padding: 0;
1008
+ }
1009
+
1010
+ .theme-sub-menu li {
1011
+ display: inline-block;
1012
+ margin-right: 15px;
1013
+ border-right: 1px solid #ccc;
1014
+ padding-right: 15px;
1015
+ }
1016
+
1017
+ .theme-sub-menu li:last-child {
1018
+ border-right: medium none;
1019
+ }
1020
+
1021
+ .theme-sub-menu li.active a {
1022
+ color: #0073aa;
1023
+ }
1024
+
1025
+ .theme-sub-menu li a {
1026
+ color: #888888;
1027
+ text-decoration: none;
1028
+ font-size: 13px;
1029
+ }
1030
+
1031
+ .theme-sub-menu li a:active,
1032
+ .theme-sub-menu li a:focus {
1033
+ outline: 0;
1034
+ border: none;
1035
+ -moz-outline-style: none;
1036
+ box-shadow: none;
1037
+ }
1038
+
1039
+ #quiz_settings .input-group {
1040
+ box-shadow: 0 0 3px rgba(10, 10, 10, 0.2);
1041
+ }
1042
+
1043
+ @media screen and (min-width: 1200px) {
1044
+ #quiz_settings_wrapper tr td fieldset>br {
1045
+ display: none;
1046
+ }
1047
+ }
1048
+
1049
+ @media (min-width: 768px) and (max-width: 1200px) {
1050
+ #quiz_settings_wrapper tr td label {
1051
+ vertical-align: top;
1052
+ margin-bottom: 15px;
1053
+ display: inline-block;
1054
+ }
1055
+
1056
+ #model-wizard .qsm-popup__container {
1057
+ width: 90%;
1058
+ }
1059
+ }
1060
+
1061
+ @media (min-width: 768px) and (max-width: 991px) {
1062
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner {
1063
+ width: 48%;
1064
+ }
1065
+
1066
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n + 2) {
1067
+ margin-right: 0;
1068
+ width: 50%;
1069
+ }
1070
+
1071
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(3n + 3) {
1072
+ margin-right: 2%;
1073
+ width: 48%;
1074
+ }
1075
+ }
1076
+
1077
+ @media screen and (max-width: 767px) {
1078
+ #model-wizard .qsm-popup__container {
1079
+ width: 90%;
1080
+ }
1081
+
1082
+ #model-wizard .qsm-popup__content .qsm-wizard-template-section {
1083
+ width: 100%;
1084
+ }
1085
+
1086
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner:nth-child(2n + 2),
1087
+ #model-wizard .qsm-popup__content .template-inner-wrap .template-list .template-list-inner {
1088
+ width: 100% !important;
1089
+ }
1090
+
1091
+ #model-wizard .qsm-wizard-setting-section {
1092
+ width: 100%;
1093
+ height: auto !important;
1094
+ }
1095
+
1096
+ #quiz_settings_wrapper tr td label {
1097
+ margin-bottom: 20px;
1098
+ display: inline-block;
1099
+ vertical-align: top;
1100
+ }
1101
+
1102
+ #model-wizard .qsm-popup__title {
1103
+ font-size: 16px;
1104
+ }
1105
+
1106
+ #model-wizard .qsm-new-menu-elements .input-group {
1107
+ width: 90%;
1108
+ }
1109
+
1110
+ #model-wizard .qsm-new-menu-elements .input-group label,
1111
+ #model-wizard .qsm-new-menu-elements .input-group input[type="text"],
1112
+ #model-wizard .qsm-new-menu-elements .input-group select {
1113
+ text-align: left;
1114
+ display: block;
1115
+ margin: 0px;
1116
+ width: 100%;
1117
+ }
1118
+
1119
+ #model-wizard .qsm-new-menu-elements .input-group .qsm-opt-desc {
1120
+ display: none;
1121
+ }
1122
+
1123
+ .welcome-panel h2 {
1124
+ width: calc(100% - 100px);
1125
+ }
1126
+ }
1127
+
1128
+ @media only screen and (max-width: 1800px) and (min-width: 1500px) {
1129
+ #wpbody-content #dashboard-widgets #postbox-container-1 {
1130
+ width: 50%;
1131
+ }
1132
+
1133
+ #wpbody-content #dashboard-widgets #postbox-container-2 {
1134
+ width: 50%;
1135
+ }
1136
  }
css/qsm-admin-question.css CHANGED
@@ -1,29 +1,29 @@
1
  .question-controls {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: space-between;
5
- align-items: center;
6
  }
7
 
8
- #delete-question-button{
9
- background-color:#dc3232;
10
  float: right;
11
  }
12
 
13
- #unlink-question-button{
14
  float: right;
15
  margin-left: 5px;
16
  }
17
 
18
- #modal-7{
19
  max-width: 500px;
20
  }
21
 
22
- #modal-7 hr{
23
  margin: 0 -30px;
24
  }
25
 
26
- #modal-7 header{
27
  margin: -10px 0 10px 0;
28
  }
29
 
@@ -32,74 +32,81 @@
32
  font-size: 20px;
33
  }
34
 
35
- #modal-7-title{
36
  color: gray;
37
  opacity: 70%;
38
  }
39
 
40
- #modal-7 footer .dashicons{
41
- font-size: 20px;
42
  margin-right: 3px;
43
  vertical-align: middle;
44
  margin-left: -10px;
45
  }
46
 
47
- #modal-7 .qsm-popup__container{
48
- max-width:560px;
49
  padding-bottom: 20px;
50
  }
51
 
52
- .modal-7-table{
53
  font-size: 16px;
54
  }
55
 
56
- #modal-7 footer{
57
  margin-top: 15px;
58
  }
59
 
60
- .modal-7-table tr td{
61
  vertical-align: top;
62
  padding: 0 10px 5px 0
63
  }
64
 
65
  @media screen and (min-width:700px) {
66
- .question-controls {
67
- flex-direction: row;
68
- }
69
  }
70
 
71
  .page {
72
- width: 100%;
73
- background-color: #fff;
74
- margin: 20px 0;
75
- padding-bottom: 60px;
76
- /*box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.4)*/
77
- position: relative;
78
- padding-left: 15px;
79
- padding-right: 15px;
80
- box-sizing: border-box;
81
  }
82
 
83
  .page-header {
84
- display: flex;
85
  align-items: center;
86
  justify-content: space-between;
87
  background-color: #fff;
88
  padding: 25px 15px 10px 10px;
89
- /*border-bottom: 5px solid #1DD969;*/
90
  }
91
 
92
- .page-header .dashicons{
93
  color: #A6ABAF;
94
  font-size: 25px;
95
  }
96
 
97
- .page-header .dashicons.dashicons-trash{
98
  color: #dc3232;
99
  }
100
- .page-header .edit-page-button{margin: 0 10px;}
101
- .page-header .edit-page-button span{color: #1F8CBE;}
102
- .page-header span.page-number {
 
 
 
 
 
 
 
103
  font-size: 18px;
104
  color: #A6ABAF;
105
  margin-left: 10px;
@@ -107,104 +114,104 @@
107
  font-style: italic;
108
  margin-top: 3px;
109
  }
110
- .page-header span.page-name {
111
-
112
- }
113
 
114
- .page-footer{
 
 
115
  position: absolute;
116
  bottom: 15px;
117
- width: 100%;
118
  right: 25px;
119
  }
120
 
121
  .page-footer a.button,
122
- .new-answer-button a#new-answer-button{
123
  border: 1px solid #cbcbcb;
124
  color: #7b7575;
125
  background: #F7F7F7;
126
  }
127
 
128
- .new-answer-button a#new-answer-button:hover{
129
  opacity: 0.9;
130
  }
131
 
132
  .page-footer a.button .dashicons,
133
- .new-answer-button a#new-answer-button .dashicons{
134
  line-height: 32px;
135
  }
136
 
137
- .question-create-page{
138
  text-align: center;
139
  }
140
 
141
- .question-create-page .new-page-button .dashicons{
142
  line-height: 30px;
143
- font-size: 16px;
144
  }
145
 
146
  .page-header a {
147
- text-decoration: none;
148
  }
149
 
150
  .page-header-buttons {
151
- text-align: right;
152
  }
153
 
154
- .question, .question-bank-question {
155
- padding: 15px 10px;
156
- background-color: #F3F3F3;
157
- border: 1px solid #cbcbcb;
158
- margin: 15px 10px 0;
 
159
  }
160
 
161
  .question a {
162
- text-decoration: none;
163
  }
164
 
165
  .question-content {
166
- display: flex;
167
- align-items: center;
168
- justify-content: space-between;
169
  }
170
 
171
- .question-content .dashicons{
172
  font-size: 22px;
173
  color: #1F8CBE;
174
  }
175
 
176
- .question-content .dashicons.dashicons-trash{
177
  color: #dc3232;
178
  }
179
 
180
- .question-content .dashicons.dashicons-move{
181
  color: #A6ABAF;
182
  font-size: 22px;
183
  }
184
 
185
- .question-content .question-content-text{
186
  color: #1F8CBE;
187
  font-size: 16px;
188
  font-weight: 500;
189
  }
190
 
191
- .question-content .question-category{
192
  color: #939697;
193
  font-size: 14px;
194
  font-weight: normal;
195
  font-style: italic;
196
  }
197
 
198
- .question-content > div {
199
- margin: 0 10px;
200
  }
201
 
202
  .question-content-text {
203
- flex-grow: 1;
204
  }
205
 
206
  .question-bank-question {
207
- display: flex;
208
  align-items: center;
209
  justify-content: space-between;
210
  clear: both;
@@ -217,28 +224,30 @@
217
  vertical-align: top;
218
  }
219
 
220
- #qsm-import-selected-question{
221
  margin-right: 30px;
222
  }
223
- #qsm-delete-selected-question{
 
224
  margin-right: 10px;
225
  }
226
 
227
  .question-bank-question div {
228
- margin: 0 10px;
229
  }
230
 
231
- .question-bank-question > div:nth-child(2){
232
  width: 100%;
233
  }
234
 
235
- .page-new, .question-new {
236
- background-color: #fff !important;
 
237
  }
238
 
239
  .correct-header {
240
- text-align: right;
241
- display: none;
242
  }
243
 
244
  .answers-single {
@@ -249,11 +258,11 @@
249
  background: #FAFAFA;
250
  }
251
 
252
- .answers-single:nth-child(2n+2){
253
  background: #FFF;
254
  }
255
 
256
- .answers-single > div {
257
  margin-left: 5px;
258
  }
259
 
@@ -261,279 +270,306 @@
261
  width: 85%;
262
  }
263
 
264
- .answers-single > div:nth-child(4){
265
  width: 12%;
266
  }
267
 
268
  .qsm-row {
269
- display: block;
270
- width: 100%;
271
- margin-bottom: 13px;
272
- font-size: 16px;
273
  }
274
 
275
  div#correct_answer_info_area {
276
  float: left;
277
  }
278
 
279
- #post-body-content .qsm-row{
280
  margin-bottom: 20px;
281
  }
282
 
283
- .qsm-row > label {
284
- font-weight: normal;
285
- display: block;
286
- margin-bottom: 7px;
287
- color: #7b7575;
288
  }
289
 
290
- .questionElements .qsm-row > label {
291
  position: relative;
292
  }
293
 
294
- .questionElements .qsm-row > label > .qsm-tooltips-icon {
295
  position: relative;
296
  top: 2px;
297
  }
298
 
299
- .questionElements .qsm-question-doc{
300
  text-decoration: none;
301
  position: absolute;
302
  right: 0;
303
  color: #969696;
304
  }
305
 
306
- #categorydiv .qsm-question-doc{
307
  right: 15px;
308
  }
309
 
310
- .questionElements .qsm-question-doc:hover{
311
  color: #0073aa;
312
  }
313
 
314
- .questionElements .qsm-row > label > .qsm-question-doc span.dashicons{
315
  font-size: 17px;
316
  width: auto;
317
  height: auto;
318
  line-height: 23px;
319
  }
320
 
321
- .questionElements .qsm-tooltips-icon .qsm-tooltips{
322
  bottom: 26px;
323
  }
324
 
325
- .questionElements .qsm-tooltips-icon{
326
  cursor: help;
327
  }
328
 
329
- .qsm-row select, .qsm-row input[type=text], .qsm-row textarea {
330
- width: 100%;
331
- max-width: 100%;
 
 
332
  }
333
 
334
  .qsm-popup {
335
- font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
336
  }
337
-
338
  .qsm-popup__overlay {
339
- position: fixed;
340
- top: 0;
341
- left: 0;
342
- right: 0;
343
- bottom: 0;
344
- background: rgba(0,0,0,0.6);
345
- display: flex;
346
- justify-content: center;
347
- align-items: center;
348
- z-index: 9999;
349
  }
350
 
351
  .qsm-popup__container {
352
- background-color: #fff;
353
- padding: 30px;
354
- min-width: 500px;
355
- max-width: 700px;
356
- max-height: 95vh;
357
- border-radius: 4px;
358
- overflow-y: auto;
359
- box-sizing: border-box;
360
  }
361
 
362
  .qsm-popup__header {
363
- display: flex;
364
- justify-content: space-between;
365
- align-items: center;
366
  }
367
 
368
  .qsm-popup__title {
369
- margin-top: 0;
370
- margin-bottom: 0;
371
- font-weight: 600;
372
- font-size: 1.25rem;
373
- line-height: 1.25;
374
- color: #00449e;
375
- box-sizing: border-box;
376
  }
377
 
378
  .qsm-popup__close {
379
- background: transparent;
380
- border: 0;
381
- color: #00449e;
382
  text-decoration: none;
383
  }
384
 
385
- .qsm-popup__header .qsm-popup__close:before {
386
- content: "\2715";
387
  }
388
 
389
  .qsm-popup__content {
390
- margin-top: 2rem;
391
- margin-bottom: 2rem;
392
- line-height: 1.5;
393
- color: rgba(0,0,0,.8);
394
  }
395
 
396
  .qsm-popup__btn {
397
- font-size: .875rem;
398
- padding-left: 1rem;
399
- padding-right: 1rem;
400
- padding-top: .5rem;
401
- padding-bottom: .5rem;
402
- background-color: #e6e6e6;
403
- color: rgba(0,0,0,.8);
404
- border-radius: .25rem;
405
- border-style: none;
406
- border-width: 0;
407
- cursor: pointer;
408
- -webkit-appearance: button;
409
- text-transform: none;
410
- overflow: visible;
411
- line-height: 1.15;
412
- margin: 0;
413
- will-change: transform;
414
- -moz-osx-font-smoothing: grayscale;
415
- -webkit-backface-visibility: hidden;
416
- backface-visibility: hidden;
417
- -webkit-transform: translateZ(0);
418
- transform: translateZ(0);
419
- transition: -webkit-transform .25s ease-out;
420
- transition: transform .25s ease-out;
421
- transition: transform .25s ease-out,-webkit-transform .25s ease-out;
422
- }
423
-
424
- .qsm-popup__btn:focus, .qsm-popup__btn:hover {
425
- -webkit-transform: scale(1.05);
426
- transform: scale(1.05);
 
427
  }
428
 
429
  .qsm-popup__btn-primary {
430
- background-color: #00449e;
431
- color: #fff;
432
  }
433
 
434
  @keyframes mmfadeIn {
435
- from { opacity: 0; }
436
- to { opacity: 1; }
 
 
 
 
 
437
  }
438
 
439
  @keyframes mmfadeOut {
440
- from { opacity: 1; }
441
- to { opacity: 0; }
 
 
 
 
 
442
  }
443
 
444
  @keyframes mmslideIn {
445
- from { transform: translateY(15%); }
446
- to { transform: translateY(0); }
 
 
 
 
 
447
  }
448
 
449
  @keyframes mmslideOut {
450
- from { transform: translateY(0); }
451
- to { transform: translateY(-10%); }
 
 
 
 
 
452
  }
453
 
454
  .qsm-popup-slide {
455
- display: none;
456
  }
457
 
458
  .qsm-popup-slide.is-open {
459
- display: block;
460
  }
461
 
462
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
463
- animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
464
  }
465
 
466
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
467
- animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
468
  }
469
 
470
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
471
- animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
472
  }
473
 
474
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
475
- animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
476
  }
477
 
478
  .qsm-popup-slide .qsm-popup__container,
479
  .qsm-popup-slide .qsm-popup__overlay {
480
- will-change: transform;
481
  }
482
 
483
  @-moz-keyframes qsm-spinner-loader {
484
- 0% {
485
- -moz-transform: rotate(0deg);
486
- transform: rotate(0deg);
487
- }
488
- 100% {
489
- -moz-transform: rotate(360deg);
490
- transform: rotate(360deg);
491
- }
 
492
  }
 
493
  @-webkit-keyframes qsm-spinner-loader {
494
- 0% {
495
- -webkit-transform: rotate(0deg);
496
- transform: rotate(0deg);
497
- }
498
- 100% {
499
- -webkit-transform: rotate(360deg);
500
- transform: rotate(360deg);
501
- }
 
502
  }
503
 
504
  @keyframes qsm-spinner-loader {
505
- 0% {
506
- -moz-transform: rotate(0deg);
507
- -ms-transform: rotate(0deg);
508
- -webkit-transform: rotate(0deg);
509
- transform: rotate(0deg);
510
- }
511
- 100% {
512
- -moz-transform: rotate(360deg);
513
- -ms-transform: rotate(360deg);
514
- -webkit-transform: rotate(360deg);
515
- transform: rotate(360deg);
516
- }
 
517
  }
518
 
519
  /* :not(:required) hides this rule from IE9 and below */
520
  .qsm-spinner-loader:not(:required) {
521
- -moz-animation: qsm-spinner-loader 1500ms infinite linear;
522
- -webkit-animation: qsm-spinner-loader 1500ms infinite linear;
523
- animation: qsm-spinner-loader 1500ms infinite linear;
524
- -moz-border-radius: 0.5em;
525
- -webkit-border-radius: 0.5em;
526
- border-radius: 0.5em;
527
- -moz-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
528
- -webkit-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
529
- box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
530
- display: inline-block;
531
- font-size: 10px;
532
- width: 1em;
533
- height: 1em;
534
- margin: 1.5em;
535
- overflow: hidden;
536
- text-indent: 100%;
537
  }
538
 
539
  /**
@@ -545,18 +581,18 @@ from { transform: translateY(15%); }
545
  font-size: 14px;
546
  font-weight: normal !important;
547
  }*/
548
- .change-answer-editor-label > #change-answer-editor{
549
  width: auto;
550
  }
551
 
552
- a.import-button.button.disable_import{
553
  position: relative;
554
  z-index: 0;
555
  }
556
 
557
  a.import-button.button.disable_import::before {
558
  content: '';
559
- background: rgba(255,255,255,0.5);
560
  width: 100%;
561
  height: 100%;
562
  left: 0;
@@ -567,13 +603,13 @@ a.import-button.button.disable_import::before {
567
  z-index: 5;
568
  }
569
 
570
- #question-bank-cat{
571
  float: right;
572
  margin-bottom: 20px;
573
  margin-right: 10px;
574
  }
575
 
576
- .ui-state-highlight {
577
  background: #F3F3F3;
578
  border: 1px dashed #cbcbcb;
579
  height: 50px;
@@ -581,16 +617,16 @@ a.import-button.button.disable_import::before {
581
  opacity: 0.8;
582
  }
583
 
584
- .questionElements #poststuff{
585
  display: inline-block;
586
- width: 100%;
587
  background: #fff;
588
  padding: 10px;
589
  box-sizing: border-box;
590
  padding-bottom: 0;
591
  }
592
 
593
- .questionElements{
594
  padding: 15px 10px;
595
  background-color: #fff;
596
  border: 1px solid #cbcbcb;
@@ -599,7 +635,7 @@ a.import-button.button.disable_import::before {
599
  border-top: medium none;
600
  }
601
 
602
- .questionElements .question-title{
603
  padding: 3px 8px;
604
  font-size: 1.7em;
605
  line-height: 100%;
@@ -610,7 +646,7 @@ a.import-button.button.disable_import::before {
610
  background-color: #fff;
611
  }
612
 
613
- .questionElements #major-publishing-actions{
614
  display: inline-block;
615
  width: 100%;
616
  box-sizing: border-box;
@@ -618,42 +654,43 @@ a.import-button.button.disable_import::before {
618
  margin-bottom: -3px;
619
  }
620
 
621
- .questionElements #minor-publishing{
622
  padding: 10px 12px 12px;
623
  }
624
 
625
- #advanceddiv input[type="number"]{
626
  width: 100% !important;
627
  }
628
 
629
- .qsm-row .answer-header{
630
  font-weight: 500;
631
  font-size: 20px;
632
  margin-bottom: 30px;
633
  margin-top: 15px;
634
  color: #23282d;
635
  }
636
- .qsm-row .new-answer-button{
 
637
  text-align: center;
638
  margin-top: 15px;
639
  }
640
 
641
- #advanceddiv{
642
  margin-bottom: 0;
643
  }
644
 
645
- #answers .delete-answer-button{
646
  text-decoration: none;
647
  color: #dc3232;
648
  vertical-align: middle;
649
  }
650
 
651
- .answers-single .correct-answer{
652
  margin-right: 0;
653
  vertical-align: -webkit-baseline-middle;
654
  }
655
 
656
- .questionElements #postbox-container-1 select{
657
  border: 1px solid #dddddd;
658
  }
659
 
@@ -661,7 +698,7 @@ a.import-button.button.disable_import::before {
661
  font-size: 16px;
662
  }
663
 
664
- .question-type-description{
665
  color: #31708f;
666
  background: #d9edf7;
667
  border-color: #bce8f1;
@@ -673,22 +710,23 @@ a.import-button.button.disable_import::before {
673
  text-align: center;
674
  margin: 0 0 20px 0;
675
  }
 
676
  .qsm-show-correct-info-box,
677
- .qsm-show-question-desc-box{
678
  display: inline-block;
679
  margin-bottom: 10px !important;
680
  font-size: 15px;
681
  }
682
 
683
- #delete-action .deletion{
684
  text-decoration: underline;
685
  }
686
 
687
- #category_area > label{
688
  display: none;
689
  }
690
 
691
- #category_area{
692
  margin-top: 10px;
693
  }
694
 
@@ -700,80 +738,116 @@ a#qsm-category-add-toggle {
700
  }
701
 
702
  .quiz_form_type_0.quiz_quiz_systen_3 #question_type_13_description,
703
- .quiz_form_type_0.quiz_quiz_systen_1 #question_type_13_description{
704
  display: none !important;
705
  }
706
 
707
- #qsm-question-id{
708
  float: right;
709
  }
 
710
  .qsm-show-correct-info-box,
711
- .qsm-show-question-desc-box{
712
  background: #fff;
713
  }
 
714
  .qsm-show-correct-info-box span.dashicons,
715
- .qsm-show-question-desc-box span.dashicons{
716
  line-height: 29px;
717
  }
718
- #modal-2 .qsm-popup__container{
 
719
  max-width: 900px;
720
  }
721
- @media screen and (max-width: 575px){
722
- .qsm-popup__container{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
723
  min-width: auto;
724
  max-width: 100%;
725
  }
726
  }
727
 
728
- .question_info_tag{
729
- float: right;
730
  }
731
- @media (min-width: 783px) and (max-width: 1199px){
732
- #poststuff #post-body.columns-2 #side-sortables{
 
733
  min-width: unset;
734
  width: 100%;
735
  }
736
- .questionElements .postbox{
 
737
  min-width: unset;
738
  width: 100%;
739
  }
740
- #post-body.columns-2 #postbox-container-1{
 
741
  width: 250px;
742
  float: left;
743
- margin-left: 10px;
744
  }
745
- .questionElements{
 
746
  overflow: hidden;
747
  }
748
  }
749
- @media screen and (max-width: 782px){
 
 
750
  /*List of questions*/
751
- .question-content .question-content-text{
752
  font-size: 14px;
753
  }
754
- body .question-content > div{
 
755
  margin: 0 5px;
756
  }
757
- .page-footer a.button{
 
758
  font-size: 10px;
759
  min-height: 25px;
760
  padding: 0 5px;
761
  }
762
- .page-footer a.button .dashicons{
 
763
  display: none;
764
  }
765
- .question-controls .search-box{
 
766
  height: auto;
767
  }
768
- .questionElements .postbox{
 
769
  max-width: 100%;
770
  width: 100%;
771
  min-width: unset;
772
  }
773
- .questionElements .category{
 
774
  margin-bottom: 10px;
775
  }
776
- .answer-text-div{
 
777
  width: 135%;
778
  }
779
  }
1
  .question-controls {
2
+ display: flex;
3
+ flex-direction: column;
4
+ justify-content: space-between;
5
+ align-items: center;
6
  }
7
 
8
+ #delete-question-button {
9
+ background-color: #dc3232;
10
  float: right;
11
  }
12
 
13
+ #unlink-question-button {
14
  float: right;
15
  margin-left: 5px;
16
  }
17
 
18
+ #modal-7 {
19
  max-width: 500px;
20
  }
21
 
22
+ #modal-7 hr {
23
  margin: 0 -30px;
24
  }
25
 
26
+ #modal-7 header {
27
  margin: -10px 0 10px 0;
28
  }
29
 
32
  font-size: 20px;
33
  }
34
 
35
+ #modal-7-title {
36
  color: gray;
37
  opacity: 70%;
38
  }
39
 
40
+ #modal-7 footer .dashicons {
41
+ font-size: 20px;
42
  margin-right: 3px;
43
  vertical-align: middle;
44
  margin-left: -10px;
45
  }
46
 
47
+ #modal-7 .qsm-popup__container {
48
+ max-width: 560px;
49
  padding-bottom: 20px;
50
  }
51
 
52
+ .modal-7-table {
53
  font-size: 16px;
54
  }
55
 
56
+ #modal-7 footer {
57
  margin-top: 15px;
58
  }
59
 
60
+ .modal-7-table tr td {
61
  vertical-align: top;
62
  padding: 0 10px 5px 0
63
  }
64
 
65
  @media screen and (min-width:700px) {
66
+ .question-controls {
67
+ flex-direction: row;
68
+ }
69
  }
70
 
71
  .page {
72
+ width: 100%;
73
+ background-color: #fff;
74
+ margin: 20px 0;
75
+ padding-bottom: 60px;
76
+ /*box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.4)*/
77
+ position: relative;
78
+ padding-left: 15px;
79
+ padding-right: 15px;
80
+ box-sizing: border-box;
81
  }
82
 
83
  .page-header {
84
+ display: flex;
85
  align-items: center;
86
  justify-content: space-between;
87
  background-color: #fff;
88
  padding: 25px 15px 10px 10px;
89
+ /*border-bottom: 5px solid #1DD969;*/
90
  }
91
 
92
+ .page-header .dashicons {
93
  color: #A6ABAF;
94
  font-size: 25px;
95
  }
96
 
97
+ .page-header .dashicons.dashicons-trash {
98
  color: #dc3232;
99
  }
100
+
101
+ .page-header .edit-page-button {
102
+ margin: 0 10px;
103
+ }
104
+
105
+ .page-header .edit-page-button span {
106
+ color: #1F8CBE;
107
+ }
108
+
109
+ .page-header span.page-number {
110
  font-size: 18px;
111
  color: #A6ABAF;
112
  margin-left: 10px;
114
  font-style: italic;
115
  margin-top: 3px;
116
  }
 
 
 
117
 
118
+ .page-header span.page-name {}
119
+
120
+ .page-footer {
121
  position: absolute;
122
  bottom: 15px;
123
+ width: 100%;
124
  right: 25px;
125
  }
126
 
127
  .page-footer a.button,
128
+ .new-answer-button a#new-answer-button {
129
  border: 1px solid #cbcbcb;
130
  color: #7b7575;
131
  background: #F7F7F7;
132
  }
133
 
134
+ .new-answer-button a#new-answer-button:hover {
135
  opacity: 0.9;
136
  }
137
 
138
  .page-footer a.button .dashicons,
139
+ .new-answer-button a#new-answer-button .dashicons {
140
  line-height: 32px;
141
  }
142
 
143
+ .question-create-page {
144
  text-align: center;
145
  }
146
 
147
+ .question-create-page .new-page-button .dashicons {
148
  line-height: 30px;
149
+ font-size: 16px;
150
  }
151
 
152
  .page-header a {
153
+ text-decoration: none;
154
  }
155
 
156
  .page-header-buttons {
157
+ text-align: right;
158
  }
159
 
160
+ .question,
161
+ .question-bank-question {
162
+ padding: 15px 10px;
163
+ background-color: #F3F3F3;
164
+ border: 1px solid #cbcbcb;
165
+ margin: 15px 10px 0;
166
  }
167
 
168
  .question a {
169
+ text-decoration: none;
170
  }
171
 
172
  .question-content {
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: space-between;
176
  }
177
 
178
+ .question-content .dashicons {
179
  font-size: 22px;
180
  color: #1F8CBE;
181
  }
182
 
183
+ .question-content .dashicons.dashicons-trash {
184
  color: #dc3232;
185
  }
186
 
187
+ .question-content .dashicons.dashicons-move {
188
  color: #A6ABAF;
189
  font-size: 22px;
190
  }
191
 
192
+ .question-content .question-content-text {
193
  color: #1F8CBE;
194
  font-size: 16px;
195
  font-weight: 500;
196
  }
197
 
198
+ .question-content .question-category {
199
  color: #939697;
200
  font-size: 14px;
201
  font-weight: normal;
202
  font-style: italic;
203
  }
204
 
205
+ .question-content>div {
206
+ margin: 0 10px;
207
  }
208
 
209
  .question-content-text {
210
+ flex-grow: 1;
211
  }
212
 
213
  .question-bank-question {
214
+ display: flex;
215
  align-items: center;
216
  justify-content: space-between;
217
  clear: both;
224
  vertical-align: top;
225
  }
226
 
227
+ #qsm-import-selected-question {
228
  margin-right: 30px;
229
  }
230
+
231
+ #qsm-delete-selected-question {
232
  margin-right: 10px;
233
  }
234
 
235
  .question-bank-question div {
236
+ margin: 0 10px;
237
  }
238
 
239
+ .question-bank-question>div:nth-child(2) {
240
  width: 100%;
241
  }
242
 
243
+ .page-new,
244
+ .question-new {
245
+ background-color: #fff !important;
246
  }
247
 
248
  .correct-header {
249
+ text-align: right;
250
+ display: none;
251
  }
252
 
253
  .answers-single {
258
  background: #FAFAFA;
259
  }
260
 
261
+ .answers-single:nth-child(2n+2) {
262
  background: #FFF;
263
  }
264
 
265
+ .answers-single>div {
266
  margin-left: 5px;
267
  }
268
 
270
  width: 85%;
271
  }
272
 
273
+ .answers-single>div:nth-child(4) {
274
  width: 12%;
275
  }
276
 
277
  .qsm-row {
278
+ display: block;
279
+ width: 100%;
280
+ margin-bottom: 13px;
281
+ font-size: 16px;
282
  }
283
 
284
  div#correct_answer_info_area {
285
  float: left;
286
  }
287
 
288
+ #post-body-content .qsm-row {
289
  margin-bottom: 20px;
290
  }
291
 
292
+ .qsm-row>label {
293
+ font-weight: normal;
294
+ display: block;
295
+ margin-bottom: 7px;
296
+ color: #7b7575;
297
  }
298
 
299
+ .questionElements .qsm-row>label {
300
  position: relative;
301
  }
302
 
303
+ .questionElements .qsm-row>label>.qsm-tooltips-icon {
304
  position: relative;
305
  top: 2px;
306
  }
307
 
308
+ .questionElements .qsm-question-doc {
309
  text-decoration: none;
310
  position: absolute;
311
  right: 0;
312
  color: #969696;
313
  }
314
 
315
+ #categorydiv .qsm-question-doc {
316
  right: 15px;
317
  }
318
 
319
+ .questionElements .qsm-question-doc:hover {
320
  color: #0073aa;
321
  }
322
 
323
+ .questionElements .qsm-row>label>.qsm-question-doc span.dashicons {
324
  font-size: 17px;
325
  width: auto;
326
  height: auto;
327
  line-height: 23px;
328
  }
329
 
330
+ .questionElements .qsm-tooltips-icon .qsm-tooltips {
331
  bottom: 26px;
332
  }
333
 
334
+ .questionElements .qsm-tooltips-icon {
335
  cursor: help;
336
  }
337
 
338
+ .qsm-row select,
339
+ .qsm-row input[type=text],
340
+ .qsm-row textarea {
341
+ width: 100%;
342
+ max-width: 100%;
343
  }
344
 
345
  .qsm-popup {
346
+ font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
347
  }
348
+
349
  .qsm-popup__overlay {
350
+ position: fixed;
351
+ top: 0;
352
+ left: 0;
353
+ right: 0;
354
+ bottom: 0;
355
+ background: rgba(0, 0, 0, 0.6);
356
+ display: flex;
357
+ justify-content: center;
358
+ align-items: center;
359
+ z-index: 9999;
360
  }
361
 
362
  .qsm-popup__container {
363
+ background-color: #fff;
364
+ padding: 30px;
365
+ min-width: 500px;
366
+ max-width: 700px;
367
+ max-height: 95vh;
368
+ border-radius: 4px;
369
+ overflow-y: auto;
370
+ box-sizing: border-box;
371
  }
372
 
373
  .qsm-popup__header {
374
+ display: flex;
375
+ justify-content: space-between;
376
+ align-items: center;
377
  }
378
 
379
  .qsm-popup__title {
380
+ margin-top: 0;
381
+ margin-bottom: 0;
382
+ font-weight: 600;
383
+ font-size: 1.25rem;
384
+ line-height: 1.25;
385
+ color: #00449e;
386
+ box-sizing: border-box;
387
  }
388
 
389
  .qsm-popup__close {
390
+ background: transparent;
391
+ border: 0;
392
+ color: #00449e;
393
  text-decoration: none;
394
  }
395
 
396
+ .qsm-popup__header .qsm-popup__close:before {
397
+ content: "\2715";
398
  }
399
 
400
  .qsm-popup__content {
401
+ margin-top: 2rem;
402
+ margin-bottom: 2rem;
403
+ line-height: 1.5;
404
+ color: rgba(0, 0, 0, .8);
405
  }
406
 
407
  .qsm-popup__btn {
408
+ font-size: .875rem;
409
+ padding-left: 1rem;
410
+ padding-right: 1rem;
411
+ padding-top: .5rem;
412
+ padding-bottom: .5rem;
413
+ background-color: #e6e6e6;
414
+ color: rgba(0, 0, 0, .8);
415
+ border-radius: .25rem;
416
+ border-style: none;
417
+ border-width: 0;
418
+ cursor: pointer;
419
+ -webkit-appearance: button;
420
+ text-transform: none;
421
+ overflow: visible;
422
+ line-height: 1.15;
423
+ margin: 0;
424
+ will-change: transform;
425
+ -moz-osx-font-smoothing: grayscale;
426
+ -webkit-backface-visibility: hidden;
427
+ backface-visibility: hidden;
428
+ -webkit-transform: translateZ(0);
429
+ transform: translateZ(0);
430
+ transition: -webkit-transform .25s ease-out;
431
+ transition: transform .25s ease-out;
432
+ transition: transform .25s ease-out, -webkit-transform .25s ease-out;
433
+ }
434
+
435
+ .qsm-popup__btn:focus,
436
+ .qsm-popup__btn:hover {
437
+ -webkit-transform: scale(1.05);
438
+ transform: scale(1.05);
439
  }
440
 
441
  .qsm-popup__btn-primary {
442
+ background-color: #00449e;
443
+ color: #fff;
444
  }
445
 
446
  @keyframes mmfadeIn {
447
+ from {
448
+ opacity: 0;
449
+ }
450
+
451
+ to {
452
+ opacity: 1;
453
+ }
454
  }
455
 
456
  @keyframes mmfadeOut {
457
+ from {
458
+ opacity: 1;
459
+ }
460
+
461
+ to {
462
+ opacity: 0;
463
+ }
464
  }
465
 
466
  @keyframes mmslideIn {
467
+ from {
468
+ transform: translateY(15%);
469
+ }
470
+
471
+ to {
472
+ transform: translateY(0);
473
+ }
474
  }
475
 
476
  @keyframes mmslideOut {
477
+ from {
478
+ transform: translateY(0);
479
+ }
480
+
481
+ to {
482
+ transform: translateY(-10%);
483
+ }
484
  }
485
 
486
  .qsm-popup-slide {
487
+ display: none;
488
  }
489
 
490
  .qsm-popup-slide.is-open {
491
+ display: block;
492
  }
493
 
494
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
495
+ animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
496
  }
497
 
498
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
499
+ animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
500
  }
501
 
502
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
503
+ animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
504
  }
505
 
506
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
507
+ animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
508
  }
509
 
510
  .qsm-popup-slide .qsm-popup__container,
511
  .qsm-popup-slide .qsm-popup__overlay {
512
+ will-change: transform;
513
  }
514
 
515
  @-moz-keyframes qsm-spinner-loader {
516
+ 0% {
517
+ -moz-transform: rotate(0deg);
518
+ transform: rotate(0deg);
519
+ }
520
+
521
+ 100% {
522
+ -moz-transform: rotate(360deg);
523
+ transform: rotate(360deg);
524
+ }
525
  }
526
+
527
  @-webkit-keyframes qsm-spinner-loader {
528
+ 0% {
529
+ -webkit-transform: rotate(0deg);
530
+ transform: rotate(0deg);
531
+ }
532
+
533
+ 100% {
534
+ -webkit-transform: rotate(360deg);
535
+ transform: rotate(360deg);
536
+ }
537
  }
538
 
539
  @keyframes qsm-spinner-loader {
540
+ 0% {
541
+ -moz-transform: rotate(0deg);
542
+ -ms-transform: rotate(0deg);
543
+ -webkit-transform: rotate(0deg);
544
+ transform: rotate(0deg);
545
+ }
546
+
547
+ 100% {
548
+ -moz-transform: rotate(360deg);
549
+ -ms-transform: rotate(360deg);
550
+ -webkit-transform: rotate(360deg);
551
+ transform: rotate(360deg);
552
+ }
553
  }
554
 
555
  /* :not(:required) hides this rule from IE9 and below */
556
  .qsm-spinner-loader:not(:required) {
557
+ -moz-animation: qsm-spinner-loader 1500ms infinite linear;
558
+ -webkit-animation: qsm-spinner-loader 1500ms infinite linear;
559
+ animation: qsm-spinner-loader 1500ms infinite linear;
560
+ -moz-border-radius: 0.5em;
561
+ -webkit-border-radius: 0.5em;
562
+ border-radius: 0.5em;
563
+ -moz-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
564
+ -webkit-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
565
+ box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
566
+ display: inline-block;
567
+ font-size: 10px;
568
+ width: 1em;
569
+ height: 1em;
570
+ margin: 1.5em;
571
+ overflow: hidden;
572
+ text-indent: 100%;
573
  }
574
 
575
  /**
581
  font-size: 14px;
582
  font-weight: normal !important;
583
  }*/
584
+ .change-answer-editor-label>#change-answer-editor {
585
  width: auto;
586
  }
587
 
588
+ a.import-button.button.disable_import {
589
  position: relative;
590
  z-index: 0;
591
  }
592
 
593
  a.import-button.button.disable_import::before {
594
  content: '';
595
+ background: rgba(255, 255, 255, 0.5);
596
  width: 100%;
597
  height: 100%;
598
  left: 0;
603
  z-index: 5;
604
  }
605
 
606
+ #question-bank-cat {
607
  float: right;
608
  margin-bottom: 20px;
609
  margin-right: 10px;
610
  }
611
 
612
+ .ui-state-highlight {
613
  background: #F3F3F3;
614
  border: 1px dashed #cbcbcb;
615
  height: 50px;
617
  opacity: 0.8;
618
  }
619
 
620
+ .questionElements #poststuff {
621
  display: inline-block;
622
+ width: 100%;
623
  background: #fff;
624
  padding: 10px;
625
  box-sizing: border-box;
626
  padding-bottom: 0;
627
  }
628
 
629
+ .questionElements {
630
  padding: 15px 10px;
631
  background-color: #fff;
632
  border: 1px solid #cbcbcb;
635
  border-top: medium none;
636
  }
637
 
638
+ .questionElements .question-title {
639
  padding: 3px 8px;
640
  font-size: 1.7em;
641
  line-height: 100%;
646
  background-color: #fff;
647
  }
648
 
649
+ .questionElements #major-publishing-actions {
650
  display: inline-block;
651
  width: 100%;
652
  box-sizing: border-box;
654
  margin-bottom: -3px;
655
  }
656
 
657
+ .questionElements #minor-publishing {
658
  padding: 10px 12px 12px;
659
  }
660
 
661
+ #advanceddiv input[type="number"] {
662
  width: 100% !important;
663
  }
664
 
665
+ .qsm-row .answer-header {
666
  font-weight: 500;
667
  font-size: 20px;
668
  margin-bottom: 30px;
669
  margin-top: 15px;
670
  color: #23282d;
671
  }
672
+
673
+ .qsm-row .new-answer-button {
674
  text-align: center;
675
  margin-top: 15px;
676
  }
677
 
678
+ #advanceddiv {
679
  margin-bottom: 0;
680
  }
681
 
682
+ #answers .delete-answer-button {
683
  text-decoration: none;
684
  color: #dc3232;
685
  vertical-align: middle;
686
  }
687
 
688
+ .answers-single .correct-answer {
689
  margin-right: 0;
690
  vertical-align: -webkit-baseline-middle;
691
  }
692
 
693
+ .questionElements #postbox-container-1 select {
694
  border: 1px solid #dddddd;
695
  }
696
 
698
  font-size: 16px;
699
  }
700
 
701
+ .question-type-description {
702
  color: #31708f;
703
  background: #d9edf7;
704
  border-color: #bce8f1;
710
  text-align: center;
711
  margin: 0 0 20px 0;
712
  }
713
+
714
  .qsm-show-correct-info-box,
715
+ .qsm-show-question-desc-box {
716
  display: inline-block;
717
  margin-bottom: 10px !important;
718
  font-size: 15px;
719
  }
720
 
721
+ #delete-action .deletion {
722
  text-decoration: underline;
723
  }
724
 
725
+ #category_area>label {
726
  display: none;
727
  }
728
 
729
+ #category_area {
730
  margin-top: 10px;
731
  }
732
 
738
  }
739
 
740
  .quiz_form_type_0.quiz_quiz_systen_3 #question_type_13_description,
741
+ .quiz_form_type_0.quiz_quiz_systen_1 #question_type_13_description {
742
  display: none !important;
743
  }
744
 
745
+ #qsm-question-id {
746
  float: right;
747
  }
748
+
749
  .qsm-show-correct-info-box,
750
+ .qsm-show-question-desc-box {
751
  background: #fff;
752
  }
753
+
754
  .qsm-show-correct-info-box span.dashicons,
755
+ .qsm-show-question-desc-box span.dashicons {
756
  line-height: 29px;
757
  }
758
+
759
+ #modal-2 .qsm-popup__container {
760
  max-width: 900px;
761
  }
762
+
763
+ #set_featured_image {
764
+ display: inline-block;
765
+ text-decoration: none;
766
+ outline: none;
767
+ position: relative;
768
+ left: calc(100% - 40px);
769
+ top: -29px;
770
+ background: #eee;
771
+ padding: 4px 10px;
772
+ border-radius: 0px 5px 5px 0px;
773
+ margin-bottom: -29px;
774
+ }
775
+
776
+ #set_featured_image:focus {
777
+ outline: none;
778
+ }
779
+
780
+ #featured_image_caption {}
781
+
782
+ @media screen and (max-width: 575px) {
783
+ .qsm-popup__container {
784
  min-width: auto;
785
  max-width: 100%;
786
  }
787
  }
788
 
789
+ .question_info_tag {
790
+ float: right;
791
  }
792
+
793
+ @media (min-width: 783px) and (max-width: 1199px) {
794
+ #poststuff #post-body.columns-2 #side-sortables {
795
  min-width: unset;
796
  width: 100%;
797
  }
798
+
799
+ .questionElements .postbox {
800
  min-width: unset;
801
  width: 100%;
802
  }
803
+
804
+ #post-body.columns-2 #postbox-container-1 {
805
  width: 250px;
806
  float: left;
807
+ margin-left: 10px;
808
  }
809
+
810
+ .questionElements {
811
  overflow: hidden;
812
  }
813
  }
814
+
815
+ @media screen and (max-width: 782px) {
816
+
817
  /*List of questions*/
818
+ .question-content .question-content-text {
819
  font-size: 14px;
820
  }
821
+
822
+ body .question-content>div {
823
  margin: 0 5px;
824
  }
825
+
826
+ .page-footer a.button {
827
  font-size: 10px;
828
  min-height: 25px;
829
  padding: 0 5px;
830
  }
831
+
832
+ .page-footer a.button .dashicons {
833
  display: none;
834
  }
835
+
836
+ .question-controls .search-box {
837
  height: auto;
838
  }
839
+
840
+ .questionElements .postbox {
841
  max-width: 100%;
842
  width: 100%;
843
  min-width: unset;
844
  }
845
+
846
+ .questionElements .category {
847
  margin-bottom: 10px;
848
  }
849
+
850
+ .answer-text-div {
851
  width: 135%;
852
  }
853
  }
css/qsm-admin.css CHANGED
@@ -6,22 +6,24 @@ Quizzes/Surveys Page
6
  font-size: 16px !important;
7
  }*/
8
 
9
-
10
  @-moz-keyframes qsm-spinner-loader {
11
  0% {
12
  -moz-transform: rotate(0deg);
13
  transform: rotate(0deg);
14
  }
 
15
  100% {
16
  -moz-transform: rotate(360deg);
17
  transform: rotate(360deg);
18
  }
19
  }
 
20
  @-webkit-keyframes qsm-spinner-loader {
21
  0% {
22
  -webkit-transform: rotate(0deg);
23
  transform: rotate(0deg);
24
  }
 
25
  100% {
26
  -webkit-transform: rotate(360deg);
27
  transform: rotate(360deg);
@@ -35,6 +37,7 @@ Quizzes/Surveys Page
35
  -webkit-transform: rotate(0deg);
36
  transform: rotate(0deg);
37
  }
 
38
  100% {
39
  -moz-transform: rotate(360deg);
40
  -ms-transform: rotate(360deg);
@@ -51,9 +54,21 @@ Quizzes/Surveys Page
51
  -moz-border-radius: 0.5em;
52
  -webkit-border-radius: 0.5em;
53
  border-radius: 0.5em;
54
- -moz-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
55
- -webkit-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
56
- box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0, rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0, rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0, rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0, rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
 
 
 
 
 
 
 
 
 
 
 
 
57
  display: inline-block;
58
  font-size: 10px;
59
  width: 1em;
@@ -64,414 +79,473 @@ Quizzes/Surveys Page
64
  }
65
 
66
  span.qsm-quiz-name {
67
- font-size: 14px;
68
- font-weight: 600;
69
  }
70
 
71
  .qsm-quizzes-page-content {
72
- display: flex;
73
- flex-direction: column;
74
- justify-content: space-between;
75
  }
76
 
77
  .qsm-quiz-page-wrapper {
78
- flex-grow: 1;
79
  }
80
 
81
  .qsm-quiz-page-wrapper-with-ads {
82
- flex-grow: 1;
83
  }
84
 
85
  .qsm-news-ads {
86
- background-color: #fff;
87
- border: 1px solid #dfd4d4;
88
- margin-top: 30px;
89
- display: none;
90
  }
91
 
92
  .qsm-news-ads-title {
93
- text-align: center;
94
- border-bottom: 1px solid #dfd4d4;
95
- margin: 0;
96
- padding: 10px 0;
97
- background-color: #fff;
98
  }
99
 
100
  .qsm-edit-name {
101
- font-size: 12px !important;
102
  }
103
 
104
  .qsm-action-link {
105
- font-size: 14px !important;
106
  }
107
 
108
  .qsm-action-links:hover {
109
- background-color: black;
110
  }
111
 
112
  .qsm-action-link-delete {
113
- color: red !important;
114
  }
115
 
116
  .qsm-dialog-form label {
117
- display: inline-block;
118
- font-size: 16px;
119
- font-weight: bold;
120
- padding-right: 30px;
121
- }
122
-
123
- .qsm-quiz-page-addon{
124
- width: 100%;
125
- float: left;
126
- }
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%;
189
- display: inline-block;
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
- }
257
- .qsm_popular_addons div.popuar-addon-ul > div .description-wrap .description{
258
- display: block;
259
- width: 100%;
260
- margin-bottom: 15px;
261
- font-size: 14px;
262
- font-style: normal;
263
- }
264
- .qsm_popular_addons div.popuar-addon-ul > div img{
265
- max-width: 100%;
266
- }
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;
369
- margin: 0;
370
- padding: 15px;
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%;
383
- background: #fff;
384
- text-align: center;
385
- font-style: italic;
386
- font-size: 16px;
387
- line-height: 22px;
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;
399
- font-weight: bold;
400
- position: relative;
401
- top: 5px;
402
- }
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
- }
417
- .qsm-active-addons{
418
- width: 100%;
419
- box-sizing: border-box;
420
- margin-bottom: 30px;
421
- }
422
- .quizzes-surveys_page_qmn_addons .qsm-news-ads{
423
- width: 15%;
424
- float: right;
425
- }
426
- .qsm-help-page .handle-order-higher ,
 
 
 
 
 
 
 
 
 
 
427
  .qsm-help-page .handle-order-lower {
428
- display: none;
429
  }
 
430
  @media screen and (min-width: 1200px) {
431
-
432
- .qsm-quiz-page-wrapper-with-ads {
433
- margin-right: 0;
434
- width: 100%;
435
- }
436
- .qsm-news-ads .qsm-info-widget{
437
- float: left;
438
- max-width: unset;
439
- width: 31.3%;
440
- }
441
- .qsm-news-ads .qsm-info-widget:nth-child(3n+5){
442
- clear: both;
443
- }
444
- .qsm-news-ads .remove-ads-adv-link{
445
- width: 100%;
446
- float: left;
447
- }
 
 
448
  }
449
 
450
  @media screen and (max-width: 767px) {
451
- .qsm-quiz-page-addon{
452
- width: 100%;
453
- }
454
 
455
- .quizzes-surveys_page_qmn_addons .qsm-news-ads{
456
- width: 100%;
457
- }
458
  }
459
 
460
-
461
  /********************
462
  Options Page
463
  *********************/
464
 
465
  .template_list_holder {
466
- width: 100%;
467
  }
 
468
  .template_variable {
469
- width: 50%;
470
- float: left;
471
- font-size: 14px;
472
  }
 
473
  .template_name {
474
- font-weight: bold;
475
  }
476
 
477
  /********************
@@ -479,155 +553,157 @@ Results Pages & Emails Tab
479
  *********************/
480
  .results-page,
481
  #qsm_emails .qsm-email {
482
- width: 100%;
483
- background-color: #fff;
484
- margin: 20px 0;
485
- /*padding-bottom: 15px;*/
486
- box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.06);
487
  }
488
 
489
  .results-page .results-page-content,
490
- #qsm_emails .qsm-email .qsm-email-content{
491
- background: #fff;
492
- padding-right: 15px;
493
- padding-left: 15px;
494
- width: 100%;
495
- box-sizing: border-box;
496
  }
497
 
498
  .results-page-header,
499
  #qsm_emails .qsm-email-header {
500
- display: flex;
501
- align-items: center;
502
- justify-content: flex-end;
503
- background-color: #fff;
504
- padding: 10px 35px;
505
- border-bottom: 1px solid #dfd4d4;
506
  }
507
 
508
  .delete-page-button,
509
  #qsm_emails .delete-email-button {
510
- background: none;
511
- border: none;
512
- color: #dc3232;
513
- cursor: pointer;
514
- transition-duration: 200ms;
515
  }
516
 
517
  .delete-page-button:hover,
518
  #qsm_emails .delete-email-button:hover {
519
- transform: scale(1.2);
520
  }
521
 
522
  .results-page-content,
523
  .qsm-email-content {
524
- display: flex;
525
- flex-direction: column;
526
  }
527
 
528
  .results-page-when,
529
  .results-page-show,
530
  .email-when,
531
  .email-show {
532
- padding: 10px;
533
- background-color: #f1f1f1;
534
- border: 1px solid #dfd4d4;
535
- margin: 15px 0;
536
- min-width: 60%;
537
  }
538
 
539
  .results-page-when,
540
- .email-when{
541
- margin-right: 15px;
542
  }
543
 
544
  .results-page-content-header,
545
  .email-content-header {
546
- margin-bottom: 10px;
547
  }
548
 
549
- .email-show label{
550
- margin-bottom: 5px;
551
- display: block;
552
  }
553
 
554
  .results-page-content-header h4,
555
  .results-page-content-header p,
556
  .email-content-header h4,
557
  .email-content-header p {
558
- margin: 0;
559
  }
560
 
561
  .results-page-condition,
562
  .email-condition {
563
- display: flex;
564
- flex-direction: column;
565
- margin-bottom: 15px;
566
- justify-content: space-around;
567
  }
568
 
569
- .results-page-condition > select,
570
- .results-page-condition > input,
571
- .email-condition > select,
572
- .email-condition > input {
573
- max-width: 100%;
574
  }
575
 
576
  .delete-condition-button {
577
- background: none;
578
- border: 1px solid #1DD969;
579
- color: #dc3232;
580
- cursor: pointer;
581
- transition-duration: 200ms;
582
- padding: 6px;
583
  }
584
 
585
  .delete-condition-button:hover {
586
- transform: scale(1.1);
587
  }
588
 
589
  .email-show .label {
590
- display: block;
591
  }
592
 
593
  .results-page-show textarea,
594
  .to-email,
595
  .subject,
596
  .email-template {
597
- width: 100%;
598
- margin-bottom: 10px;
599
  }
600
 
601
  @media screen and (min-width: 760px) {
602
- .results-page-content,
603
- .qsm-email-content {
604
- flex-direction: row;
605
- justify-content: space-around;
606
- }
607
-
608
- .results-page-when,
609
- .results-page-show,
610
- .email-when,
611
- .email-show {
612
- width: calc( 50% - 15px );
613
- min-width: unset;
614
- }
615
-
616
- .results-page-condition,
617
- .email-condition {
618
- align-items: center;
619
- flex-direction: row;
620
- }
621
- .results-page-condition > select,
622
- .results-page-condition > input,
623
- .email-condition > select,
624
- .email-condition > input {
625
- max-width: 30%;
626
- }
627
-
628
- .delete-condition-button {
629
- border: none;
630
- }
 
 
631
  }
632
 
633
  /********************
@@ -635,124 +711,137 @@ Quiz Styles Tab
635
  *********************/
636
 
637
  .qsm-styles {
638
- display: flex;
639
- flex-direction: column;
640
  }
641
 
642
- @media screen and (min-width:700px) {
643
- .qsm-styles {
644
- flex-direction: row;
645
- flex-wrap: wrap;
646
- }
 
 
 
 
 
 
 
647
  }
648
 
649
 
 
 
 
 
 
 
650
 
651
  /********************
652
  About/Credits Page
653
  *********************/
654
 
655
  div.qsm_icon_wrap {
656
- position: absolute;
657
- top: 0;
658
- right: 0;
659
- background-color: rgba(54, 58, 66, 1);
660
- color: #1DD969;
661
- background-position: center 24px;
662
- background-size: 85px 85px;
663
- font-size: 14px;
664
- text-align: center;
665
- font-weight: 600;
666
- margin: 5px 0 0;
667
- padding-top: 120px;
668
- height: 40px;
669
- display: inline-block;
670
- width: 150px;
671
- text-rendering: optimizeLegibility;
672
- border: 5px solid #106daa;
673
- -moz-border-radius: 20px;
674
- -webkit-border-radius: 20px;
675
- -khtml-border-radius: 20px;
676
- border-radius: 20px;
677
  }
678
 
679
  .qsm-tab-content .feature {
680
- margin-bottom: 20px;
681
  }
682
 
683
  .qsm-tab-content .feature .feature-headline {
684
- margin: 1.1em 0 .2em;
685
- font-size: 40px;
686
- font-weight: 300;
687
- line-height: 1.3;
688
- text-align: center;
689
  }
690
 
691
  .qsm-tab-content .feature .feature-text {
692
- text-align: center;
693
- font-size: 16px;
694
  }
695
 
696
  ul.changelog {
697
- background-color: #fff;
698
- padding: 10px 10px;
699
  }
700
 
701
  ul.changelog li {
702
- padding: 4px 0px;
703
  }
704
 
705
- ul.changelog li div.two{
706
- width: 70%;
707
- float: left;
708
- display: inline-block;
709
- height: 25px;
710
- margin-right: 20px;
711
- background: #D9E0E4;
712
- text-align: center;
713
- line-height: 25px;
714
  }
715
 
716
- ul.changelog li.fixed > div {
717
- background:#F0FFE1;
718
- color: #444;
719
- border-right:1px solid #5cb85c;
720
- width: 20%;
721
  }
722
 
723
  ul.changelog li.fixed div.two:before {
724
- content: "\f147";
725
- font-family: "dashicons";
726
- color:#5CB85C;
727
- margin-right: 5px;
728
  }
729
 
730
- ul.changelog li.add > div{
731
- background:#FFEED0;
732
- color: #444;
733
- border-right:1px solid #EFA537;
734
- width: 20%;
735
  }
736
 
737
  ul.changelog li.add div.two:before {
738
- content: "\f155";
739
- font-family: "dashicons";
740
- color:#EFA537;
741
- margin-right: 5px;
742
  }
743
 
744
- ul.changelog li.update > div{
745
- background:#bde7ff;
746
- color: #444;
747
- border-right:1px solid #106daa;
748
- width: 20%;
749
  }
750
 
751
  ul.changelog li.update div.two:before {
752
- content: "\f463";
753
- font-family: "dashicons";
754
- color:#106daa;
755
- margin-right: 5px;
756
  }
757
 
758
  /********************
@@ -760,415 +849,447 @@ Addons Page
760
  *********************/
761
 
762
  .qsm-addons {
763
- display: flex;
764
- flex-direction: column;
765
  }
766
 
767
- @media screen and (min-width:700px) {
768
- .qsm-addons {
769
- flex-direction: row;
770
- flex-wrap: wrap;
771
- }
772
  }
773
 
774
-
775
  /********************
776
  Help Page
777
  *********************/
778
 
779
  .quiz_email_support p#mlw_support_message {
780
- color: red;
781
- font-size: 20px;
782
  }
783
 
784
- .quiz_email_support input, .quiz_email_support textarea {
785
- width: 100% !important;
 
786
  }
787
 
788
  .quiz_email_support textarea {
789
- min-height: 200px;
790
  }
791
 
792
  .quiz_email_support label {
793
- font-weight: bold;
794
  }
795
 
796
-
797
  /********************
798
  Misc.
799
  *********************/
800
 
801
  /* Ads */
802
  .help-decide {
803
- display: block;
804
- text-align:center;
805
- background: #fff;
806
- border: 5px solid #1DD969;
807
- color: #000;
808
- font-weight: bold;
809
  }
 
810
  .help-decide p {
811
- font-size: 14px;
812
  }
813
 
814
  /* Info Bar */
815
  .qsm-info-box {
816
- display: block;
817
- text-align: center;
818
- background: #fff;
819
- border: 1px solid #dfd4d4;
820
- /* color: #000; */
821
- font-weight: bold;
822
- /* font-size: 14px; */
823
- margin-bottom: 20px;
824
- margin-top: 10px;
825
  }
826
 
827
  .qsm-info-box p {
828
- font-size: 14px;
829
  }
830
 
831
-
832
  /* Info Widget */
833
  .qsm-quiz-page-addon .qsm-info-widget {
834
- margin-top: 0;
835
- background: #fff;
836
- margin-left: 0;
837
  }
 
838
  .qsm-info-widget {
839
- text-align: center;
840
- border: 1px solid #dfd4d4;
841
- margin: 30px 1% 0 1%;
842
- background: #f1f1f1;
843
- padding: 10px 15px;
844
- transition-duration: 0.5s;
845
- max-width: 330px;
846
- box-sizing: border-box;
847
  }
848
 
849
  .admin_page_mlw_quiz_options .qsm-info-widget {
850
- background: #fff;
851
- margin: 0 0 20px 0;
852
- cursor: pointer;
853
  }
854
 
855
  .admin_page_mlw_quiz_options .qsm-info-widget:hover,
856
- .admin_page_mlw_quiz_options div.mlw_qmn_themeBlockActive.qsm-info-widget{
857
- background-color: #333;
858
- color: #fff;
859
  }
860
 
861
- #mlw_qmn_theme_block_primary{
862
- background-color: #005e8e;
863
- color: #fff;
864
  }
865
 
866
- #mlw_qmn_theme_block_amethyst{
867
- background-color: #9b59b6;
868
- color: #fff;
869
  }
870
 
871
- #mlw_qmn_theme_block_emerald{
872
- background-color: #006732;
873
- color: #fff;
874
  }
875
 
876
- #mlw_qmn_theme_block_turquoise{
877
- background-color: #006552;
878
- color: #fff;
879
  }
880
 
881
- #mlw_qmn_theme_block_gray{
882
- background-color: #595959;
883
- color: #fff;
884
  }
885
 
886
- .mlw_qmn_themeBlockActive.qsm-info-widget{
887
- transform: scale(1.1);
888
- border: 2px solid #d5a8a8;
889
  }
890
 
891
  .qsm-info-widget a.button-primary {
892
- margin-top: 15px;
893
  }
894
 
895
  .qsm-quiz-page-addon a.button-primary {
896
- margin-top: 0 !important;
897
  }
898
 
899
  .qsm-info-widget:hover {
900
- transform: scale(1.1);
901
  }
902
 
903
  /* Options tabs */
904
  .qsm_tab_content,
905
  .mlw_tab_content {
906
- padding: 10px 10px 10px 10px;
907
  }
908
 
909
- .admin_page_mlw_quiz_options .qsm_tab_content > form > .button-primary:nth-child(3) {
910
- display: none;
911
  }
912
 
913
- .qsm_tab_content label{
914
- margin-right: 5px;
915
  }
916
 
917
  /* Popup */
918
 
919
  .qsm-popup {
920
- font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
 
921
  }
922
 
923
  .qsm-popup__overlay {
924
- position: fixed;
925
- top: 0;
926
- left: 0;
927
- right: 0;
928
- bottom: 0;
929
- background: rgba(0,0,0,0.6);
930
- display: flex;
931
- justify-content: center;
932
- align-items: center;
933
- z-index: 9999;
934
  }
935
 
936
  .qsm-popup__container {
937
- background-color: #fff;
938
- padding: 30px;
939
- min-width: 500px;
940
- max-width: 700px;
941
- max-height: 95vh;
942
- border-radius: 4px;
943
- overflow-y: auto;
944
- box-sizing: border-box;
945
  }
946
 
947
  .qsm-popup__header {
948
- display: flex;
949
- justify-content: space-between;
950
- align-items: center;
951
  }
952
 
953
  .qsm-popup__title {
954
- margin-top: 0;
955
- margin-bottom: 0;
956
- font-weight: 600;
957
- font-size: 1.25rem;
958
- line-height: 1.25;
959
- color: #00449e;
960
- box-sizing: border-box;
961
  }
962
 
963
  .qsm-popup__close {
964
- background: transparent;
965
- border: 0;
966
- color: #00449e;
967
- text-decoration: none;
968
  }
969
 
970
- .qsm-popup__header .qsm-popup__close:before {
971
- content: "\2715";
972
  }
973
 
974
  .qsm-popup__content {
975
- margin-top: 2rem;
976
- margin-bottom: 2rem;
977
- line-height: 1.5;
978
- color: rgba(0,0,0,.8);
979
  }
980
 
981
  body .qsm-popup__btn {
982
- font-size: .875rem;
983
- padding-left: 1rem;
984
- padding-right: 1rem;
985
- padding-top: .5rem;
986
- padding-bottom: .5rem;
987
- background-color: #e6e6e6;
988
- color: rgba(0,0,0,.8);
989
- border-radius: .25rem;
990
- border-style: none;
991
- border-width: 0;
992
- cursor: pointer;
993
- -webkit-appearance: button;
994
- text-transform: none;
995
- overflow: visible;
996
- line-height: 1.15;
997
- margin: 0;
998
- will-change: transform;
999
- -moz-osx-font-smoothing: grayscale;
1000
- -webkit-backface-visibility: hidden;
1001
- backface-visibility: hidden;
1002
- -webkit-transform: translateZ(0);
1003
- transform: translateZ(0);
1004
- transition: -webkit-transform .25s ease-out;
1005
- transition: transform .25s ease-out;
1006
- transition: transform .25s ease-out,-webkit-transform .25s ease-out;
1007
- }
1008
-
1009
- .qsm-popup__btn:focus, .qsm-popup__btn:hover {
1010
- -webkit-transform: scale(1.05);
1011
- transform: scale(1.05);
 
1012
  }
1013
 
1014
  body .qsm-popup__btn-primary {
1015
- background-color: #00449e;
1016
- color: #fff;
1017
  }
1018
 
1019
  @keyframes mmfadeIn {
1020
- from { opacity: 0; }
1021
- to { opacity: 1; }
 
 
 
 
 
1022
  }
1023
 
1024
  @keyframes mmfadeOut {
1025
- from { opacity: 1; }
1026
- to { opacity: 0; }
 
 
 
 
 
1027
  }
1028
 
1029
  @keyframes mmslideIn {
1030
- from { transform: translateY(15%); }
1031
- to { transform: translateY(0); }
 
 
 
 
 
1032
  }
1033
 
1034
  @keyframes mmslideOut {
1035
- from { transform: translateY(0); }
1036
- to { transform: translateY(-10%); }
 
 
 
 
 
1037
  }
1038
 
1039
  .qsm-popup-slide {
1040
- display: none;
1041
  }
1042
 
1043
  .qsm-popup-slide.is-open {
1044
- display: block !important;
1045
  }
1046
 
1047
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
1048
- animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
1049
  }
1050
 
1051
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
1052
- animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
1053
  }
1054
 
1055
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
1056
- animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
1057
  }
1058
 
1059
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
1060
- animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
1061
  }
1062
 
1063
  .qsm-popup-slide .qsm-popup__container,
1064
  .qsm-popup-slide .qsm-popup__overlay {
1065
- will-change: transform;
1066
  }
1067
 
1068
  /**
1069
  * Shortcode accordion
1070
  */
1071
- .sc-opener{
1072
- position: relative;
1073
- font-size: 14px !important;
1074
- margin-bottom: 10px;
1075
- cursor: pointer;
1076
- display: inline-block;
1077
- color: #0073aa !important;
1078
- font-weight: 500;
1079
- }
1080
- .sc-opener span.dashicons{
1081
- position: relative;
1082
- top: 2px;
1083
- margin-right: 5px;
1084
- }
1085
- .sc-content{
1086
- display: none;
1087
- }
1088
- .quiz-preview-link{
1089
- margin-left: 10px;
1090
- position: relative;
1091
- top: 3px;
1092
- }
1093
-
1094
- #show-advanced-option{
1095
- font-size: 16px;
1096
- cursor: pointer;
1097
- color: #0073aa;
1098
- margin-bottom: 15px;
1099
- }
1100
-
1101
- .remove-ads-adv-link{
1102
- text-align: center;
1103
- margin-top: 30px;
1104
- }
1105
-
1106
- .qsm-info-widget h3{
1107
- line-height: 132%;
1108
- }
1109
-
1110
- .remove-ads-adv-link a{
1111
- background: #1DD969;
1112
- text-align: center;
1113
- color: #fff;
1114
- padding: 3px 10px;
1115
- border-radius: 5px;
1116
- display: inline-block;
1117
- text-decoration: none;
1118
- font-size: 13px;
1119
- font-weight: bold;
1120
- margin-bottom: 10px;
1121
- }
1122
-
1123
- .help-decide a.remove-adv-button{
1124
- background: #1DD969;
1125
- text-align: center;
1126
- color: #fff;
1127
- padding: 3px 10px;
1128
- border-radius: 5px;
1129
- display: inline-block;
1130
- text-decoration: none;
1131
- font-size: 13px;
1132
- font-weight: bold;
1133
- margin-left: 10px;
 
 
 
1134
  }
1135
 
1136
  h3.addon_category_name {
1137
- width: 100%;
1138
- background: transparent;
1139
- padding: 15px 0;
1140
- border-bottom: 1px solid #d7d1d1;
1141
- margin-bottom: 30px;
1142
  }
 
1143
  /*Design of new radio taggle*/
1144
  .buttonset.ui-buttonset .ui-button.ui-state-active {
1145
- background: #E21130 none repeat scroll 0 0;
1146
- border-color: #E21130 !important;
1147
  }
1148
- .buttonset.ui-buttonset .ui-button.ui-state-active span.ui-button-text{
1149
- color: #fff !important;
 
1150
  }
 
1151
  .buttonset.ui-buttonset.green .ui-state-active {
1152
- background: #44c767 none repeat scroll 0 0;
1153
- border-color: #44c767 !important;
1154
  }
 
1155
  .buttonset.ui-buttonset .ui-button.ui-state-active.ui-corner-left {
1156
- background: #44c767 none repeat scroll 0 0;
1157
- border-color: #44c767 !important;
1158
  }
 
1159
  .buttonset.ui-buttonset label {
1160
- background: #fff;
1161
- border: 1px solid #B6B6B6;
1162
- margin-right: -5px !important;
1163
- }
1164
- .buttonset.ui-buttonset label span.ui-button-text{
1165
- color: #727272;
1166
- font-size: 12px;
1167
- height: 35px;
1168
- line-height: 35px;
1169
- min-width: 20px;
1170
- padding: 0 10px;
1171
  }
 
 
 
 
 
 
 
 
 
 
1172
  .qsm_tab_content input[type="text"],
1173
  .qsm_tab_content input[type="number"],
1174
  .qsm_global_settings input[type="text"],
@@ -1176,663 +1297,805 @@ h3.addon_category_name {
1176
  .qsm_global_settings input[type="email"],
1177
  .qsm-addon-setting-wrap input[type="email"],
1178
  .qsm-addon-setting-wrap input[type="text"],
1179
- .qsm-addon-setting-wrap input[type="number"]{
1180
- background: #ffffff none repeat scroll 0 0;
1181
- border: 1px solid #dddddd;
1182
- border-radius: 5px;
1183
- box-shadow: none;
1184
- color: #666666;
1185
- /*padding: 10px 15px;*/
1186
- width: auto;
1187
- height: auto;
1188
- /*min-width: 230px;*/
1189
- /*max-width:100%;*/
1190
- }
1191
- .qsm_tab_content textarea{
1192
- background: #ffffff none repeat scroll 0 0;
1193
- border: 1px solid #dddddd;
1194
- border-radius: 5px;
1195
- box-shadow: none;
1196
- color: #666666;
1197
- padding: 10px 15px;
1198
- width: 100%;
1199
- height: auto;
1200
- }
1201
- .global-sub-text{
1202
- margin-left: 15px;
 
 
1203
  }
 
1204
  /* The switch - the box around the slider */
1205
  .switch {
1206
- position: relative;
1207
- display: inline-block;
1208
- width: 60px;
1209
- height: 34px;
1210
  }
1211
 
1212
  /* Hide default HTML checkbox */
1213
  .switch input[type="checkbox"] {
1214
- opacity: 0;
1215
- width: 0;
1216
- height: 0;
1217
  }
 
1218
  /* The slider */
1219
  .slider {
1220
- position: absolute;
1221
- cursor: pointer;
1222
- top: 0;
1223
- left: 0;
1224
- right: 0;
1225
- bottom: 0;
1226
- background-color: #ccc;
1227
- -webkit-transition: .4s;
1228
- transition: .4s;
1229
  }
1230
 
1231
  .slider:before {
1232
- position: absolute;
1233
- content: "";
1234
- height: 26px;
1235
- width: 26px;
1236
- left: 4px;
1237
- bottom: 4px;
1238
- background-color: white;
1239
- -webkit-transition: .4s;
1240
- transition: .4s;
1241
  }
1242
 
1243
- input:checked + .slider {
1244
- background-color: #2196F3;
1245
  }
1246
 
1247
- input:focus + .slider {
1248
- box-shadow: 0 0 1px #2196F3;
1249
  }
1250
 
1251
- input:checked + .slider:before {
1252
- -webkit-transform: translateX(26px);
1253
- -ms-transform: translateX(26px);
1254
- transform: translateX(26px);
1255
  }
1256
 
1257
  /* Rounded sliders */
1258
  .slider.round {
1259
- border-radius: 34px;
1260
  }
1261
 
1262
  .slider.round:before {
1263
- border-radius: 50%;
1264
  }
1265
 
1266
  input#sc-shortcode-model-text,
1267
  input#sc-shortcode-model-text-link {
1268
- height: 30px;
1269
  }
 
1270
  div#modal-6 label {
1271
- display: block;
1272
- font-size: 14px;
1273
- margin-bottom: 5px;
1274
- font-weight: 500;
1275
- color: #999;
1276
- font-style: italic;
1277
  }
1278
- #modal-6 .button > span.dashicons {
1279
- line-height: 29px;
 
1280
  }
1281
- .qsm-list-shortcode-view span.dashicons{
1282
- font-size: 24px;
 
1283
  }
 
1284
  /**
1285
  * No quiz screen design
1286
  */
1287
  .qsm-no-quiz-wrapper {
1288
- text-align: center;
1289
- max-width: 100%;
1290
- width: 100%;
1291
  }
1292
- .qsm-no-quiz-wrapper .dashicons.dashicons-format-chat{
1293
- font-size: 200px;
1294
- display: block;
1295
- /* line-height: 200px; */
1296
- width: auto;
1297
- height: auto;
 
1298
  }
1299
- .qsm-no-quiz-wrapper h2{
1300
- margin-bottom: 30px;
 
1301
  }
1302
- .qsm-no-quiz-wrapper .buttons{
1303
- margin-bottom: 30px;
 
1304
  }
1305
- .qsm-no-quiz-wrapper .buttons a{
1306
- margin-right: 20px;
 
1307
  }
1308
- .qsm-no-quiz-wrapper .buttons a:last-child{
1309
- color: #8b8888
 
1310
  }
1311
- .qsm-no-quiz-wrapper .buttons a:last-child .dashicons{
1312
- line-height: 46px;
 
1313
  }
1314
- .qsm-no-quiz-wrapper h3{
1315
- color: #8b8888;
1316
- margin-bottom: 30px;
 
1317
  }
 
1318
  /**
1319
  * Option page design
1320
  */
1321
  span.qsm-ph_text {
1322
- width: 100px;
1323
- display: inline-block;
1324
  }
1325
- tr .qsm-opt-desc{
1326
- color: #666;
1327
- font-style: italic;
1328
- font-size: 14px;
1329
- margin-top: 5px;
1330
- display: block;
 
1331
  }
1332
- #quiz_settings_wrapper .qsm-opt-desc{
1333
- display: none !important;
 
1334
  }
 
1335
  .form-table td fieldset label {
1336
- margin-right: 20px !important;
1337
  }
1338
- .form-table .qsm-opt-tr{
1339
- position: relative;
1340
- padding-right: 24px;
1341
- padding-top: 15px;
 
1342
  }
 
1343
  td.scheduled_time_start {
1344
- padding-bottom: 0 !important;
1345
- }
1346
- .qsm-opt-tr .qsm-tooltips-icon{
1347
- margin: 0 0 0 0;
1348
- position: relative;
1349
- right: 0;
1350
- top: 4px;
1351
- color: #666;
1352
- display: inline-block;
1353
- font-size: 1.2em;
1354
- font-style: normal;
1355
- cursor: help;
1356
- width: auto;
1357
- height: auto;
 
1358
  }
 
1359
  .qsm-tooltips-icon .qsm-tooltips {
1360
- background-color: #333;
1361
- border-radius: 3px;
1362
- color: #ffffff;
1363
- display: none;
1364
- font-size: 12px;
1365
- padding: 10px 5px;
1366
- line-height: 1.5;
1367
- opacity: 0;
1368
- left: 50%;
1369
- position: absolute;
1370
- text-align: center;
1371
- bottom: 25px;
1372
- width: 200px;
1373
- transform: translateX(-50%);
1374
- transition: opacity 0.5s ease 0s;
1375
- font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
1376
- }
1377
- .qsm-tooltips-icon .qsm-tooltips a{
1378
- color: #fff;
 
 
1379
  }
 
1380
  .qsm-tooltips-icon .qsm-tooltips:before {
1381
- border-color: #333 rgba(0, 0, 0, 0) rgba(0, 0, 0, 0);
1382
- border-style: solid;
1383
- border-width: 8px 7px 0;
1384
- bottom: -8px;
1385
- content: "";
1386
- left: 50%;
1387
- transform: translateX(-50%);
1388
- position: absolute;
1389
  }
 
1390
  .qsm-tooltips-icon:hover .qsm-tooltips,
1391
- .qsm-tooltips:hover{
1392
- display: block;
1393
- opacity: 1;
1394
- z-index: 9999;
1395
  }
 
1396
  /**
1397
  * Text Tab design
1398
  */
1399
- .qsm-text-main-wrap{
1400
- display: inline-block;
1401
- width: 100%;
1402
  }
1403
- .qsm-text-main-wrap #post-body-content{
1404
- background: #fff;
1405
- box-sizing: border-box;
 
1406
  }
1407
- .qsm-text-main-wrap #postbox-container-1{
1408
- position: relative;
1409
- background: #fff;
1410
- box-sizing: border-box;
 
1411
  }
1412
- .qsm-text-main-wrap #postbox-container-1 .qsm-text-header h5{
1413
- font-size: 14px;
1414
- margin: 0;
1415
- font-weight: bold;
 
1416
  }
1417
- .qsm-text-main-wrap #postbox-container-1 .qsm-text-header .description{
1418
- color: #666;
 
1419
  }
1420
- .qsm-text-main-wrap .qsm-text-header{
1421
- padding: 20px;
1422
- border-bottom: 1px solid #f1f1f1;
 
1423
  }
1424
- .qsm-text-main-wrap .qsm-text-header .message-dropdown{
1425
- display: inline-block;
 
1426
  }
1427
- .qsm-text-main-wrap .qsm-text-header .message-dropdown label{
1428
- font-size: 14px;
1429
- font-weight: bold;
 
1430
  }
1431
- .qsm-text-main-wrap .qsm-text-header .save-text-changes{
1432
- float: right;
 
1433
  }
1434
- .qsm-text-main-wrap .qsm-text-conent{
1435
- padding: 20px;
1436
- border-bottom: 1px solid #f1f1f1;
1437
- position: relative;
 
1438
  }
1439
- .qsm-text-conent.qsm-text-allowed-variables span.qsm-text-template-span{
1440
- display: inline-block;
1441
- margin-bottom: 10px;
1442
- margin-right: 10px;
1443
- position: relative;
 
1444
  }
 
1445
  #show-all-variable-content span.qsm-text-template-span {
1446
- display: inline-block;
1447
- position: relative;
1448
- text-align: center;
1449
- }
1450
- #show-all-variable-content .popup-template-span-wrap{
1451
- margin-bottom: 20px;
1452
- margin-right: 3%;
1453
- width: 30%;
1454
- display: inline-block;
1455
- }
1456
- #show-all-variable-content .popup-template-span-wrap:nth-child(3n+3) .qsm-text-template-span .qsm-tooltips-icon .qsm-tooltips{
1457
- left: calc( 100% - 100px );
1458
- }
1459
- #show-all-variable-content .popup-template-span-wrap:nth-child(3n+3) .qsm-text-template-span .qsm-tooltips-icon .qsm-tooltips:before{
1460
- left: 93%;
1461
- }
1462
- #show-all-variable-content .qsm-text-template-span .qsm-tooltips-icon{
1463
- margin-left: 5px;
1464
- }
1465
- .qsm-text-template-span button{
1466
- border-color: #ccc !important;
1467
- }
1468
- .qsm-text-template-span .qsm-tooltips-icon{
1469
- vertical-align: middle;
1470
- line-height: 30px;
1471
- color: #9E9E9E;
1472
- margin-left: 5px;
1473
- }
1474
- .qsm-text-template-span .qsm-tooltips-icon .qsm-tooltips{
1475
- left: calc( 100% - 10px );
1476
- bottom: 30px;
1477
- }
1478
- .qsm-text-label-wrapper > h2 {
1479
- font-size: 24px;
1480
- border-bottom: 1px solid #ccc;
1481
- padding-bottom: 10px;
1482
- line-height: normal;
1483
- }
1484
- .qsm-text-label-wrapper form > button:nth-child(3){
1485
- display: none;
1486
- }
1487
- .qsm-text-label-wrapper .section_heading{
1488
- margin-top: 0;
1489
- }
1490
- #show-all-variable .qsm-popup__container{
1491
- min-width: 50vw;
1492
- max-width: 1040px;
1493
- padding: 0;
1494
- }
1495
- #show-all-variable-content{
1496
- margin-bottom: 0 !important;
1497
- padding: 20px;
1498
- margin: 0;
1499
- }
1500
- #show-all-variable .qsm-popup__header{
1501
- border-bottom: 1px solid #f1f1f1;
1502
- padding: 20px;
1503
- }
1504
- #show-all-variable .qsm-popup__header .qsm-popup__title{
1505
- color: #23282d;
1506
- margin-bottom: 7px;
1507
- }
1508
- #show-all-variable .qsm-popup__footer{
1509
- border-top: 1px solid #f1f1f1;
1510
- padding: 20px;
1511
- }
1512
- .qsm-view-preview-btn{
1513
- text-decoration: none;
1514
- line-height: normal;
1515
- margin-left: -5px;
1516
- }
1517
- .qsm-view-preview-btn span.dashicons,
1518
- .edit-quiz-name span.dashicons{
1519
- line-height: 12px;
1520
- vertical-align: bottom;
1521
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1522
  .mlw_quiz_options a.button.button-default.qsm-btn-quiz-edit {
1523
- box-shadow: none;
1524
- float: right;
1525
- margin-right: 5px;
1526
- }
1527
- .mlw_quiz_options a.button.button-default.qsm-btn-quiz-edit:hover{
1528
- opacity: 0.8;
1529
- }
1530
- .mlw_quiz_options a.button.button-default.qsm-btn-quiz-edit span.dashicons{
1531
- line-height: 27px;
1532
- }
1533
- .mlw_quiz_options .nav-tab-wrapper{
1534
- margin-top: 20px;
1535
- }
1536
- .mlw_quiz_options .edit-quiz-name{
1537
- float: none;
1538
- text-decoration: none;
1539
- }
1540
- .qsm_text_customize_label{
1541
- position: fixed;
1542
- bottom: 20px;
1543
- right: 25px;
1544
- background: #fff;
1545
- color: #5c5959;
1546
- padding: 10px 20px;
1547
- box-sizing: border-box;
1548
- z-index: 99;
1549
- border-radius: 5px;
1550
- border: 1px solid #cdbaba;
1551
- cursor: pointer;
1552
- }
1553
- .qsm-text-tab-message-loader{
1554
- position: absolute;
1555
- top: 50%;
1556
- left: 50%;
1557
- z-index: 99;
1558
- transform: translate(-50%, -50%);
1559
- }
1560
- .qsm_text_customize_label .dashicons{
1561
- font-size: 14px;
1562
- line-height: 20px;
1563
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1564
  /**
1565
  * Admin result page design
1566
  */
1567
  .overview-main-wrapper {
1568
- display: flex;
1569
- width: 100%;
1570
  }
1571
- .overview-main-wrapper .overview-inner-wrap{
1572
- margin-right: 2%;
1573
- width: 33.33%;
 
1574
  }
1575
- .overview-main-wrapper .overview-inner-wrap .inside{
1576
- min-height: 105px;
 
1577
  }
1578
- .overview-main-wrapper .overview-inner-wrap:last-child{
1579
- margin-right: 0;
 
1580
  }
 
1581
  .overview-main-wrapper .overview-inner-wrap h2.hndle,
1582
  .comment-inner-wrap h2.hndle,
1583
- .response-inner-wrap h2.hndle{
1584
- margin: 0;
1585
- padding: 10px;
1586
- }
1587
- .overview-main-wrapper .candidate-detail-wrap.overview-inner-wrap .result-candidate-span{
1588
- display: block;
1589
- margin-bottom: 5px;
1590
- }
1591
- .overview-main-wrapper .candidate-detail-wrap.overview-inner-wrap .result-candidate-span:last-child{
1592
- margin-bottom: 0;
1593
- }
1594
- .overview-main-wrapper .overview-inner-wrap.candidate-detail-wrap .result-candidate-span> label{
1595
- font-weight: bold;
1596
- }
1597
- .overview-main-wrapper .overview-inner-wrap.candidate-detail-wrap .result-candidate-span > span{
1598
- float: right;
1599
- }
1600
- .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper{
1601
- display: -webkit-box;
1602
- display: -moz-box;
1603
- display: -ms-flexbox;
1604
- display: -webkit-flex;
1605
- display: flex;
1606
- -webkit-flex-flow: row wrap;
1607
- justify-content: center;
1608
- -webkit-justify-content: center;
1609
- flex-wrap: nowrap;
1610
- }
1611
- .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper > div{
1612
- padding: 15px 30px;
1613
- background: #F1F1F1;
1614
- margin-right: 10px;
1615
- max-width: 120px;
1616
- width: 100%;
1617
- }
1618
- .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper > div:last-child{
1619
- margin-right: 0;
1620
- }
1621
- .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper span.timer-span{
1622
- display: block;
1623
- font-size: 36px;
1624
- font-weight: bold;
1625
- text-align: center;
1626
- }
1627
- .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper span.timer-text{
1628
- display: block;
1629
- font-size: 16px;
1630
- font-weight: bold;
1631
- text-align: center;
1632
- }
1633
- .response-inner-wrap .inside{
1634
- padding: 10px;
1635
- margin: 0;
1636
- }
1637
- .response-inner-wrap .inside .qmn_question_answer{
1638
- background-color: #f1f1f1;
1639
- padding: 10px;
1640
- margin-bottom: 0;
1641
- background-repeat: no-repeat;
1642
- background-position: 95% center;
1643
- padding-right: 12%;
1644
- }
1645
- .response-inner-wrap .inside .qmn_question_answer:nth-child(2n){
1646
- background-color: #fff;
1647
- }
1648
- .response-inner-wrap .inside .qmn_question_answer.qmn_question_answer_incorrect{
1649
- background-image: url(../assets/wrong.png);
1650
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1651
  .response-inner-wrap .inside .qsm-add-border-bottom.qmn_question_answer.qmn_question_answer_incorrect,
1652
- .response-inner-wrap .inside .qsm-remove-border-bottom.qmn_question_answer.qmn_question_answer_incorrect{
1653
- background-image: none;
1654
  }
1655
- .response-inner-wrap .inside .qmn_question_answer.qmn_question_answer_correct{
1656
- background-image: url(../assets/right.png);
 
1657
  }
 
1658
  .response-inner-wrap .inside .qsm-add-border-bottom.qmn_question_answer.qmn_question_answer_correct,
1659
- .response-inner-wrap .inside .qsm-remove-border-bottom.qmn_question_answer.qmn_question_answer_correct{
1660
- background-image: none;
1661
- }
1662
- .old_template_result_wrap{
1663
- padding: 15px;
1664
- background: #fff;
1665
- }
1666
- .result-page-title{
1667
- text-align: left;
1668
- display: inline-block;
1669
- float: left;
1670
- font-size: 23px;
1671
- font-weight: 400;
1672
- margin: 0;
1673
- line-height: 30px;
1674
- }
1675
- .result-tab-content a.button > span.dashicons {
1676
- line-height: 29px;
1677
- font-size: 18px;
1678
- margin-left: -4px;
1679
- margin-right: -4px;
1680
- }
1681
- .result-page-wrapper .tablenav-pages{
1682
- margin-left: 10px;
1683
- }
1684
- .result-page-wrapper .tablenav.top{
1685
- margin-bottom: 20px;
1686
- margin-top: 20px;
1687
- }
1688
- .inner-sidebar1 .handlediv{
1689
- display: none !important;
1690
- }
1691
- .inner-sidebar1 .hndle{
1692
- padding-left: 10px;
1693
- padding-top: 10px;
1694
- margin: 0;
1695
- padding-bottom: 10px;
 
 
 
 
 
 
 
1696
  }
 
1697
  .inner-sidebar1 .inside h3,
1698
- .inner-sidebar1 .inside h4{
1699
- margin-bottom: 10px;
1700
  }
 
1701
  .qsm-quiz-email-tab,
1702
- .qsm-quiz-result-tab{
1703
- max-width: 1200px;
1704
- width: 100%;
1705
  }
 
1706
  .qsm-quiz-email-tab .qsm-show-all-variable-text span.dashicons,
1707
- .qsm-quiz-result-tab .qsm-show-all-variable-text span.dashicons{
1708
- font-size: 16px;
1709
- line-height: 22px;
1710
  }
 
1711
  .qsm-quiz-email-tab .qsm-show-all-variable-text,
1712
- .qsm-quiz-result-tab .qsm-show-all-variable-text{
1713
- position: fixed;
1714
- bottom: 20px;
1715
- right: 25px;
1716
- background: #fff;
1717
- color: #5c5959;
1718
- padding: 10px 20px;
1719
- box-sizing: border-box;
1720
- z-index: 99;
1721
- border-radius: 5px;
1722
- border: 1px solid #cdbaba;
1723
- cursor: pointer;
1724
- text-decoration: none;
1725
  }
 
1726
  .popup-template-span-wrap .popup-copied-des {
1727
- color: green;
1728
- }
1729
- .popup-template-span-wrap .popup-copied-des span.dashicons{
1730
- line-height: 28px;
1731
- }
1732
- .comment-inner-wrap{
1733
- display: none;
1734
- }
1735
- @media (min-width: 768px) and (max-width: 1199px){
1736
- .qsm-news-ads .qsm-info-widget{
1737
- float: left;
1738
- max-width: unset;
1739
- width: 31.3%;
1740
- }
1741
- .qsm-news-ads .qsm-info-widget:nth-child(3n+5){
1742
- clear: both;
1743
- }
1744
- .remove-ads-adv-link{
1745
- width: 100%;
1746
- display: inline-block;
1747
- margin-bottom: 30px;
1748
- }
1749
- }
1750
- @media screen and (max-width: 782px){
1751
- .form-table td fieldset label {
1752
- margin-top: -1px !important;
1753
- vertical-align: top;
1754
- }
1755
- .qsm-tooltips-icon .qsm-tooltips{
1756
- left: -90px;
1757
- }
1758
- .qsm-opt-tr .qsm-tooltips-icon{
1759
- right: 13px;
1760
- }
1761
- .qsm-tooltips-icon .qsm-tooltips:before{
1762
- left: auto;
1763
- right: -3px;
1764
- }
1765
- }
1766
- @media screen and (max-width: 767px){
1767
- .qsm-quiz-row td:nth-of-type(2n){
1768
- display: none;
1769
- }
1770
- .qsm-quiz-page-wrapper,
1771
- .qsm-quiz-page-wrapper-with-ads {
1772
- overflow-x: auto;
1773
- }
1774
- .qsm-quiz-page-wrapper thead th:nth-of-type(2n),
1775
- .qsm-quiz-page-wrapper tfoot th:nth-of-type(2n),
1776
- .qsm-quiz-page-wrapper-with-ads thead th:nth-of-type(2n),
1777
- .qsm-quiz-page-wrapper-with-ads tfoot th:nth-of-type(2n){
1778
- display: none;
1779
- }
1780
- .qsm-quiz-page-wrapper .row-actions{
1781
- display: inline-block !important;
1782
- }
1783
- .qsm-quiz-page-wrapper p.search-box {
1784
- bottom: -30px;
1785
- }
1786
- .qsm-popup__container{
1787
- min-width: auto;
1788
- max-width: 100%;
1789
- }
1790
- #show-advanced-option {
1791
- display: block;
1792
- width: 100%;
1793
- float: left;
1794
- }
1795
- .contact-form-label {
1796
- display: inline-block;
1797
- }
1798
- .template_variable{
1799
- width: 100%;
1800
- max-width: 100%;
1801
- margin-bottom: 10px;
1802
- word-break: break-word;
1803
- }
1804
- .qsm_tab_content .form-table input[type=radio]{
1805
- top: 6px;
1806
- margin-bottom: 8px;
1807
- }
1808
- .result-page-wrapper form{
1809
- overflow: scroll;
1810
- width: 100%;
1811
- }
1812
- p.search-box{
1813
- bottom: -30px;
1814
- }
1815
- .quizzes-surveys_page_qsm_quiz_help .hndle{
1816
- padding-left: 15px;
1817
- padding-bottom: 15px;
1818
- }
1819
- .qsm-news-ads .qsm-info-widget{
1820
- width: calc( 100% - 30px );
1821
- max-width: 100%;
1822
- box-sizing: border-box;
1823
- margin: 15px 15px 0 15px;
1824
- }
1825
- .form-table .qsm-opt-tr{
1826
- padding-bottom: 10px;
1827
- }
1828
- .overview-main-wrapper{
1829
- display: block;
1830
- }
1831
- .overview-main-wrapper .overview-inner-wrap{
1832
- margin-right: 0;
1833
- width: 100%;
1834
- }
1835
- .result-page-title{
1836
- margin-bottom: 10px;
1837
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1838
  }
6
  font-size: 16px !important;
7
  }*/
8
 
 
9
  @-moz-keyframes qsm-spinner-loader {
10
  0% {
11
  -moz-transform: rotate(0deg);
12
  transform: rotate(0deg);
13
  }
14
+
15
  100% {
16
  -moz-transform: rotate(360deg);
17
  transform: rotate(360deg);
18
  }
19
  }
20
+
21
  @-webkit-keyframes qsm-spinner-loader {
22
  0% {
23
  -webkit-transform: rotate(0deg);
24
  transform: rotate(0deg);
25
  }
26
+
27
  100% {
28
  -webkit-transform: rotate(360deg);
29
  transform: rotate(360deg);
37
  -webkit-transform: rotate(0deg);
38
  transform: rotate(0deg);
39
  }
40
+
41
  100% {
42
  -moz-transform: rotate(360deg);
43
  -ms-transform: rotate(360deg);
54
  -moz-border-radius: 0.5em;
55
  -webkit-border-radius: 0.5em;
56
  border-radius: 0.5em;
57
+ -moz-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0,
58
+ rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0,
59
+ rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0,
60
+ rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0,
61
+ rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
62
+ -webkit-box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0,
63
+ rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0,
64
+ rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0,
65
+ rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0,
66
+ rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
67
+ box-shadow: rgba(0, 0, 51, 0.3) 1.5em 0 0 0,
68
+ rgba(0, 0, 51, 0.3) 1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) 0 1.5em 0 0,
69
+ rgba(0, 0, 51, 0.3) -1.1em 1.1em 0 0, rgba(0, 0, 51, 0.3) -1.5em 0 0 0,
70
+ rgba(0, 0, 51, 0.3) -1.1em -1.1em 0 0, rgba(0, 0, 51, 0.3) 0 -1.5em 0 0,
71
+ rgba(0, 0, 51, 0.3) 1.1em -1.1em 0 0;
72
  display: inline-block;
73
  font-size: 10px;
74
  width: 1em;
79
  }
80
 
81
  span.qsm-quiz-name {
82
+ font-size: 14px;
83
+ font-weight: 600;
84
  }
85
 
86
  .qsm-quizzes-page-content {
87
+ display: flex;
88
+ flex-direction: column;
89
+ justify-content: space-between;
90
  }
91
 
92
  .qsm-quiz-page-wrapper {
93
+ flex-grow: 1;
94
  }
95
 
96
  .qsm-quiz-page-wrapper-with-ads {
97
+ flex-grow: 1;
98
  }
99
 
100
  .qsm-news-ads {
101
+ background-color: #fff;
102
+ border: 1px solid #dfd4d4;
103
+ margin-top: 30px;
104
+ display: none;
105
  }
106
 
107
  .qsm-news-ads-title {
108
+ text-align: center;
109
+ border-bottom: 1px solid #dfd4d4;
110
+ margin: 0;
111
+ padding: 10px 0;
112
+ background-color: #fff;
113
  }
114
 
115
  .qsm-edit-name {
116
+ font-size: 12px !important;
117
  }
118
 
119
  .qsm-action-link {
120
+ font-size: 14px !important;
121
  }
122
 
123
  .qsm-action-links:hover {
124
+ background-color: black;
125
  }
126
 
127
  .qsm-action-link-delete {
128
+ color: red !important;
129
  }
130
 
131
  .qsm-dialog-form label {
132
+ display: inline-block;
133
+ font-size: 16px;
134
+ font-weight: bold;
135
+ padding-right: 30px;
136
+ }
137
+
138
+ .qsm-quiz-page-addon {
139
+ width: 100%;
140
+ float: left;
141
+ }
142
+
143
+ .qsm-addon-browse-addons {
144
+ background: #fff;
145
+ padding: 0;
146
+ width: 100%;
147
+ display: inline-block;
148
+ box-sizing: border-box;
149
+ margin-bottom: 30px;
150
+ }
151
+
152
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon {
153
+ float: left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  }
155
+
156
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-add-addon {
157
+ padding-top: 9px;
158
+ padding-left: 30px;
159
+ }
160
+
161
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-add-addon a.active {
162
+ background: #222;
163
+ color: #fff;
164
+ outline: none;
165
+ box-shadow: none;
166
+ }
167
+
168
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-add-addon a {
169
+ padding: 7px 15px;
170
+ font-weight: normal;
171
+ border-radius: 5px;
172
+ }
173
+
174
+ .qsm-addon-browse-addons .qsm-addon-anchor-left {
175
+ float: left;
176
+ }
177
+
178
+ .qsm-addon-browse-addons .qsm-addon-list-right {
179
+ float: right;
180
+ padding-top: 15px;
181
+ padding-right: 30px;
182
+ }
183
+
184
+ .qsm-addon-browse-addons .qsm-addon-list-right>span {
185
+ margin-right: 10px;
186
+ font-size: 16px;
187
+ }
188
+
189
+ .qsm-addon-browse-addons .qsm-addon-anchor-left a {
190
+ display: inline-block;
191
+ font-size: 16px;
192
+ color: #474444;
193
+ text-decoration: none;
194
+ /*margin-top: 5px;*/
195
+ margin-right: 15px;
196
+ }
197
+
198
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon a {
199
+ background: #aaaaaa;
200
+ padding: 15px 25px;
201
+ color: #fff;
202
+ margin-right: -4px;
203
+ box-sizing: border-box;
204
+ }
205
+
206
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon a span.dashicons {
207
+ height: 15px;
208
+ }
209
+
210
+ .qsm-addon-browse-addons .qsm-addon-anchor-left .qsm-install-addon a.active {
211
+ background: #007cba;
212
+ }
213
+
214
+ .qsm_popular_addons div.popuar-addon-ul {
215
+ width: 100%;
216
+ display: inline-block;
217
+ }
218
+
219
+ .qsm_popular_addons div.popuar-addon-ul>div {
220
+ background: #fff;
221
+ padding: 10px;
222
+ width: 31%;
223
+ margin-right: 2%;
224
+ float: left;
225
+ margin-bottom: 30px;
226
+ box-sizing: border-box;
227
+ }
228
+
229
+ .qsm_popular_addons div.popuar-addon-ul>div:nth-child(3n + 4) {
230
+ clear: both;
231
+ }
232
+
233
  .qsm_popular_addons div.popuar-addon-ul .addon-itd-wrap {
234
+ width: 100%;
235
+ display: inline-block;
236
+ }
237
+
238
+ .qsm_popular_addons div.popuar-addon-ul .addon-image {
239
+ width: 100px;
240
+ height: 80px;
241
+ background-size: cover;
242
+ background-repeat: no-repeat;
243
+ background-position: center center;
244
+ background-color: #f0f0f0;
245
+ float: left;
246
+ }
247
+
248
+ .qsm_popular_addons div.popuar-addon-ul .addon-title-descption {
249
+ width: calc(100% - 110px);
250
+ float: right;
251
+ }
252
+
253
+ .qsm_popular_addons div.popuar-addon-ul .description {
254
+ display: block;
255
+ margin-bottom: 5px;
256
+ }
257
+
258
+ .qsm_popular_addons div.popuar-addon-ul .addon-title {
259
+ font-size: 16px;
260
+ color: #222;
261
+ font-weight: bold;
262
+ text-decoration: none;
263
+ margin-bottom: 5px;
264
+ display: block;
265
  }
266
+
267
  .qsm_popular_addons div.popuar-addon-ul .addon-price {
268
+ border-top: 1px solid #f1f1f1;
269
+ padding-top: 10px;
270
+ margin-top: 15px;
271
+ }
272
+
273
+ .qsm_popular_addons div.popuar-addon-ul .addon-price-btn {
274
+ background: #fff;
275
+ border: #fff;
276
+ color: #007cba;
277
+ font-weight: bold;
278
+ font-size: 14px;
 
 
 
 
 
 
279
  }
280
+
281
+ .qsm_popular_addons div.popuar-addon-ul .addon-get-link {
282
+ float: right;
283
+ background: #fff;
284
+ color: #007cba;
285
+ border-width: 2px;
286
+ font-weight: bold;
287
+ }
288
+
289
  .qsm_popular_addons div.popuar-addon-ul .addon-get-link span.dashicons {
290
+ margin-top: 4px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  }
292
+
293
+ .qsm_popular_addons div.popuar-addon-ul>div .description-wrap {
294
+ padding: 20px;
295
+ }
296
+
297
+ .qsm_popular_addons div.popuar-addon-ul>div .description-wrap .description {
298
+ display: block;
299
+ width: 100%;
300
+ margin-bottom: 15px;
301
+ font-size: 14px;
302
+ font-style: normal;
303
+ }
304
+
305
+ .qsm_popular_addons div.popuar-addon-ul>div img {
306
+ max-width: 100%;
307
+ }
308
+
309
+ .qsm-quiz-page-addon.qsm-addon-page-list {
310
+ width: 75%;
311
+ float: left;
312
+ margin-top: 0;
313
+ }
314
+
315
+ .qsm-addon-news-ads {
316
+ width: 25%;
317
+ float: right;
318
+ background: #007cba;
319
+ padding: 10px 20px 30px 20px;
320
+ box-sizing: border-box;
321
+ margin-top: 0;
322
+ }
323
+
324
+ .qsm-addon-news-ads .qsm-news-ads-title {
325
+ border-bottom: 0;
326
+ margin-top: 20px;
327
+ background: #fff;
328
+ padding: 16px;
329
+ color: #007cba;
330
+ font-weight: bold;
331
+ position: relative;
332
+ }
333
+
334
  .qsm-addon-news-ads .qsm-news-ads-title:before,
335
+ .qsm-addon-news-ads .qsm-news-ads-title:after {
336
+ content: "";
337
+ position: absolute;
338
+ height: 0;
339
+ width: 0;
340
+ top: 0;
341
+ left: 0;
342
+ border-style: solid;
343
+ border-width: 25px;
344
+ }
345
+
346
+ .qsm-addon-news-ads .qsm-news-ads-title:before {
347
+ border-color: transparent transparent transparent #007cba;
348
+ }
349
+
350
+ .qsm-addon-news-ads .qsm-news-ads-title:after {
351
+ right: 0;
352
+ left: auto;
353
+ border-color: transparent #007cba transparent transparent;
354
+ }
355
+
356
+ .qsm-addon-news-ads .qsm-info-widget {
357
+ text-align: left;
358
+ padding: 30px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  }
360
+
361
+ .qsm-addon-news-ads .qsm-info-widget h3 {
362
+ color: #222;
363
+ font-weight: bold;
364
+ margin-top: 20px;
365
+ margin-bottom: 15px;
366
+ }
367
+
368
+ .qsm-addon-news-ads .qsm-info-widget p {
369
+ font-size: 14px;
370
+ }
371
+
372
+ .qsm-addon-news-ads .qsm-info-widget {
373
+ transform: none !important;
374
+ max-width: 100%;
375
+ position: relative;
376
+ background: #fff;
377
+ text-align: center;
378
+ margin-top: 70px;
379
+ }
380
+
381
+ .qsm-addon-news-ads .qsm-info-widget .bundle-icon {
382
+ width: 40px;
383
+ height: 40px;
384
+ padding: 20px;
385
+ border-radius: 50%;
386
+ position: absolute;
387
+ top: -40px;
388
+ left: calc(50% - 40px);
389
+ border: 2px solid #fff;
390
+ box-shadow: 0px 0px 5px 1px rgb(0 0 0 / 16%);
391
+ }
392
+
393
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(2) .bundle-icon {
394
+ background: #00b592;
395
+ }
396
+
397
+ .qsm-addon-news-ads .qsm-info-widget .addon-bundle-btn {
398
+ color: #fff;
399
+ width: 100%;
400
+ padding: 5px;
401
+ font-size: 14px;
402
+ position: relative;
403
+ margin-top: 0;
404
+ }
405
+
406
+ .qsm-addon-news-ads .qsm-info-widget .addon-bundle-btn span.dashicons {
407
+ position: absolute;
408
+ top: 10px;
409
+ right: 10px;
410
+ }
411
+
412
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(2) .addon-bundle-btn {
413
+ background: #00b592;
414
+ border-color: #00b592;
415
+ }
416
+
417
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(3) .bundle-icon {
418
+ background: #ed706f;
419
+ }
420
+
421
+ .qsm-addon-news-ads .qsm-info-widget:nth-child(3) .addon-bundle-btn {
422
+ background: #ed706f;
423
+ border-color: #ed706f;
424
+ }
425
+
426
+ .qsm-active-addons .installed_title {
427
+ background: #fff;
428
+ margin: 0;
429
+ padding: 15px;
430
+ border: 1px solid #ccd0d4;
431
+ color: #007cba;
432
+ font-size: 16px;
433
+ display: none;
434
+ }
435
+
436
  .qsm-active-addons .installed_addons_wrapper,
437
+ .qsm-active-addons .no_addons_installed {
438
+ border: 1px solid #ccd0d4;
439
+ /*border-top: medium none;*/
440
+ }
441
+
442
+ .qsm-active-addons .no_addons_installed {
443
+ padding: 30px 25%;
444
+ background: #fff;
445
+ text-align: center;
446
+ font-style: italic;
447
+ font-size: 16px;
448
+ line-height: 22px;
449
+ }
450
+
451
+ .qsm-active-addons .installed_addons_wrapper .installed_addon {
452
+ padding: 15px 15px 27px 15px;
453
+ background: #fff;
454
+ border-bottom: 1px solid #cdc7c7;
455
+ }
456
+
457
+ .qsm-active-addons .installed_addons_wrapper .installed_addon:last-child {
458
+ border-bottom: medium none;
459
+ }
460
+
461
+ .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_name {
462
+ font-size: 14px;
463
+ font-weight: bold;
464
+ position: relative;
465
+ top: 5px;
466
+ }
467
+
468
+ .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link {
469
+ float: right;
470
+ }
471
+
472
+ .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link a {
473
+ background: #fff;
474
+ border-width: 2px;
475
+ font-weight: 500;
476
+ font-size: 13px;
477
+ padding-left: 15px;
478
+ padding-right: 15px;
479
+ }
480
+
481
+ .qsm-active-addons .installed_addons_wrapper .installed_addon .installed_addon_link span.dashicons {
482
+ margin-top: 4px;
483
+ }
484
+
485
+ .qsm-active-addons {
486
+ width: 100%;
487
+ box-sizing: border-box;
488
+ margin-bottom: 30px;
489
+ }
490
+
491
+ .quizzes-surveys_page_qmn_addons .qsm-news-ads {
492
+ width: 15%;
493
+ float: right;
494
+ }
495
+
496
+ .qsm-help-page .handle-order-higher,
497
  .qsm-help-page .handle-order-lower {
498
+ display: none;
499
  }
500
+
501
  @media screen and (min-width: 1200px) {
502
+ .qsm-quiz-page-wrapper-with-ads {
503
+ margin-right: 0;
504
+ width: 100%;
505
+ }
506
+
507
+ .qsm-news-ads .qsm-info-widget {
508
+ float: left;
509
+ max-width: unset;
510
+ width: 31.3%;
511
+ }
512
+
513
+ .qsm-news-ads .qsm-info-widget:nth-child(3n + 5) {
514
+ clear: both;
515
+ }
516
+
517
+ .qsm-news-ads .remove-ads-adv-link {
518
+ width: 100%;
519
+ float: left;
520
+ }
521
  }
522
 
523
  @media screen and (max-width: 767px) {
524
+ .qsm-quiz-page-addon {
525
+ width: 100%;
526
+ }
527
 
528
+ .quizzes-surveys_page_qmn_addons .qsm-news-ads {
529
+ width: 100%;
530
+ }
531
  }
532
 
 
533
  /********************
534
  Options Page
535
  *********************/
536
 
537
  .template_list_holder {
538
+ width: 100%;
539
  }
540
+
541
  .template_variable {
542
+ width: 50%;
543
+ float: left;
544
+ font-size: 14px;
545
  }
546
+
547
  .template_name {
548
+ font-weight: bold;
549
  }
550
 
551
  /********************
553
  *********************/
554
  .results-page,
555
  #qsm_emails .qsm-email {
556
+ width: 100%;
557
+ background-color: #fff;
558
+ margin: 20px 0;
559
+ /*padding-bottom: 15px;*/
560
+ box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.06);
561
  }
562
 
563
  .results-page .results-page-content,
564
+ #qsm_emails .qsm-email .qsm-email-content {
565
+ background: #fff;
566
+ padding-right: 15px;
567
+ padding-left: 15px;
568
+ width: 100%;
569
+ box-sizing: border-box;
570
  }
571
 
572
  .results-page-header,
573
  #qsm_emails .qsm-email-header {
574
+ display: flex;
575
+ align-items: center;
576
+ justify-content: flex-end;
577
+ background-color: #fff;
578
+ padding: 10px 35px;
579
+ border-bottom: 1px solid #dfd4d4;
580
  }
581
 
582
  .delete-page-button,
583
  #qsm_emails .delete-email-button {
584
+ background: none;
585
+ border: none;
586
+ color: #dc3232;
587
+ cursor: pointer;
588
+ transition-duration: 200ms;
589
  }
590
 
591
  .delete-page-button:hover,
592
  #qsm_emails .delete-email-button:hover {
593
+ transform: scale(1.2);
594
  }
595
 
596
  .results-page-content,
597
  .qsm-email-content {
598
+ display: flex;
599
+ flex-direction: column;
600
  }
601
 
602
  .results-page-when,
603
  .results-page-show,
604
  .email-when,
605
  .email-show {
606
+ padding: 10px;
607
+ background-color: #f1f1f1;
608
+ border: 1px solid #dfd4d4;
609
+ margin: 15px 0;
610
+ min-width: 60%;
611
  }
612
 
613
  .results-page-when,
614
+ .email-when {
615
+ margin-right: 15px;
616
  }
617
 
618
  .results-page-content-header,
619
  .email-content-header {
620
+ margin-bottom: 10px;
621
  }
622
 
623
+ .email-show label {
624
+ margin-bottom: 5px;
625
+ display: block;
626
  }
627
 
628
  .results-page-content-header h4,
629
  .results-page-content-header p,
630
  .email-content-header h4,
631
  .email-content-header p {
632
+ margin: 0;
633
  }
634
 
635
  .results-page-condition,
636
  .email-condition {
637
+ display: flex;
638
+ flex-direction: column;
639
+ margin-bottom: 15px;
640
+ justify-content: space-around;
641
  }
642
 
643
+ .results-page-condition>select,
644
+ .results-page-condition>input,
645
+ .email-condition>select,
646
+ .email-condition>input {
647
+ max-width: 100%;
648
  }
649
 
650
  .delete-condition-button {
651
+ background: none;
652
+ border: 1px solid #1dd969;
653
+ color: #dc3232;
654
+ cursor: pointer;
655
+ transition-duration: 200ms;
656
+ padding: 6px;
657
  }
658
 
659
  .delete-condition-button:hover {
660
+ transform: scale(1.1);
661
  }
662
 
663
  .email-show .label {
664
+ display: block;
665
  }
666
 
667
  .results-page-show textarea,
668
  .to-email,
669
  .subject,
670
  .email-template {
671
+ width: 100%;
672
+ margin-bottom: 10px;
673
  }
674
 
675
  @media screen and (min-width: 760px) {
676
+
677
+ .results-page-content,
678
+ .qsm-email-content {
679
+ flex-direction: row;
680
+ justify-content: space-around;
681
+ }
682
+
683
+ .results-page-when,
684
+ .results-page-show,
685
+ .email-when,
686
+ .email-show {
687
+ width: calc(50% - 15px);
688
+ min-width: unset;
689
+ }
690
+
691
+ .results-page-condition,
692
+ .email-condition {
693
+ align-items: center;
694
+ flex-direction: row;
695
+ }
696
+
697
+ .results-page-condition>select,
698
+ .results-page-condition>input,
699
+ .email-condition>select,
700
+ .email-condition>input {
701
+ max-width: 30%;
702
+ }
703
+
704
+ .delete-condition-button {
705
+ border: none;
706
+ }
707
  }
708
 
709
  /********************
711
  *********************/
712
 
713
  .qsm-styles {
714
+ display: flex;
715
+ flex-direction: column;
716
  }
717
 
718
+ .qsm_featured_image_preview {
719
+ max-height: 200px;
720
+ max-width: 300px;
721
+ margin: 5px 0;
722
+ border-radius: 3px;
723
+ }
724
+
725
+ .qsm_featured_image_preview:hover:before {
726
+ content: "\f147";
727
+ font-family: "dashicons";
728
+ color: #5cb85c;
729
+ margin-right: 5px;
730
  }
731
 
732
 
733
+ @media screen and (min-width: 700px) {
734
+ .qsm-styles {
735
+ flex-direction: row;
736
+ flex-wrap: wrap;
737
+ }
738
+ }
739
 
740
  /********************
741
  About/Credits Page
742
  *********************/
743
 
744
  div.qsm_icon_wrap {
745
+ position: absolute;
746
+ top: 0;
747
+ right: 0;
748
+ background-color: rgba(54, 58, 66, 1);
749
+ color: #1dd969;
750
+ background-position: center 24px;
751
+ background-size: 85px 85px;
752
+ font-size: 14px;
753
+ text-align: center;
754
+ font-weight: 600;
755
+ margin: 5px 0 0;
756
+ padding-top: 120px;
757
+ height: 40px;
758
+ display: inline-block;
759
+ width: 150px;
760
+ text-rendering: optimizeLegibility;
761
+ border: 5px solid #106daa;
762
+ -moz-border-radius: 20px;
763
+ -webkit-border-radius: 20px;
764
+ -khtml-border-radius: 20px;
765
+ border-radius: 20px;
766
  }
767
 
768
  .qsm-tab-content .feature {
769
+ margin-bottom: 20px;
770
  }
771
 
772
  .qsm-tab-content .feature .feature-headline {
773
+ margin: 1.1em 0 0.2em;
774
+ font-size: 40px;
775
+ font-weight: 300;
776
+ line-height: 1.3;
777
+ text-align: center;
778
  }
779
 
780
  .qsm-tab-content .feature .feature-text {
781
+ text-align: center;
782
+ font-size: 16px;
783
  }
784
 
785
  ul.changelog {
786
+ background-color: #fff;
787
+ padding: 10px 10px;
788
  }
789
 
790
  ul.changelog li {
791
+ padding: 4px 0px;
792
  }
793
 
794
+ ul.changelog li div.two {
795
+ width: 70%;
796
+ float: left;
797
+ display: inline-block;
798
+ height: 25px;
799
+ margin-right: 20px;
800
+ background: #d9e0e4;
801
+ text-align: center;
802
+ line-height: 25px;
803
  }
804
 
805
+ ul.changelog li.fixed>div {
806
+ background: #f0ffe1;
807
+ color: #444;
808
+ border-right: 1px solid #5cb85c;
809
+ width: 20%;
810
  }
811
 
812
  ul.changelog li.fixed div.two:before {
813
+ content: "\f147";
814
+ font-family: "dashicons";
815
+ color: #5cb85c;
816
+ margin-right: 5px;
817
  }
818
 
819
+ ul.changelog li.add>div {
820
+ background: #ffeed0;
821
+ color: #444;
822
+ border-right: 1px solid #efa537;
823
+ width: 20%;
824
  }
825
 
826
  ul.changelog li.add div.two:before {
827
+ content: "\f155";
828
+ font-family: "dashicons";
829
+ color: #efa537;
830
+ margin-right: 5px;
831
  }
832
 
833
+ ul.changelog li.update>div {
834
+ background: #bde7ff;
835
+ color: #444;
836
+ border-right: 1px solid #106daa;
837
+ width: 20%;
838
  }
839
 
840
  ul.changelog li.update div.two:before {
841
+ content: "\f463";
842
+ font-family: "dashicons";
843
+ color: #106daa;
844
+ margin-right: 5px;
845
  }
846
 
847
  /********************
849
  *********************/
850
 
851
  .qsm-addons {
852
+ display: flex;
853
+ flex-direction: column;
854
  }
855
 
856
+ @media screen and (min-width: 700px) {
857
+ .qsm-addons {
858
+ flex-direction: row;
859
+ flex-wrap: wrap;
860
+ }
861
  }
862
 
 
863
  /********************
864
  Help Page
865
  *********************/
866
 
867
  .quiz_email_support p#mlw_support_message {
868
+ color: red;
869
+ font-size: 20px;
870
  }
871
 
872
+ .quiz_email_support input,
873
+ .quiz_email_support textarea {
874
+ width: 100% !important;
875
  }
876
 
877
  .quiz_email_support textarea {
878
+ min-height: 200px;
879
  }
880
 
881
  .quiz_email_support label {
882
+ font-weight: bold;
883
  }
884
 
 
885
  /********************
886
  Misc.
887
  *********************/
888
 
889
  /* Ads */
890
  .help-decide {
891
+ display: block;
892
+ text-align: center;
893
+ background: #fff;
894
+ border: 5px solid #1dd969;
895
+ color: #000;
896
+ font-weight: bold;
897
  }
898
+
899
  .help-decide p {
900
+ font-size: 14px;
901
  }
902
 
903
  /* Info Bar */
904
  .qsm-info-box {
905
+ display: block;
906
+ text-align: center;
907
+ background: #fff;
908
+ border: 1px solid #dfd4d4;
909
+ /* color: #000; */
910
+ font-weight: bold;
911
+ /* font-size: 14px; */
912
+ margin-bottom: 20px;
913
+ margin-top: 10px;
914
  }
915
 
916
  .qsm-info-box p {
917
+ font-size: 14px;
918
  }
919
 
 
920
  /* Info Widget */
921
  .qsm-quiz-page-addon .qsm-info-widget {
922
+ margin-top: 0;
923
+ background: #fff;
924
+ margin-left: 0;
925
  }
926
+
927
  .qsm-info-widget {
928
+ text-align: center;
929
+ border: 1px solid #dfd4d4;
930
+ margin: 30px 1% 0 1%;
931
+ background: #f1f1f1;
932
+ padding: 10px 15px;
933
+ transition-duration: 0.5s;
934
+ max-width: 330px;
935
+ box-sizing: border-box;
936
  }
937
 
938
  .admin_page_mlw_quiz_options .qsm-info-widget {
939
+ background: #fff;
940
+ margin: 0 0 20px 0;
941
+ cursor: pointer;
942
  }
943
 
944
  .admin_page_mlw_quiz_options .qsm-info-widget:hover,
945
+ .admin_page_mlw_quiz_options div.mlw_qmn_themeBlockActive.qsm-info-widget {
946
+ background-color: #333;
947
+ color: #fff;
948
  }
949
 
950
+ #mlw_qmn_theme_block_primary {
951
+ background-color: #005e8e;
952
+ color: #fff;
953
  }
954
 
955
+ #mlw_qmn_theme_block_amethyst {
956
+ background-color: #9b59b6;
957
+ color: #fff;
958
  }
959
 
960
+ #mlw_qmn_theme_block_emerald {
961
+ background-color: #006732;
962
+ color: #fff;
963
  }
964
 
965
+ #mlw_qmn_theme_block_turquoise {
966
+ background-color: #006552;
967
+ color: #fff;
968
  }
969
 
970
+ #mlw_qmn_theme_block_gray {
971
+ background-color: #595959;
972
+ color: #fff;
973
  }
974
 
975
+ .mlw_qmn_themeBlockActive.qsm-info-widget {
976
+ transform: scale(1.1);
977
+ border: 2px solid #d5a8a8;
978
  }
979
 
980
  .qsm-info-widget a.button-primary {
981
+ margin-top: 15px;
982
  }
983
 
984
  .qsm-quiz-page-addon a.button-primary {
985
+ margin-top: 0 !important;
986
  }
987
 
988
  .qsm-info-widget:hover {
989
+ transform: scale(1.1);
990
  }
991
 
992
  /* Options tabs */
993
  .qsm_tab_content,
994
  .mlw_tab_content {
995
+ padding: 10px 10px 10px 10px;
996
  }
997
 
998
+ .admin_page_mlw_quiz_options .qsm_tab_content>form>.button-primary:nth-child(3) {
999
+ display: none;
1000
  }
1001
 
1002
+ .qsm_tab_content label {
1003
+ margin-right: 5px;
1004
  }
1005
 
1006
  /* Popup */
1007
 
1008
  .qsm-popup {
1009
+ font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir,
1010
+ helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
1011
  }
1012
 
1013
  .qsm-popup__overlay {
1014
+ position: fixed;
1015
+ top: 0;
1016
+ left: 0;
1017
+ right: 0;
1018
+ bottom: 0;
1019
+ background: rgba(0, 0, 0, 0.6);
1020
+ display: flex;
1021
+ justify-content: center;
1022
+ align-items: center;
1023
+ z-index: 9999;
1024
  }
1025
 
1026
  .qsm-popup__container {
1027
+ background-color: #fff;
1028
+ padding: 30px;
1029
+ min-width: 500px;
1030
+ max-width: 700px;
1031
+ max-height: 95vh;
1032
+ border-radius: 4px;
1033
+ overflow-y: auto;
1034
+ box-sizing: border-box;
1035
  }
1036
 
1037
  .qsm-popup__header {
1038
+ display: flex;
1039
+ justify-content: space-between;
1040
+ align-items: center;
1041
  }
1042
 
1043
  .qsm-popup__title {
1044
+ margin-top: 0;
1045
+ margin-bottom: 0;
1046
+ font-weight: 600;
1047
+ font-size: 1.25rem;
1048
+ line-height: 1.25;
1049
+ color: #00449e;
1050
+ box-sizing: border-box;
1051
  }
1052
 
1053
  .qsm-popup__close {
1054
+ background: transparent;
1055
+ border: 0;
1056
+ color: #00449e;
1057
+ text-decoration: none;
1058
  }
1059
 
1060
+ .qsm-popup__header .qsm-popup__close:before {
1061
+ content: "\2715";
1062
  }
1063
 
1064
  .qsm-popup__content {
1065
+ margin-top: 2rem;
1066
+ margin-bottom: 2rem;
1067
+ line-height: 1.5;
1068
+ color: rgba(0, 0, 0, 0.8);
1069
  }
1070
 
1071
  body .qsm-popup__btn {
1072
+ font-size: 0.875rem;
1073
+ padding-left: 1rem;
1074
+ padding-right: 1rem;
1075
+ padding-top: 0.5rem;
1076
+ padding-bottom: 0.5rem;
1077
+ background-color: #e6e6e6;
1078
+ color: rgba(0, 0, 0, 0.8);
1079
+ border-radius: 0.25rem;
1080
+ border-style: none;
1081
+ border-width: 0;
1082
+ cursor: pointer;
1083
+ -webkit-appearance: button;
1084
+ text-transform: none;
1085
+ overflow: visible;
1086
+ line-height: 1.15;
1087
+ margin: 0;
1088
+ will-change: transform;
1089
+ -moz-osx-font-smoothing: grayscale;
1090
+ -webkit-backface-visibility: hidden;
1091
+ backface-visibility: hidden;
1092
+ -webkit-transform: translateZ(0);
1093
+ transform: translateZ(0);
1094
+ transition: -webkit-transform 0.25s ease-out;
1095
+ transition: transform 0.25s ease-out;
1096
+ transition: transform 0.25s ease-out, -webkit-transform 0.25s ease-out;
1097
+ }
1098
+
1099
+ .qsm-popup__btn:focus,
1100
+ .qsm-popup__btn:hover {
1101
+ -webkit-transform: scale(1.05);
1102
+ transform: scale(1.05);
1103
  }
1104
 
1105
  body .qsm-popup__btn-primary {
1106
+ background-color: #00449e;
1107
+ color: #fff;
1108
  }
1109
 
1110
  @keyframes mmfadeIn {
1111
+ from {
1112
+ opacity: 0;
1113
+ }
1114
+
1115
+ to {
1116
+ opacity: 1;
1117
+ }
1118
  }
1119
 
1120
  @keyframes mmfadeOut {
1121
+ from {
1122
+ opacity: 1;
1123
+ }
1124
+
1125
+ to {
1126
+ opacity: 0;
1127
+ }
1128
  }
1129
 
1130
  @keyframes mmslideIn {
1131
+ from {
1132
+ transform: translateY(15%);
1133
+ }
1134
+
1135
+ to {
1136
+ transform: translateY(0);
1137
+ }
1138
  }
1139
 
1140
  @keyframes mmslideOut {
1141
+ from {
1142
+ transform: translateY(0);
1143
+ }
1144
+
1145
+ to {
1146
+ transform: translateY(-10%);
1147
+ }
1148
  }
1149
 
1150
  .qsm-popup-slide {
1151
+ display: none;
1152
  }
1153
 
1154
  .qsm-popup-slide.is-open {
1155
+ display: block !important;
1156
  }
1157
 
1158
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
1159
+ animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1);
1160
  }
1161
 
1162
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
1163
+ animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1);
1164
  }
1165
 
1166
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
1167
+ animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1);
1168
  }
1169
 
1170
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
1171
+ animation: mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1);
1172
  }
1173
 
1174
  .qsm-popup-slide .qsm-popup__container,
1175
  .qsm-popup-slide .qsm-popup__overlay {
1176
+ will-change: transform;
1177
  }
1178
 
1179
  /**
1180
  * Shortcode accordion
1181
  */
1182
+ .sc-opener {
1183
+ position: relative;
1184
+ font-size: 14px !important;
1185
+ margin-bottom: 10px;
1186
+ cursor: pointer;
1187
+ display: inline-block;
1188
+ color: #0073aa !important;
1189
+ font-weight: 500;
1190
+ }
1191
+
1192
+ .sc-opener span.dashicons {
1193
+ position: relative;
1194
+ top: 2px;
1195
+ margin-right: 5px;
1196
+ }
1197
+
1198
+ .sc-content {
1199
+ display: none;
1200
+ }
1201
+
1202
+ .quiz-preview-link {
1203
+ margin-left: 10px;
1204
+ position: relative;
1205
+ top: 3px;
1206
+ }
1207
+
1208
+ #show-advanced-option {
1209
+ font-size: 16px;
1210
+ cursor: pointer;
1211
+ color: #0073aa;
1212
+ margin-bottom: 15px;
1213
+ }
1214
+
1215
+ .remove-ads-adv-link {
1216
+ text-align: center;
1217
+ margin-top: 30px;
1218
+ }
1219
+
1220
+ .qsm-info-widget h3 {
1221
+ line-height: 132%;
1222
+ }
1223
+
1224
+ .remove-ads-adv-link a {
1225
+ background: #1dd969;
1226
+ text-align: center;
1227
+ color: #fff;
1228
+ padding: 3px 10px;
1229
+ border-radius: 5px;
1230
+ display: inline-block;
1231
+ text-decoration: none;
1232
+ font-size: 13px;
1233
+ font-weight: bold;
1234
+ margin-bottom: 10px;
1235
+ }
1236
+
1237
+ .help-decide a.remove-adv-button {
1238
+ background: #1dd969;
1239
+ text-align: center;
1240
+ color: #fff;
1241
+ padding: 3px 10px;
1242
+ border-radius: 5px;
1243
+ display: inline-block;
1244
+ text-decoration: none;
1245
+ font-size: 13px;
1246
+ font-weight: bold;
1247
+ margin-left: 10px;
1248
  }
1249
 
1250
  h3.addon_category_name {
1251
+ width: 100%;
1252
+ background: transparent;
1253
+ padding: 15px 0;
1254
+ border-bottom: 1px solid #d7d1d1;
1255
+ margin-bottom: 30px;
1256
  }
1257
+
1258
  /*Design of new radio taggle*/
1259
  .buttonset.ui-buttonset .ui-button.ui-state-active {
1260
+ background: #e21130 none repeat scroll 0 0;
1261
+ border-color: #e21130 !important;
1262
  }
1263
+
1264
+ .buttonset.ui-buttonset .ui-button.ui-state-active span.ui-button-text {
1265
+ color: #fff !important;
1266
  }
1267
+
1268
  .buttonset.ui-buttonset.green .ui-state-active {
1269
+ background: #44c767 none repeat scroll 0 0;
1270
+ border-color: #44c767 !important;
1271
  }
1272
+
1273
  .buttonset.ui-buttonset .ui-button.ui-state-active.ui-corner-left {
1274
+ background: #44c767 none repeat scroll 0 0;
1275
+ border-color: #44c767 !important;
1276
  }
1277
+
1278
  .buttonset.ui-buttonset label {
1279
+ background: #fff;
1280
+ border: 1px solid #b6b6b6;
1281
+ margin-right: -5px !important;
 
 
 
 
 
 
 
 
1282
  }
1283
+
1284
+ .buttonset.ui-buttonset label span.ui-button-text {
1285
+ color: #727272;
1286
+ font-size: 12px;
1287
+ height: 35px;
1288
+ line-height: 35px;
1289
+ min-width: 20px;
1290
+ padding: 0 10px;
1291
+ }
1292
+
1293
  .qsm_tab_content input[type="text"],
1294
  .qsm_tab_content input[type="number"],
1295
  .qsm_global_settings input[type="text"],
1297
  .qsm_global_settings input[type="email"],
1298
  .qsm-addon-setting-wrap input[type="email"],
1299
  .qsm-addon-setting-wrap input[type="text"],
1300
+ .qsm-addon-setting-wrap input[type="number"] {
1301
+ background: #ffffff none repeat scroll 0 0;
1302
+ border: 1px solid #dddddd;
1303
+ border-radius: 5px;
1304
+ box-shadow: none;
1305
+ color: #666666;
1306
+ /*padding: 10px 15px;*/
1307
+ width: auto;
1308
+ height: auto;
1309
+ /*min-width: 230px;*/
1310
+ /*max-width:100%;*/
1311
+ }
1312
+
1313
+ .qsm_tab_content textarea {
1314
+ background: #ffffff none repeat scroll 0 0;
1315
+ border: 1px solid #dddddd;
1316
+ border-radius: 5px;
1317
+ box-shadow: none;
1318
+ color: #666666;
1319
+ padding: 10px 15px;
1320
+ width: 100%;
1321
+ height: auto;
1322
+ }
1323
+
1324
+ .global-sub-text {
1325
+ margin-left: 15px;
1326
  }
1327
+
1328
  /* The switch - the box around the slider */
1329
  .switch {
1330
+ position: relative;
1331
+ display: inline-block;
1332
+ width: 60px;
1333
+ height: 34px;
1334
  }
1335
 
1336
  /* Hide default HTML checkbox */
1337
  .switch input[type="checkbox"] {
1338
+ opacity: 0;
1339
+ width: 0;
1340
+ height: 0;
1341
  }
1342
+
1343
  /* The slider */
1344
  .slider {
1345
+ position: absolute;
1346
+ cursor: pointer;
1347
+ top: 0;
1348
+ left: 0;
1349
+ right: 0;
1350
+ bottom: 0;
1351
+ background-color: #ccc;
1352
+ -webkit-transition: 0.4s;
1353
+ transition: 0.4s;
1354
  }
1355
 
1356
  .slider:before {
1357
+ position: absolute;
1358
+ content: "";
1359
+ height: 26px;
1360
+ width: 26px;
1361
+ left: 4px;
1362
+ bottom: 4px;
1363
+ background-color: white;
1364
+ -webkit-transition: 0.4s;
1365
+ transition: 0.4s;
1366
  }
1367
 
1368
+ input:checked+.slider {
1369
+ background-color: #2196f3;
1370
  }
1371
 
1372
+ input:focus+.slider {
1373
+ box-shadow: 0 0 1px #2196f3;
1374
  }
1375
 
1376
+ input:checked+.slider:before {
1377
+ -webkit-transform: translateX(26px);
1378
+ -ms-transform: translateX(26px);
1379
+ transform: translateX(26px);
1380
  }
1381
 
1382
  /* Rounded sliders */
1383
  .slider.round {
1384
+ border-radius: 34px;
1385
  }
1386
 
1387
  .slider.round:before {
1388
+ border-radius: 50%;
1389
  }
1390
 
1391
  input#sc-shortcode-model-text,
1392
  input#sc-shortcode-model-text-link {
1393
+ height: 30px;
1394
  }
1395
+
1396
  div#modal-6 label {
1397
+ display: block;
1398
+ font-size: 14px;
1399
+ margin-bottom: 5px;
1400
+ font-weight: 500;
1401
+ color: #999;
1402
+ font-style: italic;
1403
  }
1404
+
1405
+ #modal-6 .button>span.dashicons {
1406
+ line-height: 29px;
1407
  }
1408
+
1409
+ .qsm-list-shortcode-view span.dashicons {
1410
+ font-size: 24px;
1411
  }
1412
+
1413
  /**
1414
  * No quiz screen design
1415
  */
1416
  .qsm-no-quiz-wrapper {
1417
+ text-align: center;
1418
+ max-width: 100%;
1419
+ width: 100%;
1420
  }
1421
+
1422
+ .qsm-no-quiz-wrapper .dashicons.dashicons-format-chat {
1423
+ font-size: 200px;
1424
+ display: block;
1425
+ /* line-height: 200px; */
1426
+ width: auto;
1427
+ height: auto;
1428
  }
1429
+
1430
+ .qsm-no-quiz-wrapper h2 {
1431
+ margin-bottom: 30px;
1432
  }
1433
+
1434
+ .qsm-no-quiz-wrapper .buttons {
1435
+ margin-bottom: 30px;
1436
  }
1437
+
1438
+ .qsm-no-quiz-wrapper .buttons a {
1439
+ margin-right: 20px;
1440
  }
1441
+
1442
+ .qsm-no-quiz-wrapper .buttons a:last-child {
1443
+ color: #8b8888;
1444
  }
1445
+
1446
+ .qsm-no-quiz-wrapper .buttons a:last-child .dashicons {
1447
+ line-height: 46px;
1448
  }
1449
+
1450
+ .qsm-no-quiz-wrapper h3 {
1451
+ color: #8b8888;
1452
+ margin-bottom: 30px;
1453
  }
1454
+
1455
  /**
1456
  * Option page design
1457
  */
1458
  span.qsm-ph_text {
1459
+ width: 100px;
1460
+ display: inline-block;
1461
  }
1462
+
1463
+ tr .qsm-opt-desc {
1464
+ color: #666;
1465
+ font-style: italic;
1466
+ font-size: 14px;
1467
+ margin-top: 5px;
1468
+ display: block;
1469
  }
1470
+
1471
+ #quiz_settings_wrapper .qsm-opt-desc {
1472
+ display: none !important;
1473
  }
1474
+
1475
  .form-table td fieldset label {
1476
+ margin-right: 20px !important;
1477
  }
1478
+
1479
+ .form-table .qsm-opt-tr {
1480
+ position: relative;
1481
+ padding-right: 24px;
1482
+ padding-top: 15px;
1483
  }
1484
+
1485
  td.scheduled_time_start {
1486
+ padding-bottom: 0 !important;
1487
+ }
1488
+
1489
+ .qsm-opt-tr .qsm-tooltips-icon {
1490
+ margin: 0 0 0 0;
1491
+ position: relative;
1492
+ right: 0;
1493
+ top: 4px;
1494
+ color: #666;
1495
+ display: inline-block;
1496
+ font-size: 1.2em;
1497
+ font-style: normal;
1498
+ cursor: help;
1499
+ width: auto;
1500
+ height: auto;
1501
  }
1502
+
1503
  .qsm-tooltips-icon .qsm-tooltips {
1504
+ background-color: #333;
1505
+ border-radius: 3px;
1506
+ color: #ffffff;
1507
+ display: none;
1508
+ font-size: 12px;
1509
+ padding: 10px 5px;
1510
+ line-height: 1.5;
1511
+ opacity: 0;
1512
+ left: 50%;
1513
+ position: absolute;
1514
+ text-align: center;
1515
+ bottom: 25px;
1516
+ width: 200px;
1517
+ transform: translateX(-50%);
1518
+ transition: opacity 0.5s ease 0s;
1519
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
1520
+ Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
1521
+ }
1522
+
1523
+ .qsm-tooltips-icon .qsm-tooltips a {
1524
+ color: #fff;
1525
  }
1526
+
1527
  .qsm-tooltips-icon .qsm-tooltips:before {
1528
+ border-color: #333 rgba(0, 0, 0, 0) rgba(0, 0, 0, 0);
1529
+ border-style: solid;
1530
+ border-width: 8px 7px 0;
1531
+ bottom: -8px;
1532
+ content: "";
1533
+ left: 50%;
1534
+ transform: translateX(-50%);
1535
+ position: absolute;
1536
  }
1537
+
1538
  .qsm-tooltips-icon:hover .qsm-tooltips,
1539
+ .qsm-tooltips:hover {
1540
+ display: block;
1541
+ opacity: 1;
1542
+ z-index: 9999;
1543
  }
1544
+
1545
  /**
1546
  * Text Tab design
1547
  */
1548
+ .qsm-text-main-wrap {
1549
+ display: inline-block;
1550
+ width: 100%;
1551
  }
1552
+
1553
+ .qsm-text-main-wrap #post-body-content {
1554
+ background: #fff;
1555
+ box-sizing: border-box;
1556
  }
1557
+
1558
+ .qsm-text-main-wrap #postbox-container-1 {
1559
+ position: relative;
1560
+ background: #fff;
1561
+ box-sizing: border-box;
1562
  }
1563
+
1564
+ .qsm-text-main-wrap #postbox-container-1 .qsm-text-header h5 {
1565
+ font-size: 14px;
1566
+ margin: 0;
1567
+ font-weight: bold;
1568
  }
1569
+
1570
+ .qsm-text-main-wrap #postbox-container-1 .qsm-text-header .description {
1571
+ color: #666;
1572
  }
1573
+
1574
+ .qsm-text-main-wrap .qsm-text-header {
1575
+ padding: 20px;
1576
+ border-bottom: 1px solid #f1f1f1;
1577
  }
1578
+
1579
+ .qsm-text-main-wrap .qsm-text-header .message-dropdown {
1580
+ display: inline-block;
1581
  }
1582
+
1583
+ .qsm-text-main-wrap .qsm-text-header .message-dropdown label {
1584
+ font-size: 14px;
1585
+ font-weight: bold;
1586
  }
1587
+
1588
+ .qsm-text-main-wrap .qsm-text-header .save-text-changes {
1589
+ float: right;
1590
  }
1591
+
1592
+ .qsm-text-main-wrap .qsm-text-conent {
1593
+ padding: 20px;
1594
+ border-bottom: 1px solid #f1f1f1;
1595
+ position: relative;
1596
  }
1597
+
1598
+ .qsm-text-conent.qsm-text-allowed-variables span.qsm-text-template-span {
1599
+ display: inline-block;
1600
+ margin-bottom: 10px;
1601
+ margin-right: 10px;
1602
+ position: relative;
1603
  }
1604
+
1605
  #show-all-variable-content span.qsm-text-template-span {
1606
+ display: inline-block;
1607
+ position: relative;
1608
+ text-align: center;
1609
+ }
1610
+
1611
+ #show-all-variable-content .popup-template-span-wrap {
1612
+ margin-bottom: 20px;
1613
+ margin-right: 3%;
1614
+ width: 30%;
1615
+ display: inline-block;
1616
+ }
1617
+
1618
+ #show-all-variable-content .popup-template-span-wrap:nth-child(3n + 3) .qsm-text-template-span .qsm-tooltips-icon .qsm-tooltips {
1619
+ left: calc(100% - 100px);
1620
+ }
1621
+
1622
+ #show-all-variable-content .popup-template-span-wrap:nth-child(3n + 3) .qsm-text-template-span .qsm-tooltips-icon .qsm-tooltips:before {
1623
+ left: 93%;
1624
+ }
1625
+
1626
+ #show-all-variable-content .qsm-text-template-span .qsm-tooltips-icon {
1627
+ margin-left: 5px;
1628
+ }
1629
+
1630
+ .qsm-text-template-span button {
1631
+ border-color: #ccc !important;
1632
+ }
1633
+
1634
+ .qsm-text-template-span .qsm-tooltips-icon {
1635
+ vertical-align: middle;
1636
+ line-height: 30px;
1637
+ color: #9e9e9e;
1638
+ margin-left: 5px;
1639
+ }
1640
+
1641
+ .qsm-text-template-span .qsm-tooltips-icon .qsm-tooltips {
1642
+ left: calc(100% - 10px);
1643
+ bottom: 30px;
1644
+ }
1645
+
1646
+ .qsm-text-label-wrapper>h2 {
1647
+ font-size: 24px;
1648
+ border-bottom: 1px solid #ccc;
1649
+ padding-bottom: 10px;
1650
+ line-height: normal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1651
  }
1652
+
1653
+ .qsm-text-label-wrapper form>button:nth-child(3) {
1654
+ display: none;
1655
+ }
1656
+
1657
+ .qsm-text-label-wrapper .section_heading {
1658
+ margin-top: 0;
1659
+ }
1660
+
1661
+ #show-all-variable .qsm-popup__container {
1662
+ min-width: 50vw;
1663
+ max-width: 1040px;
1664
+ padding: 0;
1665
+ }
1666
+
1667
+ #show-all-variable-content {
1668
+ margin-bottom: 0 !important;
1669
+ padding: 20px;
1670
+ margin: 0;
1671
+ }
1672
+
1673
+ #show-all-variable .qsm-popup__header {
1674
+ border-bottom: 1px solid #f1f1f1;
1675
+ padding: 20px;
1676
+ }
1677
+
1678
+ #show-all-variable .qsm-popup__header .qsm-popup__title {
1679
+ color: #23282d;
1680
+ margin-bottom: 7px;
1681
+ }
1682
+
1683
+ #show-all-variable .qsm-popup__footer {
1684
+ border-top: 1px solid #f1f1f1;
1685
+ padding: 20px;
1686
+ }
1687
+
1688
+ .qsm-view-preview-btn {
1689
+ text-decoration: none;
1690
+ line-height: normal;
1691
+ margin-left: -5px;
1692
+ }
1693
+
1694
+ .qsm-view-preview-btn span.dashicons,
1695
+ .edit-quiz-name span.dashicons {
1696
+ line-height: 12px;
1697
+ vertical-align: bottom;
1698
+ }
1699
+
1700
  .mlw_quiz_options a.button.button-default.qsm-btn-quiz-edit {
1701
+ box-shadow: none;
1702
+ float: right;
1703
+ margin-right: 5px;
1704
+ }
1705
+
1706
+ .mlw_quiz_options a.button.button-default.qsm-btn-quiz-edit:hover {
1707
+ opacity: 0.8;
1708
+ }
1709
+
1710
+ .mlw_quiz_options a.button.button-default.qsm-btn-quiz-edit span.dashicons {
1711
+ line-height: 27px;
1712
+ }
1713
+
1714
+ .mlw_quiz_options .nav-tab-wrapper {
1715
+ margin-top: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1716
  }
1717
+
1718
+ .mlw_quiz_options .edit-quiz-name {
1719
+ float: none;
1720
+ text-decoration: none;
1721
+ }
1722
+
1723
+ .qsm_text_customize_label {
1724
+ position: fixed;
1725
+ bottom: 20px;
1726
+ right: 25px;
1727
+ background: #fff;
1728
+ color: #5c5959;
1729
+ padding: 10px 20px;
1730
+ box-sizing: border-box;
1731
+ z-index: 99;
1732
+ border-radius: 5px;
1733
+ border: 1px solid #cdbaba;
1734
+ cursor: pointer;
1735
+ }
1736
+
1737
+ .qsm-text-tab-message-loader {
1738
+ position: absolute;
1739
+ top: 50%;
1740
+ left: 50%;
1741
+ z-index: 99;
1742
+ transform: translate(-50%, -50%);
1743
+ }
1744
+
1745
+ .qsm_text_customize_label .dashicons {
1746
+ font-size: 14px;
1747
+ line-height: 20px;
1748
+ }
1749
+
1750
  /**
1751
  * Admin result page design
1752
  */
1753
  .overview-main-wrapper {
1754
+ display: flex;
1755
+ width: 100%;
1756
  }
1757
+
1758
+ .overview-main-wrapper .overview-inner-wrap {
1759
+ margin-right: 2%;
1760
+ width: 33.33%;
1761
  }
1762
+
1763
+ .overview-main-wrapper .overview-inner-wrap .inside {
1764
+ min-height: 105px;
1765
  }
1766
+
1767
+ .overview-main-wrapper .overview-inner-wrap:last-child {
1768
+ margin-right: 0;
1769
  }
1770
+
1771
  .overview-main-wrapper .overview-inner-wrap h2.hndle,
1772
  .comment-inner-wrap h2.hndle,
1773
+ .response-inner-wrap h2.hndle {
1774
+ margin: 0;
1775
+ padding: 10px;
1776
+ }
1777
+
1778
+ .overview-main-wrapper .candidate-detail-wrap.overview-inner-wrap .result-candidate-span {
1779
+ display: block;
1780
+ margin-bottom: 5px;
1781
+ }
1782
+
1783
+ .overview-main-wrapper .candidate-detail-wrap.overview-inner-wrap .result-candidate-span:last-child {
1784
+ margin-bottom: 0;
1785
+ }
1786
+
1787
+ .overview-main-wrapper .overview-inner-wrap.candidate-detail-wrap .result-candidate-span>label {
1788
+ font-weight: bold;
1789
+ }
1790
+
1791
+ .overview-main-wrapper .overview-inner-wrap.candidate-detail-wrap .result-candidate-span>span {
1792
+ float: right;
1793
+ }
1794
+
1795
+ .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper {
1796
+ display: -webkit-box;
1797
+ display: -moz-box;
1798
+ display: -ms-flexbox;
1799
+ display: -webkit-flex;
1800
+ display: flex;
1801
+ -webkit-flex-flow: row wrap;
1802
+ justify-content: center;
1803
+ -webkit-justify-content: center;
1804
+ flex-wrap: nowrap;
1805
+ }
1806
+
1807
+ .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper>div {
1808
+ padding: 15px 30px;
1809
+ background: #f1f1f1;
1810
+ margin-right: 10px;
1811
+ max-width: 120px;
1812
+ width: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1813
  }
1814
+
1815
+ .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper>div:last-child {
1816
+ margin-right: 0;
1817
+ }
1818
+
1819
+ .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper span.timer-span {
1820
+ display: block;
1821
+ font-size: 36px;
1822
+ font-weight: bold;
1823
+ text-align: center;
1824
+ }
1825
+
1826
+ .overview-main-wrapper .overview-inner-wrap .timer-div-wrapper span.timer-text {
1827
+ display: block;
1828
+ font-size: 16px;
1829
+ font-weight: bold;
1830
+ text-align: center;
1831
+ }
1832
+
1833
+ .response-inner-wrap .inside {
1834
+ padding: 10px;
1835
+ margin: 0;
1836
+ }
1837
+
1838
+ .response-inner-wrap .inside .qmn_question_answer {
1839
+ background-color: #f1f1f1;
1840
+ padding: 10px;
1841
+ margin-bottom: 0;
1842
+ background-repeat: no-repeat;
1843
+ background-position: 95% center;
1844
+ padding-right: 12%;
1845
+ }
1846
+
1847
+ .response-inner-wrap .inside .qmn_question_answer:nth-child(2n) {
1848
+ background-color: #fff;
1849
+ }
1850
+
1851
+ .response-inner-wrap .inside .qmn_question_answer.qmn_question_answer_incorrect {
1852
+ background-image: url(../assets/wrong.png);
1853
+ }
1854
+
1855
  .response-inner-wrap .inside .qsm-add-border-bottom.qmn_question_answer.qmn_question_answer_incorrect,
1856
+ .response-inner-wrap .inside .qsm-remove-border-bottom.qmn_question_answer.qmn_question_answer_incorrect {
1857
+ background-image: none;
1858
  }
1859
+
1860
+ .response-inner-wrap .inside .qmn_question_answer.qmn_question_answer_correct {
1861
+ background-image: url(../assets/right.png);
1862
  }
1863
+
1864
  .response-inner-wrap .inside .qsm-add-border-bottom.qmn_question_answer.qmn_question_answer_correct,
1865
+ .response-inner-wrap .inside .qsm-remove-border-bottom.qmn_question_answer.qmn_question_answer_correct {
1866
+ background-image: none;
1867
+ }
1868
+
1869
+ .old_template_result_wrap {
1870
+ padding: 15px;
1871
+ background: #fff;
1872
+ }
1873
+
1874
+ .result-page-title {
1875
+ text-align: left;
1876
+ display: inline-block;
1877
+ float: left;
1878
+ font-size: 23px;
1879
+ font-weight: 400;
1880
+ margin: 0;
1881
+ line-height: 30px;
1882
+ }
1883
+
1884
+ .result-tab-content a.button>span.dashicons {
1885
+ line-height: 29px;
1886
+ font-size: 18px;
1887
+ margin-left: -4px;
1888
+ margin-right: -4px;
1889
+ }
1890
+
1891
+ .result-page-wrapper .tablenav-pages {
1892
+ margin-left: 10px;
1893
+ }
1894
+
1895
+ .result-page-wrapper .tablenav.top {
1896
+ margin-bottom: 20px;
1897
+ margin-top: 20px;
1898
+ }
1899
+
1900
+ .inner-sidebar1 .handlediv {
1901
+ display: none !important;
1902
+ }
1903
+
1904
+ .inner-sidebar1 .hndle {
1905
+ padding-left: 10px;
1906
+ padding-top: 10px;
1907
+ margin: 0;
1908
+ padding-bottom: 10px;
1909
  }
1910
+
1911
  .inner-sidebar1 .inside h3,
1912
+ .inner-sidebar1 .inside h4 {
1913
+ margin-bottom: 10px;
1914
  }
1915
+
1916
  .qsm-quiz-email-tab,
1917
+ .qsm-quiz-result-tab {
1918
+ max-width: 1200px;
1919
+ width: 100%;
1920
  }
1921
+
1922
  .qsm-quiz-email-tab .qsm-show-all-variable-text span.dashicons,
1923
+ .qsm-quiz-result-tab .qsm-show-all-variable-text span.dashicons {
1924
+ font-size: 16px;
1925
+ line-height: 22px;
1926
  }
1927
+
1928
  .qsm-quiz-email-tab .qsm-show-all-variable-text,
1929
+ .qsm-quiz-result-tab .qsm-show-all-variable-text {
1930
+ position: fixed;
1931
+ bottom: 20px;
1932
+ right: 25px;
1933
+ background: #fff;
1934
+ color: #5c5959;
1935
+ padding: 10px 20px;
1936
+ box-sizing: border-box;
1937
+ z-index: 99;
1938
+ border-radius: 5px;
1939
+ border: 1px solid #cdbaba;
1940
+ cursor: pointer;
1941
+ text-decoration: none;
1942
  }
1943
+
1944
  .popup-template-span-wrap .popup-copied-des {
1945
+ color: green;
1946
+ }
1947
+
1948
+ .popup-template-span-wrap .popup-copied-des span.dashicons {
1949
+ line-height: 28px;
1950
+ }
1951
+
1952
+ .comment-inner-wrap {
1953
+ display: none;
1954
+ }
1955
+
1956
+ #qsm_themes h2.wp-heading-inline {
1957
+ display: inline-block;
1958
+ margin-right: 5px;
1959
+ }
1960
+
1961
+ /**
1962
+ * Style tab design
1963
+ */
1964
+ .wp-upload-form {
1965
+ background: #fafafa;
1966
+ border: 1px solid #ccd0d4;
1967
+ padding: 30px;
1968
+ margin: 0 0 30px auto;
1969
+ display: inline-flex;
1970
+ justify-content: space-between;
1971
+ align-items: center;
1972
+ }
1973
+
1974
+ @media (min-width: 768px) and (max-width: 1199px) {
1975
+ .qsm-news-ads .qsm-info-widget {
1976
+ float: left;
1977
+ max-width: unset;
1978
+ width: 31.3%;
1979
+ }
1980
+
1981
+ .qsm-news-ads .qsm-info-widget:nth-child(3n + 5) {
1982
+ clear: both;
1983
+ }
1984
+
1985
+ .remove-ads-adv-link {
1986
+ width: 100%;
1987
+ display: inline-block;
1988
+ margin-bottom: 30px;
1989
+ }
1990
+ }
1991
+
1992
+ @media screen and (max-width: 782px) {
1993
+ .form-table td fieldset label {
1994
+ margin-top: -1px !important;
1995
+ vertical-align: top;
1996
+ }
1997
+
1998
+ .qsm-tooltips-icon .qsm-tooltips {
1999
+ left: -90px;
2000
+ }
2001
+
2002
+ .qsm-opt-tr .qsm-tooltips-icon {
2003
+ right: 13px;
2004
+ }
2005
+
2006
+ .qsm-tooltips-icon .qsm-tooltips:before {
2007
+ left: auto;
2008
+ right: -3px;
2009
+ }
2010
+ }
2011
+
2012
+ @media screen and (max-width: 767px) {
2013
+ .qsm-quiz-row td:nth-of-type(2n) {
2014
+ display: none;
2015
+ }
2016
+
2017
+ .qsm-quiz-page-wrapper,
2018
+ .qsm-quiz-page-wrapper-with-ads {
2019
+ overflow-x: auto;
2020
+ }
2021
+
2022
+ .qsm-quiz-page-wrapper thead th:nth-of-type(2n),
2023
+ .qsm-quiz-page-wrapper tfoot th:nth-of-type(2n),
2024
+ .qsm-quiz-page-wrapper-with-ads thead th:nth-of-type(2n),
2025
+ .qsm-quiz-page-wrapper-with-ads tfoot th:nth-of-type(2n) {
2026
+ display: none;
2027
+ }
2028
+
2029
+ .qsm-quiz-page-wrapper .row-actions {
2030
+ display: inline-block !important;
2031
+ }
2032
+
2033
+ .qsm-quiz-page-wrapper p.search-box {
2034
+ bottom: -30px;
2035
+ }
2036
+
2037
+ .qsm-popup__container {
2038
+ min-width: auto;
2039
+ max-width: 100%;
2040
+ }
2041
+
2042
+ #show-advanced-option {
2043
+ display: block;
2044
+ width: 100%;
2045
+ float: left;
2046
+ }
2047
+
2048
+ .contact-form-label {
2049
+ display: inline-block;
2050
+ }
2051
+
2052
+ .template_variable {
2053
+ width: 100%;
2054
+ max-width: 100%;
2055
+ margin-bottom: 10px;
2056
+ word-break: break-word;
2057
+ }
2058
+
2059
+ .qsm_tab_content .form-table input[type="radio"] {
2060
+ top: 6px;
2061
+ margin-bottom: 8px;
2062
+ }
2063
+
2064
+ .result-page-wrapper form {
2065
+ overflow: scroll;
2066
+ width: 100%;
2067
+ }
2068
+
2069
+ p.search-box {
2070
+ bottom: -30px;
2071
+ }
2072
+
2073
+ .quizzes-surveys_page_qsm_quiz_help .hndle {
2074
+ padding-left: 15px;
2075
+ padding-bottom: 15px;
2076
+ }
2077
+
2078
+ .qsm-news-ads .qsm-info-widget {
2079
+ width: calc(100% - 30px);
2080
+ max-width: 100%;
2081
+ box-sizing: border-box;
2082
+ margin: 15px 15px 0 15px;
2083
+ }
2084
+
2085
+ .form-table .qsm-opt-tr {
2086
+ padding-bottom: 10px;
2087
+ }
2088
+
2089
+ .overview-main-wrapper {
2090
+ display: block;
2091
+ }
2092
+
2093
+ .overview-main-wrapper .overview-inner-wrap {
2094
+ margin-right: 0;
2095
+ width: 100%;
2096
+ }
2097
+
2098
+ .result-page-title {
2099
+ margin-bottom: 10px;
2100
+ }
2101
  }
js/admin.js CHANGED
@@ -62,90 +62,83 @@ var QSMAdmin;
62
  $('#edit-name-form').submit();
63
  });
64
  $('#sendySignupForm').submit(function (e) {
65
-
66
  e.preventDefault();
67
  var $form = $(this),
68
- name = $form.find('input[name="name"]').val(),
69
- email = $form.find('input[name="email"]').val(),
70
- action = 'qsm_send_data_sendy';
71
- $form.find('#submit').attr('disabled', true);
72
- $.post(ajaxurl, {name: name, email: email, nonce: qsmAdminObject.saveNonce, action: action},
73
- function (data) {
74
- if (data)
75
- {
76
- $("#status").text('');
77
- if (data == "Some fields are missing.")
78
- {
79
- $("#status").text("Please fill in your name and email.");
80
- $("#status").css("color", "red");
81
- } else if (data == "Invalid email address.")
82
- {
83
- $("#status").text("Your email address is invalid.");
84
- $("#status").css("color", "red");
85
- } else if (data == "Invalid list ID.")
86
- {
87
- $("#status").text("Your list ID is invalid.");
88
- $("#status").css("color", "red");
89
- } else if (data == "Already subscribed.")
90
- {
91
- $("#status").text("You're already subscribed!");
92
- $("#status").css("color", "red");
93
- } else
94
- {
95
- $("#status").text("Thanks, you are now subscribed to our mailing list!");
96
- $("#status").css("color", "green");
97
- }
98
- $form.find('#submit').attr('disabled', false);
99
- } else
100
- {
101
- alert("Sorry, unable to subscribe. Please try again later!");
102
  }
 
 
 
103
  }
 
104
  );
105
- });
106
- jQuery('.category_selection_random').change(function(){
107
- var checked_data = jQuery(this).val().toString();
108
- jQuery('.catergory_comma_values').val(checked_data);
109
  });
110
- jQuery('.row-actions-c > .rtq-delete-result').click(function(e){
 
 
 
 
111
  e.preventDefault();
112
  var $this = jQuery(this);
113
- if(confirm('are you sure?')){
114
  var action = 'qsm_dashboard_delete_result';
115
  var result_id = jQuery(this).data('result_id');
116
- $.post(ajaxurl, {result_id: result_id, action: action },
117
  function (data) {
118
- if(data == 'failed'){
119
  alert('Error to delete the result!');
120
- }else{
121
  $this.parents('li').slideUp();
122
  $this.parents('li').remove();
123
- }
124
  }
125
  );
126
  }
127
  });
128
- jQuery('.load-quiz-wizard').click(function(e){
129
- e.preventDefault();
130
  MicroModal.show('model-wizard');
131
  var height = jQuery(".qsm-wizard-template-section").css("height");
132
  jQuery(".qsm-wizard-setting-section").css("height", height);
133
- if(jQuery( "#accordion" ).length > 0){
134
  var icons = {
135
  header: "iconClosed", // custom icon class
136
  activeHeader: "iconOpen" // custom icon class
137
  };
138
- jQuery( "#accordion" ).accordion({
139
- collapsible: true,
140
- icons: icons,
141
- heightStyle: "content"
142
  });
143
  jQuery('#accordion h3.ui-accordion-header').next().slideDown();
144
- jQuery('.template-list .template-list-inner:first-child').trigger('click');
145
  }
146
  });
147
  //Get quiz options
148
- jQuery('.template-list-inner').click(function(){
149
  var action = 'qsm_wizard_template_quiz_options';
150
  var settings = jQuery(this).data('settings');
151
  var addons = jQuery(this).data('addons');
@@ -153,106 +146,106 @@ var QSMAdmin;
153
  jQuery(this).addClass('selected-quiz-template');
154
  jQuery('#quiz_settings_wrapper').html('').html('<div class="qsm-spinner-loader"></div>');
155
  jQuery('#recomm_addons_wrapper').html('').html('<div class="qsm-spinner-loader"></div>');
156
- $.post(ajaxurl, {settings: settings, addons: addons, action: action },
157
  function (data) {
158
- var diff_html = data.split('=====');
159
  jQuery('#quiz_settings_wrapper').html('');
160
  jQuery('#quiz_settings_wrapper').html(diff_html[0]);
161
  jQuery('#recomm_addons_wrapper').html('');
162
  jQuery('#recomm_addons_wrapper').html(diff_html[1]);
163
- jQuery( "#accordion" ).accordion();
164
  jQuery('#accordion h3.ui-accordion-header').next().slideDown();
165
- $( '#quiz_settings_wrapper select' ).each(function(){
166
  var name = $(this).attr('name');
167
- var value = $(this).val();
168
- if( $( '.' + name + '_' + value ).length > 0 ){
169
- $( '.' + name + '_' + value ).show();
170
  }
171
  });
172
  }
173
  );
174
  });
175
-
176
- jQuery( '#create-quiz-button' ).on( 'click', function( event ) {
177
  event.preventDefault();
178
- if( jQuery('#new-quiz-form').find('.quiz_name').val() === ''){
179
  jQuery('#new-quiz-form').find('.quiz_name').addClass('qsm-required');
180
  jQuery('#new-quiz-form').find('.quiz_name').focus();
181
  return;
182
  }
183
- jQuery( '#new-quiz-form' ).submit();
184
  });
185
-
186
  //Hide/Show legacy option
187
  jQuery('#legacy_options').parents('tr').nextAll('tr').hide();
188
- jQuery(document).on('click','#legacy_options', function(e){
189
  e.preventDefault();
190
- if( jQuery('#legacy_options').parents('tr').next('tr').is(':visible') ){
191
  jQuery(this).text('').text('Show Legacy options');
192
- jQuery('#legacy_options').parents('tr').nextAll('tr').hide();
193
- }else{
194
  jQuery(this).text('').text('Hide Legacy options');
195
  jQuery('#legacy_options').parents('tr').nextAll('tr').show();
196
  }
197
  });
198
-
199
  //Dismiss the welcome panel
200
- jQuery('.qsm-welcome-panel-dismiss').click(function(e){
201
  e.preventDefault();
202
- jQuery( '#welcome_panel' ).addClass('hidden');
203
  jQuery('#screen-options-wrap').find('#welcome_panel-hide').prop('checked', false);
204
- postboxes.save_state( 'toplevel_page_qsm_dashboard' );
205
  });
206
  //Get the message in text tab
207
- jQuery( document ).on( 'change', '#qsm_question_text_message_id' , function(){
208
  var text_id = jQuery(this).val();
209
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
210
- jQuery.post(ajaxurl, {text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message'},function (response) {
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();
223
  } else {
224
- console.log( data.message );
225
  }
226
  });
227
  });
228
  //Save the message in text tab
229
- jQuery( document ).on( 'click', '#qsm_save_text_message' , function(){
230
  var $this = jQuery(this);
231
  $this.siblings('.spinner').addClass('is-active');
232
- var text_id = jQuery( '#qsm_question_text_message_id' ).val();
233
- var message = wp.editor.getContent( 'qsm_question_text_message' );
234
- jQuery.post(ajaxurl, {text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message'},function (response) {
235
- var data = jQuery.parseJSON( response );
236
- if( data.success === true ){
237
  //Do nothing
238
  } else {
239
- console.log( data.message );
240
  }
241
  $this.siblings('.spinner').removeClass('is-active');
242
  });
243
  });
244
  //On click append on tiny mce
245
- jQuery( document ).on( 'click', '.qsm-text-allowed-variables button.button' , function(){
246
  var content = jQuery(this).text();
247
- if( jQuery('.qsm-question-text-tab .html-active').length > 0 ){
248
  var $txt = jQuery("#qsm_question_text_message");
249
  var caretPos = $txt[0].selectionStart;
250
  var textAreaTxt = $txt.val();
251
  var txtToAdd = content;
252
- $txt.val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos) );
253
- }else{
254
  tinyMCE.activeEditor.execCommand('mceInsertContent', false, content);
255
- }
256
  });
257
  //Show all the variable list
258
  jQuery('.qsm-show-all-variable-text').click(function (e) {
@@ -260,70 +253,70 @@ var QSMAdmin;
260
  MicroModal.show('show-all-variable');
261
  });
262
  //Hide/show tr based on selection
263
- $( '.qsm_tab_content select' ).each(function(){
 
 
 
 
 
 
 
264
  var name = $(this).attr('name');
265
- var value = $(this).val();
266
- if( $( '.' + name + '_' + value ).length > 0 ){
267
- $( '.' + name + '_' + value ).show();
 
268
  }
269
  });
270
- $(document).on('change', '.qsm_tab_content select, #quiz_settings_wrapper select', function(){
271
  var name = $(this).attr('name');
272
- var value = $(this).val();
273
- $( '.qsm_hidden_tr' ).hide();
274
- if( $( '.' + name + '_' + value ).length > 0 ){
275
- $( '.' + name + '_' + value ).show();
276
  }
277
  });
278
- $(document).on('click', '.qsm_tab_content input[name="system"]', function(){
279
- var name = $(this).attr('name');
280
- var value = $(this).val();
281
- $( '.qsm_hidden_tr_gradingsystem' ).hide();
282
- if(value == 0 || value == 3){
283
- $( '.qsm_hidden_tr_gradingsystem').show();
284
- }
285
  });
286
- $( document ).ready(function() {
287
- var system_option = $("input[type=radio][name='system']:checked").val();
288
- $( '.qsm_hidden_tr_gradingsystem' ).hide();
289
- if(system_option == 0 || system_option == 3){
290
- $( '.qsm_hidden_tr_gradingsystem').show();
291
- }
292
- });
293
- if( $('.qsm-text-label-wrapper').length > 0 ){
294
  var element_position = $('.qsm-text-label-wrapper').offset().top;
295
- $(window).scroll(function() {
296
  var y_scroll_pos = window.pageYOffset;
297
  var scroll_pos_test = element_position;
298
- if(y_scroll_pos > scroll_pos_test) {
299
- $('.qsm_text_customize_label').fadeOut('slow');
300
- }else{
301
  $('.qsm_text_customize_label').fadeIn('slow');
302
  }
303
  });
304
- }
305
- $(document).on('click','.qsm_text_customize_label', function(){
306
  $('html, body').animate({
307
  scrollTop: $(".qsm-text-label-wrapper").offset().top - 30
308
  }, 2000);
309
  });
310
  //New template design hide show
311
  var new_template_result_detail = $('.new_template_result_detail:checked').val();
312
- if( new_template_result_detail == 1 ){
313
  $('.new_template_result_detail:checked').parents('tr').next('tr').hide();
314
  }
315
- $(document).on('change','.new_template_result_detail', function(){
316
- if( $(this).val() == 1 ){
317
  $(this).parents('tr').next('tr').hide();
318
- }else{
319
  $(this).parents('tr').next('tr').show();
320
  }
321
  });
322
- $(document).on('click', '#show-all-variable .qsm-text-template-span > .button', function(e){
323
  e.preventDefault();
324
  var $temp = $("<input>");
325
  $("body").append($temp);
326
- $temp.val( jQuery(this).text() ).select();
327
  document.execCommand("copy");
328
  $temp.remove();
329
  var button_width = $(this).width();
@@ -331,31 +324,51 @@ var QSMAdmin;
331
  $(this).css('width', button_width);
332
  $(this).text('').html('<span class="popup-copied-des"><span class="dashicons dashicons-yes"></span> Copied!</span>');
333
  var this_par = $(this);
334
- setTimeout(function(){
335
  this_par.css('width', 'auto');
336
  this_par.text('').text(button_txt);
337
  }, 1000);
338
  });
339
- $(document).on('click', '.qsm-addon-anchor-left .qsm-install-addon a', function(e){
340
  e.preventDefault();
341
  var href = $(this).attr('href');
342
  $('.qsm-addon-anchor-left .qsm-install-addon').find('a').removeClass('active');
343
  $(this).addClass('active');
344
  $('.qsm-addon-setting-wrap .qsm-primary-acnhor').hide();
345
- $( href ).show();
346
- if( href == '#qsm_add_addons' ){
347
  $('.qsm-add-addon').css('display', 'inline-block');
348
- }else{
349
  $('.qsm-add-addon').css('display', 'none');
350
  }
351
  });
352
- $(document).on('click', '.qsm-addon-anchor-left .qsm-add-addon a', function(e){
353
  e.preventDefault();
354
  var href = $(this).attr('href');
355
  $('.qsm-addon-anchor-left .qsm-add-addon').find('a').removeClass('active');
356
  $(this).addClass('active');
357
  $('.qsm-addon-setting-wrap .qsm_popular_addons').hide();
358
- $( href ).show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  });
360
- });
361
  }(jQuery));
62
  $('#edit-name-form').submit();
63
  });
64
  $('#sendySignupForm').submit(function (e) {
65
+
66
  e.preventDefault();
67
  var $form = $(this),
68
+ name = $form.find('input[name="name"]').val(),
69
+ email = $form.find('input[name="email"]').val(),
70
+ action = 'qsm_send_data_sendy';
71
+ $form.find('#submit').attr('disabled', true);
72
+ $.post(ajaxurl, { name: name, email: email, nonce: qsmAdminObject.saveNonce, action: action },
73
+ function (data) {
74
+ if (data) {
75
+ $("#status").text('');
76
+ if (data == "Some fields are missing.") {
77
+ $("#status").text("Please fill in your name and email.");
78
+ $("#status").css("color", "red");
79
+ } else if (data == "Invalid email address.") {
80
+ $("#status").text("Your email address is invalid.");
81
+ $("#status").css("color", "red");
82
+ } else if (data == "Invalid list ID.") {
83
+ $("#status").text("Your list ID is invalid.");
84
+ $("#status").css("color", "red");
85
+ } else if (data == "Already subscribed.") {
86
+ $("#status").text("You're already subscribed!");
87
+ $("#status").css("color", "red");
88
+ } else {
89
+ $("#status").text("Thanks, you are now subscribed to our mailing list!");
90
+ $("#status").css("color", "green");
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
+ $form.find('#submit').attr('disabled', false);
93
+ } else {
94
+ alert("Sorry, unable to subscribe. Please try again later!");
95
  }
96
+ }
97
  );
 
 
 
 
98
  });
99
+ jQuery('.category_selection_random').change(function () {
100
+ var checked_data = jQuery(this).val().toString();
101
+ jQuery('.catergory_comma_values').val(checked_data);
102
+ });
103
+ jQuery('.row-actions-c > .rtq-delete-result').click(function (e) {
104
  e.preventDefault();
105
  var $this = jQuery(this);
106
+ if (confirm('are you sure?')) {
107
  var action = 'qsm_dashboard_delete_result';
108
  var result_id = jQuery(this).data('result_id');
109
+ $.post(ajaxurl, { result_id: result_id, action: action },
110
  function (data) {
111
+ if (data == 'failed') {
112
  alert('Error to delete the result!');
113
+ } else {
114
  $this.parents('li').slideUp();
115
  $this.parents('li').remove();
116
+ }
117
  }
118
  );
119
  }
120
  });
121
+ jQuery('.load-quiz-wizard').click(function (e) {
122
+ e.preventDefault();
123
  MicroModal.show('model-wizard');
124
  var height = jQuery(".qsm-wizard-template-section").css("height");
125
  jQuery(".qsm-wizard-setting-section").css("height", height);
126
+ if (jQuery("#accordion").length > 0) {
127
  var icons = {
128
  header: "iconClosed", // custom icon class
129
  activeHeader: "iconOpen" // custom icon class
130
  };
131
+ jQuery("#accordion").accordion({
132
+ collapsible: true,
133
+ icons: icons,
134
+ heightStyle: "content"
135
  });
136
  jQuery('#accordion h3.ui-accordion-header').next().slideDown();
137
+ jQuery('.template-list .template-list-inner:first-child').trigger('click');
138
  }
139
  });
140
  //Get quiz options
141
+ jQuery('.template-list-inner').click(function () {
142
  var action = 'qsm_wizard_template_quiz_options';
143
  var settings = jQuery(this).data('settings');
144
  var addons = jQuery(this).data('addons');
146
  jQuery(this).addClass('selected-quiz-template');
147
  jQuery('#quiz_settings_wrapper').html('').html('<div class="qsm-spinner-loader"></div>');
148
  jQuery('#recomm_addons_wrapper').html('').html('<div class="qsm-spinner-loader"></div>');
149
+ $.post(ajaxurl, { settings: settings, addons: addons, action: action },
150
  function (data) {
151
+ var diff_html = data.split('=====');
152
  jQuery('#quiz_settings_wrapper').html('');
153
  jQuery('#quiz_settings_wrapper').html(diff_html[0]);
154
  jQuery('#recomm_addons_wrapper').html('');
155
  jQuery('#recomm_addons_wrapper').html(diff_html[1]);
156
+ jQuery("#accordion").accordion();
157
  jQuery('#accordion h3.ui-accordion-header').next().slideDown();
158
+ $('#quiz_settings_wrapper select').each(function () {
159
  var name = $(this).attr('name');
160
+ var value = $(this).val();
161
+ if ($('.' + name + '_' + value).length > 0) {
162
+ $('.' + name + '_' + value).show();
163
  }
164
  });
165
  }
166
  );
167
  });
168
+
169
+ jQuery('#create-quiz-button').on('click', function (event) {
170
  event.preventDefault();
171
+ if (jQuery('#new-quiz-form').find('.quiz_name').val() === '') {
172
  jQuery('#new-quiz-form').find('.quiz_name').addClass('qsm-required');
173
  jQuery('#new-quiz-form').find('.quiz_name').focus();
174
  return;
175
  }
176
+ jQuery('#new-quiz-form').submit();
177
  });
178
+
179
  //Hide/Show legacy option
180
  jQuery('#legacy_options').parents('tr').nextAll('tr').hide();
181
+ jQuery(document).on('click', '#legacy_options', function (e) {
182
  e.preventDefault();
183
+ if (jQuery('#legacy_options').parents('tr').next('tr').is(':visible')) {
184
  jQuery(this).text('').text('Show Legacy options');
185
+ jQuery('#legacy_options').parents('tr').nextAll('tr').hide();
186
+ } else {
187
  jQuery(this).text('').text('Hide Legacy options');
188
  jQuery('#legacy_options').parents('tr').nextAll('tr').show();
189
  }
190
  });
191
+
192
  //Dismiss the welcome panel
193
+ jQuery('.qsm-welcome-panel-dismiss').click(function (e) {
194
  e.preventDefault();
195
+ jQuery('#welcome_panel').addClass('hidden');
196
  jQuery('#screen-options-wrap').find('#welcome_panel-hide').prop('checked', false);
197
+ postboxes.save_state('toplevel_page_qsm_dashboard');
198
  });
199
  //Get the message in text tab
200
+ jQuery(document).on('change', '#qsm_question_text_message_id', function () {
201
  var text_id = jQuery(this).val();
202
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
203
+ jQuery.post(ajaxurl, { text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message' }, function (response) {
204
+ var data = jQuery.parseJSON(response);
205
+ if (data.success === true) {
206
+ var text_msg = data.text_message;
207
  if ($('#wp-qsm_question_text_message-wrap').hasClass('html-active')) {
208
+ jQuery("#qsm_question_text_message").val(text_msg);
209
  } else {
210
+ text_msg = text_msg.replace(/\n/g, "<br>");
211
+ tinyMCE.get('qsm_question_text_message').setContent(text_msg);
212
+ }
213
  //tinyMCE.get( 'qsm_question_text_message' ).setContent( text_msg );
214
+ jQuery('.qsm-text-allowed-variables > .qsm-text-variable-wrap').html('').html(data.allowed_variable_text);
215
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').hide();
216
  } else {
217
+ console.log(data.message);
218
  }
219
  });
220
  });
221
  //Save the message in text tab
222
+ jQuery(document).on('click', '#qsm_save_text_message', function () {
223
  var $this = jQuery(this);
224
  $this.siblings('.spinner').addClass('is-active');
225
+ var text_id = jQuery('#qsm_question_text_message_id').val();
226
+ var message = wp.editor.getContent('qsm_question_text_message');
227
+ jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message' }, function (response) {
228
+ var data = jQuery.parseJSON(response);
229
+ if (data.success === true) {
230
  //Do nothing
231
  } else {
232
+ console.log(data.message);
233
  }
234
  $this.siblings('.spinner').removeClass('is-active');
235
  });
236
  });
237
  //On click append on tiny mce
238
+ jQuery(document).on('click', '.qsm-text-allowed-variables button.button', function () {
239
  var content = jQuery(this).text();
240
+ if (jQuery('.qsm-question-text-tab .html-active').length > 0) {
241
  var $txt = jQuery("#qsm_question_text_message");
242
  var caretPos = $txt[0].selectionStart;
243
  var textAreaTxt = $txt.val();
244
  var txtToAdd = content;
245
+ $txt.val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos));
246
+ } else {
247
  tinyMCE.activeEditor.execCommand('mceInsertContent', false, content);
248
+ }
249
  });
250
  //Show all the variable list
251
  jQuery('.qsm-show-all-variable-text').click(function (e) {
253
  MicroModal.show('show-all-variable');
254
  });
255
  //Hide/show tr based on selection
256
+ $('.qsm_tab_content select').each(function () {
257
+ var name = $(this).attr('name');
258
+ var value = $(this).val();
259
+ if ($('.' + name + '_' + value).length > 0) {
260
+ $('.' + name + '_' + value).show();
261
+ }
262
+ });
263
+ $(document).on('change', '.qsm_tab_content select, #quiz_settings_wrapper select', function () {
264
  var name = $(this).attr('name');
265
+ var value = $(this).val();
266
+ $('.qsm_hidden_tr').hide();
267
+ if ($('.' + name + '_' + value).length > 0) {
268
+ $('.' + name + '_' + value).show();
269
  }
270
  });
271
+ $(document).on('click', '.qsm_tab_content input[name="system"]', function () {
272
  var name = $(this).attr('name');
273
+ var value = $(this).val();
274
+ $('.qsm_hidden_tr_gradingsystem').hide();
275
+ if (value == 0 || value == 3) {
276
+ $('.qsm_hidden_tr_gradingsystem').show();
277
  }
278
  });
279
+ $(document).ready(function () {
280
+ var system_option = $("input[type=radio][name='system']:checked").val();
281
+ $('.qsm_hidden_tr_gradingsystem').hide();
282
+ if (system_option == 0 || system_option == 3) {
283
+ $('.qsm_hidden_tr_gradingsystem').show();
284
+ }
 
285
  });
286
+ if ($('.qsm-text-label-wrapper').length > 0) {
 
 
 
 
 
 
 
287
  var element_position = $('.qsm-text-label-wrapper').offset().top;
288
+ $(window).scroll(function () {
289
  var y_scroll_pos = window.pageYOffset;
290
  var scroll_pos_test = element_position;
291
+ if (y_scroll_pos > scroll_pos_test) {
292
+ $('.qsm_text_customize_label').fadeOut('slow');
293
+ } else {
294
  $('.qsm_text_customize_label').fadeIn('slow');
295
  }
296
  });
297
+ }
298
+ $(document).on('click', '.qsm_text_customize_label', function () {
299
  $('html, body').animate({
300
  scrollTop: $(".qsm-text-label-wrapper").offset().top - 30
301
  }, 2000);
302
  });
303
  //New template design hide show
304
  var new_template_result_detail = $('.new_template_result_detail:checked').val();
305
+ if (new_template_result_detail == 1) {
306
  $('.new_template_result_detail:checked').parents('tr').next('tr').hide();
307
  }
308
+ $(document).on('change', '.new_template_result_detail', function () {
309
+ if ($(this).val() == 1) {
310
  $(this).parents('tr').next('tr').hide();
311
+ } else {
312
  $(this).parents('tr').next('tr').show();
313
  }
314
  });
315
+ $(document).on('click', '#show-all-variable .qsm-text-template-span > .button', function (e) {
316
  e.preventDefault();
317
  var $temp = $("<input>");
318
  $("body").append($temp);
319
+ $temp.val(jQuery(this).text()).select();
320
  document.execCommand("copy");
321
  $temp.remove();
322
  var button_width = $(this).width();
324
  $(this).css('width', button_width);
325
  $(this).text('').html('<span class="popup-copied-des"><span class="dashicons dashicons-yes"></span> Copied!</span>');
326
  var this_par = $(this);
327
+ setTimeout(function () {
328
  this_par.css('width', 'auto');
329
  this_par.text('').text(button_txt);
330
  }, 1000);
331
  });
332
+ $(document).on('click', '.qsm-addon-anchor-left .qsm-install-addon a', function (e) {
333
  e.preventDefault();
334
  var href = $(this).attr('href');
335
  $('.qsm-addon-anchor-left .qsm-install-addon').find('a').removeClass('active');
336
  $(this).addClass('active');
337
  $('.qsm-addon-setting-wrap .qsm-primary-acnhor').hide();
338
+ $(href).show();
339
+ if (href == '#qsm_add_addons') {
340
  $('.qsm-add-addon').css('display', 'inline-block');
341
+ } else {
342
  $('.qsm-add-addon').css('display', 'none');
343
  }
344
  });
345
+ $(document).on('click', '.qsm-addon-anchor-left .qsm-add-addon a', function (e) {
346
  e.preventDefault();
347
  var href = $(this).attr('href');
348
  $('.qsm-addon-anchor-left .qsm-add-addon').find('a').removeClass('active');
349
  $(this).addClass('active');
350
  $('.qsm-addon-setting-wrap .qsm_popular_addons').hide();
351
+ $(href).show();
352
+ });
353
+
354
+ // opens media library o set featured image for quiz
355
+ $(document).on('click', '#set_featured_image', function (e) {
356
+ var button = $(this);
357
+ e.preventDefault();
358
+ custom_uploader = wp.media({
359
+ title: 'Set Featured Image',
360
+ library: {
361
+ type: 'image'
362
+ },
363
+ button: {
364
+ text: 'Use this image' // button label text
365
+ },
366
+ multiple: false
367
+ }).on('select', function () { // it also has "open" and "close" events
368
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
369
+ button.prev().val(attachment.url);
370
+ button.nextAll('.qsm_featured_image_preview').attr('src', attachment.url);
371
+ }).open();
372
  });
373
+ });
374
  }(jQuery));
js/qsm-admin-question.js CHANGED
@@ -388,15 +388,24 @@ var import_button;
388
  if (!category) {
389
  category = '';
390
  }
 
 
391
  var answerType = $('#change-answer-editor').val();
 
392
  var answers = [];
393
  var $answers = jQuery('.answers-single');
394
  _.each($answers, function (answer) {
395
  var $answer = jQuery(answer);
396
  var answer = '';
 
397
  if (answerType == 'rich') {
398
  var ta_id = $answer.find('textarea').attr('id')
399
  answer = wp.editor.getContent(ta_id);
 
 
 
 
 
400
  } else {
401
  answer = $answer.find('.answer-text').val().trim();
402
  answer = $.QSMSanitize(answer);
@@ -407,7 +416,13 @@ var import_button;
407
  if ($answer.find('.answer-correct').prop('checked')) {
408
  correct = 1;
409
  }
410
- answers.push([answer, points, correct]);
 
 
 
 
 
 
411
  });
412
  $('.questionElements .advanced-content > .qsm-row ').each(function () {
413
  if ($(this).find('input[type="text"]').length > 0) {
@@ -421,30 +436,33 @@ var import_button;
421
  advanced_option[element_id] = $(this).find('select').val();
422
  } else if ($(this).find('input[type="checkbox"]').length > 0) {
423
  var element_id = $(this).find('input[type="checkbox"]').attr('name');
424
- var multi_value = $(this).find('input[type="checkbox"]:checked').map(function () {
425
- return this.value;
426
- }).get().join(',');
427
  element_id = element_id.replace('[]', '');
428
  advanced_option[element_id] = multi_value;
429
  }
430
  });
431
- model.save({
432
- type: type,
433
- name: name,
434
- question_title: question_title,
435
- answerInfo: answerInfo,
436
- comments: comments,
437
- hint: hint,
438
- category: category,
439
- answers: answers,
440
- answerEditor: answerType,
441
- other_settings: advanced_option
442
- }, {
443
- headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
444
- success: QSMQuestion.saveSuccess,
445
- error: QSMAdmin.displayError,
446
- type: 'POST'
447
- });
 
 
 
 
 
448
  //CurrentElement.parents('.questionElements').slideUp('slow');
449
  },
450
  saveSuccess: function (model) {
@@ -464,7 +482,12 @@ var import_button;
464
  },
465
  addNewAnswer: function (answer) {
466
  var answerTemplate = wp.template('single-answer');
467
- $('#answers').append(answerTemplate({ answer: decodeEntities(answer[0]), points: answer[1], correct: answer[2], count: answer[3], question_id: answer[4], answerType: answer[5], form_type: qsmQuestionSettings.form_type, quiz_system: qsmQuestionSettings.quiz_system }));
 
 
 
 
 
468
  if (answer[5] == 'rich' && qsmQuestionSettings.qsm_user_ve === 'true') {
469
  var textarea_id = 'answer-' + answer[4] + '-' + answer[3];
470
  wp.editor.remove(textarea_id);
@@ -525,6 +548,7 @@ var import_button;
525
  } else {
526
  jQuery("#question-text").val(questionText);
527
  }
 
528
  if ($('#wp-correct_answer_info-wrap').hasClass('html-active')) {
529
  jQuery("#correct_answer_info").val(answerInfo);
530
  } else if (CAI_editor) {
@@ -559,6 +583,12 @@ var import_button;
559
  if (get_limit_fu === null || typeof get_limit_fu === "undefined") {
560
  get_limit_fu = '0';
561
  }
 
 
 
 
 
 
562
  //Get checked question type
563
  var get_file_upload_type = question.get('file_upload_type');
564
  $("input[name='file_upload_type[]']:checkbox").attr("checked", false);
@@ -588,6 +618,7 @@ var import_button;
588
  if ($('.qsm_show_question_type_' + question.get('type')).length > 0) {
589
  $('.qsm_show_question_type_' + question.get('type')).show();
590
  }
 
591
  qsm_hide_show_question_desc(question.get('type'));
592
  $('#hint').val(question.get('hint'));
593
  $("#question_type").val(question.get('type'));
@@ -606,6 +637,14 @@ var import_button;
606
  if (0 !== question.get('category').length) {
607
  $(".category-radio").val([question.get('category')]);
608
  }
 
 
 
 
 
 
 
 
609
  //Append extra settings
610
  var all_setting = question.get('settings');
611
  if (all_setting === null || typeof all_setting === "undefined") {
@@ -780,9 +819,18 @@ var import_button;
780
  });
781
  $(document).on('click', '#save-popup-button', function (event) {
782
  event.preventDefault();
 
 
 
 
 
 
 
 
783
  $('#save-edit-question-spinner').addClass('is-active');
784
  var model_html = $('#modal-1-content').html();
785
  $('#modal-1-content').children().remove();
 
786
  QSMQuestion.saveQuestion($(this).parents('.questionElements').children('#edit_question_id').val(), $(this));
787
  $('.save-page-button').trigger('click');
788
  $('#modal-1-content').html(model_html);
@@ -947,6 +995,12 @@ var import_button;
947
  //Hide the question settings based on question type
948
  $(document).on('change', '#question_type', function () {
949
  var question_val = $(this).val();
 
 
 
 
 
 
950
  $('.qsm_hide_for_other').hide();
951
  if ($('.qsm_show_question_type_' + question_val).length > 0) {
952
  $('.qsm_show_question_type_' + question_val).show();
@@ -973,14 +1027,52 @@ var import_button;
973
  $(this).next('.qsm-row').slideUp();
974
  } else {
975
  $(this).hide();
 
976
  var question_description = wp.editor.getContent('question-text');
977
  if (question_description == '' || question_description == null) {
978
- tinyMCE.get('question-text').setContent('Add description here!');
 
 
 
 
 
979
  }
980
  $(this).next('.qsm-row').slideDown();
981
  }
982
  });
983
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984
  //Hide/show correct answer info
985
  $(document).on('click', '.qsm-show-correct-info-box', function (e) {
986
  e.preventDefault();
388
  if (!category) {
389
  category = '';
390
  }
391
+ var featureImageID = $('.qsm-feature-image-id').val();
392
+ var featureImageSrc = $('.qsm-feature-image-src').val();
393
  var answerType = $('#change-answer-editor').val();
394
+
395
  var answers = [];
396
  var $answers = jQuery('.answers-single');
397
  _.each($answers, function (answer) {
398
  var $answer = jQuery(answer);
399
  var answer = '';
400
+ var caption = '';
401
  if (answerType == 'rich') {
402
  var ta_id = $answer.find('textarea').attr('id')
403
  answer = wp.editor.getContent(ta_id);
404
+ } else if (answerType == 'image') {
405
+ answer = $answer.find('.answer-text').val().trim();
406
+ answer = $.QSMSanitize(answer);
407
+ caption = $answer.find('.answer-caption').val().trim();
408
+ caption = $.QSMSanitize(caption);
409
  } else {
410
  answer = $answer.find('.answer-text').val().trim();
411
  answer = $.QSMSanitize(answer);
416
  if ($answer.find('.answer-correct').prop('checked')) {
417
  correct = 1;
418
  }
419
+
420
+ if (answerType == 'image') {
421
+ answers.push([answer, points, correct, caption]);
422
+ } else {
423
+ answers.push([answer, points, correct]);
424
+ }
425
+
426
  });
427
  $('.questionElements .advanced-content > .qsm-row ').each(function () {
428
  if ($(this).find('input[type="text"]').length > 0) {
436
  advanced_option[element_id] = $(this).find('select').val();
437
  } else if ($(this).find('input[type="checkbox"]').length > 0) {
438
  var element_id = $(this).find('input[type="checkbox"]').attr('name');
439
+ var multi_value = $(this).find('input[type="checkbox"]:checked').map(function () { return this.value; }).get().join(',');
 
 
440
  element_id = element_id.replace('[]', '');
441
  advanced_option[element_id] = multi_value;
442
  }
443
  });
444
+ model.save(
445
+ {
446
+ type: type,
447
+ name: name,
448
+ question_title: question_title,
449
+ answerInfo: answerInfo,
450
+ comments: comments,
451
+ hint: hint,
452
+ category: category,
453
+ featureImageID: featureImageID,
454
+ featureImageSrc: featureImageSrc,
455
+ answers: answers,
456
+ answerEditor: answerType,
457
+ other_settings: advanced_option
458
+ },
459
+ {
460
+ headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
461
+ success: QSMQuestion.saveSuccess,
462
+ error: QSMAdmin.displayError,
463
+ type: 'POST'
464
+ }
465
+ );
466
  //CurrentElement.parents('.questionElements').slideUp('slow');
467
  },
468
  saveSuccess: function (model) {
482
  },
483
  addNewAnswer: function (answer) {
484
  var answerTemplate = wp.template('single-answer');
485
+ if (answer.length >= 7 && answer[6] == 'image') {
486
+ $('#answers').append(answerTemplate({ answer: decodeEntities(answer[0]), points: answer[1], correct: answer[2], caption: answer[3], count: answer[4], question_id: answer[5], answerType: answer[6], form_type: qsmQuestionSettings.form_type, quiz_system: qsmQuestionSettings.quiz_system }));
487
+ } else {
488
+ $('#answers').append(answerTemplate({ answer: decodeEntities(answer[0]), points: answer[1], correct: answer[2], count: answer[3], question_id: answer[4], answerType: answer[5], form_type: qsmQuestionSettings.form_type, quiz_system: qsmQuestionSettings.quiz_system }));
489
+ }
490
+
491
  if (answer[5] == 'rich' && qsmQuestionSettings.qsm_user_ve === 'true') {
492
  var textarea_id = 'answer-' + answer[4] + '-' + answer[3];
493
  wp.editor.remove(textarea_id);
548
  } else {
549
  jQuery("#question-text").val(questionText);
550
  }
551
+
552
  if ($('#wp-correct_answer_info-wrap').hasClass('html-active')) {
553
  jQuery("#correct_answer_info").val(answerInfo);
554
  } else if (CAI_editor) {
583
  if (get_limit_fu === null || typeof get_limit_fu === "undefined") {
584
  get_limit_fu = '0';
585
  }
586
+ //Get featured image
587
+ var get_featureImageSrc = question.get('featureImageSrc');
588
+ var get_featureImageID = question.get('featureImageID');
589
+ if (get_featureImageSrc === null || typeof get_featureImageSrc === "undefined") {
590
+ get_featureImageSrc = get_featureImageID = '';
591
+ }
592
  //Get checked question type
593
  var get_file_upload_type = question.get('file_upload_type');
594
  $("input[name='file_upload_type[]']:checkbox").attr("checked", false);
618
  if ($('.qsm_show_question_type_' + question.get('type')).length > 0) {
619
  $('.qsm_show_question_type_' + question.get('type')).show();
620
  }
621
+
622
  qsm_hide_show_question_desc(question.get('type'));
623
  $('#hint').val(question.get('hint'));
624
  $("#question_type").val(question.get('type'));
637
  if (0 !== question.get('category').length) {
638
  $(".category-radio").val([question.get('category')]);
639
  }
640
+ //Append feature image
641
+ if (get_featureImageSrc) {
642
+ var button = $('.qsm-feature-image-upl');
643
+ button.html('<img src="' + get_featureImageSrc + '" style="width:150px">');
644
+ button.next('.qsm-feature-image-rmv').show();
645
+ button.next().next('.qsm-feature-image-id').val(get_featureImageID);
646
+ button.next().next().next('.qsm-feature-image-src').val(get_featureImageSrc);
647
+ }
648
  //Append extra settings
649
  var all_setting = question.get('settings');
650
  if (all_setting === null || typeof all_setting === "undefined") {
819
  });
820
  $(document).on('click', '#save-popup-button', function (event) {
821
  event.preventDefault();
822
+ questionElements = $(this).parents('.questionElements');
823
+ if (6 == questionElements.find('#question_type').val()) {
824
+ question_description = wp.editor.getContent('question-text').trim();
825
+ if (question_description == '' || question_description == null) {
826
+ alert('Text/HTML Section cannot be empty');
827
+ return false;
828
+ }
829
+ }
830
  $('#save-edit-question-spinner').addClass('is-active');
831
  var model_html = $('#modal-1-content').html();
832
  $('#modal-1-content').children().remove();
833
+
834
  QSMQuestion.saveQuestion($(this).parents('.questionElements').children('#edit_question_id').val(), $(this));
835
  $('.save-page-button').trigger('click');
836
  $('#modal-1-content').html(model_html);
995
  //Hide the question settings based on question type
996
  $(document).on('change', '#question_type', function () {
997
  var question_val = $(this).val();
998
+ if (6 == question_val) {
999
+ var question_description = wp.editor.getContent('question-text');
1000
+ if (question_description == 'Add description here!') {
1001
+ tinyMCE.get('question-text').setContent('');
1002
+ }
1003
+ }
1004
  $('.qsm_hide_for_other').hide();
1005
  if ($('.qsm_show_question_type_' + question_val).length > 0) {
1006
  $('.qsm_show_question_type_' + question_val).show();
1027
  $(this).next('.qsm-row').slideUp();
1028
  } else {
1029
  $(this).hide();
1030
+ questionElements = $(this).parents('.questionElements');
1031
  var question_description = wp.editor.getContent('question-text');
1032
  if (question_description == '' || question_description == null) {
1033
+ console.log(questionElements.find('#question_type').val());
1034
+ if (6 == questionElements.find('#question_type').val()) {
1035
+ tinyMCE.get('question-text').setContent('');
1036
+ } else {
1037
+ tinyMCE.get('question-text').setContent('Add description here!');
1038
+ }
1039
  }
1040
  $(this).next('.qsm-row').slideDown();
1041
  }
1042
  });
1043
 
1044
+ //Open file upload on feature image
1045
+ $('body').on('click', '.qsm-feature-image-upl', function (e) {
1046
+ e.preventDefault();
1047
+ var button = $(this),
1048
+ custom_uploader = wp.media({
1049
+ title: 'Insert image',
1050
+ library: {
1051
+ // uploadedTo : wp.media.view.settings.post.id, // attach to the current post?
1052
+ type: 'image'
1053
+ },
1054
+ button: {
1055
+ text: 'Use this image' // button label text
1056
+ },
1057
+ multiple: false
1058
+ }).on('select', function () { // it also has "open" and "close" events
1059
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
1060
+ button.html('<img src="' + attachment.url + '" style="width:150px">');
1061
+ button.next('.qsm-feature-image-rmv').show();
1062
+ button.next().next('.qsm-feature-image-id').val(attachment.id);
1063
+ button.next().next().next('.qsm-feature-image-src').val(attachment.url);
1064
+ }).open();
1065
+ });
1066
+
1067
+ // on remove button click
1068
+ $('body').on('click', '.qsm-feature-image-rmv', function (e) {
1069
+ e.preventDefault();
1070
+ var button = $(this);
1071
+ button.next().val(''); // emptying the hidden field
1072
+ button.next().next().val(''); // emptying the hidden field
1073
+ button.hide().prev().html('Upload image');
1074
+ });
1075
+
1076
  //Hide/show correct answer info
1077
  $(document).on('click', '.qsm-show-correct-info-box', function (e) {
1078
  e.preventDefault();
js/qsm-admin.js CHANGED
@@ -146,6 +146,7 @@ var QSMQuizzesSurveys;
146
  $( '.' + name + '_' + value ).show();
147
  }
148
  });
 
149
  /*$( '#quiz_search' ).keyup( function() {
150
  QSMQuizzesSurveys.searchQuizzes( $( this ).val() );
151
  });*/
@@ -169,15 +170,6 @@ var QSMQuizzesSurveys;
169
  event.preventDefault();
170
  $( '#reset_quiz_form' ).submit();
171
  });
172
- $( '#create-quiz-button' ).on( 'click', function( event ) {
173
- if( $('#new-quiz-form').find('.quiz_name').val() === ''){
174
- $('#new-quiz-form').find('.quiz_name').addClass('qsm-required');
175
- $('#new-quiz-form').find('.quiz_name').focus();
176
- return;
177
- }
178
- event.preventDefault();
179
- $( '#new-quiz-form' ).submit();
180
- });
181
  $( '#duplicate-quiz-button' ).on( 'click', function( event ) {
182
  event.preventDefault();
183
  $( '#duplicate-quiz-form' ).submit();
@@ -204,6 +196,6 @@ var QSMQuizzesSurveys;
204
  var copyText = document.getElementById("sc-shortcode-model-text-link");
205
  copyText.select();
206
  document.execCommand("copy");
207
- });
208
  });
209
  }(jQuery));
146
  $( '.' + name + '_' + value ).show();
147
  }
148
  });
149
+
150
  /*$( '#quiz_search' ).keyup( function() {
151
  QSMQuizzesSurveys.searchQuizzes( $( this ).val() );
152
  });*/
170
  event.preventDefault();
171
  $( '#reset_quiz_form' ).submit();
172
  });
 
 
 
 
 
 
 
 
 
173
  $( '#duplicate-quiz-button' ).on( 'click', function( event ) {
174
  event.preventDefault();
175
  $( '#duplicate-quiz-form' ).submit();
196
  var copyText = document.getElementById("sc-shortcode-model-text-link");
197
  copyText.select();
198
  document.execCommand("copy");
199
+ });
200
  });
201
  }(jQuery));
js/qsm-quiz-wizard.js ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ $('#create-quiz-button').on('click', function (event) {
4
+ if ($('#new-quiz-form').find('.quiz_name').val() === '') {
5
+ $('#new-quiz-form').find('.quiz_name').addClass('qsm-required');
6
+ $('.qsm-wizard-wrap[data-show="quiz_settings"]').trigger('click');
7
+ $('#new-quiz-form').find('.quiz_name').focus();
8
+ return;
9
+ }
10
+ event.preventDefault();
11
+ $('#new-quiz-form').submit();
12
+ });
13
+
14
+ //Hide/show the wizard quiz options
15
+ $(document).on('change', '#quiz_settings select', function () {
16
+ var value = $(this).val();
17
+ if (value == 0) {
18
+ jQuery(this).closest('.input-group').next('.input-group').show();
19
+ } else {
20
+ jQuery(this).closest('.input-group').next('.input-group').hide();
21
+ }
22
+ });
23
+
24
+ //Show the menus on widget click
25
+ $(document).on('click', '.qsm-new_menu_tab_items li', function (e) {
26
+ $('.qsm-new_menu_tab_items li').removeClass('active');
27
+ $(this).addClass('active');
28
+ $('.qsm-new-menu-elements').hide();
29
+ var id = $(this).attr('data-show');
30
+ $('#' + id).show();
31
+ e.preventDefault();
32
+ });
33
+
34
+ $(document).on('click', '.qsm-wizard-wrap', function (e) {
35
+ $('.qsm-wizard-menu .qsm-wizard-wrap').removeClass('active');
36
+ $(this).addClass('active');
37
+ $('.qsm-new-menu-elements').hide();
38
+ var id = $(this).attr('data-show');
39
+ $('#' + id).fadeIn()
40
+ $('#modal-2-content').scrollTop(0);
41
+ switch (id) {
42
+ case 'select_themes':
43
+ $('#model-wizard .qsm-popup__footer #prev-theme-button').hide();
44
+ $('#model-wizard .qsm-popup__footer #prev-quiz-button').hide();
45
+ $('#model-wizard .qsm-popup__footer #next-quiz-button').show();
46
+ $('#model-wizard .qsm-popup__footer #create-quiz-button').hide();
47
+ $('#model-wizard .qsm-popup__footer #choose-addons-button').hide();
48
+ break;
49
+ case 'quiz_settings':
50
+ $('#model-wizard .qsm-popup__footer #prev-theme-button').show();
51
+ $('#model-wizard .qsm-popup__footer #prev-quiz-button').hide();
52
+ $('#model-wizard .qsm-popup__footer #next-quiz-button').hide();
53
+ $('#model-wizard .qsm-popup__footer #create-quiz-button').hide();
54
+ $('#model-wizard .qsm-popup__footer #choose-addons-button').show();
55
+ break;
56
+ case 'addons_list':
57
+ $('#model-wizard .qsm-popup__footer #prev-theme-button').hide();
58
+ $('#model-wizard .qsm-popup__footer #prev-quiz-button').show();
59
+ $('#model-wizard .qsm-popup__footer #next-quiz-button').hide();
60
+ $('#model-wizard .qsm-popup__footer #create-quiz-button').show();
61
+ $('#model-wizard .qsm-popup__footer #choose-addons-button').hide();
62
+ break;
63
+ default:
64
+ $('#model-wizard .qsm-popup__footer #prev-theme-button').hide();
65
+ $('#model-wizard .qsm-popup__footer #prev-quiz-button').hide();
66
+ $('#model-wizard .qsm-popup__footer #next-quiz-button').show();
67
+ $('#model-wizard .qsm-popup__footer #create-quiz-button').hide();
68
+ $('#model-wizard .qsm-popup__footer #choose-addons-button').hide();
69
+ break;
70
+ }
71
+ e.preventDefault();
72
+ });
73
+ $(document).on('click', '#model-wizard .qsm-popup__footer #prev-theme-button', function (e) {
74
+ $('.qsm-wizard-wrap[data-show="select_themes"]').trigger('click');
75
+ e.preventDefault();
76
+ });
77
+ $(document).on('click', '#model-wizard .qsm-popup__footer #prev-quiz-button', function (e) {
78
+ $('.qsm-wizard-wrap[data-show="quiz_settings"]').trigger('click');
79
+ e.preventDefault();
80
+ });
81
+ $(document).on('click', '#model-wizard .qsm-popup__footer #choose-addons-button', function (e) {
82
+ $('.qsm-wizard-wrap[data-show="addons_list"]').trigger('click');
83
+ e.preventDefault();
84
+ });
85
+ $(document).on('click', '#model-wizard .qsm-popup__footer #next-quiz-button', function (e) {
86
+ $('.qsm-wizard-wrap[data-show="quiz_settings"]').trigger('click');
87
+ e.preventDefault();
88
+ });
89
+ $(document).on('click', '.theme-sub-menu li', function (e) {
90
+ e.preventDefault();
91
+ var id = $(this).children('a').attr('data-show');
92
+ $('.theme-sub-menu li').removeClass('active');
93
+ $(this).addClass('active');
94
+ $('.theme-wrap').hide();
95
+ $('#' + id).show();
96
+ });
97
+ $(document).on('click', '#downloaded_theme .theme-wrapper:not(.market-theme)', function (e) {
98
+ e.preventDefault();
99
+ $('#downloaded_theme .theme-wrapper').removeClass('active');
100
+ $('#downloaded_theme .theme-wrapper').find('.theme-name').stop().fadeTo('slow', 0);
101
+ // $('#downloaded_theme .theme-wrapper').find('.qsm-activate-theme').html('').html('Select Theme');
102
+ $(this).find('input[name="quiz_theme_id"]').prop("checked", true);
103
+ $(this).addClass('active');
104
+ $(this).find('.theme-name').stop().fadeTo('slow', 1);
105
+ // $('#downloaded_theme .theme-wrapper.active').find('.qsm-activate-theme').html('').html('Selected Theme');
106
+ if ($(this).find('input[name="quiz_theme_id"]').val() == 0) {
107
+ $('#model-wizard .featured_image').hide();
108
+ $('#model-wizard .featured_image .quiz_featured_image').val('');
109
+ $('#model-wizard #quiz_settings #pagination').val(0).parents('.input-group').hide();
110
+ $('#model-wizard #quiz_settings #progress_bar-0').prop('checked', true).parents('.input-group').hide();
111
+ $('#model-wizard #quiz_settings #enable_pagination_quiz-0').prop('checked', true).parents('.input-group').hide();
112
+ $('#model-wizard #quiz_settings #disable_scroll_next_previous_click-0').prop('checked', true).parents('.input-group').hide();
113
+ } else {
114
+ $('#model-wizard .featured_image').show();
115
+ $('#model-wizard #quiz_settings #pagination').val(1).parents('.input-group').show();
116
+ $('#model-wizard #quiz_settings #progress_bar-1').prop('checked', true).parents('.input-group').show();
117
+ $('#model-wizard #quiz_settings #enable_pagination_quiz-1').prop('checked', true).parents('.input-group').show();
118
+ $('#model-wizard #quiz_settings #disable_scroll_next_previous_click-1').prop('checked', true).parents('.input-group').show();
119
+ }
120
+ });
121
+
122
+ $(document).on('mouseover', '#downloaded_theme .theme-wrapper, #browse_themes .theme-wrapper', function (e) {
123
+ e.preventDefault();
124
+ if (!$(this).hasClass('active')) {
125
+ $(this).find('.theme-name').stop().fadeTo('slow', 1);
126
+ }
127
+ });
128
+
129
+ $(document).on('mouseout', '#downloaded_theme .theme-wrapper, #browse_themes .theme-wrapper', function (e) {
130
+ e.preventDefault();
131
+ if (!$(this).hasClass('active')) {
132
+ $(this).find('.theme-name').stop().fadeTo('slow', 0);
133
+ }
134
+ });
135
+
136
+ $(document).find('#select_themes .theme-actions').remove();
137
+
138
+ $(document).on('click', '#new_quiz_button', function () {
139
+ $('#quiz_settings').find('.qsm-opt-desc').each(function () {
140
+ if ($(this)) {
141
+ desc = $(this);
142
+ desc.parents('.input-group').find('label:first-child').append(desc);
143
+ }
144
+ })
145
+ });
146
+
147
+ // $(document).on('click', '#set_featured_image', function (e) {
148
+ // var button = $(this);
149
+ // e.preventDefault();
150
+ // custom_uploader = wp.media({
151
+ // title: 'Set Featured Image',
152
+ // library: {
153
+ // type: 'image'
154
+ // },
155
+ // button: {
156
+ // text: 'Use this image' // button label text
157
+ // },
158
+ // multiple: false
159
+ // }).on('select', function () { // it also has "open" and "close" events
160
+ // var attachment = custom_uploader.state().get('selection').first().toJSON();
161
+ // button.prev().val(attachment.url);
162
+ // }).open();
163
+ // return false;
164
+ // });
165
+
166
+ }(jQuery));
js/qsm-quiz.js CHANGED
@@ -214,7 +214,7 @@ var QSMPageTimer;
214
  $(".mlw_answer_number").attr('readonly', true);
215
 
216
  $quizForm.closest('.qmn_quiz_container').addClass('qsm_timer_ended');
217
- $quizForm.closest('.qmn_quiz_container').prepend('<p style="color: red;">Quiz time is over</p>');
218
  if (qmn_quiz_data[quizID].enable_result_after_timer_end == 1) {
219
  $quizForm.closest('.qmn_quiz_container').find('.qsm-submit-btn').trigger('click');
220
  } else {
@@ -891,6 +891,8 @@ function qmnDisplayResults(results, quiz_form_id, $container) {
891
  $container.find('.qmn_results_page').html(results.display);
892
  qsmScrollTo($container);
893
  MathJax.Hub.queue.Push(["Typeset", MathJax.Hub]);
 
 
894
  }
895
  }
896
 
@@ -971,6 +973,13 @@ function qmnNextSlide(pagination, go_to_top, quiz_form_id) {
971
  $container.find(".mlw_previous").show();
972
  $container.find('.g-recaptcha').show();
973
  } else if (slide_number >= 0 && page_number >= 1) {
 
 
 
 
 
 
 
974
  $container.find('.qsm-auto-page-row.qsm-apc-' + page_number).show();
975
  $container.find('.slide_number_hidden').val(parseInt(slide_number) + 1);
976
  $container.find('.current_page_hidden').val(parseInt(page_number) + 1);
@@ -1059,7 +1068,9 @@ function qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number) {
1059
  var qmn_total_questions = qmn_quiz_data[quiz_id].pagination.total_questions;
1060
  var pagination = qmn_quiz_data[quiz_id].pagination.amount;
1061
  total_page_number = Math.ceil(qmn_total_questions / pagination);
1062
- total_page_number = total_page_number + 1; //Increase for quiz end section
 
 
1063
  var animate_value = page_number / total_page_number;
1064
  if (animate_value <= 1) {
1065
  qmn_quiz_data[quiz_id].bar.animate(animate_value);
@@ -1094,6 +1105,7 @@ function qmnInitPagination(quiz_id) {
1094
  qmn_total_pages = qmn_total_pages + 1; //quiz begin
1095
  qmn_total_pages = qmn_total_pages + 1; //quiz end
1096
 
 
1097
  jQuery('#quizForm' + quiz_id).closest('.qmn_quiz_container').append('<div class="qmn_pagination border margin-bottom"></div>');
1098
  jQuery('#quizForm' + quiz_id).closest('.qmn_quiz_container').find('.qmn_pagination').append('<input type="hidden" value="0" name="slide_number" class="slide_number_hidden" />')
1099
  .append('<input type="hidden" value="0" name="current_page" class="current_page_hidden" />')
214
  $(".mlw_answer_number").attr('readonly', true);
215
 
216
  $quizForm.closest('.qmn_quiz_container').addClass('qsm_timer_ended');
217
+ $quizForm.closest('.qmn_quiz_container').prepend('<p class="qmn_error_message" style="color: red;">Quiz time is over</p>');
218
  if (qmn_quiz_data[quizID].enable_result_after_timer_end == 1) {
219
  $quizForm.closest('.qmn_quiz_container').find('.qsm-submit-btn').trigger('click');
220
  } else {
891
  $container.find('.qmn_results_page').html(results.display);
892
  qsmScrollTo($container);
893
  MathJax.Hub.queue.Push(["Typeset", MathJax.Hub]);
894
+ // Fires after result is populates via ajax
895
+ jQuery(document).trigger('qsm_after_display_result');
896
  }
897
  }
898
 
973
  $container.find(".mlw_previous").show();
974
  $container.find('.g-recaptcha').show();
975
  } else if (slide_number >= 0 && page_number >= 1) {
976
+ if (total_pages == parseInt(page_number) + 2) { // if last page empty
977
+ if (jQuery(quiz_form_id + " .qsm-auto-page-row.empty_quiz_end").length) {
978
+ submit_button = jQuery(quiz_form_id + " .qsm-auto-page-row.empty_quiz_end").html();
979
+ jQuery(quiz_form_id + " .qsm-auto-page-row.empty_quiz_end").show();
980
+ $container.find(".mlw_next").hide();
981
+ }
982
+ }
983
  $container.find('.qsm-auto-page-row.qsm-apc-' + page_number).show();
984
  $container.find('.slide_number_hidden').val(parseInt(slide_number) + 1);
985
  $container.find('.current_page_hidden').val(parseInt(page_number) + 1);
1068
  var qmn_total_questions = qmn_quiz_data[quiz_id].pagination.total_questions;
1069
  var pagination = qmn_quiz_data[quiz_id].pagination.amount;
1070
  total_page_number = Math.ceil(qmn_total_questions / pagination);
1071
+ if (!jQuery('#quizForm' + quiz_id).closest('.qmn_quiz_container').find('.empty_quiz_end').length) {
1072
+ total_page_number = total_page_number + 1; //Increase for quiz end section
1073
+ }
1074
  var animate_value = page_number / total_page_number;
1075
  if (animate_value <= 1) {
1076
  qmn_quiz_data[quiz_id].bar.animate(animate_value);
1105
  qmn_total_pages = qmn_total_pages + 1; //quiz begin
1106
  qmn_total_pages = qmn_total_pages + 1; //quiz end
1107
 
1108
+
1109
  jQuery('#quizForm' + quiz_id).closest('.qmn_quiz_container').append('<div class="qmn_pagination border margin-bottom"></div>');
1110
  jQuery('#quizForm' + quiz_id).closest('.qmn_quiz_container').find('.qmn_pagination').append('<input type="hidden" value="0" name="slide_number" class="slide_number_hidden" />')
1111
  .append('<input type="hidden" value="0" name="current_page" class="current_page_hidden" />')
js/qsm-theme-color.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function () {
2
+ jQuery(document).on('click', '.qsm-customize-color-settings', function (e) {
3
+ e.preventDefault();
4
+ MicroModal.show('qsm-theme-color-settings');
5
+ if( jQuery('.my-color-field').length > 0 ){
6
+ jQuery('.my-color-field').wpColorPicker();
7
+ }
8
+ });
9
+ jQuery(document).on('click', '#qsm-save-theme-settings', function(e){
10
+ e.preventDefault();
11
+ jQuery('.qsm-theme-settings-frm').submit();
12
+ });
13
+ });
mlw_quizmaster2.php CHANGED
@@ -2,14 +2,14 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 7.1.19
6
  * Author: ExpressTech
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://expresstech.io/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
- * @version 7.1.19
13
  * @package QSM
14
  */
15
 
@@ -17,10 +17,13 @@ if ( ! defined( 'ABSPATH' ) ) {
17
  exit;
18
  }
19
 
 
20
  define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
21
  define( 'QSM_SUBMENU', __FILE__ );
22
  define( 'QSM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
23
  define( 'hide_qsm_adv', true );
 
 
24
 
25
  /**
26
  * This class is the main class of the plugin
@@ -38,7 +41,7 @@ class MLWQuizMasterNext {
38
  * @var string
39
  * @since 4.0.0
40
  */
41
- public $version = '7.1.19';
42
 
43
  /**
44
  * QSM Alert Manager Object
@@ -88,6 +91,14 @@ class MLWQuizMasterNext {
88
  */
89
  public $quiz_settings;
90
 
 
 
 
 
 
 
 
 
91
  /**
92
  * Main Construct Function
93
  *
@@ -173,6 +184,9 @@ class MLWQuizMasterNext {
173
  include 'php/classes/class-qsm-settings.php';
174
  $this->quiz_settings = new QSM_Quiz_Settings();
175
 
 
 
 
176
  include 'php/rest-api.php';
177
  }
178
 
@@ -205,10 +219,17 @@ class MLWQuizMasterNext {
205
  *
206
  * @since 7.1.16
207
  */
208
- public function qsm_admin_scripts_style( $hook_prefix ) {
209
- if ( $hook_prefix == 'admin_page_mlw_quiz_options' ) {
 
210
  wp_enqueue_script( 'wp-tinymce' );
211
  }
 
 
 
 
 
 
212
  }
213
 
214
  /**
@@ -334,18 +355,15 @@ class MLWQuizMasterNext {
334
  * @return void
335
  */
336
  public function qsm_overide_old_setting_options() {
337
- $settings = (array) get_option( 'qmn-settings' );
338
- if ( isset( $settings['facebook_app_id'] ) ) {
339
- $facebook_app_id = $settings['facebook_app_id'];
340
- if ( $facebook_app_id == '483815031724529' ) {
341
- $settings['facebook_app_id'] = '594986844960937';
342
- update_option( 'qmn-settings', $settings );
343
- }
344
  }
345
-
346
  }
347
  }
348
 
349
  global $mlwQuizMasterNext;
350
  $mlwQuizMasterNext = new MLWQuizMasterNext();
351
- register_activation_hook( __FILE__, array( 'QSM_Install', 'install' ) );
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 7.2.0
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.2.0
13
  * @package QSM
14
  */
15
 
17
  exit;
18
  }
19
 
20
+ define( 'QSM_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
21
  define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
22
  define( 'QSM_SUBMENU', __FILE__ );
23
  define( 'QSM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
24
  define( 'hide_qsm_adv', true );
25
+ define( 'QSM_THEME_PATH', plugin_dir_path( __DIR__ ) );
26
+ define( 'QSM_THEME_SLUG', plugins_url( '/' ) );
27
 
28
  /**
29
  * This class is the main class of the plugin
41
  * @var string
42
  * @since 4.0.0
43
  */
44
+ public $version = '7.2.0';
45
 
46
  /**
47
  * QSM Alert Manager Object
91
  */
92
  public $quiz_settings;
93
 
94
+ /**
95
+ * QSM theme settings object
96
+ *
97
+ * @var object
98
+ * @since 7.1.15
99
+ */
100
+ public $theme_settings;
101
+
102
  /**
103
  * Main Construct Function
104
  *
184
  include 'php/classes/class-qsm-settings.php';
185
  $this->quiz_settings = new QSM_Quiz_Settings();
186
 
187
+ include 'php/classes/class-qsm-theme-settings.php';
188
+ $this->theme_settings = new QSM_Theme_Settings();
189
+
190
  include 'php/rest-api.php';
191
  }
192
 
219
  *
220
  * @since 7.1.16
221
  */
222
+ public function qsm_admin_scripts_style( $hook ) {
223
+ global $mlwQuizMasterNext;
224
+ if ( $hook == 'admin_page_mlw_quiz_options' ) {
225
  wp_enqueue_script( 'wp-tinymce' );
226
  }
227
+
228
+ if ( $hook == 'toplevel_page_qsm_dashboard' || $hook == 'qsm_page_mlw_quiz_list' ) {
229
+ wp_enqueue_script( 'qsm_quiz_wizard_script', plugins_url( 'js/qsm-quiz-wizard.js', __FILE__ ), array( 'jquery', 'micromodal_script' ), $this->version );
230
+ wp_enqueue_script( 'qsm_admin_js', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), $this->version );
231
+ wp_enqueue_media();
232
+ }
233
  }
234
 
235
  /**
355
  * @return void
356
  */
357
  public function qsm_overide_old_setting_options() {
358
+ $settings = (array) get_option( 'qmn-settings' );
359
+ $facebook_app_id = $settings['facebook_app_id'];
360
+ if ( $facebook_app_id == '483815031724529' ) {
361
+ $settings['facebook_app_id'] = '594986844960937';
362
+ update_option( 'qmn-settings', $settings );
 
 
363
  }
 
364
  }
365
  }
366
 
367
  global $mlwQuizMasterNext;
368
  $mlwQuizMasterNext = new MLWQuizMasterNext();
369
+ register_activation_hook( __FILE__, array( 'QSM_Install', 'install' ) );
php/admin/addons-page.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
- if (!defined('ABSPATH')) {
3
- exit;
4
  }
5
 
6
  /**
@@ -10,47 +10,50 @@ if (!defined('ABSPATH')) {
10
  * @since 4.4.0
11
  */
12
  function qmn_addons_page() {
13
- if (!current_user_can('moderate_comments')) {
14
- return;
15
- }
16
 
17
- global $mlwQuizMasterNext;
18
- $active_tab = strtolower(str_replace(" ", "-", isset($_GET['tab']) ? $_GET['tab'] : __('Featured Addons', 'quiz-master-next')));
19
- $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
20
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
21
- ?>
22
- <div class="wrap qsm-addon-setting-wrap">
23
- <h2 style="margin-bottom: 20px;">
24
- <?php _e('QSM Addon Settings', 'quiz-master-next'); ?>
25
- <?php
26
- if( isset( $_GET['tab'] ) && $_GET['tab'] != '' ){ ?>
27
- <a class="button button-default" href="?page=qmn_addons"><span style="margin-top: 4px;" class="dashicons dashicons-arrow-left-alt"></span> <?php _e('Back to list', 'quiz-master-next'); ?></a>
28
- <?php
29
- }
30
- ?>
31
- </h2>
32
- <h2 class="nav-tab-wrapper" style="display: none;">
33
- <?php
34
- foreach ($tab_array as $tab) {
35
- $active_class = '';
36
- if ($active_tab == $tab['slug']) {
37
- $active_class = 'nav-tab-active';
38
- }
39
- echo "<a href=\"?page=qmn_addons&tab={$tab['slug']}\" class=\"nav-tab $active_class\">{$tab['title']}</a>";
40
- }
41
- ?>
42
- </h2>
43
- <div>
44
- <?php
45
- foreach ($tab_array as $tab) {
46
- if ($active_tab == $tab['slug']) {
47
- call_user_func($tab['function']);
48
- }
49
- }
50
- ?>
51
- </div>
52
- </div>
53
- <?php
 
 
 
54
  }
55
 
56
  /**
@@ -60,213 +63,245 @@ function qmn_addons_page() {
60
  * @since 4.4.0
61
  */
62
  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-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 ){ ?>
88
- <div class="installed_addons_wrapper">
89
- <?php
90
- foreach ($tab_array as $tab) {
91
- if( trim( $tab['title'] ) == 'Featured Addons' ){
92
- continue;
93
- }
94
- ?>
95
- <div class="installed_addon">
96
- <span class="installed_addon_name"><?php echo $tab['title']; ?></span>
97
- <span class="installed_addon_link">
98
- <a class="button button-default" href="?page=qmn_addons&tab=<?php echo $tab['slug']; ?>"><span class="dashicons dashicons-admin-generic"></span> <?php _e('Settings', 'quiz-master-next'); ?></a>
99
- </span>
100
- </div>
101
- <?php } ?>
102
- </div>
103
- <?php
104
- } else { ?>
105
- <div class="no_addons_installed">
106
- <?php
107
- _e('You have currently not installed any addons. Explore our addons repository with 40+ addons to make your quiz even better.', 'quiz-master-next');
108
- ?>
109
- </div>
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 ) ){
118
- $qsm_admin_dd = qsm_fetch_data_from_script();
119
- $popular_addons = isset( $qsm_admin_dd['popular_products'] ) ? $qsm_admin_dd['popular_products'] : array();
120
- }
121
- ?>
122
- <div class="qsm_popular_addons" id="qsm_popular_addons">
123
- <div class="popuar-addon-ul">
124
- <?php
125
- if ( $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
- }
150
- }
151
- ?>
152
- </div>
153
- </div>
154
- <div class="qsm_popular_addons" id="qsm_onsale_addons" style="display: none;">
155
- <?php
156
- $qsm_onsale_addons = qsm_get_widget_data('on_sale_products');
157
- if( empty( $qsm_onsale_addons ) ){
158
- $qsm_admin_dd = qsm_fetch_data_from_script();
159
- $qsm_onsale_addons = isset( $qsm_admin_dd['on_sale_products'] ) ? $qsm_admin_dd['on_sale_products'] : array();
160
- }
161
- ?>
162
- <div class="popuar-addon-ul">
163
- <?php
164
- if ( $qsm_onsale_addons ) {
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
- }
189
- }
190
- ?>
191
- </div>
192
- </div>
193
- <div class="qsm_popular_addons" id="qsm_new_addons" style="display: none;">
194
- <?php
195
- $new_addons = qsm_get_widget_data('new_addons');
196
- if( empty( $popular_addons ) ){
197
- $qsm_admin_dd = qsm_fetch_data_from_script();
198
- $new_addons = isset( $qsm_admin_dd['new_addons'] ) ? $qsm_admin_dd['new_addons'] : array();
199
- }
200
- ?>
201
- <div class="popuar-addon-ul">
202
- <?php
203
- if ( $new_addons ) {
204
- foreach ( $new_addons as $key => $single_arr ) {
205
- if( trim( $single_arr['name'] ) == 'Starter Bundle' || trim( $single_arr['name'] ) == 'Premium Bundle' ){
206
- continue;
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
- }
231
- }
232
- ?>
233
- </div>
234
- </div>
235
- </div>
236
- <div class="qsm-addon-news-ads">
237
- <?php
238
- $bundles = qsm_get_widget_data('bundles');
239
- if( empty( $bundles ) ){
240
- $qsm_admin_dd = qsm_fetch_data_from_script();
241
- $bundles = isset( $qsm_admin_dd['bundles'] ) ? $qsm_admin_dd['bundles'] : array();
242
- }
243
- ?>
244
- <?php
245
- if( $bundles ){
246
- ?>
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
 
272
  /**
@@ -276,196 +311,216 @@ function qsm_generate_featured_addons() {
276
  * @since 4.4.0
277
  */
278
  function qsm_featured_addons_tab() {
279
- global $mlwQuizMasterNext;
280
- $mlwQuizMasterNext->pluginHelper->register_addon_settings_tab(__('Featured Addons', 'quiz-master-next'), 'qsm_generate_featured_addons');
281
  }
282
 
283
- add_action('plugins_loaded', 'qsm_featured_addons_tab');
284
 
285
  /**
286
  * @version 3.2.0
287
  * Display get a free addon page
288
  */
289
  function qsm_display_optin_page() {
290
- global $mlwQuizMasterNext;
291
- wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
292
- wp_localize_script( 'qsm_admin_script', 'qsmAdminObject', array( 'saveNonce' => wp_create_nonce('ajax-nonce-sendy-save') ) );
293
- ?>
294
- <div class="wrap about-wrap">
295
 
296
- <h1><?php esc_html_e('Get Your Free Addon!', 'quiz-master-next'); ?></h1>
297
 
298
- <div class="about-text"><?php esc_html_e('Wanna get more out of Quiz and Survey Master, but not yet ready to spend the cash? Get one free addon today!', 'quiz-master-next'); ?></div>
 
 
299
 
300
- <div class="changelog">
301
 
302
- <div class="row">
303
- <!-- <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
304
- <div class="about-body">
305
- <img src="" alt="Improved Custom Fields">
306
- </div>
307
- </div> -->
308
- </div>
309
 
310
- <p><?php echo __('Getting your addon is dead simple: just subscribe to our newsletter and then you will get the free addon by e-mail. We will not spam you. We usually send out newsletters to talk about new features in ', 'quiz-master-next') . '<b>'. __('Quiz and Survey Master', 'quiz-master-next') .'</b>,' . __(' let you know when new or updated addons are being released and provide informative articles that show you how to use ', 'quiz-master-next') . '<b>'. __('Quiz and Survey Master ', 'quiz-master-next') .'</b>' . __('to its full potential. ', 'quiz-master-next') . '<a href="https://quizandsurveymaster.com/privacy-policy/" target="_blank">' . __('View our privacy policy', 'quiz-master-next') .'</a>'; ?></p>
 
311
 
312
- <div id="wpas-mailchimp-signup-form-wrapper">
313
- <div id="status"></div>
314
- <!-- Begin Sendinblue Form -->
315
- <!-- START - We recommend to place the below code in head tag of your website html -->
316
- <style>
317
- @font-face {
318
- font-display: block;
319
- font-family: Roboto;
320
- src: url(https://assets.sendinblue.com/font/Roboto/Latin/normal/normal/7529907e9eaf8ebb5220c5f9850e3811.woff2) format("woff2"), url(https://assets.sendinblue.com/font/Roboto/Latin/normal/normal/25c678feafdc175a70922a116c9be3e7.woff) format("woff")
321
- }
322
 
323
- @font-face {
324
- font-display: fallback;
325
- font-family: Roboto;
326
- font-weight: 600;
327
- src: url(https://assets.sendinblue.com/font/Roboto/Latin/medium/normal/6e9caeeafb1f3491be3e32744bc30440.woff2) format("woff2"), url(https://assets.sendinblue.com/font/Roboto/Latin/medium/normal/71501f0d8d5aa95960f6475d5487d4c2.woff) format("woff")
328
- }
329
 
330
- @font-face {
331
- font-display: fallback;
332
- font-family: Roboto;
333
- font-weight: 700;
334
- src: url(https://assets.sendinblue.com/font/Roboto/Latin/bold/normal/3ef7cf158f310cf752d5ad08cd0e7e60.woff2) format("woff2"), url(https://assets.sendinblue.com/font/Roboto/Latin/bold/normal/ece3a1d82f18b60bcce0211725c476aa.woff) format("woff")
335
- }
336
 
337
- #sib-container input:-ms-input-placeholder {
338
- text-align: left;
339
- font-family: "Helvetica", sans-serif;
340
- color: #c0ccda;
341
- border-width: px;
342
- }
343
 
344
- #sib-container input::placeholder {
345
- text-align: left;
346
- font-family: "Helvetica", sans-serif;
347
- color: #c0ccda;
348
- border-width: px;
349
- }
350
- </style>
351
- <link rel="stylesheet" href="https://assets.sendinblue.com/component/form/2ef8d8058c0694a305b0.css">
352
- <link rel="stylesheet" href="https://assets.sendinblue.com/component/clickable/b056d6397f4ba3108595.css">
353
- <link rel="stylesheet" href="https://assets.sendinblue.com/component/progress-indicator/f86d65a4a9331c5e2851.css">
354
- <link rel="stylesheet" href="https://sibforms.com/forms/end-form/build/sib-styles.css">
355
- <!-- END - We recommend to place the above code in head tag of your website html -->
 
356
 
357
- <!-- START - We recommend to place the below code where you want the form in your website html -->
358
- <div class="sib-form" style="text-align: center;">
359
- <div id="sib-form-container" class="sib-form-container">
360
- <div id="error-message" class="sib-form-message-panel" style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#661d1d; background-color:#ffeded; border-radius:3px; border-width:px; border-color:#ff4949;max-width:540px;">
361
- <div class="sib-form-message-panel__text sib-form-message-panel__text--center">
362
- <svg viewBox="0 0 512 512" class="sib-icon sib-notification__icon">
363
- <path d="M256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm-11.49 120h22.979c6.823 0 12.274 5.682 11.99 12.5l-7 168c-.268 6.428-5.556 11.5-11.99 11.5h-8.979c-6.433 0-11.722-5.073-11.99-11.5l-7-168c-.283-6.818 5.167-12.5 11.99-12.5zM256 340c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28z"
364
- />
365
- </svg>
366
- <span class="sib-form-message-panel__inner-text">
367
- <?php _e('Your subscription could not be saved. Please try again.', 'quiz-master-next'); ?>
368
- </span>
369
- </div>
370
- </div>
371
- <div></div>
372
- <div id="success-message" class="sib-form-message-panel" style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#085229; background-color:#e7faf0; border-radius:3px; border-width:px; border-color:#13ce66;max-width:540px;">
373
- <div class="sib-form-message-panel__text sib-form-message-panel__text--center">
374
- <svg viewBox="0 0 512 512" class="sib-icon sib-notification__icon">
375
- <path d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 464c-118.664 0-216-96.055-216-216 0-118.663 96.055-216 216-216 118.664 0 216 96.055 216 216 0 118.663-96.055 216-216 216zm141.63-274.961L217.15 376.071c-4.705 4.667-12.303 4.637-16.97-.068l-85.878-86.572c-4.667-4.705-4.637-12.303.068-16.97l8.52-8.451c4.705-4.667 12.303-4.637 16.97.068l68.976 69.533 163.441-162.13c4.705-4.667 12.303-4.637 16.97.068l8.451 8.52c4.668 4.705 4.637 12.303-.068 16.97z"
376
- />
377
- </svg>
378
- <span class="sib-form-message-panel__inner-text">
379
- <?php _e('Your subscription has been successful.', 'quiz-master-next'); ?>
380
- </span>
381
- </div>
382
- </div>
383
- <div></div>
384
- <div id="sib-container" class="sib-container--large sib-container--vertical" style="text-align:center; background-color:rgba(255,255,255,1); max-width:540px; border-radius:3px; border-width:1px; border-color:#C0CCD9; border-style:solid;">
385
- <form id="sib-form" method="POST" action="https://cddf18fd.sibforms.com/serve/MUIEAO9t8eOB2GOqY73EWqFatPi328RiosfYMKieZ_8IxVL2jyEazmQ9LlkDj6pYrTlvB7JBsx3su8WdK5A4l445X0P-0r0Qf82LWXLSFa3yK0YZuypiIxy8hZfBXClZMANBeEVpBkswLw0RxDt2uWrN7B7zHTFXWY0W4mftpWo3Nqen7SQW1L9DYnXrex6lyw5EfHvZ3ZwsU6Xp"
386
- data-type="subscription">
387
- <div style="padding: 16px 0;">
388
- <div class="sib-input sib-form-block">
389
- <div class="form__entry entry_block">
390
- <div class="form__label-row ">
391
- <label class="entry__label" style="font-size:16px; text-align:left; font-weight:700; font-family:Helvetica, sans-serif; color:#3c4858; border-width:px;" for="EMAIL" data-required="*">
392
- <?php _e('Enter your email address to subscribe', 'quiz-master-next'); ?>
393
- </label>
 
 
 
 
 
 
394
 
395
- <div class="entry__field">
396
- <input class="input" type="text" id="EMAIL" name="EMAIL" autocomplete="off" placeholder="EMAIL" data-required="true" required />
397
- </div>
398
- </div>
 
 
399
 
400
- <label class="entry__error entry__error--primary" style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#661d1d; background-color:#ffeded; border-radius:3px; border-width:px; border-color:#ff4949;">
401
- </label>
402
- <label class="entry__specification" style="font-size:12px; text-align:left; font-family:Helvetica, sans-serif; color:#8390A4; border-width:px;">
403
- <?php _e('Provide your email address to subscribe. For e.g abc@xyz.com', 'quiz-master-next'); ?>
404
- </label>
405
- </div>
406
- </div>
407
- </div>
408
- <div style="padding: 16px 0;">
409
- <div class="sib-form-block" style="text-align: left">
410
- <button class="sib-form-block__button sib-form-block__button-with-loader" style="font-size:16px; text-align:left; font-weight:700; font-family:Helvetica, sans-serif; color:#FFFFFF; background-color:#3E4857; border-radius:3px; border-width:0px;"
411
- form="sib-form" type="submit">
412
- <svg class="icon clickable__icon progress-indicator__icon sib-hide-loader-icon" viewBox="0 0 512 512">
413
- <path d="M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z"
414
- />
415
- </svg>
416
- <?php _e('SUBSCRIBE', 'quiz-master-next'); ?>
417
- </button>
418
- </div>
419
- </div>
420
- <div style="padding: 16px 0;">
421
- <div class="sib-form-block" style="font-size:14px; text-align:center; font-family:Helvetica, sans-serif; color:#333; background-color:transparent; border-width:px;">
422
- <div class="sib-text-form-block">
423
- <p>
424
- <a href="https://sendinblue.com" target="_blank"><?php _e('Terms & Privacy policy', 'quiz-master-next'); ?></a>
425
- </p>
426
- </div>
427
- </div>
428
- </div>
 
 
 
 
 
 
429
 
430
- <input type="text" name="email_address_check" value="" class="input--hidden">
431
- <input type="hidden" name="locale" value="en">
432
- </form>
433
- </div>
434
- </div>
435
- </div>
436
- <!-- END - We recommend to place the below code where you want the form in your website html -->
437
 
438
- <!-- START - We recommend to place the below code in footer or bottom of your website html -->
439
- <script>
440
- window.REQUIRED_CODE_ERROR_MESSAGE = 'Please choose a country code';
441
 
442
- window.EMAIL_INVALID_MESSAGE = window.SMS_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
 
443
 
444
- window.REQUIRED_ERROR_MESSAGE = "This field cannot be left blank. ";
445
 
446
- window.GENERIC_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
 
447
 
448
 
449
 
450
 
451
- window.translation = {
452
- common: {
453
- selectedList: '{quantity} list selected',
454
- selectedLists: '{quantity} lists selected'
455
- }
456
- };
457
 
458
- var AUTOHIDE = Boolean(0);
459
- </script>
460
- <script src="https://sibforms.com/forms/end-form/build/main.js">
461
- </script>
462
- <script src="https://www.google.com/recaptcha/api.js?hl=en"></script>
463
- <!-- END - We recommend to place the above code in footer or bottom of your website html -->
464
- <!-- End Sendinblue Form -->
465
- </div>
466
- </div>
467
 
468
- </div>
469
- <?php
470
  }
471
- ?>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
  }
5
 
6
  /**
10
  * @since 4.4.0
11
  */
12
  function qmn_addons_page() {
13
+ if ( ! current_user_can( 'moderate_comments' ) ) {
14
+ return;
15
+ }
16
 
17
+ global $mlwQuizMasterNext;
18
+ $active_tab = strtolower( str_replace( ' ', '-', isset( $_GET['tab'] ) ? $_GET['tab'] : __( 'Featured Addons', 'quiz-master-next' ) ) );
19
+ $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
20
+ wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
21
+ ?>
22
+ <div class="wrap qsm-addon-setting-wrap">
23
+ <h2 style="margin-bottom: 20px;">
24
+ <?php _e( 'QSM Addon Settings', 'quiz-master-next' ); ?>
25
+ <?php
26
+ if ( isset( $_GET['tab'] ) && $_GET['tab'] != '' ) {
27
+ ?>
28
+ <a class="button button-default" href="?page=qmn_addons"><span style="margin-top: 4px;"
29
+ class="dashicons dashicons-arrow-left-alt"></span>
30
+ <?php _e( 'Back to list', 'quiz-master-next' ); ?></a>
31
+ <?php
32
+ }
33
+ ?>
34
+ </h2>
35
+ <h2 class="nav-tab-wrapper" style="display: none;">
36
+ <?php
37
+ foreach ( $tab_array as $tab ) {
38
+ $active_class = '';
39
+ if ( $active_tab == $tab['slug'] ) {
40
+ $active_class = 'nav-tab-active';
41
+ }
42
+ echo "<a href=\"?page=qmn_addons&tab={$tab['slug']}\" class=\"nav-tab $active_class\">{$tab['title']}</a>";
43
+ }
44
+ ?>
45
+ </h2>
46
+ <div>
47
+ <?php
48
+ foreach ( $tab_array as $tab ) {
49
+ if ( $active_tab == $tab['slug'] ) {
50
+ call_user_func( $tab['function'] );
51
+ }
52
+ }
53
+ ?>
54
+ </div>
55
+ </div>
56
+ <?php
57
  }
58
 
59
  /**
63
  * @since 4.4.0
64
  */
65
  function qsm_generate_featured_addons() {
66
+ global $mlwQuizMasterNext;
67
+ wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
68
+ $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
69
+ ?>
70
+ <div class="qsm-addon-browse-addons">
71
+ <div class="qsm-addon-anchor-left">
72
+ <div class="qsm-install-addon">
73
+ <a class="active" href="#qsm_installed_addons"><?php _e( 'Installed Addons', 'quiz-master-next' ); ?></a>
74
+ <a href="#qsm_add_addons"><?php _e( 'Add Addons', 'quiz-master-next' ); ?> <span
75
+ class="dashicons dashicons-arrow-right-alt2"></span></a>
76
+ </div>
77
+ <div class="qsm-add-addon" style="display: none;">
78
+ <a class="active" href="#qsm_popular_addons"><?php _e( 'Popular', 'quiz-master-next' ); ?></a>
79
+ <a href="#qsm_onsale_addons"><?php _e( 'On Sale', 'quiz-master-next' ); ?></a>
80
+ <a href="#qsm_new_addons"><?php _e( 'Recently Updated', 'quiz-master-next' ); ?></a>
81
+ </div>
82
+ </div>
83
+ <div class="qsm-addon-list-right">
84
+ <span><?php _e( '40+ addons available', 'quiz-master-next' ); ?></span>
85
+ <a rel="noopener" style="text-decoration: none; font-size: 15px;"
86
+ href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
87
+ target="_blank"><?php _e( 'Browse All Addons', 'quiz-master-next' ); ?></a>
88
+ </div>
89
+ </div>
90
+ <div id="qsm_installed_addons" class="qsm-active-addons qsm-primary-acnhor">
91
+ <h2 class="installed_title"><?php _e( 'Installed Addons', 'quiz-master-next' ); ?></h2>
92
+ <?php
93
+ if ( $tab_array && count( $tab_array ) > 1 ) {
94
+ ?>
95
+ <div class="installed_addons_wrapper">
96
+ <?php
97
+ foreach ( $tab_array as $tab ) {
98
+ if ( trim( $tab['title'] ) == 'Featured Addons' ) {
99
+ continue;
100
+ }
101
+ ?>
102
+ <div class="installed_addon">
103
+ <span class="installed_addon_name"><?php echo $tab['title']; ?></span>
104
+ <span class="installed_addon_link">
105
+ <a class="button button-default" href="?page=qmn_addons&tab=<?php echo $tab['slug']; ?>"><span
106
+ class="dashicons dashicons-admin-generic"></span>
107
+ <?php _e( 'Settings', 'quiz-master-next' ); ?></a>
108
+ </span>
109
+ </div>
110
+ <?php } ?>
111
+ </div>
112
+ <?php
113
+ } else {
114
+ ?>
115
+ <div class="no_addons_installed">
116
+ <?php
117
+ _e( 'You have currently not installed any addons. Explore our addons repository with 40+ addons to make your quiz even better.', 'quiz-master-next' );
118
+ ?>
119
+ </div>
120
+ <?php
121
+ }
122
+ ?>
123
+ </div>
124
+ <div id="qsm_add_addons" class="qsm-primary-acnhor" style="display: none;">
125
+ <div class="qsm-quiz-page-addon qsm-addon-page-list">
126
+ <?php
127
+ $popular_addons = qsm_get_widget_data( 'popular_products' );
128
+ if ( empty( $popular_addons ) ) {
129
+ $qsm_admin_dd = qsm_fetch_data_from_script();
130
+ $popular_addons = isset( $qsm_admin_dd['popular_products'] ) ? $qsm_admin_dd['popular_products'] : array();
131
+ }
132
+ ?>
133
+ <div class="qsm_popular_addons" id="qsm_popular_addons">
134
+ <div class="popuar-addon-ul">
135
+ <?php
136
+ if ( $popular_addons ) {
137
+ foreach ( $popular_addons as $key => $single_arr ) {
138
+ ?>
139
+ <div>
140
+ <div class="addon-itd-wrap">
141
+ <div class="addon-image" style="background-image: url('<?php echo $single_arr['img']; ?>')">
142
+ </div>
143
+ <div class="addon-title-descption">
144
+ <a class="addon-title" href="<?php echo $single_arr['link']; ?>" target="_blank">
145
+ <?php echo $single_arr['name']; ?>
146
+ </a>
147
+ <span class="description">
148
+ <?php echo wp_trim_words( $single_arr['description'], 8 ); ?>
149
+ </span>
150
+ <?php
151
+ if ( str_word_count( $single_arr['description'] ) > 9 ) {
152
+ echo '<a class="read-more" href="' . $single_arr['link'] . '">' . __( 'Show more', 'quiz-master-next' ) . '</a>';
153
+ }
154
+ ?>
155
+ </div>
156
+ </div>
157
+ <div class="addon-price">
158
+ <button
159
+ class="button button-primary addon-price-btn"><?php _e( 'Price: ', 'quiz-master-next' ); ?>$<?php echo array_values( $single_arr['price'] )[0]; ?></button>
160
+ <a class="button button-primary addon-get-link" rel="noopener"
161
+ href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
162
+ target="_blank"><?php _e( 'Get This Addon', 'quiz-master-next' ); ?> <span
163
+ class="dashicons dashicons-arrow-right-alt2"></span></a>
164
+ </div>
165
+ </div>
166
+ <?php
167
+ }
168
+ }
169
+ ?>
170
+ </div>
171
+ </div>
172
+ <div class="qsm_popular_addons" id="qsm_onsale_addons" style="display: none;">
173
+ <?php
174
+ $qsm_onsale_addons = qsm_get_widget_data( 'on_sale_products' );
175
+ if ( empty( $qsm_onsale_addons ) ) {
176
+ $qsm_admin_dd = qsm_fetch_data_from_script();
177
+ $qsm_onsale_addons = isset( $qsm_admin_dd['on_sale_products'] ) ? $qsm_admin_dd['on_sale_products'] : array();
178
+ }
179
+ ?>
180
+ <div class="popuar-addon-ul">
181
+ <?php
182
+ if ( $qsm_onsale_addons ) {
183
+ foreach ( $qsm_onsale_addons as $key => $single_arr ) {
184
+ ?>
185
+ <div>
186
+ <div class="addon-itd-wrap">
187
+ <div class="addon-image" style="background-image: url('<?php echo $single_arr['img']; ?>')">
188
+ </div>
189
+ <div class="addon-title-descption">
190
+ <a class="addon-title" href="<?php echo $single_arr['link']; ?>" target="_blank">
191
+ <?php echo $single_arr['name']; ?>
192
+ </a>
193
+ <span class="description">
194
+ <?php echo wp_trim_words( $single_arr['description'], 8 ); ?>
195
+ </span>
196
+ <?php
197
+ if ( str_word_count( $single_arr['description'] ) > 9 ) {
198
+ echo '<a class="read-more" href="' . $single_arr['link'] . '">' . __( 'Show more', 'quiz-master-next' ) . '</a>';
199
+ }
200
+ ?>
201
+ </div>
202
+ </div>
203
+ <div class="addon-price">
204
+ <button
205
+ class="button button-primary addon-price-btn"><?php _e( 'Price: ', 'quiz-master-next' ); ?>$<?php echo array_values( $single_arr['price'] )[0]; ?></button>
206
+ <a class="button button-primary addon-get-link" rel="noopener"
207
+ href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
208
+ target="_blank"><?php _e( 'Get This Addon', 'quiz-master-next' ); ?> <span
209
+ class="dashicons dashicons-arrow-right-alt2"></span></a>
210
+ </div>
211
+ </div>
212
+ <?php
213
+ }
214
+ }
215
+ ?>
216
+ </div>
217
+ </div>
218
+ <div class="qsm_popular_addons" id="qsm_new_addons" style="display: none;">
219
+ <?php
220
+ $new_addons = qsm_get_widget_data( 'new_addons' );
221
+ if ( empty( $popular_addons ) ) {
222
+ $qsm_admin_dd = qsm_fetch_data_from_script();
223
+ $new_addons = isset( $qsm_admin_dd['new_addons'] ) ? $qsm_admin_dd['new_addons'] : array();
224
+ }
225
+ ?>
226
+ <div class="popuar-addon-ul">
227
+ <?php
228
+ if ( $new_addons ) {
229
+ foreach ( $new_addons as $key => $single_arr ) {
230
+ if ( trim( $single_arr['name'] ) == 'Starter Bundle' || trim( $single_arr['name'] ) == 'Premium Bundle' ) {
231
+ continue;
232
+ }
233
+ ?>
234
+ <div>
235
+ <div class="addon-itd-wrap">
236
+ <div class="addon-image" style="background-image: url('<?php echo $single_arr['img']; ?>')">
237
+ </div>
238
+ <div class="addon-title-descption">
239
+ <a class="addon-title" href="<?php echo $single_arr['link']; ?>" target="_blank">
240
+ <?php echo $single_arr['name']; ?>
241
+ </a>
242
+ <span class="description">
243
+ <?php echo wp_trim_words( $single_arr['description'], 8 ); ?>
244
+ </span>
245
+ <?php
246
+ if ( str_word_count( $single_arr['description'] ) > 9 ) {
247
+ echo '<a class="read-more" href="' . $single_arr['link'] . '">' . __( 'Show more', 'quiz-master-next' ) . '</a>';
248
+ }
249
+ ?>
250
+ </div>
251
+ </div>
252
+ <div class="addon-price">
253
+ <button
254
+ class="button button-primary addon-price-btn"><?php _e( 'Price: ', 'quiz-master-next' ); ?>$<?php echo array_values( $single_arr['price'] )[0]; ?></button>
255
+ <a class="button button-primary addon-get-link" rel="noopener"
256
+ href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
257
+ target="_blank"><?php _e( 'Get This Addon', 'quiz-master-next' ); ?> <span
258
+ class="dashicons dashicons-arrow-right-alt2"></span></a>
259
+ </div>
260
+ </div>
261
+ <?php
262
+ }
263
+ }
264
+ ?>
265
+ </div>
266
+ </div>
267
+ </div>
268
+ <div class="qsm-addon-news-ads">
269
+ <?php
270
+ $bundles = qsm_get_widget_data( 'bundles' );
271
+ if ( empty( $bundles ) ) {
272
+ $qsm_admin_dd = qsm_fetch_data_from_script();
273
+ $bundles = isset( $qsm_admin_dd['bundles'] ) ? $qsm_admin_dd['bundles'] : array();
274
+ }
275
+ ?>
276
+ <?php
277
+ if ( $bundles ) {
278
+ ?>
279
+ <h3 class="qsm-news-ads-title"><?php _e( 'SAVE WITH OUR BUNDLES', 'quiz-master-next' ); ?></h3>
280
+ <?php
281
+ foreach ( $bundles as $key => $bundles_arr ) {
282
+ ?>
283
+ <div class="qsm-info-widget">
284
+ <div class="bundle-icon">
285
+ <?php
286
+ echo '<img src="' . QSM_PLUGIN_URL . 'assets/' . $bundles_arr['name'] . '.png" />';
287
+ ?>
288
+ </div>
289
+ <h3><?php echo $bundles_arr['name']; ?></h3>
290
+ <p><?php echo $bundles_arr['desc']; ?></p>
291
+ <a href="<?php echo $bundles_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
292
+ target="_blank" class="button button-primary addon-bundle-btn" rel="noopener">
293
+ <?php echo _e( 'Get now', 'quiz-master-next' ); ?>
294
+ $<?php echo array_values( $bundles_arr['price'] )[0]; ?>
295
+ <span class="dashicons dashicons-arrow-right-alt2"></span>
296
+ </a>
297
+ </div>
298
+ <?php
299
+ }
300
+ }
301
+ ?>
302
+ </div>
303
+ </div>
304
+ <?php
305
  }
306
 
307
  /**
311
  * @since 4.4.0
312
  */
313
  function qsm_featured_addons_tab() {
314
+ global $mlwQuizMasterNext;
315
+ $mlwQuizMasterNext->pluginHelper->register_addon_settings_tab( __( 'Featured Addons', 'quiz-master-next' ), 'qsm_generate_featured_addons' );
316
  }
317
 
318
+ add_action( 'plugins_loaded', 'qsm_featured_addons_tab' );
319
 
320
  /**
321
  * @version 3.2.0
322
  * Display get a free addon page
323
  */
324
  function qsm_display_optin_page() {
325
+ global $mlwQuizMasterNext;
326
+ wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
327
+ wp_localize_script( 'qsm_admin_script', 'qsmAdminObject', array( 'saveNonce' => wp_create_nonce( 'ajax-nonce-sendy-save' ) ) );
328
+ ?>
329
+ <div class="wrap about-wrap">
330
 
331
+ <h1><?php esc_html_e( 'Get Your Free Addon!', 'quiz-master-next' ); ?></h1>
332
 
333
+ <div class="about-text">
334
+ <?php esc_html_e( 'Wanna get more out of Quiz and Survey Master, but not yet ready to spend the cash? Get one free addon today!', 'quiz-master-next' ); ?>
335
+ </div>
336
 
337
+ <div class="changelog">
338
 
339
+ <div class="row">
340
+ <!-- <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
341
+ <div class="about-body">
342
+ <img src="" alt="Improved Custom Fields">
343
+ </div>
344
+ </div> -->
345
+ </div>
346
 
347
+ <p><?php echo __( 'Getting your addon is dead simple: just subscribe to our newsletter and then you will get the free addon by e-mail. We will not spam you. We usually send out newsletters to talk about new features in ', 'quiz-master-next' ) . '<b>' . __( 'Quiz and Survey Master', 'quiz-master-next' ) . '</b>,' . __( ' let you know when new or updated addons are being released and provide informative articles that show you how to use ', 'quiz-master-next' ) . '<b>' . __( 'Quiz and Survey Master ', 'quiz-master-next' ) . '</b>' . __( 'to its full potential. ', 'quiz-master-next' ) . '<a href="https://quizandsurveymaster.com/privacy-policy/" target="_blank">' . __( 'View our privacy policy', 'quiz-master-next' ) . '</a>'; ?>
348
+ </p>
349
 
350
+ <div id="wpas-mailchimp-signup-form-wrapper">
351
+ <div id="status"></div>
352
+ <!-- Begin Sendinblue Form -->
353
+ <!-- START - We recommend to place the below code in head tag of your website html -->
354
+ <style>
355
+ @font-face {
356
+ font-display: block;
357
+ font-family: Roboto;
358
+ src: url(https://assets.sendinblue.com/font/Roboto/Latin/normal/normal/7529907e9eaf8ebb5220c5f9850e3811.woff2) format("woff2"), url(https://assets.sendinblue.com/font/Roboto/Latin/normal/normal/25c678feafdc175a70922a116c9be3e7.woff) format("woff")
359
+ }
360
 
361
+ @font-face {
362
+ font-display: fallback;
363
+ font-family: Roboto;
364
+ font-weight: 600;
365
+ src: url(https://assets.sendinblue.com/font/Roboto/Latin/medium/normal/6e9caeeafb1f3491be3e32744bc30440.woff2) format("woff2"), url(https://assets.sendinblue.com/font/Roboto/Latin/medium/normal/71501f0d8d5aa95960f6475d5487d4c2.woff) format("woff")
366
+ }
367
 
368
+ @font-face {
369
+ font-display: fallback;
370
+ font-family: Roboto;
371
+ font-weight: 700;
372
+ src: url(https://assets.sendinblue.com/font/Roboto/Latin/bold/normal/3ef7cf158f310cf752d5ad08cd0e7e60.woff2) format("woff2"), url(https://assets.sendinblue.com/font/Roboto/Latin/bold/normal/ece3a1d82f18b60bcce0211725c476aa.woff) format("woff")
373
+ }
374
 
375
+ #sib-container input:-ms-input-placeholder {
376
+ text-align: left;
377
+ font-family: "Helvetica", sans-serif;
378
+ color: #c0ccda;
379
+ border-width: px;
380
+ }
381
 
382
+ #sib-container input::placeholder {
383
+ text-align: left;
384
+ font-family: "Helvetica", sans-serif;
385
+ color: #c0ccda;
386
+ border-width: px;
387
+ }
388
+ </style>
389
+ <link rel="stylesheet" href="https://assets.sendinblue.com/component/form/2ef8d8058c0694a305b0.css">
390
+ <link rel="stylesheet" href="https://assets.sendinblue.com/component/clickable/b056d6397f4ba3108595.css">
391
+ <link rel="stylesheet"
392
+ href="https://assets.sendinblue.com/component/progress-indicator/f86d65a4a9331c5e2851.css">
393
+ <link rel="stylesheet" href="https://sibforms.com/forms/end-form/build/sib-styles.css">
394
+ <!-- END - We recommend to place the above code in head tag of your website html -->
395
 
396
+ <!-- START - We recommend to place the below code where you want the form in your website html -->
397
+ <div class="sib-form" style="text-align: center;">
398
+ <div id="sib-form-container" class="sib-form-container">
399
+ <div id="error-message" class="sib-form-message-panel"
400
+ style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#661d1d; background-color:#ffeded; border-radius:3px; border-width:px; border-color:#ff4949;max-width:540px;">
401
+ <div class="sib-form-message-panel__text sib-form-message-panel__text--center">
402
+ <svg viewBox="0 0 512 512" class="sib-icon sib-notification__icon">
403
+ <path
404
+ d="M256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm-11.49 120h22.979c6.823 0 12.274 5.682 11.99 12.5l-7 168c-.268 6.428-5.556 11.5-11.99 11.5h-8.979c-6.433 0-11.722-5.073-11.99-11.5l-7-168c-.283-6.818 5.167-12.5 11.99-12.5zM256 340c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28z" />
405
+ </svg>
406
+ <span class="sib-form-message-panel__inner-text">
407
+ <?php _e( 'Your subscription could not be saved. Please try again.', 'quiz-master-next' ); ?>
408
+ </span>
409
+ </div>
410
+ </div>
411
+ <div></div>
412
+ <div id="success-message" class="sib-form-message-panel"
413
+ style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#085229; background-color:#e7faf0; border-radius:3px; border-width:px; border-color:#13ce66;max-width:540px;">
414
+ <div class="sib-form-message-panel__text sib-form-message-panel__text--center">
415
+ <svg viewBox="0 0 512 512" class="sib-icon sib-notification__icon">
416
+ <path
417
+ d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 464c-118.664 0-216-96.055-216-216 0-118.663 96.055-216 216-216 118.664 0 216 96.055 216 216 0 118.663-96.055 216-216 216zm141.63-274.961L217.15 376.071c-4.705 4.667-12.303 4.637-16.97-.068l-85.878-86.572c-4.667-4.705-4.637-12.303.068-16.97l8.52-8.451c4.705-4.667 12.303-4.637 16.97.068l68.976 69.533 163.441-162.13c4.705-4.667 12.303-4.637 16.97.068l8.451 8.52c4.668 4.705 4.637 12.303-.068 16.97z" />
418
+ </svg>
419
+ <span class="sib-form-message-panel__inner-text">
420
+ <?php _e( 'Your subscription has been successful.', 'quiz-master-next' ); ?>
421
+ </span>
422
+ </div>
423
+ </div>
424
+ <div></div>
425
+ <div id="sib-container" class="sib-container--large sib-container--vertical"
426
+ style="text-align:center; background-color:rgba(255,255,255,1); max-width:540px; border-radius:3px; border-width:1px; border-color:#C0CCD9; border-style:solid;">
427
+ <form id="sib-form" method="POST"
428
+ action="https://cddf18fd.sibforms.com/serve/MUIEAO9t8eOB2GOqY73EWqFatPi328RiosfYMKieZ_8IxVL2jyEazmQ9LlkDj6pYrTlvB7JBsx3su8WdK5A4l445X0P-0r0Qf82LWXLSFa3yK0YZuypiIxy8hZfBXClZMANBeEVpBkswLw0RxDt2uWrN7B7zHTFXWY0W4mftpWo3Nqen7SQW1L9DYnXrex6lyw5EfHvZ3ZwsU6Xp"
429
+ data-type="subscription">
430
+ <div style="padding: 16px 0;">
431
+ <div class="sib-input sib-form-block">
432
+ <div class="form__entry entry_block">
433
+ <div class="form__label-row ">
434
+ <label class="entry__label"
435
+ style="font-size:16px; text-align:left; font-weight:700; font-family:Helvetica, sans-serif; color:#3c4858; border-width:px;"
436
+ for="EMAIL" data-required="*">
437
+ <?php _e( 'Enter your email address to subscribe', 'quiz-master-next' ); ?>
438
+ </label>
439
 
440
+ <div class="entry__field">
441
+ <input class="input" type="text" id="EMAIL" name="EMAIL"
442
+ autocomplete="off" placeholder="EMAIL" data-required="true"
443
+ required />
444
+ </div>
445
+ </div>
446
 
447
+ <label class="entry__error entry__error--primary"
448
+ style="font-size:16px; text-align:left; font-family:Helvetica, sans-serif; color:#661d1d; background-color:#ffeded; border-radius:3px; border-width:px; border-color:#ff4949;">
449
+ </label>
450
+ <label class="entry__specification"
451
+ style="font-size:12px; text-align:left; font-family:Helvetica, sans-serif; color:#8390A4; border-width:px;">
452
+ <?php _e( 'Provide your email address to subscribe. For e.g abc@xyz.com', 'quiz-master-next' ); ?>
453
+ </label>
454
+ </div>
455
+ </div>
456
+ </div>
457
+ <div style="padding: 16px 0;">
458
+ <div class="sib-form-block" style="text-align: left">
459
+ <button class="sib-form-block__button sib-form-block__button-with-loader"
460
+ style="font-size:16px; text-align:left; font-weight:700; font-family:Helvetica, sans-serif; color:#FFFFFF; background-color:#3E4857; border-radius:3px; border-width:0px;"
461
+ form="sib-form" type="submit">
462
+ <svg class="icon clickable__icon progress-indicator__icon sib-hide-loader-icon"
463
+ viewBox="0 0 512 512">
464
+ <path
465
+ d="M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z" />
466
+ </svg>
467
+ <?php _e( 'SUBSCRIBE', 'quiz-master-next' ); ?>
468
+ </button>
469
+ </div>
470
+ </div>
471
+ <div style="padding: 16px 0;">
472
+ <div class="sib-form-block"
473
+ style="font-size:14px; text-align:center; font-family:Helvetica, sans-serif; color:#333; background-color:transparent; border-width:px;">
474
+ <div class="sib-text-form-block">
475
+ <p>
476
+ <a href="https://sendinblue.com" rel="noopener"
477
+ target="_blank"><?php _e( 'Terms & Privacy policy', 'quiz-master-next' ); ?></a>
478
+ </p>
479
+ </div>
480
+ </div>
481
+ </div>
482
 
483
+ <input type="text" name="email_address_check" value="" class="input--hidden">
484
+ <input type="hidden" name="locale" value="en">
485
+ </form>
486
+ </div>
487
+ </div>
488
+ </div>
489
+ <!-- END - We recommend to place the below code where you want the form in your website html -->
490
 
491
+ <!-- START - We recommend to place the below code in footer or bottom of your website html -->
492
+ <script>
493
+ window.REQUIRED_CODE_ERROR_MESSAGE = 'Please choose a country code';
494
 
495
+ window.EMAIL_INVALID_MESSAGE = window.SMS_INVALID_MESSAGE =
496
+ "The information provided is invalid. Please review the field format and try again.";
497
 
498
+ window.REQUIRED_ERROR_MESSAGE = "This field cannot be left blank. ";
499
 
500
+ window.GENERIC_INVALID_MESSAGE =
501
+ "The information provided is invalid. Please review the field format and try again.";
502
 
503
 
504
 
505
 
506
+ window.translation = {
507
+ common: {
508
+ selectedList: '{quantity} list selected',
509
+ selectedLists: '{quantity} lists selected'
510
+ }
511
+ };
512
 
513
+ var AUTOHIDE = Boolean(0);
514
+ </script>
515
+ <script src="https://sibforms.com/forms/end-form/build/main.js">
516
+ </script>
517
+ <script src="https://www.google.com/recaptcha/api.js?hl=en"></script>
518
+ <!-- END - We recommend to place the above code in footer or bottom of your website html -->
519
+ <!-- End Sendinblue Form -->
520
+ </div>
521
+ </div>
522
 
523
+ </div>
524
+ <?php
525
  }
526
+ ?>
php/admin/admin-dashboard.php CHANGED
@@ -4,23 +4,23 @@
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 );
22
- }
23
- return array();
24
  }
25
  /**
26
  * @since 7.0
@@ -55,32 +55,32 @@ function qsm_dashboard_screen_options( $status, $args ) {
55
  $page_id = $screen->id;
56
  $user = wp_get_current_user();
57
  ?>
58
- <form id="adv-settings" method="post">
59
- <fieldset class="metabox-prefs">
60
- <legend>Boxes</legend>
61
- <?php
62
  $hidden_box = get_user_option( "metaboxhidden_$page_id", $user->ID );
63
  $hidden_box_arr = ! empty( $hidden_box ) ? $hidden_box : array();
64
  $registered_widget = get_option( 'qsm_dashboard_widget_arr', array() );
65
- $registered_widget['welcome_panel'] = array(
66
- 'title' => __('Welcome', 'quiz-master-next')
67
- );
68
- if ( $registered_widget ) {
69
- foreach ( $registered_widget as $key => $value ) {
70
- ?>
71
- <label for="<?php echo $key; ?>-hide"><input class="hide-postbox-tog" name="<?php echo $key; ?>-hide" type="checkbox" id="<?php echo $key; ?>-hide" value="<?php echo $key; ?>"
72
- <?php
73
  if ( ! in_array( $key, $hidden_box_arr ) ) {
74
- ?>
75
- checked="checked"<?php } ?>><?php echo $value['title']; ?></label>
76
- <?php
77
- }
78
- }
79
- ?>
80
- </fieldset>
81
- <?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ); ?>
82
- </form>
83
  <?php
 
 
 
 
 
 
 
 
84
  return ob_get_clean();
85
  }
86
  return $status;
@@ -106,45 +106,72 @@ function qsm_generate_dashboard_page() {
106
  wp_enqueue_script( 'jquery-touch-punch' );
107
  }
108
  ?>
109
- <div class="wrap">
110
- <h1><?php _e( 'QSM Dashboard', 'quiz-master-next' ); ?></h1>
111
- <div id="welcome_panel" class="postbox welcome-panel <?php qsm_check_close_hidden_box( 'welcome_panel' ); ?>">
112
- <div class="qsm-welcome-panel-close">
113
- <img src="<?php echo QSM_PLUGIN_URL . '/assets/icon-128x128.png'; ?>">
114
- <p class="current_version"><?php echo $mlwQuizMasterNext->version; ?></p>
115
- </div>
116
- <a class="qsm-welcome-panel-dismiss" href="#" aria-label="Dismiss the welcome panel"><?php _e( 'Dismiss', 'quiz-master-next' ); ?></a>
117
- <div class="welcome-panel-content">
118
- <h2><?php _e( 'Welcome to Quiz And Survey Master!', 'quiz-master-next' ); ?></h2>
119
- <p class="about-description"><?php _e( 'Formerly Quiz Master Next', 'quiz-master-next' ); ?></p>
120
- <div class="welcome-panel-column-container">
121
- <div class="welcome-panel-column">
122
- <h3><?php _e( 'Get Started', 'quiz-master-next' ); ?></h3>
123
- <a class="button button-primary button-hero load-quiz-wizard hide-if-no-customize" href="#"><?php _e( 'Create New Quiz/Survey', 'quiz-master-next' ); ?></a>
124
- <p class="hide-if-no-customize">
125
- or, <a href="admin.php?page=mlw_quiz_list"><?php _e( 'Edit previously created quizzes', 'quiz-master-next' ); ?></a>
126
- </p>
127
- </div>
128
- <div class="welcome-panel-column">
129
- <h3><?php _e( 'Next Steps', 'quiz-master-next' ); ?></h3>
130
- <ul>
131
- <li><a target="_blank" href="https://quizandsurveymaster.com/docs/" class="welcome-icon"><span class="dashicons dashicons-media-document"></span>&nbsp;&nbsp;<?php _e( 'Read Documentation', 'quiz-master-next' ); ?></a></li>
132
- <li><a target="_blank" href="https://demo.quizandsurveymaster.com/" class="welcome-icon"><span class="dashicons dashicons-format-video"></span>&nbsp;&nbsp;<?php _e( 'See demos', 'quiz-master-next' ); ?></a></li>
133
- <li><a target="_blank" href="https://quizandsurveymaster.com/addons/" class="welcome-icon"><span class="dashicons dashicons-plugins-checked"></span>&nbsp;&nbsp;<?php _e( 'Extend QSM with PRO Addons', 'quiz-master-next' ); ?></a></li>
134
- </ul>
135
- </div>
136
- <div class="welcome-panel-column welcome-panel-last">
137
- <h3><?php _e( 'Useful Links', 'quiz-master-next' ); ?></h3>
138
- <ul>
139
- <li><a target="_blank" href="https://quizandsurveymaster.com/contact-support/" class="welcome-icon"><span class="dashicons dashicons-admin-users"></span>&nbsp;&nbsp;<?php _e( 'Contact Support', 'quiz-master-next' ); ?></a></li>
140
- <li><a target="_blank" href="https://github.com/QuizandSurveyMaster/quiz_master_next" class="welcome-icon"><span class="dashicons dashicons-editor-code"></span>&nbsp;&nbsp;<?php _e( 'Github Repository', 'quiz-master-next' ); ?></a></li>
141
- </ul>
142
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  </div>
144
  </div>
145
- <?php do_action( 'qsm_welcome_panel' ); ?>
146
  </div>
147
- <?php
 
 
148
  $qsm_dashboard_widget = array(
149
  'dashboard_popular_addon' => array(
150
  'sidebar' => 'normal',
@@ -176,66 +203,66 @@ function qsm_generate_dashboard_page() {
176
  $user = wp_get_current_user();
177
  $box_positions = get_user_option( "meta-box-order_$page_id", $user->ID );
178
  ?>
179
- <div id="dashboard-widgets-wrap">
180
- <div id="dashboard-widgets" class="metabox-holder">
181
- <div id="postbox-container-1" class="postbox-container">
182
- <div id="normal-sortables" class="meta-box-sortables ui-sortable">
183
- <?php
184
  $normal_widgets = $side_widgets = array();
185
- if ( $box_positions && is_array( $box_positions ) && isset( $box_positions['normal'] ) && $box_positions['normal'] != '' ) {
186
- $normal_widgets = explode( ',', $box_positions['normal'] );
187
- foreach ( $normal_widgets as $value ) {
188
- if ( isset( $qsm_dashboard_widget[ $value ] ) ) {
189
- call_user_func( $qsm_dashboard_widget[ $value ]['callback'], $value );
190
- }
191
  }
192
  }
193
- if ( $box_positions && is_array( $box_positions ) && isset( $box_positions['side'] ) && $box_positions['side'] != '' ) {
194
- $side_widgets = explode( ',', $box_positions['side'] );
195
- }
 
196
  $all_widgets = array_merge( $normal_widgets, $side_widgets );
197
- if ( $qsm_dashboard_widget ) {
198
- foreach ( $qsm_dashboard_widget as $widgte_id => $normal_widget ) {
199
- if ( ! in_array( $widgte_id, $all_widgets ) && $normal_widget['sidebar'] == 'normal' ) {
200
- call_user_func( $normal_widget['callback'], $widgte_id );
201
- }
202
  }
203
  }
204
- ?>
205
- </div>
206
  </div>
207
- <div id="postbox-container-2" class="postbox-container">
208
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
209
- <?php
 
210
  $normal_widgets = array();
211
- if ( $box_positions && is_array( $box_positions ) && isset( $box_positions['side'] ) && $box_positions['side'] != '' ) {
212
- $normal_widgets = explode( ',', $box_positions['side'] );
213
- foreach ( $normal_widgets as $value ) {
214
- if ( isset( $qsm_dashboard_widget[ $value ] ) ) {
215
- call_user_func( $qsm_dashboard_widget[ $value ]['callback'], $value );
216
- }
217
  }
218
  }
219
- if ( $qsm_dashboard_widget ) {
220
- foreach ( $qsm_dashboard_widget as $widgte_id => $normal_widget ) {
221
- if ( ! in_array( $widgte_id, $all_widgets ) && $normal_widget['sidebar'] == 'side' ) {
222
- call_user_func( $normal_widget['callback'], $widgte_id );
223
- }
224
  }
225
  }
226
- ?>
227
- </div>
228
  </div>
229
  </div>
230
- <?php
 
231
  wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
232
  wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
233
- ?>
234
- </div><!-- dashboard-widgets-wrap -->
235
- </div>
236
- <!-- Popup for new wizard -->
237
- <?php echo qsm_create_new_quiz_wizard(); ?>
238
- <?php
239
  }
240
 
241
  /**
@@ -293,38 +320,42 @@ add_action( 'wp_ajax_qsm_wizard_template_quiz_options', 'qsm_wizard_template_qui
293
  * Generate popular addon
294
  */
295
  function qsm_dashboard_popular_addon( $widget_id ) {
296
- $addon_array = qsm_get_widget_data('products');
297
  ?>
298
- <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
299
- <button type="button" class="handlediv" aria-expanded="true">
300
- <span class="screen-reader-text">Toggle panel: <?php _e( 'Most Popular Addon this Week', 'quiz-master-next' ); ?></span>
301
- <span class="toggle-indicator" aria-hidden="true"></span>
302
- </button>
303
- <h2 class="hndle ui-sortable-handle"><span><?php _e( 'Most Popular Addon this Week', 'quiz-master-next' ); ?></span></h2>
304
- <div class="inside">
305
- <div class="main">
306
- <ul class="popuar-addon-ul">
307
- <?php
308
- if ( $addon_array ) {
309
- foreach ( $addon_array as $key => $single_arr ) {
310
- ?>
311
- <li>
312
- <a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-dashoard-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank">
313
- <img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
314
- </a>
315
- </li>
316
- <?php
317
- }
 
 
318
  }
319
- ?>
320
- </ul>
321
- <div class="pa-all-addon">
322
- <a href="https://quizandsurveymaster.com/addons/" target="_blank"><?php _e( 'SEE ALL ADDONS', 'quiz-master-next' ); ?></a>
323
- </div>
 
324
  </div>
325
  </div>
326
  </div>
327
- <?php
 
328
  }
329
 
330
  /**
@@ -336,109 +367,114 @@ function qsm_dashboard_popular_addon( $widget_id ) {
336
  function qsm_dashboard_recent_taken_quiz( $widget_id ) {
337
  global $wpdb;
338
  ?>
339
- <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
340
- <button type="button" class="handlediv" aria-expanded="true">
341
- <span class="screen-reader-text">Toggle panel: <?php _e( 'Recently Taken Quizzes', 'quiz-master-next' ); ?></span>
342
- <span class="toggle-indicator" aria-hidden="true"></span>
343
- </button>
344
- <h2 class="hndle ui-sortable-handle"><span><?php _e( 'Recently Taken Quizzes', 'quiz-master-next' ); ?></span></h2>
345
- <div class="inside">
346
- <div class="main">
347
- <ul class="recently-taken-quiz-ul">
348
- <?php
 
349
  $mlw_result_data = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE deleted=0 ORDER BY result_id DESC LIMIT 2", ARRAY_A );
350
- if ( $mlw_result_data ) {
351
- foreach ( $mlw_result_data as $key => $single_result_arr ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  ?>
353
- <li>
354
- <?php
355
- if ( isset( $single_result_arr['user'] ) && $single_result_arr['user'] != '' ) {
356
- echo '<img src="' . get_avatar_url( $single_result_arr['user'] ) . '" class="avatar avatar-50 photo">';
357
- } else {
358
- echo '<img src="' . QSM_PLUGIN_URL . '/assets/default_image.png" class="avatar avatar-50 photo">';
 
 
 
 
359
  }
360
- ?>
361
- <div class="rtq-main-wrapper">
362
- <span class="rtq_user_info">
363
- <?php
364
- if ( isset( $single_result_arr['user'] ) && $single_result_arr['user'] != 0 ) {
365
- $edit_link = get_edit_profile_url( $single_result_arr['user'] );
366
- $actual_user = get_userdata( $single_result_arr['user'] );
367
- $user_name = $single_result_arr['name'] == 'None' ? $actual_user->data->display_name : $single_result_arr['name'];
368
- echo '<a href="' . $edit_link . '">' . $user_name . '</a>';
369
- } else {
370
- echo __('Guest', 'quiz-master-next');
371
- }
372
- _e( ' took quiz ', 'quiz-master-next' );
373
- echo '<a href="admin.php?page=mlw_quiz_options&quiz_id=' . $single_result_arr['quiz_id'] . '">' . $single_result_arr['quiz_name'] . '</a>';
374
- ?>
375
- </span>
376
- <span class="rtq-result-info">
377
- <?php
378
- $quotes_list = '';
379
- $form_type = isset( $single_result_arr['form_type'] ) ? $single_result_arr['form_type'] : 0;
380
- if( $form_type == 1 || $form_type == 2 ){
381
- $quotes_list .= __( 'Not Graded', 'quiz-master-next' );
382
- }else{
383
- if ( $single_result_arr['quiz_system'] == 0 ) {
384
- $quotes_list .= $single_result_arr['correct'] . ' out of ' . $single_result_arr['total'] . ' or ' . $single_result_arr['correct_score'] . '%';
385
- }
386
- if ( $single_result_arr['quiz_system'] == 1 ) {
387
- $quotes_list .= $single_result_arr['point_score'] . ' Points';
388
- }
389
- if ( $single_result_arr['quiz_system'] == 3 ) {
390
- $quotes_list .= $single_result_arr['correct'] . ' out of ' . $single_result_arr['total'] . ' or ' . $single_result_arr['correct_score'] . '%<br/>';
391
- $quotes_list .= $single_result_arr['point_score'] . ' Points';
392
- }
393
- }
394
- echo $quotes_list;
395
- ?>
396
- |
397
- <?php
398
- $mlw_complete_time = '';
399
- $mlw_qmn_results_array = @unserialize( $single_result_arr['quiz_results'] );
400
- if ( is_array( $mlw_qmn_results_array ) ) {
401
- $mlw_complete_hours = floor( $mlw_qmn_results_array[0] / 3600 );
402
- if ( $mlw_complete_hours > 0 ) {
403
- $mlw_complete_time .= "$mlw_complete_hours hours ";
404
- }
405
- $mlw_complete_minutes = floor( ( $mlw_qmn_results_array[0] % 3600 ) / 60 );
406
- if ( $mlw_complete_minutes > 0 ) {
407
- $mlw_complete_time .= "$mlw_complete_minutes minutes ";
408
- }
409
- $mlw_complete_seconds = $mlw_qmn_results_array[0] % 60;
410
- $mlw_complete_time .= "$mlw_complete_seconds seconds";
411
- }
412
- _e( ' Time to complete ', 'quiz-master-next' );
413
- echo $mlw_complete_time;
414
- ?>
415
- </span>
416
- <span class="rtq-time-taken"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $single_result_arr['time_taken'] ) ); ?></span>
417
- <p class="row-actions-c">
418
- <a href="admin.php?page=qsm_quiz_result_details&result_id=<?php echo $single_result_arr['result_id']; ?>">View</a> | <a href="#" data-result_id="<?php echo $single_result_arr['result_id']; ?>" class="trash rtq-delete-result">Delete</a>
419
- </p>
420
- </div>
421
- </li>
422
  <?php
423
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  }
425
- ?>
426
- </ul>
427
- <p>
428
- <a href="admin.php?page=mlw_quiz_results">
429
- <?php
 
430
  $mlw_result_data = $wpdb->get_row( "SELECT DISTINCT COUNT(result_id) as total_result FROM {$wpdb->prefix}mlw_results WHERE deleted=0", ARRAY_A );
431
  echo isset( $mlw_result_data['total_result'] ) ? __( 'See All Results ', 'quiz-master-next' ) : '';
432
- ?>
433
- </a>
434
- <?php
435
- echo isset( $mlw_result_data['total_result'] ) ? '(' . $mlw_result_data['total_result'] . ')' : '';
436
  ?>
437
- </p>
438
- </div>
 
 
 
439
  </div>
440
  </div>
441
- <?php
 
442
  }
443
 
444
  /**
@@ -448,37 +484,37 @@ function qsm_dashboard_recent_taken_quiz( $widget_id ) {
448
  */
449
  function qsm_dashboard_what_new( $widget_id ) {
450
  ?>
451
- <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
452
- <button type="button" class="handlediv" aria-expanded="true">
453
- <span class="screen-reader-text">Toggle panel: <?php _e( "'what's New", 'quiz-master-next' ); ?></span>
454
- <span class="toggle-indicator" aria-hidden="true"></span>
455
- </button>
456
- <h2 class="hndle ui-sortable-handle"><span><?php _e( "What's New", 'quiz-master-next' ); ?></span></h2>
457
- <div class="inside">
458
- <div class="main">
459
- <ul class="what-new-ul">
460
- <?php
461
- $feed_posts_array = qsm_get_widget_data('blog_post');
462
- if ( ! empty( $feed_posts_array ) ) {
463
- foreach ( $feed_posts_array as $key => $single_feed_arr ) {
464
- ?>
465
- <li>
466
- <a href="<?php echo $single_feed_arr['link']; ?>" target="_blank">
467
- <?php echo $single_feed_arr['title']; ?>
468
- </a>
469
- <div class="post-description">
470
- <?php echo $single_feed_arr['excerpt']; ?>
471
- </div>
472
- </li>
473
- <?php
474
- }
475
  }
476
- ?>
477
- </ul>
478
- </div>
479
  </div>
480
  </div>
481
- <?php
 
482
  }
483
 
484
  /**
@@ -487,50 +523,59 @@ function qsm_dashboard_what_new( $widget_id ) {
487
  * Generate change log
488
  */
489
  function qsm_dashboard_chagelog( $widget_id ) {
490
- $change_log = qsm_get_widget_data('change_log');
491
- global $mlwQuizMasterNext;
492
  ?>
493
- <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
494
- <button type="button" class="handlediv" aria-expanded="true">
495
- <span class="screen-reader-text">Toggle panel: <?php _e( 'Changelog', 'quiz-master-next' ); ?></span>
496
- <span class="toggle-indicator" aria-hidden="true"></span>
497
- </button>
498
- <h2 class="hndle ui-sortable-handle"><span><?php _e( 'Changelog ' . '( ' . $mlwQuizMasterNext->version .' )', 'quiz-master-next' ); ?></span></h2>
499
- <div class="inside">
500
- <div class="main">
501
- <?php if($change_log){
502
- $change_log_count = count( $change_log );
503
- ?>
504
- <ul class="changelog-ul">
505
- <?php
506
- $i = 0;
507
- foreach ($change_log as $single_change_log) {
508
- if( $single_change_log != ''){
509
- if( $i == 5 )
510
- break;
511
-
512
- $expload_str = explode(':', $single_change_log);
513
- $cl_type = $expload_str[0];
514
- $cl_str = $expload_str[1];
515
- ?>
516
- <li><span class="<?php echo trim(strtolower($cl_type)); ?>"><?php echo trim( $cl_type ); ?></span> <?php echo $cl_str; ?></li>
517
- <?php
518
- $i++;
519
- }
520
- }
521
- ?>
522
- </ul>
523
- <?php if( $change_log_count > 5 ){ ?>
524
- <div class="pa-all-addon" style="border-top: 1px solid #ede8e8;padding-top: 15px;">
525
- <a href="https://wordpress.org/plugins/quiz-master-next/#developers" target="_blank"><?php _e('View Complete Changelog', 'quiz-master-next'); ?></a>
526
- </div>
527
- <?php
528
- }
529
- } ?>
 
 
 
 
530
  </div>
 
 
 
 
531
  </div>
532
  </div>
533
- <?php
 
534
  }
535
 
536
  /**
@@ -542,12 +587,14 @@ function qsm_create_new_quiz_from_wizard() {
542
  if ( isset( $_POST['qsm_new_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_new_quiz_nonce'], 'qsm_new_quiz' ) ) {
543
  global $mlwQuizMasterNext;
544
  $quiz_name = sanitize_text_field( htmlspecialchars( stripslashes( $_POST['quiz_name'] ), ENT_QUOTES ) );
 
545
  unset( $_POST['qsm_new_quiz_nonce'] );
546
  unset( $_POST['_wp_http_referer'] );
 
547
  $setting_arr = array(
548
  'quiz_options' => serialize( $_POST ),
549
  );
550
- $mlwQuizMasterNext->quizCreator->create_quiz( $quiz_name, serialize( $setting_arr ) );
551
  }
552
  }
553
  add_action( 'admin_init', 'qsm_create_new_quiz_from_wizard' );
@@ -556,17 +603,17 @@ add_action( 'admin_init', 'qsm_create_new_quiz_from_wizard' );
556
  /**
557
  * @since 7.0
558
  * @param Object $upgrader_object
559
- * @param Array $options
560
  * Reset the transient on QSM plugin update
561
  */
562
  function qsm_reset_transient_dashboard( $upgrader_object, $options ) {
563
- $current_plugin_path_name = QSM_PLUGIN_BASENAME;
564
- if ($options['action'] == 'update' && $options['type'] == 'plugin' ){
565
- foreach($options['plugins'] as $each_plugin) {
566
- if ( $each_plugin == $current_plugin_path_name ){
567
- delete_transient( 'qsm_admin_dashboard_data' );
568
- }
569
- }
570
- }
571
  }
572
  add_action( 'upgrader_process_complete', 'qsm_reset_transient_dashboard', 10, 2 );
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?v=1', $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 );
22
+ }
23
+ return array();
24
  }
25
  /**
26
  * @since 7.0
55
  $page_id = $screen->id;
56
  $user = wp_get_current_user();
57
  ?>
58
+ <form id="adv-settings" method="post">
59
+ <fieldset class="metabox-prefs">
60
+ <legend>Boxes</legend>
61
+ <?php
62
  $hidden_box = get_user_option( "metaboxhidden_$page_id", $user->ID );
63
  $hidden_box_arr = ! empty( $hidden_box ) ? $hidden_box : array();
64
  $registered_widget = get_option( 'qsm_dashboard_widget_arr', array() );
65
+ $registered_widget['welcome_panel'] = array(
66
+ 'title' => __( 'Welcome', 'quiz-master-next' ),
67
+ );
68
+ if ( $registered_widget ) {
69
+ foreach ( $registered_widget as $key => $value ) {
70
+ ?>
71
+ <label for="<?php echo $key; ?>-hide"><input class="hide-postbox-tog" name="<?php echo $key; ?>-hide"
72
+ type="checkbox" id="<?php echo $key; ?>-hide" value="<?php echo $key; ?>" <?php
73
  if ( ! in_array( $key, $hidden_box_arr ) ) {
74
+ ?> checked="checked" <?php } ?>><?php echo $value['title']; ?></label>
 
 
 
 
 
 
 
 
75
  <?php
76
+
77
+ }
78
+ }
79
+ ?>
80
+ </fieldset>
81
+ <?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ); ?>
82
+ </form>
83
+ <?php
84
  return ob_get_clean();
85
  }
86
  return $status;
106
  wp_enqueue_script( 'jquery-touch-punch' );
107
  }
108
  ?>
109
+ <div class="wrap">
110
+ <h1><?php _e( 'QSM Dashboard', 'quiz-master-next' ); ?></h1>
111
+ <div id="welcome_panel" class="postbox welcome-panel <?php qsm_check_close_hidden_box( 'welcome_panel' ); ?>">
112
+ <div class="qsm-welcome-panel-close">
113
+ <img src="<?php echo QSM_PLUGIN_URL . '/assets/icon-128x128.png'; ?>">
114
+ <p class="current_version"><?php echo $mlwQuizMasterNext->version; ?></p>
115
+ </div>
116
+ <a class="qsm-welcome-panel-dismiss" href="#"
117
+ aria-label="Dismiss the welcome panel"><?php _e( 'Dismiss', 'quiz-master-next' ); ?></a>
118
+ <div class="welcome-panel-content">
119
+ <h2><?php _e( 'Welcome to Quiz And Survey Master!', 'quiz-master-next' ); ?></h2>
120
+ <p class="about-description"><?php _e( 'Formerly Quiz Master Next', 'quiz-master-next' ); ?></p>
121
+ <div class="welcome-panel-column-container">
122
+ <div class="welcome-panel-column">
123
+ <h3><?php _e( 'Get Started', 'quiz-master-next' ); ?></h3>
124
+ <a class="button button-primary button-hero load-quiz-wizard hide-if-no-customize"
125
+ href="#"><?php _e( 'Create New Quiz/Survey', 'quiz-master-next' ); ?></a>
126
+ <p class="hide-if-no-customize">
127
+ or, <a
128
+ href="admin.php?page=mlw_quiz_list"><?php _e( 'Edit previously created quizzes', 'quiz-master-next' ); ?></a>
129
+ </p>
130
+ </div>
131
+ <div class="welcome-panel-column">
132
+ <h3><?php _e( 'Next Steps', 'quiz-master-next' ); ?></h3>
133
+ <ul>
134
+ <li><a target="_blank" rel="noopener" href="https://quizandsurveymaster.com/docs/"
135
+ class="welcome-icon"><span
136
+ class="dashicons dashicons-media-document"></span>&nbsp;&nbsp;<?php _e( 'Read Documentation', 'quiz-master-next' ); ?></a>
137
+ </li>
138
+ <li><a target="_blank" rel="noopener" href="https://demo.quizandsurveymaster.com/"
139
+ class="welcome-icon"><span
140
+ class="dashicons dashicons-format-video"></span>&nbsp;&nbsp;<?php _e( 'See demos', 'quiz-master-next' ); ?></a>
141
+ </li>
142
+ <li><a target="_blank" rel="noopener" href="https://quizandsurveymaster.com/pricing/"
143
+ class="welcome-icon"><span
144
+ class="dashicons dashicons-plugins-checked"></span>&nbsp;&nbsp;<?php _e( 'Extend QSM with PRO Addons', 'quiz-master-next' ); ?></a>
145
+ </li>
146
+ <li><a target="_blank" rel="noopener" href="https://themes.quizandsurveymaster.com/"
147
+ class="welcome-icon"><span
148
+ class="dashicons dashicons-admin-appearance"></span>&nbsp;&nbsp;<?php _e( 'Beautify QSM with Themes', 'quiz-master-next' ); ?></a>
149
+ </li>
150
+ </ul>
151
+ </div>
152
+ <div class="welcome-panel-column welcome-panel-last">
153
+ <h3><?php _e( 'Useful Links', 'quiz-master-next' ); ?></h3>
154
+ <ul>
155
+ <li><a target="_blank" rel="noopener" href="https://quizandsurveymaster.com/contact-support/"
156
+ class="welcome-icon"><span
157
+ class="dashicons dashicons-admin-users"></span>&nbsp;&nbsp;<?php _e( 'Contact Support', 'quiz-master-next' ); ?></a>
158
+ </li>
159
+ <li><a target="_blank" rel="noopener"
160
+ href="https://github.com/QuizandSurveyMaster/quiz_master_next"
161
+ class="welcome-icon"><span
162
+ class="dashicons dashicons-editor-code"></span>&nbsp;&nbsp;<?php _e( 'Github Repository', 'quiz-master-next' ); ?></a>
163
+ </li>
164
+ <li><a target="_blank" rel="noopener" href="https://www.facebook.com/groups/516958552587745"
165
+ class="welcome-icon"><span
166
+ class="dashicons dashicons-facebook"></span>&nbsp;&nbsp;<?php _e( 'Connect on Facebook', 'quiz-master-next' ); ?></a>
167
+ </li>
168
+ </ul>
169
  </div>
170
  </div>
 
171
  </div>
172
+ <?php do_action( 'qsm_welcome_panel' ); ?>
173
+ </div>
174
+ <?php
175
  $qsm_dashboard_widget = array(
176
  'dashboard_popular_addon' => array(
177
  'sidebar' => 'normal',
203
  $user = wp_get_current_user();
204
  $box_positions = get_user_option( "meta-box-order_$page_id", $user->ID );
205
  ?>
206
+ <div id="dashboard-widgets-wrap">
207
+ <div id="dashboard-widgets" class="metabox-holder">
208
+ <div id="postbox-container-1" class="postbox-container">
209
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
210
+ <?php
211
  $normal_widgets = $side_widgets = array();
212
+ if ( $box_positions && is_array( $box_positions ) && isset( $box_positions['normal'] ) && $box_positions['normal'] != '' ) {
213
+ $normal_widgets = explode( ',', $box_positions['normal'] );
214
+ foreach ( $normal_widgets as $value ) {
215
+ if ( isset( $qsm_dashboard_widget[ $value ] ) ) {
216
+ call_user_func( $qsm_dashboard_widget[ $value ]['callback'], $value );
 
217
  }
218
  }
219
+ }
220
+ if ( $box_positions && is_array( $box_positions ) && isset( $box_positions['side'] ) && $box_positions['side'] != '' ) {
221
+ $side_widgets = explode( ',', $box_positions['side'] );
222
+ }
223
  $all_widgets = array_merge( $normal_widgets, $side_widgets );
224
+ if ( $qsm_dashboard_widget ) {
225
+ foreach ( $qsm_dashboard_widget as $widgte_id => $normal_widget ) {
226
+ if ( ! in_array( $widgte_id, $all_widgets ) && $normal_widget['sidebar'] == 'normal' ) {
227
+ call_user_func( $normal_widget['callback'], $widgte_id );
 
228
  }
229
  }
230
+ }
231
+ ?>
232
  </div>
233
+ </div>
234
+ <div id="postbox-container-2" class="postbox-container">
235
+ <div id="side-sortables" class="meta-box-sortables ui-sortable">
236
+ <?php
237
  $normal_widgets = array();
238
+ if ( $box_positions && is_array( $box_positions ) && isset( $box_positions['side'] ) && $box_positions['side'] != '' ) {
239
+ $normal_widgets = explode( ',', $box_positions['side'] );
240
+ foreach ( $normal_widgets as $value ) {
241
+ if ( isset( $qsm_dashboard_widget[ $value ] ) ) {
242
+ call_user_func( $qsm_dashboard_widget[ $value ]['callback'], $value );
 
243
  }
244
  }
245
+ }
246
+ if ( $qsm_dashboard_widget ) {
247
+ foreach ( $qsm_dashboard_widget as $widgte_id => $normal_widget ) {
248
+ if ( ! in_array( $widgte_id, $all_widgets ) && $normal_widget['sidebar'] == 'side' ) {
249
+ call_user_func( $normal_widget['callback'], $widgte_id );
250
  }
251
  }
252
+ }
253
+ ?>
254
  </div>
255
  </div>
256
+ </div>
257
+ <?php
258
  wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
259
  wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
260
+ ?>
261
+ </div><!-- dashboard-widgets-wrap -->
262
+ </div>
263
+ <!-- Popup for new wizard -->
264
+ <?php echo qsm_create_new_quiz_wizard(); ?>
265
+ <?php
266
  }
267
 
268
  /**
320
  * Generate popular addon
321
  */
322
  function qsm_dashboard_popular_addon( $widget_id ) {
323
+ $addon_array = qsm_get_widget_data( 'products' );
324
  ?>
325
+ <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
326
+ <button type="button" class="handlediv" aria-expanded="true">
327
+ <span class="screen-reader-text">Toggle panel:
328
+ <?php _e( 'Most Popular Addon this Week', 'quiz-master-next' ); ?></span>
329
+ <span class="toggle-indicator" aria-hidden="true"></span>
330
+ </button>
331
+ <h2 class="hndle ui-sortable-handle"><span><?php _e( 'Most Popular Addon this Week', 'quiz-master-next' ); ?></span>
332
+ </h2>
333
+ <div class="inside">
334
+ <div class="main">
335
+ <ul class="popuar-addon-ul">
336
+ <?php
337
+ if ( $addon_array ) {
338
+ foreach ( $addon_array as $key => $single_arr ) {
339
+ ?>
340
+ <li>
341
+ <a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-dashoard-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
342
+ target="_blank" rel="noopener">
343
+ <img src="<?php echo $single_arr['img']; ?>" title="<?php echo $single_arr['name']; ?>">
344
+ </a>
345
+ </li>
346
+ <?php
347
  }
348
+ }
349
+ ?>
350
+ </ul>
351
+ <div class="pa-all-addon">
352
+ <a href="https://quizandsurveymaster.com/pricing/" rel="noopener"
353
+ target="_blank"><?php _e( 'SEE ALL ADDONS', 'quiz-master-next' ); ?></a>
354
  </div>
355
  </div>
356
  </div>
357
+ </div>
358
+ <?php
359
  }
360
 
361
  /**
367
  function qsm_dashboard_recent_taken_quiz( $widget_id ) {
368
  global $wpdb;
369
  ?>
370
+ <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
371
+ <button type="button" class="handlediv" aria-expanded="true">
372
+ <span class="screen-reader-text">Toggle panel:
373
+ <?php _e( 'Recently Taken Quizzes', 'quiz-master-next' ); ?></span>
374
+ <span class="toggle-indicator" aria-hidden="true"></span>
375
+ </button>
376
+ <h2 class="hndle ui-sortable-handle"><span><?php _e( 'Recently Taken Quizzes', 'quiz-master-next' ); ?></span></h2>
377
+ <div class="inside">
378
+ <div class="main">
379
+ <ul class="recently-taken-quiz-ul">
380
+ <?php
381
  $mlw_result_data = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE deleted=0 ORDER BY result_id DESC LIMIT 2", ARRAY_A );
382
+ if ( $mlw_result_data ) {
383
+ foreach ( $mlw_result_data as $key => $single_result_arr ) {
384
+ ?>
385
+ <li>
386
+ <?php
387
+ if ( isset( $single_result_arr['user'] ) && $single_result_arr['user'] != '' ) {
388
+ echo '<img src="' . get_avatar_url( $single_result_arr['user'] ) . '" class="avatar avatar-50 photo">';
389
+ } else {
390
+ echo '<img src="' . QSM_PLUGIN_URL . '/assets/default_image.png" class="avatar avatar-50 photo">';
391
+ }
392
+ ?>
393
+ <div class="rtq-main-wrapper">
394
+ <span class="rtq_user_info">
395
+ <?php
396
+ if ( isset( $single_result_arr['user'] ) && $single_result_arr['user'] != 0 ) {
397
+ $edit_link = get_edit_profile_url( $single_result_arr['user'] );
398
+ $actual_user = get_userdata( $single_result_arr['user'] );
399
+ $user_name = $single_result_arr['name'] == 'None' ? $actual_user->data->display_name : $single_result_arr['name'];
400
+ echo '<a href="' . $edit_link . '">' . $user_name . '</a>';
401
+ } else {
402
+ echo __( 'Guest', 'quiz-master-next' );
403
+ }
404
+ _e( ' took quiz ', 'quiz-master-next' );
405
+ echo '<a href="admin.php?page=mlw_quiz_options&quiz_id=' . $single_result_arr['quiz_id'] . '">' . $single_result_arr['quiz_name'] . '</a>';
406
  ?>
407
+ </span>
408
+ <span class="rtq-result-info">
409
+ <?php
410
+ $quotes_list = '';
411
+ $form_type = isset( $single_result_arr['form_type'] ) ? $single_result_arr['form_type'] : 0;
412
+ if ( $form_type == 1 || $form_type == 2 ) {
413
+ $quotes_list .= __( 'Not Graded', 'quiz-master-next' );
414
+ } else {
415
+ if ( $single_result_arr['quiz_system'] == 0 ) {
416
+ $quotes_list .= $single_result_arr['correct'] . ' out of ' . $single_result_arr['total'] . ' or ' . $single_result_arr['correct_score'] . '%';
417
  }
418
+ if ( $single_result_arr['quiz_system'] == 1 ) {
419
+ $quotes_list .= $single_result_arr['point_score'] . ' Points';
420
+ }
421
+ if ( $single_result_arr['quiz_system'] == 3 ) {
422
+ $quotes_list .= $single_result_arr['correct'] . ' out of ' . $single_result_arr['total'] . ' or ' . $single_result_arr['correct_score'] . '%<br/>';
423
+ $quotes_list .= $single_result_arr['point_score'] . ' Points';
424
+ }
425
+ }
426
+ echo $quotes_list;
427
+ ?>
428
+ |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  <?php
430
+ $mlw_complete_time = '';
431
+ $mlw_qmn_results_array = @unserialize( $single_result_arr['quiz_results'] );
432
+ if ( is_array( $mlw_qmn_results_array ) ) {
433
+ $mlw_complete_hours = floor( $mlw_qmn_results_array[0] / 3600 );
434
+ if ( $mlw_complete_hours > 0 ) {
435
+ $mlw_complete_time .= "$mlw_complete_hours hours ";
436
+ }
437
+ $mlw_complete_minutes = floor( ( $mlw_qmn_results_array[0] % 3600 ) / 60 );
438
+ if ( $mlw_complete_minutes > 0 ) {
439
+ $mlw_complete_time .= "$mlw_complete_minutes minutes ";
440
+ }
441
+ $mlw_complete_seconds = $mlw_qmn_results_array[0] % 60;
442
+ $mlw_complete_time .= "$mlw_complete_seconds seconds";
443
+ }
444
+ _e( ' Time to complete ', 'quiz-master-next' );
445
+ echo $mlw_complete_time;
446
+ ?>
447
+ </span>
448
+ <span
449
+ class="rtq-time-taken"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $single_result_arr['time_taken'] ) ); ?></span>
450
+ <p class="row-actions-c">
451
+ <a
452
+ href="admin.php?page=qsm_quiz_result_details&result_id=<?php echo $single_result_arr['result_id']; ?>">View</a>
453
+ | <a href="#" data-result_id="<?php echo $single_result_arr['result_id']; ?>"
454
+ class="trash rtq-delete-result">Delete</a>
455
+ </p>
456
+ </div>
457
+ </li>
458
+ <?php
459
  }
460
+ }
461
+ ?>
462
+ </ul>
463
+ <p>
464
+ <a href="admin.php?page=mlw_quiz_results">
465
+ <?php
466
  $mlw_result_data = $wpdb->get_row( "SELECT DISTINCT COUNT(result_id) as total_result FROM {$wpdb->prefix}mlw_results WHERE deleted=0", ARRAY_A );
467
  echo isset( $mlw_result_data['total_result'] ) ? __( 'See All Results ', 'quiz-master-next' ) : '';
 
 
 
 
468
  ?>
469
+ </a>
470
+ <?php
471
+ echo isset( $mlw_result_data['total_result'] ) ? '(' . $mlw_result_data['total_result'] . ')' : '';
472
+ ?>
473
+ </p>
474
  </div>
475
  </div>
476
+ </div>
477
+ <?php
478
  }
479
 
480
  /**
484
  */
485
  function qsm_dashboard_what_new( $widget_id ) {
486
  ?>
487
+ <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
488
+ <button type="button" class="handlediv" aria-expanded="true">
489
+ <span class="screen-reader-text">Toggle panel: <?php _e( "'what's New", 'quiz-master-next' ); ?></span>
490
+ <span class="toggle-indicator" aria-hidden="true"></span>
491
+ </button>
492
+ <h2 class="hndle ui-sortable-handle"><span><?php _e( "What's New", 'quiz-master-next' ); ?></span></h2>
493
+ <div class="inside">
494
+ <div class="main">
495
+ <ul class="what-new-ul">
496
+ <?php
497
+ $feed_posts_array = qsm_get_widget_data( 'blog_post' );
498
+ if ( ! empty( $feed_posts_array ) ) {
499
+ foreach ( $feed_posts_array as $key => $single_feed_arr ) {
500
+ ?>
501
+ <li>
502
+ <a href="<?php echo $single_feed_arr['link']; ?>" target="_blank" rel="noopener">
503
+ <?php echo $single_feed_arr['title']; ?>
504
+ </a>
505
+ <div class="post-description">
506
+ <?php echo $single_feed_arr['excerpt']; ?>
507
+ </div>
508
+ </li>
509
+ <?php
 
510
  }
511
+ }
512
+ ?>
513
+ </ul>
514
  </div>
515
  </div>
516
+ </div>
517
+ <?php
518
  }
519
 
520
  /**
523
  * Generate change log
524
  */
525
  function qsm_dashboard_chagelog( $widget_id ) {
526
+ $change_log = qsm_get_widget_data( 'change_log' );
527
+ global $mlwQuizMasterNext;
528
  ?>
529
+ <div id="<?php echo $widget_id; ?>" class="postbox <?php qsm_check_close_hidden_box( $widget_id ); ?>">
530
+ <button type="button" class="handlediv" aria-expanded="true">
531
+ <span class="screen-reader-text">Toggle panel: <?php _e( 'Changelog', 'quiz-master-next' ); ?></span>
532
+ <span class="toggle-indicator" aria-hidden="true"></span>
533
+ </button>
534
+ <h2 class="hndle ui-sortable-handle">
535
+ <span><?php _e( 'Changelog ' . '( ' . $mlwQuizMasterNext->version . ' )', 'quiz-master-next' ); ?></span>
536
+ </h2>
537
+ <div class="inside">
538
+ <div class="main">
539
+ <?php
540
+ if ( $change_log ) {
541
+ $change_log_count = count( $change_log );
542
+ ?>
543
+ <ul class="changelog-ul">
544
+ <?php
545
+ $i = 0;
546
+ foreach ( $change_log as $single_change_log ) {
547
+ if ( $single_change_log != '' ) {
548
+ if ( $i == 5 ) {
549
+ break;
550
+ }
551
+
552
+ $expload_str = explode( ':', $single_change_log );
553
+ $cl_type = $expload_str[0];
554
+ $cl_str = $expload_str[1];
555
+ ?>
556
+
557
+ <li><span class="<?php echo trim( strtolower( $cl_type ) ); ?>"><?php echo trim( $cl_type ); ?></span>
558
+ <?php echo $cl_str; ?></li>
559
+ <?php
560
+ $i++;
561
+ }
562
+ }
563
+ ?>
564
+
565
+ </ul>
566
+ <?php if ( $change_log_count > 5 ) { ?>
567
+ <div class="pa-all-addon" style="border-top: 1px solid #ede8e8;padding-top: 15px;">
568
+ <a href="https://wordpress.org/plugins/quiz-master-next/#developers" target="_blank"
569
+ rel="noopener"><?php _e( 'View Complete Changelog', 'quiz-master-next' ); ?></a>
570
  </div>
571
+ <?php
572
+ }
573
+ }
574
+ ?>
575
  </div>
576
  </div>
577
+ </div>
578
+ <?php
579
  }
580
 
581
  /**
587
  if ( isset( $_POST['qsm_new_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_new_quiz_nonce'], 'qsm_new_quiz' ) ) {
588
  global $mlwQuizMasterNext;
589
  $quiz_name = sanitize_text_field( htmlspecialchars( stripslashes( $_POST['quiz_name'] ), ENT_QUOTES ) );
590
+ $theme_id = isset( $_POST['quiz_theme_id'] ) ? (int) $_POST['quiz_theme_id'] : 0;
591
  unset( $_POST['qsm_new_quiz_nonce'] );
592
  unset( $_POST['_wp_http_referer'] );
593
+ unset( $_POST['quiz_theme_id'] );
594
  $setting_arr = array(
595
  'quiz_options' => serialize( $_POST ),
596
  );
597
+ $mlwQuizMasterNext->quizCreator->create_quiz( $quiz_name, $theme_id, serialize( $setting_arr ) );
598
  }
599
  }
600
  add_action( 'admin_init', 'qsm_create_new_quiz_from_wizard' );
603
  /**
604
  * @since 7.0
605
  * @param Object $upgrader_object
606
+ * @param Array $options
607
  * Reset the transient on QSM plugin update
608
  */
609
  function qsm_reset_transient_dashboard( $upgrader_object, $options ) {
610
+ $current_plugin_path_name = QSM_PLUGIN_BASENAME;
611
+ if ( $options['action'] == 'update' && $options['type'] == 'plugin' ) {
612
+ foreach ( $options['plugins'] as $each_plugin ) {
613
+ if ( $each_plugin == $current_plugin_path_name ) {
614
+ delete_transient( 'qsm_admin_dashboard_data' );
615
+ }
616
+ }
617
+ }
618
  }
619
  add_action( 'upgrader_process_complete', 'qsm_reset_transient_dashboard', 10, 2 );
php/admin/functions.php CHANGED
@@ -1,56 +1,75 @@
1
  <?php
 
2
 
3
  function qsm_fetch_data_from_xml() {
4
- $file = esc_url('https://quizandsurveymaster.com/addons.xml');
5
- $response = wp_remote_post($file, array('sslverify' => false));
6
-
7
- if (is_wp_error($response) || $response['response']['code'] === 404 ) {
8
- return "<p>" . __('Something went wrong', 'quiz-master-next') . "</p>";
9
- }else{
10
- $body = wp_remote_retrieve_body($response);
11
- return $xml = simplexml_load_string($body);
12
- }
13
  }
14
 
15
- add_action('qmn_quiz_created','qsm_redirect_to_edit_page',10,1);
16
  /**
17
  * @since 6.4.5
18
  * @param int $quiz_id Quiz id.
19
  */
20
- function qsm_redirect_to_edit_page($quiz_id){
21
- $url = admin_url( 'admin.php?page=mlw_quiz_options&&quiz_id=' . $quiz_id ); ?>
22
- <script>
23
- window.location.href = '<?php echo $url; ?>';
24
- </script>
25
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
 
28
- add_action('admin_init','qsm_add_author_column_in_db');
29
  /**
30
  * @since 6.4.6
31
  * Insert new column in quiz table
32
  */
33
  function qsm_add_author_column_in_db() {
34
-
35
- if( get_option('qsm_update_db_column', '') != '1' ) {
36
 
37
  global $wpdb;
38
 
39
  /*
40
  * Array of table and its column mapping.
41
- * Each array's item key refers to the table to be altered and its value refers
42
  * to the array of column and its definition to be added.
43
  */
44
- $table_column_arr = array(
45
  $wpdb->prefix . 'mlw_quizzes' => array( 'quiz_author_id' => 'INT NOT NULL' ),
46
- $wpdb->prefix . 'mlw_results' => array( 'unique_id' => 'VARCHAR(255) NOT NULL' ),
47
  );
48
 
49
- foreach( $table_column_arr as $table => $column_def ) {
50
- foreach( $column_def as $col_name => $col_def ) {
51
- $table_col_obj = $wpdb->get_results( $wpdb->prepare(
52
- 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ', $wpdb->dbname, $table, $col_name
53
- ) );
 
 
 
 
 
54
 
55
  if ( empty( $table_col_obj ) ) {
56
  $wpdb->query( 'ALTER TABLE ' . $table . ' ADD ' . $col_name . ' ' . $col_def );
@@ -61,267 +80,299 @@ function qsm_add_author_column_in_db() {
61
  update_option( 'qsm_update_db_column', '1' );
62
 
63
  }
64
-
65
- //Update result db
66
- if( get_option('qsm_update_result_db_column', '') != '1' ){
67
- global $wpdb;
68
- $result_table_name = $wpdb->prefix . "mlw_results";
69
- $table_result_col_obj = $wpdb->get_results( $wpdb->prepare(
70
- 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ', $wpdb->dbname, $result_table_name, 'form_type'
71
- ) );
72
- if ( empty( $table_result_col_obj ) ) {
73
- $wpdb->query("ALTER TABLE $result_table_name ADD form_type INT NOT NULL");
74
- }
75
- update_option('qsm_update_result_db_column', '1');
76
- }
77
-
78
- /**
79
- * Changed the system word to quiz_system in quiz table
80
- * @since 7.0.0
81
- */
82
- if( get_option('qsm_update_quiz_db_column', '') != '1' ){
83
- global $wpdb;
84
- $quiz_table_name = $wpdb->prefix . "mlw_quizzes";
85
- $table_quiz_col_obj = $wpdb->get_results( $wpdb->prepare(
86
- 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ', $wpdb->dbname, $quiz_table_name, 'system'
87
- ) );
88
- if ( !empty( $table_quiz_col_obj ) ) {
89
- $wpdb->query("ALTER TABLE $quiz_table_name CHANGE `system` `quiz_system` INT(11) NOT NULL;");
90
- }
91
- update_option('qsm_update_quiz_db_column', '1');
92
- }
93
-
94
- /**
95
- * Changed result table column data type
96
- * @since 7.0.1
97
- */
98
- if( get_option('qsm_update_result_db_column_datatype', '') != '1' ){
99
- global $wpdb;
100
- $result_table_name = $wpdb->prefix . "mlw_results";
101
- $table_quiz_result_obj = $wpdb->get_row( $wpdb->prepare(
102
- 'SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ', $wpdb->dbname, $result_table_name, 'quiz_results'
103
- ), ARRAY_A );
104
- if ( isset( $table_quiz_result_obj['DATA_TYPE'] ) && $table_quiz_result_obj['DATA_TYPE'] == 'text' ) {
105
- $wpdb->query("ALTER TABLE $result_table_name CHANGE `quiz_results` `quiz_results` LONGTEXT;");
106
- }
107
- update_option('qsm_update_result_db_column_datatype', '1');
108
- }
109
-
110
- /**
111
- * Add new column in question table
112
- * @since 7.0.3
113
- */
114
- if( get_option('qsm_add_new_column_question_table_table', '1') <= 3 ){
115
- $total_count_val = get_option('qsm_add_new_column_question_table_table', '1');
116
- global $wpdb;
117
- $question_table_name = $wpdb->prefix . "mlw_questions";
118
- $table_result_col_obj = $wpdb->get_results( $wpdb->prepare(
119
- 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ', $wpdb->dbname, $question_table_name, 'deleted_question_bank'
120
- ) );
121
- if ( empty( $table_result_col_obj ) ) {
122
- $wpdb->query("ALTER TABLE $question_table_name ADD deleted_question_bank INT NOT NULL");
123
- }
124
- $inc_val = $total_count_val + 1;
125
- update_option('qsm_add_new_column_question_table_table', $inc_val);
126
- }
127
- }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
- add_action('admin_init', 'qsm_change_the_post_type');
131
  /**
132
  * @since version 6.4.8
133
  * Transfer all quiz post to new cpt 'qsm_quiz'
134
  */
135
- function qsm_change_the_post_type(){
136
- if( get_option('qsm_change_the_post_type', '') != '1' ){
137
- $post_arr = array(
138
- 'post_type' => 'quiz',
139
- 'posts_per_page' => -1,
140
- 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'trash')
141
- );
142
- $my_query = new WP_Query( $post_arr );
143
-
144
- if ( $my_query->have_posts() ) {
145
- while ( $my_query->have_posts() ) {
146
- $my_query->the_post();
147
-
148
- $post_id = get_the_ID();
149
- $post_obj = get_post( $post_id );
150
- if($post_obj->post_status == 'trash'){
151
- $post_obj->post_status = 'draft';
152
- }
153
- $post_obj->post_type = 'qsm_quiz';
154
- wp_update_post( $post_obj );
155
- }
156
- wp_reset_postdata();
157
- }
158
- update_option('qsm_change_the_post_type', '1');
159
- flush_rewrite_rules();
160
- }
161
  }
162
 
163
  /**
164
  * @since 7.0.0
165
  * @param arr $single_option
166
  */
167
- function qsm_display_question_option($key, $single_option){
168
- $type = isset($single_option['type']) ? $single_option['type'] : 'text';
169
- $show = isset($single_option['show']) ? explode(',', $single_option['show']) : array();
170
  $show_class = '';
171
- if($show){
172
- foreach($show as $show_value){
173
- $show_class .= 'qsm_show_question_type_' . trim( $show_value ) .' ';
174
  }
175
  $show_class .= ' qsm_hide_for_other';
176
  }
177
- $tooltip = '';
178
- $document_text = '';
179
- if( isset($single_option['tooltip']) && $single_option['tooltip'] != '' ){
180
- $tooltip .= '<span class="dashicons dashicons-editor-help qsm-tooltips-icon">';
181
- $tooltip .= '<span class="qsm-tooltips">' . $single_option['tooltip'] . '</span>';
182
- $tooltip .= '</span>';
183
- }
184
- if( isset($single_option['documentation_link']) && $single_option['documentation_link'] != '' ){
185
- $document_text .= '<a class="qsm-question-doc" href="'. $single_option['documentation_link'] .'" target="_blank" title="'. __('View Documentation', 'quiz-master-next') .'">';
186
- $document_text .= '<span class="dashicons dashicons-media-document"></span>';
187
- $document_text .= '</a>';
188
- }
189
- switch ($type){
190
- case 'text':
191
- ?>
192
- <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
193
- <label>
194
- <?php echo isset($single_option['label']) ? $single_option['label'] : ''; ?>
195
- <?php echo $tooltip; ?>
196
- <?php echo $document_text; ?>
197
- </label>
198
- <input type="text" name="<?php echo $key; ?>" value="<?php echo isset($single_option['default']) ? $single_option['default'] : ''; ?>" id="<?php echo $key ?>" />
199
- </div>
200
- <?php
201
- break;
202
-
203
- case 'number':
204
- ?>
205
- <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
206
- <label>
207
- <?php echo isset($single_option['label']) ? $single_option['label'] : ''; ?>
208
- <?php echo $tooltip; ?>
209
- <?php echo $document_text; ?>
210
- </label>
211
- <input type="number" name="<?php echo $key; ?>" value="<?php echo isset($single_option['default']) ? $single_option['default'] : ''; ?>" id="<?php echo $key ?>" />
212
- </div>
213
- <?php
214
- break;
215
-
216
- case 'select':
217
- ?>
218
- <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
219
- <label>
220
- <?php echo isset($single_option['label']) ? $single_option['label'] : ''; ?>
221
- <?php echo $tooltip; ?>
222
- <?php echo $document_text; ?>
223
- </label>
224
- <select name="<?php echo $key; ?>" id="<?php echo $key ?>">
225
- <?php
226
- $default = isset($single_option['default']) ? $single_option['default'] : '';
227
- if(isset($single_option['options']) && is_array($single_option['options'])){
228
- foreach ($single_option['options'] as $key => $value) {
229
- $selected = $key === $default ? 'selected = selected' : '';
230
- ?>
231
- <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value; ?></option>
232
- <?php
233
- }
234
- }
235
- ?>
236
- </select>
237
- </div>
238
- <?php
239
- break;
240
-
241
- case 'textarea':
242
- ?>
243
- <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
244
- <label>
245
- <?php echo isset($single_option['label']) ? $single_option['label'] : ''; ?>
246
- <?php echo $tooltip; ?>
247
- <?php echo $document_text; ?>
248
- </label>
249
- <textarea id="<?php echo $key ?>" name="<?php echo $key; ?>"><?php echo isset($single_option['default']) ? $single_option['default'] : ''; ?></textarea>
250
- </div>
251
- <?php
252
- break;
253
-
254
- case 'category':
255
- ?>
256
- <div id="category_area" class="qsm-row <?php echo $show_class; ?>">
257
- <label>
258
- <?php echo isset($single_option['label']) ? $single_option['label'] : ''; ?>
259
- <?php echo $tooltip; ?>
260
- <?php echo $document_text; ?>
261
- </label>
262
- <div id="categories">
263
- <a id="qsm-category-add-toggle" class="hide-if-no-js">
264
- <?php _e( '+ Add New Category', 'quiz-master-next' ); ?>
265
- </a>
266
- <p id="qsm-category-add" style="display: none;">
267
- <input type="radio" style="display: none;" name="category" class="category-radio" id="new_category_new" value="new_category"><label for="new_category_new"><input type='text' id='new_category' value='' placeholder="Add new category" /></label>
268
- </p>
269
- </div>
270
- </div>
271
- <?php
272
- break;
273
-
274
- case 'multi_checkbox':
275
- ?>
276
- <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
277
- <label>
278
- <?php echo isset($single_option['label']) ? $single_option['label'] : ''; ?>
279
- <?php echo $tooltip; ?>
280
- <?php echo $document_text; ?>
281
- </label>
282
- <?php
283
- $parent_key = $key;
284
- $default = isset($single_option['default']) ? $single_option['default'] : '';
285
- if(isset($single_option['options']) && is_array($single_option['options'])){
286
- foreach ($single_option['options'] as $key => $value) {
287
- $selected = $key === $default ? 'checked' : '';
288
- ?>
289
- <input name="<?php echo $parent_key; ?>[]" type="checkbox" value="<?php echo $key; ?>" <?php echo $selected; ?> /> <?php echo $value; ?><br/>
290
- <?php
291
- }
292
- }
293
- ?>
294
- </div>
295
- <?php
296
- break;
297
-
298
- case 'single_checkbox':
299
- ?>
300
- <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
301
- <label>
302
- <?php
303
- $parent_key = $key;
304
- $default = isset($single_option['default']) ? $single_option['default'] : '';
305
- if(isset($single_option['options']) && is_array($single_option['options'])){
306
- foreach ($single_option['options'] as $key => $value) {
307
- $selected = $key === $default ? 'checked' : '';
308
- ?>
309
- <input name="<?php echo $parent_key; ?>" id="<?php echo $parent_key ?>" type="checkbox" value="<?php echo $key; ?>" <?php echo $selected; ?> />
310
- <?php
311
- }
312
- }
313
- ?>
314
- <?php echo isset($single_option['label']) ? $single_option['label'] : ''; ?>
315
- <?php echo $tooltip; ?>
316
- <?php echo $document_text; ?>
317
- </label>
318
- </div>
319
- <?php
320
- break;
321
-
322
- default:
323
- //Do nothing
324
- }
 
 
 
 
 
 
 
 
 
325
 
326
  }
327
 
@@ -329,218 +380,241 @@ function qsm_display_question_option($key, $single_option){
329
  * @since 7.0
330
  * New quiz popup
331
  */
332
- function qsm_create_new_quiz_wizard(){ ?>
333
- <div class="qsm-popup qsm-popup-slide" id="model-wizard" aria-hidden="true">
334
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
335
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-2-title">
336
- <header class="qsm-popup__header">
337
- <h2 class="qsm-popup__title" id="modal-2-title"><?php _e('Create New Quiz Or Survey', 'quiz-master-next'); ?></h2>
338
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
339
- </header>
340
- <main class="qsm-popup__content" id="modal-2-content">
341
- <?php
342
- $qsm_quiz_templates = array(
343
- array(
344
- 'template_name' => __('Start from scratch', 'quiz-master-next'),
345
- 'priority' => '1',
346
- 'options' => array(
347
- 'form_type' => array(
348
- 'option_name' => 'Form Type',
349
- 'value' => 0
350
- ),
351
- 'system' => array(
352
- 'option_name' => 'Graded System',
353
- 'value' => 0
354
- ),
355
- 'require_log_in' => array(
356
- 'option_name' => 'Require User Login',
357
- 'value' => 0
358
- )
359
- ),
360
- 'recommended_addon' => array(
361
- array(
362
- 'name' => 'Reporting And Analysis',
363
- 'link' => 'https://quizandsurveymaster.com/downloads/results-analysis/',
364
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/Reporting-And-Analysis.jpg',
365
- 'attribute' => 'recommended'
366
- ),
367
- array(
368
- 'name' => 'Export & Import',
369
- 'link' => 'https://quizandsurveymaster.com/downloads/export-import/',
370
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/Export-Import.jpg',
371
- 'attribute' => 'recommended'
372
- ),
373
- )
374
- ),
375
- array(
376
- 'template_name' => __('Simple Quiz', 'quiz-master-next'),
377
- 'priority' => '2',
378
- 'template_img' => QSM_PLUGIN_URL . '/assets/simple-quiz.png',
379
- 'options' => array(
380
- 'form_type' => array(
381
- 'option_name' => 'Form Type',
382
- 'value' => 0
383
- ),
384
- 'system' => array(
385
- 'option_name' => 'Graded System',
386
- 'value' => 0
387
- ),
388
- 'require_log_in' => array(
389
- 'option_name' => 'Require User Login',
390
- 'value' => 0
391
- ),
392
- 'progress_bar' => array(
393
- 'option_name' => 'Show progress bar',
394
- 'value' => 0
395
- )
396
- ),
397
- 'recommended_addon' => array(
398
- array(
399
- 'name' => 'Payment Integration',
400
- 'link' => 'https://quizandsurveymaster.com/downloads/paypal-and-stripe-payment-integration/',
401
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/Paypal-and-Stripe-Payment-Integration-300x170.jpg',
402
- 'attribute' => 'recommended'
403
- ),
404
- array(
405
- 'name' => 'Recaptcha',
406
- 'link' => 'https://quizandsurveymaster.com/downloads/recaptcha/',
407
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/reCaptcha.jpg',
408
- 'attribute' => 'recommended'
409
- ),
410
- )
411
- ),
412
- array(
413
- 'template_name' => __('Time Based Quiz', 'quiz-master-next'),
414
- 'priority' => '3',
415
- 'template_img' => QSM_PLUGIN_URL . '/assets/time-based-quiz.png',
416
- 'options' => array(
417
- 'form_type' => array(
418
- 'option_name' => 'Form Type',
419
- 'value' => 0
420
- ),
421
- 'system' => array(
422
- 'option_name' => 'Graded System',
423
- 'value' => 0
424
- ),
425
- 'timer_limit' => array(
426
- 'option_name' => 'Time Limit (in Minute)',
427
- 'value' => 0
428
- )
429
- ),
430
- 'recommended_addon' => array(
431
- array(
432
- 'name' => 'Save and Resume',
433
- 'link' => 'https://quizandsurveymaster.com/downloads/save-and-resume/',
434
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/Save-and-Resume.jpg',
435
- 'attribute' => 'recommended'
436
- ),
437
- array(
438
- 'name' => 'Advanced Timer',
439
- 'link' => 'https://quizandsurveymaster.com/downloads/wordpress-quiz-timer-advanced/',
440
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/35.jpg',
441
- 'attribute' => 'recommended'
442
- ),
443
- )
444
- ),
445
- array(
446
- 'template_name' => __('Survey', 'quiz-master-next'),
447
- 'priority' => '4',
448
- 'template_img' => QSM_PLUGIN_URL . '/assets/survey-quiz.png',
449
- 'options' => array(
450
- 'form_type' => array(
451
- 'option_name' => 'Form Type',
452
- 'value' => 1
453
- ),
454
- 'system' => array(
455
- 'option_name' => 'Graded System',
456
- 'value' => 0
457
- ),
458
- 'progress_bar' => array(
459
- 'option_name' => 'Progress Bar',
460
- 'value' => 0
461
- )
462
- ),
463
- 'recommended_addon' => array(
464
- array(
465
- 'name' => 'Daily Limit',
466
- 'link' => 'https://quizandsurveymaster.com/downloads/daily-limit/',
467
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/Daily-Limit.jpg',
468
- 'attribute' => 'recommended'
469
- ),
470
- array(
471
- 'name' => 'Google Sheet Connector',
472
- 'link' => 'https://quizandsurveymaster.com/downloads/sync-with-google-sheets/',
473
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/03/first-1.jpg',
474
- 'attribute' => 'recommended'
475
- ),
476
- array(
477
- 'name' => 'Mailchimp Integration',
478
- 'link' => 'https://quizandsurveymaster.com/downloads/mailchimp-integration/',
479
- 'img' => 'https://t6k8i7j6.stackpathcdn.com/wp-content/uploads/edd/2020/04/MailChimp-Integration.jpg',
480
- 'attribute' => 'recommended'
481
- ),
482
- )
483
- ),
484
- );
485
- $qsm_quiz_templates = apply_filters('qsm_wizard_quiz_templates', $qsm_quiz_templates);
486
- $keys = array_column($qsm_quiz_templates, 'priority');
487
- array_multisort($keys, SORT_ASC, $qsm_quiz_templates);
488
- ?>
489
- <form action="" method="post" id="new-quiz-form">
490
- <div class="qsm-wizard-template-section">
491
- <?php wp_nonce_field('qsm_new_quiz', 'qsm_new_quiz_nonce'); ?>
492
- <input type="text" class="quiz_name" name="quiz_name" value="" placeholder="<?php _e('Enter quiz name here', 'quiz-master-next'); ?>" required/>
493
- <div class="template-inner-wrap">
494
- <h6><?php _e('Select Template', 'quiz-master-next'); ?></h6>
495
- <div class="template-list">
496
- <?php
497
- if( $qsm_quiz_templates ){
498
- foreach ($qsm_quiz_templates as $key => $single_template) {
499
- if(isset($single_template['priority']) && $single_template['priority'] == 1){ ?>
500
- <div class="template-list-inner" data-settings='<?php echo isset($single_template['options']) ? json_encode($single_template['options']) : ''; ?>' data-addons='<?php echo isset($single_template['recommended_addon']) ? json_encode($single_template['recommended_addon']) : ''; ?>'>
501
- <div class="template-center-vertical">
502
- <span class="dashicons dashicons-plus-alt2"></span>
503
- <p class="start_scratch"><?php echo isset($single_template['template_name']) ? $single_template['template_name'] : ''; ?></p>
504
- </div>
505
- </div>
506
- <?php
507
- }else{ ?>
508
- <div class="template-list-inner inner-json" data-settings='<?php echo isset($single_template['options']) ? json_encode($single_template['options']) : ''; ?>' data-addons='<?php echo isset($single_template['recommended_addon']) ? json_encode($single_template['recommended_addon']) : ''; ?>'>
509
- <div class="template-center-vertical">
510
- <?php
511
- if( isset($single_template['template_img']) ){ ?>
512
- <img src="<?php echo $single_template['template_img']; ?>" title="<?php echo isset($single_template['template_name']) ? $single_template['template_name'] : ''; ?>">
513
- <?php
514
- }
515
- ?>
516
- </div>
517
- <h3><?php echo isset($single_template['template_name']) ? $single_template['template_name'] : ''; ?></h3>
518
- </div>
519
- <?php
520
- }
521
- }
522
- }
523
- ?>
524
- </div>
525
- </div>
526
- </div>
527
- <div class="qsm-wizard-setting-section">
528
- <div id="accordion">
529
- <h3><?php _e('Quiz Settings', 'quiz-master-next'); ?></h3>
530
- <div id="quiz_settings_wrapper"></div>
531
- <h3><?php _e('Recommended Addons', 'quiz-master-next'); ?></h3>
532
- <div id="recomm_addons_wrapper"></div>
533
- </div>
534
- </div>
535
- </form>
536
- </main>
537
- <footer class="qsm-popup__footer">
538
- <button id="create-quiz-button" class="button button-primary"><?php _e('Create Quiz', 'quiz-master-next'); ?></button>
539
- <button class="button" data-micromodal-close aria-label="Close this dialog window"><?php _e('Cancel', 'quiz-master-next'); ?></button>
540
- </footer>
541
- </div>
542
- </div>
543
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  <?php
545
  }
546
 
@@ -548,71 +622,72 @@ function qsm_create_new_quiz_wizard(){ ?>
548
  * @since 7.0
549
  * @return array Template Variable
550
  */
551
- function qsm_text_template_variable_list(){
552
- $variable_list = array(
553
- '%POINT_SCORE%' => __('Score for the quiz when using points', 'quiz-master-next'),
554
- '%MAXIMUM_POINTS%' => __('Maximum possible points one can score', 'quiz-master-next'),
555
- '%AVERAGE_POINT%' => __('The average amount of points user had per question', 'quiz-master-next'),
556
- '%AMOUNT_CORRECT%' => __('The number of correct answers the user had', 'quiz-master-next'),
557
- '%AMOUNT_INCORRECT%' => __('The number of incorrect answers the user had', 'quiz-master-next'),
558
- '%AMOUNT_ATTEMPTED%' => __('The number of questions are attempted', 'quiz-master-next'),
559
- '%TOTAL_QUESTIONS%' => __('The total number of questions in the quiz', 'quiz-master-next'),
560
- '%CORRECT_SCORE%' => __('Score for the quiz when using correct answers', 'quiz-master-next'),
561
- '%USER_NAME%' => __('The name the user entered before the quiz', 'quiz-master-next'),
562
- '%FULL_NAME%' => __('The full name of user with first name and last name', 'quiz-master-next'),
563
- '%USER_BUSINESS%' => __('The business the user entered before the quiz', 'quiz-master-next'),
564
- '%USER_PHONE%' => __('The phone number the user entered before the quiz', 'quiz-master-next'),
565
- '%USER_EMAIL%' => __('The email the user entered before the quiz', 'quiz-master-next'),
566
- '%QUIZ_NAME%' => __('The name of the quiz', 'quiz-master-next'),
567
- '%QUIZ_LINK%' => __('The link of the quiz', 'quiz-master-next'),
568
- '%QUESTIONS_ANSWERS%' => __('Shows the question, the answer the user provided, and the correct answer', 'quiz-master-next'),
569
- '%COMMENT_SECTION%' => __('The comments the user entered into comment box if enabled', 'quiz-master-next'),
570
- '%TIMER%' => __('The amount of time user spent on quiz in seconds', 'quiz-master-next'),
571
- '%TIMER_MINUTES%' => __('The amount of time user spent on quiz in minutes', 'quiz-master-next'),
572
- '%CATEGORY_POINTS_X%' => __('X: Category name - The amount of points a specific category earned.', 'quiz-master-next'),
573
- '%CATEGORY_SCORE_X%' => __('X: Category name - The score a specific category earned.', 'quiz-master-next'),
574
- '%CATEGORY_AVERAGE_POINTS%' => __('The average points from all categories.', 'quiz-master-next'),
575
- '%CATEGORY_AVERAGE_SCORE%' => __('The average score from all categories.', 'quiz-master-next'),
576
- '%QUESTION%' => __('The question that the user answered', 'quiz-master-next'),
577
- '%USER_ANSWER%' => __('The answer the user gave for the question', 'quiz-master-next'),
578
- '%USER_ANSWERS_DEFAULT%' => __('The answer the user gave for the question with default design', 'quiz-master-next'),
579
- '%CORRECT_ANSWER%' => __('The correct answer for the question', 'quiz-master-next'),
580
- '%USER_COMMENTS%' => __('The comments the user provided in the comment field for the question', 'quiz-master-next'),
581
- '%CORRECT_ANSWER_INFO%' => __('Reason why the correct answer is the correct answer', 'quiz-master-next'),
582
- '%CURRENT_DATE%' => __('The Current Date', 'quiz-master-next'),
583
- '%QUESTION_POINT_SCORE%' => __('Point Score of the question', 'quiz-master-next'),
584
- '%QUESTION_MAX_POINTS%' => __('Maximum points of the question', 'quiz-master-next'),
585
- '%FACEBOOK_SHARE%' => __('Displays button to share on Facebook.', 'quiz-master-next'),
586
- '%TWITTER_SHARE%' => __('Displays button to share on Twitter.', 'quiz-master-next'),
587
- '%RESULT_LINK%' => __('The link of the result page.', 'quiz-master-next'),
588
- );
589
- $variable_list = apply_filters('qsm_text_variable_list', $variable_list);
590
- return $variable_list;
591
  }
592
 
593
- add_action('admin_init', 'qsm_update_question_type_col_val');
594
 
595
  /**
596
- * Replace `fill-in-the-blank` value in question_type_column for Fill
597
  * In The Blank question types.
598
  *
599
  * @since version 6.4.12
600
  */
601
  function qsm_update_question_type_col_val() {
602
-
603
  global $wpdb;
604
  global $mlwQuizMasterNext;
605
 
606
  if ( version_compare( $mlwQuizMasterNext->version, '6.4.12', '<' ) ) {
607
- if( get_option('qsm_upated_question_type_val') != '1' ) {
608
- $table_name = $wpdb->prefix . 'mlw_questions';
609
- $status = $wpdb->query(
610
- $wpdb->prepare(
611
- "UPDATE " . $table_name . " SET `question_type_new` = REPLACE( `question_type_new`, 'fill-in-the-blank', %d )", 14 )
612
- );
 
 
613
 
614
- if( $status ) {
615
- update_option('qsm_upated_question_type_val', '1');
616
  }
617
  }
618
  }
@@ -620,50 +695,254 @@ function qsm_update_question_type_col_val() {
620
 
621
  /**
622
  * Check and create table if not present
623
- *
624
  * @since 7.0.0
625
  */
626
- function qsm_check_create_tables(){
627
- global $wpdb;
628
- $quiz_table_name = $wpdb->prefix . "mlw_quizzes";
629
- if( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_table_name'" ) != $quiz_table_name ) {
630
- QSM_Install::install();
631
- }
 
 
 
 
 
632
  }
633
- add_action('admin_init', 'qsm_check_create_tables');
634
 
635
  /**
636
  * Redirect the admin old slug to new slug
637
- *
638
  * @since 7.0.0
639
  */
640
- function qsm_admin_page_access_func(){
641
- if( isset( $_GET['page'] ) && $_GET['page'] == 'quiz-master-next/mlw_quizmaster2.php'){
642
- wp_redirect( admin_url( 'admin.php?page=qsm_dashboard' ) );
643
- exit;
644
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
645
  }
646
- add_action('admin_page_access_denied', 'qsm_admin_page_access_func');
647
 
648
  /**
649
  * Display roadmap page
650
- *
651
  * @since 7.1.11
652
  */
653
- function qsm_generate_roadmap_page(){ ?>
654
- <div class="wrap">
655
- <style>
656
- iframe {
657
- height: 1350px;
658
- }
659
- </style>
660
- <iframe src="https://app.productstash.io/roadmaps/5f7b1a36636db50029f51d5c/public" height="900" width="100%" frameborder="0"></iframe>
661
- <script>
662
- var ps_config = {
663
- productId : "d24ad9de-78c7-4835-a2a8-3f5ee0317f31"
664
- };
665
- </script>
666
- <script type="text/javascript" src="https://app.productstash.io/js/productstash-embed.js" defer="defer"></script>
667
- </div>
 
 
668
  <?php
669
  }
1
  <?php
2
+ $themes_data = array();
3
 
4
  function qsm_fetch_data_from_xml() {
5
+ $file = esc_url( 'https://quizandsurveymaster.com/addons.xml' );
6
+ $response = wp_remote_post( $file, array( 'sslverify' => false ) );
7
+
8
+ if ( is_wp_error( $response ) || $response['response']['code'] === 404 ) {
9
+ return '<p>' . __( 'Something went wrong', 'quiz-master-next' ) . '</p>';
10
+ } else {
11
+ $body = wp_remote_retrieve_body( $response );
12
+ return $xml = simplexml_load_string( $body );
13
+ }
14
  }
15
 
16
+ add_action( 'qmn_quiz_created', 'qsm_redirect_to_edit_page', 10, 1 );
17
  /**
18
  * @since 6.4.5
19
  * @param int $quiz_id Quiz id.
20
  */
21
+ function qsm_redirect_to_edit_page( $quiz_id ) {
22
+ link_featured_image( $quiz_id );
23
+ $url = admin_url( 'admin.php?page=mlw_quiz_options&&quiz_id=' . $quiz_id );?>
24
+ <script>
25
+ window.location.href = '<?php echo $url; ?>';
26
+ </script>
27
+ <?php
28
+ }
29
+
30
+ /**
31
+ * Links quiz featured image if exists
32
+ *
33
+ * @param int $quiz_id
34
+ * @return void
35
+ */
36
+ function link_featured_image( $quiz_id ) {
37
+ $url = trim( $_POST['quiz_featured_image'] );
38
+ if ( ! empty( $url ) ) {
39
+ update_option( "quiz_featured_image_$quiz_id", $url );
40
+ }
41
  }
42
 
43
+ add_action( 'admin_init', 'qsm_add_author_column_in_db' );
44
  /**
45
  * @since 6.4.6
46
  * Insert new column in quiz table
47
  */
48
  function qsm_add_author_column_in_db() {
49
+ if ( get_option( 'qsm_update_db_column', '' ) != '1' ) {
 
50
 
51
  global $wpdb;
52
 
53
  /*
54
  * Array of table and its column mapping.
55
+ * Each array's item key refers to the table to be altered and its value refers
56
  * to the array of column and its definition to be added.
57
  */
58
+ $table_column_arr = array(
59
  $wpdb->prefix . 'mlw_quizzes' => array( 'quiz_author_id' => 'INT NOT NULL' ),
60
+ $wpdb->prefix . 'mlw_results' => array( 'unique_id' => 'VARCHAR(255) NOT NULL' ),
61
  );
62
 
63
+ foreach ( $table_column_arr as $table => $column_def ) {
64
+ foreach ( $column_def as $col_name => $col_def ) {
65
+ $table_col_obj = $wpdb->get_results(
66
+ $wpdb->prepare(
67
+ 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ',
68
+ $wpdb->dbname,
69
+ $table,
70
+ $col_name
71
+ )
72
+ );
73
 
74
  if ( empty( $table_col_obj ) ) {
75
  $wpdb->query( 'ALTER TABLE ' . $table . ' ADD ' . $col_name . ' ' . $col_def );
80
  update_option( 'qsm_update_db_column', '1' );
81
 
82
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
+ // Update result db
85
+ if ( get_option( 'qsm_update_result_db_column', '' ) != '1' ) {
86
+ global $wpdb;
87
+ $result_table_name = $wpdb->prefix . 'mlw_results';
88
+ $table_result_col_obj = $wpdb->get_results(
89
+ $wpdb->prepare(
90
+ 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ',
91
+ $wpdb->dbname,
92
+ $result_table_name,
93
+ 'form_type'
94
+ )
95
+ );
96
+ if ( empty( $table_result_col_obj ) ) {
97
+ $wpdb->query( "ALTER TABLE $result_table_name ADD form_type INT NOT NULL" );
98
+ }
99
+ update_option( 'qsm_update_result_db_column', '1' );
100
+ }
101
+
102
+ /**
103
+ * Changed the system word to quiz_system in quiz table
104
+ *
105
+ * @since 7.0.0
106
+ */
107
+ if ( get_option( 'qsm_update_quiz_db_column', '' ) != '1' ) {
108
+ global $wpdb;
109
+ $quiz_table_name = $wpdb->prefix . 'mlw_quizzes';
110
+ $table_quiz_col_obj = $wpdb->get_results(
111
+ $wpdb->prepare(
112
+ 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ',
113
+ $wpdb->dbname,
114
+ $quiz_table_name,
115
+ 'system'
116
+ )
117
+ );
118
+ if ( ! empty( $table_quiz_col_obj ) ) {
119
+ $wpdb->query( "ALTER TABLE $quiz_table_name CHANGE `system` `quiz_system` INT(11) NOT NULL;" );
120
+ }
121
+ update_option( 'qsm_update_quiz_db_column', '1' );
122
+ }
123
+
124
+ /**
125
+ * Changed result table column data type
126
+ *
127
+ * @since 7.0.1
128
+ */
129
+ if ( get_option( 'qsm_update_result_db_column_datatype', '' ) != '1' ) {
130
+ global $wpdb;
131
+ $result_table_name = $wpdb->prefix . 'mlw_results';
132
+ $table_quiz_result_obj = $wpdb->get_row(
133
+ $wpdb->prepare(
134
+ 'SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ',
135
+ $wpdb->dbname,
136
+ $result_table_name,
137
+ 'quiz_results'
138
+ ),
139
+ ARRAY_A
140
+ );
141
+ if ( isset( $table_quiz_result_obj['DATA_TYPE'] ) && $table_quiz_result_obj['DATA_TYPE'] == 'text' ) {
142
+ $wpdb->query( "ALTER TABLE $result_table_name CHANGE `quiz_results` `quiz_results` LONGTEXT;" );
143
+ }
144
+ update_option( 'qsm_update_result_db_column_datatype', '1' );
145
+ }
146
+
147
+ /**
148
+ * Add new column in question table
149
+ *
150
+ * @since 7.0.3
151
+ */
152
+ if ( get_option( 'qsm_add_new_column_question_table_table', '1' ) <= 3 ) {
153
+ $total_count_val = get_option( 'qsm_add_new_column_question_table_table', '1' );
154
+ global $wpdb;
155
+ $question_table_name = $wpdb->prefix . 'mlw_questions';
156
+ $table_result_col_obj = $wpdb->get_results(
157
+ $wpdb->prepare(
158
+ 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ',
159
+ $wpdb->dbname,
160
+ $question_table_name,
161
+ 'deleted_question_bank'
162
+ )
163
+ );
164
+ if ( empty( $table_result_col_obj ) ) {
165
+ $wpdb->query( "ALTER TABLE $question_table_name ADD deleted_question_bank INT NOT NULL" );
166
+ }
167
+ $inc_val = $total_count_val + 1;
168
+ update_option( 'qsm_add_new_column_question_table_table', $inc_val );
169
+ }
170
+ }
171
 
172
+ add_action( 'admin_init', 'qsm_change_the_post_type' );
173
  /**
174
  * @since version 6.4.8
175
  * Transfer all quiz post to new cpt 'qsm_quiz'
176
  */
177
+ function qsm_change_the_post_type() {
178
+ if ( get_option( 'qsm_change_the_post_type', '' ) != '1' ) {
179
+ $post_arr = array(
180
+ 'post_type' => 'quiz',
181
+ 'posts_per_page' => -1,
182
+ 'post_status' => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'trash' ),
183
+ );
184
+ $my_query = new WP_Query( $post_arr );
185
+
186
+ if ( $my_query->have_posts() ) {
187
+ while ( $my_query->have_posts() ) {
188
+ $my_query->the_post();
189
+
190
+ $post_id = get_the_ID();
191
+ $post_obj = get_post( $post_id );
192
+ if ( $post_obj->post_status == 'trash' ) {
193
+ $post_obj->post_status = 'draft';
194
+ }
195
+ $post_obj->post_type = 'qsm_quiz';
196
+ wp_update_post( $post_obj );
197
+ }
198
+ wp_reset_postdata();
199
+ }
200
+ update_option( 'qsm_change_the_post_type', '1' );
201
+ flush_rewrite_rules();
202
+ }
203
  }
204
 
205
  /**
206
  * @since 7.0.0
207
  * @param arr $single_option
208
  */
209
+ function qsm_display_question_option( $key, $single_option ) {
210
+ $type = isset( $single_option['type'] ) ? $single_option['type'] : 'text';
211
+ $show = isset( $single_option['show'] ) ? explode( ',', $single_option['show'] ) : array();
212
  $show_class = '';
213
+ if ( $show ) {
214
+ foreach ( $show as $show_value ) {
215
+ $show_class .= 'qsm_show_question_type_' . trim( $show_value ) . ' ';
216
  }
217
  $show_class .= ' qsm_hide_for_other';
218
  }
219
+ $tooltip = '';
220
+ $document_text = '';
221
+ if ( isset( $single_option['tooltip'] ) && $single_option['tooltip'] != '' ) {
222
+ $tooltip .= '<span class="dashicons dashicons-editor-help qsm-tooltips-icon">';
223
+ $tooltip .= '<span class="qsm-tooltips">' . $single_option['tooltip'] . '</span>';
224
+ $tooltip .= '</span>';
225
+ }
226
+ if ( isset( $single_option['documentation_link'] ) && $single_option['documentation_link'] != '' ) {
227
+ $document_text .= '<a class="qsm-question-doc" href="' . $single_option['documentation_link'] . '" target="_blank" title="' . __( 'View Documentation', 'quiz-master-next' ) . '">';
228
+ $document_text .= '<span class="dashicons dashicons-media-document"></span>';
229
+ $document_text .= '</a>';
230
+ }
231
+ switch ( $type ) {
232
+ case 'text':
233
+ ?>
234
+ <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
235
+ <label>
236
+ <?php echo isset( $single_option['label'] ) ? $single_option['label'] : ''; ?>
237
+ <?php echo $tooltip; ?>
238
+ <?php echo $document_text; ?>
239
+ </label>
240
+ <input type="text" name="<?php echo $key; ?>"
241
+ value="<?php echo isset( $single_option['default'] ) ? $single_option['default'] : ''; ?>"
242
+ id="<?php echo $key; ?>" />
243
+ </div>
244
+ <?php
245
+ break;
246
+
247
+ case 'number':
248
+ ?>
249
+ <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
250
+ <label>
251
+ <?php echo isset( $single_option['label'] ) ? $single_option['label'] : ''; ?>
252
+ <?php echo $tooltip; ?>
253
+ <?php echo $document_text; ?>
254
+ </label>
255
+ <input type="number" name="<?php echo $key; ?>"
256
+ value="<?php echo isset( $single_option['default'] ) ? $single_option['default'] : ''; ?>"
257
+ id="<?php echo $key; ?>" />
258
+ </div>
259
+ <?php
260
+ break;
261
+
262
+ case 'select':
263
+ ?>
264
+ <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
265
+ <label>
266
+ <?php echo isset( $single_option['label'] ) ? $single_option['label'] : ''; ?>
267
+ <?php echo $tooltip; ?>
268
+ <?php echo $document_text; ?>
269
+ </label>
270
+ <select name="<?php echo $key; ?>" id="<?php echo $key; ?>">
271
+ <?php
272
+ $default = isset( $single_option['default'] ) ? $single_option['default'] : '';
273
+ if ( isset( $single_option['options'] ) && is_array( $single_option['options'] ) ) {
274
+ foreach ( $single_option['options'] as $key => $value ) {
275
+ $selected = $key === $default ? 'selected = selected' : '';
276
+ ?>
277
+ <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value; ?></option>
278
+ <?php
279
+ }
280
+ }
281
+ ?>
282
+ </select>
283
+ </div>
284
+ <?php
285
+ break;
286
+
287
+ case 'textarea':
288
+ ?>
289
+ <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
290
+ <label>
291
+ <?php echo isset( $single_option['label'] ) ? $single_option['label'] : ''; ?>
292
+ <?php echo $tooltip; ?>
293
+ <?php echo $document_text; ?>
294
+ </label>
295
+ <textarea id="<?php echo $key; ?>"
296
+ name="<?php echo $key; ?>"><?php echo isset( $single_option['default'] ) ? $single_option['default'] : ''; ?></textarea>
297
+ </div>
298
+ <?php
299
+ break;
300
+
301
+ case 'category':
302
+ ?>
303
+ <div id="category_area" class="qsm-row <?php echo $show_class; ?>">
304
+ <label>
305
+ <?php echo isset( $single_option['label'] ) ? $single_option['label'] : ''; ?>
306
+ <?php echo $tooltip; ?>
307
+ <?php echo $document_text; ?>
308
+ </label>
309
+ <div id="categories">
310
+ <a id="qsm-category-add-toggle" class="hide-if-no-js">
311
+ <?php _e( '+ Add New Category', 'quiz-master-next' ); ?>
312
+ </a>
313
+ <p id="qsm-category-add" style="display: none;">
314
+ <input type="radio" style="display: none;" name="category" class="category-radio" id="new_category_new"
315
+ value="new_category"><label for="new_category_new"><input type='text' id='new_category' value=''
316
+ placeholder="Add new category" /></label>
317
+ </p>
318
+ </div>
319
+ </div>
320
+ <?php
321
+ break;
322
+
323
+ case 'multi_checkbox':
324
+ ?>
325
+ <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
326
+ <label>
327
+ <?php echo isset( $single_option['label'] ) ? $single_option['label'] : ''; ?>
328
+ <?php echo $tooltip; ?>
329
+ <?php echo $document_text; ?>
330
+ </label>
331
+ <?php
332
+ $parent_key = $key;
333
+ $default = isset( $single_option['default'] ) ? $single_option['default'] : '';
334
+ if ( isset( $single_option['options'] ) && is_array( $single_option['options'] ) ) {
335
+ foreach ( $single_option['options'] as $key => $value ) {
336
+ $selected = $key === $default ? 'checked' : '';
337
+ ?>
338
+ <input name="<?php echo $parent_key; ?>[]" type="checkbox" value="<?php echo $key; ?>" <?php echo $selected; ?> />
339
+ <?php echo $value; ?><br />
340
+ <?php
341
+ }
342
+ }
343
+ ?>
344
+ </div>
345
+ <?php
346
+ break;
347
+
348
+ case 'single_checkbox':
349
+ ?>
350
+ <div id="<?php echo $key; ?>_area" class="qsm-row <?php echo $show_class; ?>">
351
+ <label>
352
+ <?php
353
+ $parent_key = $key;
354
+ $default = isset( $single_option['default'] ) ? $single_option['default'] : '';
355
+ if ( isset( $single_option['options'] ) && is_array( $single_option['options'] ) ) {
356
+ foreach ( $single_option['options'] as $key => $value ) {
357
+ $selected = $key === $default ? 'checked' : '';
358
+ ?>
359
+ <input name="<?php echo $parent_key; ?>" id="<?php echo $parent_key; ?>" type="checkbox"
360
+ value="<?php echo $key; ?>" <?php echo $selected; ?> />
361
+ <?php
362
+ }
363
+ }
364
+ ?>
365
+ <?php echo isset( $single_option['label'] ) ? $single_option['label'] : ''; ?>
366
+ <?php echo $tooltip; ?>
367
+ <?php echo $document_text; ?>
368
+ </label>
369
+ </div>
370
+ <?php
371
+ break;
372
+
373
+ default:
374
+ // Do nothing
375
+ }
376
 
377
  }
378
 
380
  * @since 7.0
381
  * New quiz popup
382
  */
383
+ function qsm_create_new_quiz_wizard() {
384
+ global $mlwQuizMasterNext;
385
+ global $themes_data;
386
+ qsm_fetch_theme_data();
387
+ ?>
388
+ <div class="qsm-popup qsm-popup-slide" id="model-wizard" aria-hidden="true">
389
+ <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
390
+ <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-2-title">
391
+ <header class="qsm-popup__header">
392
+ <h2 class="qsm-popup__title" id="modal-2-title">
393
+ <?php _e( 'Create New Quiz Or Survey', 'quiz-master-next' ); ?></h2>
394
+ <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
395
+ </header>
396
+ <form action="" method="post" id="new-quiz-form">
397
+ <?php wp_nonce_field( 'qsm_new_quiz', 'qsm_new_quiz_nonce' ); ?>
398
+ <main class="qsm-popup__content" id="modal-2-content">
399
+ <div class="qsm-wizard-menu">
400
+ <div class="qsm-logo"><img alt="" src="<?php echo QSM_PLUGIN_URL; ?>/assets/icon-128x128.png">
401
+ </div>
402
+ <div class="qsm-wizard-wrap active" data-show="select_themes">
403
+ <span
404
+ class="qsm-wizard-step-text"><?php echo _e( 'Select theme', 'quiz-master-next' ); ?></span>
405
+ </div>
406
+ <div class="qsm-wizard-wrap" data-show="quiz_settings">
407
+ <span
408
+ class="qsm-wizard-step-text"><?php echo _e( 'Quiz Settings', 'quiz-master-next' ); ?></span>
409
+ </div>
410
+ <div class="qsm-wizard-wrap" data-show="addons_list">
411
+ <span class="qsm-wizard-step-text"><?php echo _e( 'Addons', 'quiz-master-next' ); ?></span>
412
+ </div>
413
+ <span class="qsm-wizard-step-text-optional">
414
+ <?php echo _e( '(Optional)', 'quiz-master-next' ); ?>
415
+ </span>
416
+ </div>
417
+ <ul style="display: none;" class="qsm-new_menu_tab_items">
418
+ <li class="qsm-new_menu_tab_li active" data-show="quiz_settings">
419
+ <a href="#">
420
+ <div class="nav-item-label">
421
+ <span class="nav-item-label-icon dashicons dashicons-admin-generic "></span>
422
+ <div class="nav-item-label-content">
423
+ <h4><?php _e( 'Quiz Setting', 'quiz-master-next' ); ?></h4>
424
+ <span><?php _e( 'Fill quiz settings as per preferences', 'quiz-master-next' ); ?></span>
425
+ </div>
426
+ </div>
427
+ </a>
428
+ </li>
429
+ <li class="qsm-new_menu_tab_li" data-show="select_themes">
430
+ <a href="#">
431
+ <div class="nav-item-label">
432
+ <span class="nav-item-label-icon dashicons dashicons-layout"></span>
433
+ <div class="nav-item-label-content">
434
+ <h4><?php _e( 'Select Themes', 'quiz-master-next' ); ?></h4>
435
+ <span><?php _e( 'Use pre-made theme to speed up the things.', 'quiz-master-next' ); ?></span>
436
+ </div>
437
+ </div>
438
+ </a>
439
+ </li>
440
+ <li class="qsm-new_menu_tab_li" data-show="addons_list">
441
+ <a href="#">
442
+ <div class="nav-item-label">
443
+ <span class="nav-item-label-icon dashicons dashicons-welcome-add-page"></span>
444
+ <div class="nav-item-label-content">
445
+ <h4><?php _e( 'Addons', 'quiz-master-next' ); ?></h4>
446
+ <span><?php _e( 'Use 40+ addons to customize the quiz.', 'quiz-master-next' ); ?></span>
447
+ </div>
448
+ </div>
449
+ </a>
450
+ </li>
451
+ </ul>
452
+ <div id="quiz_settings" class="qsm-new-menu-elements" style="display: none;">
453
+ <div class="input-group">
454
+ <label for="quiz_name"><?php _e( 'Quiz Name', 'quiz-master-next' ); ?>
455
+ <span
456
+ class="qsm-opt-desc"><?php _e( 'Enter a name for this Quiz.', 'quiz-master-next' ); ?></span>
457
+ </label>
458
+ <input type="text" class="quiz_name" name="quiz_name" value="" required="">
459
+ </div>
460
+ <div class="input-group featured_image">
461
+ <label for="quiz_name"><?php _e( 'Quiz Featured Image', 'quiz-master-next' ); ?>
462
+ <span class="qsm-opt-desc">
463
+ <?php _e( 'Enter an external URL or Choose from Media Library.', 'quiz-master-next' ); ?>
464
+ <?php _e( 'Can be changed further from style tab', 'quiz-master-next' ); ?>
465
+ </span>
466
+ </label>
467
+ <span id="qsm_span">
468
+ <input type="text" class="quiz_featured_image" name="quiz_featured_image" value="">
469
+ <a id="set_featured_image"
470
+ class="button "><?php _e( 'Set Featured Image', 'quiz-master-next' ); ?></a>
471
+ </span>
472
+ </div>
473
+ <?php
474
+ $all_settings = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_options' );
475
+ $quiz_setting_option = array(
476
+ 'form_type' => array(
477
+ 'option_name' => __( 'Form Type', 'quiz-master-next' ),
478
+ 'value' => 0,
479
+ ),
480
+ 'system' => array(
481
+ 'option_name' => __( 'Graded System', 'quiz-master-next' ),
482
+ 'value' => 0,
483
+ ),
484
+ 'pagination' => array(
485
+ 'option_name' => __( 'Questions Per Page', 'quiz-master-next' ),
486
+ 'value' => 0,
487
+ ),
488
+ 'progress_bar' => array(
489
+ 'option_name' => __( 'Show Progress Bar', 'quiz-master-next' ),
490
+ 'value' => 0,
491
+ ),
492
+ 'timer_limit' => array(
493
+ 'option_name' => __( 'Time Limit (in Minute)', 'quiz-master-next' ),
494
+ 'value' => 0,
495
+ ),
496
+ 'enable_pagination_quiz' => array(
497
+ 'option_name' => __( 'Show current page number', 'quiz-master-next' ),
498
+ 'value' => 0,
499
+ ),
500
+ 'require_log_in' => array(
501
+ 'option_name' => __( 'Require User Login', 'quiz-master-next' ),
502
+ 'value' => 0,
503
+ ),
504
+ 'disable_scroll_next_previous_click' => array(
505
+ 'option_name' => __( 'Disable scroll on next and previous button click?', 'quiz-master-next' ),
506
+ 'value' => 0,
507
+ ),
508
+ );
509
+ $quiz_setting_option = apply_filters( 'qsm_quiz_wizard_settings_option', $quiz_setting_option );
510
+ if ( $quiz_setting_option ) {
511
+ foreach ( $quiz_setting_option as $key => $single_setting ) {
512
+ $key = array_search( $key, array_column( $all_settings, 'id' ) );
513
+ $field = $all_settings[ $key ];
514
+ $field['label'] = $single_setting['option_name'];
515
+ $field['default'] = $single_setting['value'];
516
+ echo '<div class="input-group">';
517
+ QSM_Fields::generate_field( $field, $single_setting['value'] );
518
+ echo '</div>';
519
+ }
520
+ } else {
521
+ _e( 'No settings found!', 'quiz-master-next' );
522
+ }
523
+ ?>
524
+ </div>
525
+ <div id="select_themes" class="qsm-new-menu-elements">
526
+ <div class="theme-browser rendered">
527
+ <div class="themes wp-clearfix">
528
+ <ul class="theme-sub-menu">
529
+ <li class="active"><a data-show="downloaded_theme"
530
+ href="#"><?php _e( 'Themes', 'quiz-master-next' ); ?></a></li>
531
+ <?php if ( ! empty( $themes_data ) ) { ?>
532
+ <li><a data-show="browse_themes"
533
+ href="#"><?php _e( 'Explore Marketplace', 'quiz-master-next' ); ?></a></li>
534
+ <?php } ?>
535
+ </ul>
536
+ <div class="theme-wrap" id="downloaded_theme">
537
+ <?php
538
+ qsm_get_installed_theme( 0, 'wizard_theme_list' );
539
+ qsm_get_default_wizard_themes();
540
+ ?>
541
+ </div>
542
+ <div class="theme-wrap" id="browse_themes" style="display: none;">
543
+ <?php qsm_get_market_themes(); ?>
544
+ </div>
545
+ </div>
546
+ </div>
547
+ </div>
548
+ <div id="addons_list" class="qsm-new-menu-elements" style="display: none;">
549
+ <div class="qsm-addon-setting-wrap">
550
+ <div id="qsm_add_addons" class="qsm-primary-acnhor">
551
+ <div class="qsm-quiz-page-addon qsm-addon-page-list">
552
+ <?php
553
+ $popular_addons = qsm_get_widget_data( 'popular_products' );
554
+ if ( empty( $popular_addons ) ) {
555
+ $qsm_admin_dd = qsm_fetch_data_from_script();
556
+ $popular_addons = isset( $qsm_admin_dd['popular_products'] ) ? $qsm_admin_dd['popular_products'] : array();
557
+ }
558
+ ?>
559
+ <div class="qsm_popular_addons" id="qsm_popular_addons">
560
+ <div class="popuar-addon-ul">
561
+ <?php
562
+ if ( $popular_addons ) {
563
+ foreach ( $popular_addons as $key => $single_arr ) {
564
+ ?>
565
+ <div>
566
+ <a href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
567
+ target="_blank" rel="noopener">
568
+ <span class="addon-itd-wrap">
569
+ <img alt="" src="<?php echo $single_arr['img']; ?>" />
570
+ </span>
571
+ <span class="addon-price">
572
+ <a class="addon-get-link"
573
+ href="<?php echo $single_arr['link']; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
574
+ target="_blank" rel="noopener">
575
+ <?php
576
+ _e( 'Buy now', 'quiz-master-next' );
577
+ echo ' : $ ';
578
+ echo array_values( $single_arr['price'] )[0];
579
+ ?>
580
+ </a>
581
+ </span>
582
+ </a>
583
+ </div>
584
+ <?php
585
+ }
586
+ }
587
+ ?>
588
+ </div>
589
+ </div>
590
+ </div>
591
+ </div>
592
+ <div class="qsm-addon-list-right">
593
+ <span><?php _e( '40+ addons available', 'quiz-master-next' ); ?></span>
594
+ <a style="text-decoration: none; font-size: 15px;" rel="noopener"
595
+ href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin"
596
+ target="_blank"><?php _e( 'Browse All Addons', 'quiz-master-next' ); ?></a>
597
+ </div>
598
+ </div>
599
+ </main>
600
+ </form>
601
+ <footer class="qsm-popup__footer">
602
+ <button id="prev-theme-button"
603
+ class="button qsm-wizard-borderless"><?php _e( 'Back', 'quiz-master-next' ); ?></button>
604
+ <button id="prev-quiz-button"
605
+ class="button qsm-wizard-borderless"></span><?php _e( 'Back', 'quiz-master-next' ); ?></button>
606
+ <button class="button qsm-wizard-borderless" data-micromodal-close
607
+ aria-label="Close this dialog window"><?php _e( 'Cancel', 'quiz-master-next' ); ?></button>
608
+ <button id="next-quiz-button"
609
+ class="button button-primary"><?php _e( 'Next', 'quiz-master-next' ); ?></button>
610
+ <button id="choose-addons-button"
611
+ class="button button-primary"><?php _e( 'Next', 'quiz-master-next' ); ?></button>
612
+ <button id="create-quiz-button"
613
+ class="button button-primary"><?php _e( 'Create Quiz', 'quiz-master-next' ); ?></button>
614
+ </footer>
615
+ </div>
616
+ </div>
617
+ </div>
618
  <?php
619
  }
620
 
622
  * @since 7.0
623
  * @return array Template Variable
624
  */
625
+ function qsm_text_template_variable_list() {
626
+ $variable_list = array(
627
+ '%POINT_SCORE%' => __( 'Score for the quiz when using points', 'quiz-master-next' ),
628
+ '%MAXIMUM_POINTS%' => __( 'Maximum possible points one can score', 'quiz-master-next' ),
629
+ '%AVERAGE_POINT%' => __( 'The average amount of points user had per question', 'quiz-master-next' ),
630
+ '%AMOUNT_CORRECT%' => __( 'The number of correct answers the user had', 'quiz-master-next' ),
631
+ '%AMOUNT_INCORRECT%' => __( 'The number of incorrect answers the user had', 'quiz-master-next' ),
632
+ '%AMOUNT_ATTEMPTED%' => __( 'The number of questions are attempted', 'quiz-master-next' ),
633
+ '%TOTAL_QUESTIONS%' => __( 'The total number of questions in the quiz', 'quiz-master-next' ),
634
+ '%CORRECT_SCORE%' => __( 'Score for the quiz when using correct answers', 'quiz-master-next' ),
635
+ '%USER_NAME%' => __( 'The name the user entered before the quiz', 'quiz-master-next' ),
636
+ '%FULL_NAME%' => __( 'The full name of user with first name and last name', 'quiz-master-next' ),
637
+ '%USER_BUSINESS%' => __( 'The business the user entered before the quiz', 'quiz-master-next' ),
638
+ '%USER_PHONE%' => __( 'The phone number the user entered before the quiz', 'quiz-master-next' ),
639
+ '%USER_EMAIL%' => __( 'The email the user entered before the quiz', 'quiz-master-next' ),
640
+ '%QUIZ_NAME%' => __( 'The name of the quiz', 'quiz-master-next' ),
641
+ '%QUIZ_LINK%' => __( 'The link of the quiz', 'quiz-master-next' ),
642
+ '%QUESTIONS_ANSWERS%' => __( 'Shows the question, the answer the user provided, and the correct answer', 'quiz-master-next' ),
643
+ '%COMMENT_SECTION%' => __( 'The comments the user entered into comment box if enabled', 'quiz-master-next' ),
644
+ '%TIMER%' => __( 'The amount of time user spent on quiz in seconds', 'quiz-master-next' ),
645
+ '%TIMER_MINUTES%' => __( 'The amount of time user spent on quiz in minutes', 'quiz-master-next' ),
646
+ '%CATEGORY_POINTS_X%' => __( 'X: Category name - The amount of points a specific category earned.', 'quiz-master-next' ),
647
+ '%CATEGORY_SCORE_X%' => __( 'X: Category name - The score a specific category earned.', 'quiz-master-next' ),
648
+ '%CATEGORY_AVERAGE_POINTS%' => __( 'The average points from all categories.', 'quiz-master-next' ),
649
+ '%CATEGORY_AVERAGE_SCORE%' => __( 'The average score from all categories.', 'quiz-master-next' ),
650
+ '%QUESTION%' => __( 'The question that the user answered', 'quiz-master-next' ),
651
+ '%USER_ANSWER%' => __( 'The answer the user gave for the question', 'quiz-master-next' ),
652
+ '%USER_ANSWERS_DEFAULT%' => __( 'The answer the user gave for the question with default design', 'quiz-master-next' ),
653
+ '%CORRECT_ANSWER%' => __( 'The correct answer for the question', 'quiz-master-next' ),
654
+ '%USER_COMMENTS%' => __( 'The comments the user provided in the comment field for the question', 'quiz-master-next' ),
655
+ '%CORRECT_ANSWER_INFO%' => __( 'Reason why the correct answer is the correct answer', 'quiz-master-next' ),
656
+ '%CURRENT_DATE%' => __( 'The Current Date', 'quiz-master-next' ),
657
+ '%QUESTION_POINT_SCORE%' => __( 'Point Score of the question', 'quiz-master-next' ),
658
+ '%QUESTION_MAX_POINTS%' => __( 'Maximum points of the question', 'quiz-master-next' ),
659
+ '%FACEBOOK_SHARE%' => __( 'Displays button to share on Facebook.', 'quiz-master-next' ),
660
+ '%TWITTER_SHARE%' => __( 'Displays button to share on Twitter.', 'quiz-master-next' ),
661
+ '%RESULT_LINK%' => __( 'The link of the result page.', 'quiz-master-next' ),
662
+ );
663
+ $variable_list = apply_filters( 'qsm_text_variable_list', $variable_list );
664
+ return $variable_list;
665
  }
666
 
667
+ add_action( 'admin_init', 'qsm_update_question_type_col_val' );
668
 
669
  /**
670
+ * Replace `fill-in-the-blank` value in question_type_column for Fill
671
  * In The Blank question types.
672
  *
673
  * @since version 6.4.12
674
  */
675
  function qsm_update_question_type_col_val() {
 
676
  global $wpdb;
677
  global $mlwQuizMasterNext;
678
 
679
  if ( version_compare( $mlwQuizMasterNext->version, '6.4.12', '<' ) ) {
680
+ if ( get_option( 'qsm_upated_question_type_val' ) != '1' ) {
681
+ $table_name = $wpdb->prefix . 'mlw_questions';
682
+ $status = $wpdb->query(
683
+ $wpdb->prepare(
684
+ 'UPDATE ' . $table_name . " SET `question_type_new` = REPLACE( `question_type_new`, 'fill-in-the-blank', %d )",
685
+ 14
686
+ )
687
+ );
688
 
689
+ if ( $status ) {
690
+ update_option( 'qsm_upated_question_type_val', '1' );
691
  }
692
  }
693
  }
695
 
696
  /**
697
  * Check and create table if not present
698
+ *
699
  * @since 7.0.0
700
  */
701
+ function qsm_check_create_tables() {
702
+ global $wpdb;
703
+ $quiz_table_name = $wpdb->prefix . 'mlw_quizzes';
704
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_table_name'" ) != $quiz_table_name ) {
705
+ QSM_Install::install();
706
+ }
707
+
708
+ $quiz_theme_table_name = $wpdb->prefix . 'mlw_themes';
709
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_theme_table_name'" ) != $quiz_theme_table_name ) {
710
+ QSM_Install::install();
711
+ }
712
  }
713
+ add_action( 'admin_init', 'qsm_check_create_tables' );
714
 
715
  /**
716
  * Redirect the admin old slug to new slug
717
+ *
718
  * @since 7.0.0
719
  */
720
+ function qsm_admin_page_access_func() {
721
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'quiz-master-next/mlw_quizmaster2.php' ) {
722
+ wp_redirect( admin_url( 'admin.php?page=qsm_dashboard' ) );
723
+ exit;
724
+ }
725
+ }
726
+ add_action( 'admin_page_access_denied', 'qsm_admin_page_access_func' );
727
+
728
+ function qsm_fetch_theme_data() {
729
+ global $themes_data;
730
+ $themes_data = qsm_get_widget_data( 'themes' );
731
+ if ( empty( $themes_data ) ) {
732
+ $qsm_admin_dd = qsm_fetch_data_from_script();
733
+ $themes_data = isset( $qsm_admin_dd['themes'] ) ? $qsm_admin_dd['themes'] : array();
734
+ }
735
+ }
736
+
737
+ function qsm_get_installed_theme( $saved_quiz_theme, $wizard_theme_list = '' ) {
738
+ global $mlwQuizMasterNext;
739
+ $active_themes = $mlwQuizMasterNext->theme_settings->get_active_themes();
740
+ $folder_name = QSM_THEME_PATH;
741
+ $folder_slug = QSM_THEME_SLUG;
742
+ $theme_folders = array();
743
+ if ( ! empty( $active_themes ) ) {
744
+ foreach ( $active_themes as $dir ) {
745
+ $theme_dir = $folder_name . $dir['theme'];
746
+ if ( is_dir( $theme_dir ) ) {
747
+ $theme_folders[] = $dir;
748
+ }
749
+ }
750
+ }
751
+ ?>
752
+ <div class="theme-wrapper theme
753
+ <?php
754
+ if ( $saved_quiz_theme == '' || $saved_quiz_theme == 0 ) {
755
+ echo 'active';
756
+ }
757
+ ?>
758
+ ">
759
+ <input style="display: none" type="radio" name="quiz_theme_id" value="0"
760
+ <?php checked( $saved_quiz_theme, '0', true ); ?>>
761
+ <div class="theme-screenshot" id="qsm-theme-screenshot">
762
+ <img alt="" src="<?php echo QSM_PLUGIN_URL . '/assets/screenshot-default-theme.png'; ?>">
763
+ <div class="downloaded-theme-button">
764
+ <span class="button button-primary"><?php _e( 'Select', 'quiz-master-next' ); ?></span>
765
+ </div>
766
+ </div>
767
+ <div class="theme-id-container">
768
+ <h2 class="theme-name" id="emarket-name"><?php echo __( 'Default Theme', 'quiz-master-next' ); ?></h2>
769
+ <div class="theme-actions">
770
+ <?php if ( $saved_quiz_theme != 'default' ) { ?>
771
+ <button class="button qsm-activate-theme"><?php _e( 'Activate', 'quiz-master-next' ); ?></button>
772
+ <?php } ?>
773
+ </div>
774
+ </div>
775
+ </div>
776
+ <?php do_action( 'qsm_add_after_default_theme' ); ?>
777
+ <?php
778
+ if ( $theme_folders ) {
779
+ foreach ( $theme_folders as $key => $theme ) {
780
+ $theme_name = $theme['theme'];
781
+ $theme_id = $theme['id'];
782
+ ?>
783
+ <div class="theme-wrapper theme
784
+ <?php
785
+ if ( $saved_quiz_theme == $theme_id ) {
786
+ echo 'active';
787
+ }
788
+ ?>
789
+ ">
790
+ <input style="display: none" type="radio" name="quiz_theme_id" value="<?php echo (int) $theme_id; ?>"
791
+ <?php checked( $saved_quiz_theme, $theme_id, true ); ?>>
792
+ <div class="theme-screenshot" id="qsm-theme-screenshot">
793
+ <img alt="" src="<?php echo $folder_slug . $theme_name . '/screenshot.png'; ?>" />
794
+ <div class="downloaded-theme-button">
795
+ <span class="button button-primary"><?php _e( 'Select', 'quiz-master-next' ); ?></span>
796
+ </div>
797
+ </div>
798
+ <span class="more-details" style="display: none;"><?php _e( 'Templates', 'quiz-master-next' ); ?></span>
799
+ <div class="theme-id-container">
800
+ <h2 class="theme-name" id="emarket-name"><?php echo $theme['theme_name']; ?></h2>
801
+ <div class="theme-actions">
802
+ <?php
803
+ if ( $saved_quiz_theme != $theme_id ) {
804
+ if ( $wizard_theme_list == 'wizard_theme_list' ) {
805
+ ?>
806
+ <?php
807
+ } else {
808
+ ?>
809
+ <button class="button qsm-activate-theme"><?php _e( 'Activate', 'quiz-master-next' ); ?></button>
810
+ <?php
811
+ }
812
+ ?>
813
+ <?php } ?>
814
+ <?php if ( $saved_quiz_theme == $theme_id ) { ?>
815
+ <a class="button button-primary qsm-customize-color-settings"
816
+ href="#"><?php _e( 'Customize', 'quiz-master-next' ); ?></a>
817
+ <?php } ?>
818
+ </div>
819
+ </div>
820
+ </div>
821
+ <?php
822
+ do_action( 'qsm_add_after_themes' );
823
+ }
824
+ }
825
+ }
826
+
827
+ function qsm_get_default_wizard_themes() {
828
+ global $mlwQuizMasterNext;
829
+ global $themes_data;
830
+ $installed_themes = $mlwQuizMasterNext->theme_settings->get_installed_themes();
831
+ $default_themes = array( 'Breeze', 'Fragrance', 'Pool', 'Ivory' );
832
+ $default_themes_data = array();
833
+ $keys_to_unset = array();
834
+ if ( ! empty( $themes_data ) ) {
835
+ foreach ( $default_themes as $theme ) {
836
+ $key = array_search( $theme, array_column( $installed_themes, 'theme_name' ) );
837
+ if ( $key !== false ) { // installed themes to be removed
838
+ $key_to_unset = array_search( $theme, array_column( $themes_data, 'name' ) );
839
+ if ( $key_to_unset !== false ) {
840
+ $keys_to_unset[] = $key_to_unset;
841
+ }
842
+ } else {
843
+ $key_to_move = array_search( $theme, array_column( $themes_data, 'name' ) );
844
+ if ( $key_to_move !== false ) {
845
+ array_push( $default_themes_data, $themes_data[ $key_to_move ] );
846
+ // $keys_to_unset[] = $key_to_move;
847
+ }
848
+ }
849
+ }
850
+ foreach ( $installed_themes as $theme ) {
851
+ $key = array_search( $theme['theme_name'], array_column( $themes_data, 'name' ) );
852
+ if ( $key !== false ) { // installed themes to be removed
853
+ $keys_to_unset[] = $key;
854
+ }
855
+ }
856
+ }
857
+
858
+ $keys_to_unset = array_unique( $keys_to_unset );
859
+ rsort( $keys_to_unset );
860
+ foreach ( $keys_to_unset as $key ) {
861
+ unset( $themes_data[ $key ] );
862
+ }
863
+
864
+ if ( ! empty( $default_themes_data ) ) {
865
+ foreach ( $default_themes_data as $key => $theme ) {
866
+ $theme_name = $theme['name'];
867
+ $theme_url = $theme['link'];
868
+ $theme_screenshot = $theme['img'];
869
+ $theme_demo = $theme['demo'];
870
+ ?>
871
+ <div class="theme-wrapper theme market-theme">
872
+ <div class="theme-screenshot" id="qsm-theme-screenshot">
873
+ <img alt="" src="<?php echo $theme_screenshot; ?>" />
874
+ <div class="market-theme-url">
875
+ <a class="button button-primary" target="_blank" rel="noopener"
876
+ href="<?php echo $theme_demo; ?>"><?php _e( 'Live Preview', 'quiz-master-next' ); ?></a>
877
+ <a class="button" target="_blank" rel="noopener"
878
+ href="<?php echo $theme_url; ?>"><?php _e( 'Buy Now', 'quiz-master-next' ); ?></a>
879
+ </div>
880
+ </div>
881
+ <div class="theme-id-container">
882
+ <h2 class="theme-name" id="emarket-name"><?php echo $theme_name; ?></h2>
883
+ </div>
884
+ </div>
885
+ <?php
886
+ }
887
+ }
888
+ }
889
+
890
+ function qsm_get_market_themes() {
891
+ global $themes_data;
892
+ if ( ! empty( $themes_data ) ) {
893
+ foreach ( $themes_data as $key => $theme ) {
894
+ $theme_name = $theme['name'];
895
+ $theme_url = $theme['link'];
896
+ $theme_screenshot = $theme['img'];
897
+ $theme_demo = $theme['demo'];
898
+ ?>
899
+ <div class="theme-wrapper theme market-theme">
900
+ <div class="theme-screenshot" id="qsm-theme-screenshot">
901
+ <img alt="" src="<?php echo $theme_screenshot; ?>" />
902
+ <div class="market-theme-url">
903
+ <a class="button button-primary" target="_blank" rel="noopener"
904
+ href="<?php echo $theme_demo; ?>"><?php _e( 'Live Preview', 'quiz-master-next' ); ?></a>
905
+ <a class="button" target="_blank" rel="noopener"
906
+ href="<?php echo $theme_url; ?>"><?php _e( 'Buy Now', 'quiz-master-next' ); ?></a>
907
+ </div>
908
+ </div>
909
+ <div class="theme-id-container">
910
+ <h2 class="theme-name" id="emarket-name"><?php echo $theme_name; ?></h2>
911
+ </div>
912
+ </div>
913
+ <?php
914
+ }
915
+ } else {
916
+ ?>
917
+ <div class="empty-market-place">
918
+ <span class="dashicons dashicons-welcome-widgets-menus"></span><br />
919
+ <span class="no-themes-message"><?php _e( 'No more themes found.', 'quiz-master-next' ); ?></span>
920
+ </div>
921
+ <?php
922
+ }
923
  }
 
924
 
925
  /**
926
  * Display roadmap page
927
+ *
928
  * @since 7.1.11
929
  */
930
+ function qsm_generate_roadmap_page() {
931
+ ?>
932
+ <div class="wrap">
933
+ <style>
934
+ iframe {
935
+ height: 1350px;
936
+ }
937
+ </style>
938
+ <iframe src="https://app.productstash.io/roadmaps/5f7b1a36636db50029f51d5c/public" height="900" width="100%"
939
+ frameborder="0"></iframe>
940
+ <script>
941
+ var ps_config = {
942
+ productId: "d24ad9de-78c7-4835-a2a8-3f5ee0317f31"
943
+ };
944
+ </script>
945
+ <script type="text/javascript" src="https://app.productstash.io/js/productstash-embed.js" defer="defer"></script>
946
+ </div>
947
  <?php
948
  }
php/admin/options-page-questions-tab.php CHANGED
@@ -12,15 +12,14 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  * Adds the settings for questions tab to the Quiz Settings page.
13
  *
14
  * @return void
15
- * @since 4.4.0
16
  */
17
  function qsm_settings_questions_tab() {
18
- global $mlwQuizMasterNext;
19
  $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Questions', 'quiz-master-next' ), 'qsm_options_questions_tab_content' );
20
  }
21
  add_action( 'plugins_loaded', 'qsm_settings_questions_tab', 5 );
22
 
23
-
24
  /**
25
  * Adds the content for the options for questions tab.
26
  *
@@ -28,52 +27,66 @@ add_action( 'plugins_loaded', 'qsm_settings_questions_tab', 5 );
28
  * @since 4.4.0
29
  */
30
  function qsm_options_questions_tab_content() {
31
-
32
  global $wpdb;
33
  global $mlwQuizMasterNext;
34
  $question_categories = $wpdb->get_results( "SELECT DISTINCT category FROM {$wpdb->prefix}mlw_questions", 'ARRAY_A' );
35
- $quiz_id = intval( $_GET['quiz_id'] );
36
- $user_id = get_current_user_id();
37
- $form_type = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'form_type' );
38
- $quiz_system = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'system' );
39
- $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('pages', array());
40
- $db_qpages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('qpages', array());
41
- $qpages = array();
42
- if (!empty($pages)) {
43
- $defaultQPage = array('id' => 1, 'quizID' => $quiz_id, 'pagekey' => '', 'hide_prevbtn' => 0, 'questions' => array());
44
- foreach ($pages as $k => $val) {
45
- $qpage = isset($db_qpages[$k]) ? $db_qpages[$k] : $defaultQPage;
46
- $qpage['id'] = $k + 1;
47
- $qpage['pagekey'] = (isset($qpage['pagekey']) && !empty($qpage['pagekey'])) ? $qpage['pagekey'] : uniqid();
48
- $qpage['hide_prevbtn'] = (isset($qpage['hide_prevbtn']) && !empty($qpage['hide_prevbtn'])) ? $qpage['hide_prevbtn'] : 0;
49
- $qpage['questions'] = $val;
50
- $qpages[] = $qpage;
 
 
 
 
 
 
51
  }
52
  } else {
53
- $defaultQPage = array('id' => 1, 'quizID' => $quiz_id, 'pagekey' => uniqid(), 'hide_prevbtn' => 0, 'questions' => array());
54
- $qpages[] = $defaultQPage;
55
- }
56
- $qpages = apply_filters('qsm_filter_quiz_page_attributes', $qpages, $pages);
 
 
 
 
 
 
57
  $json_data = array(
58
- 'quizID' => $quiz_id,
59
- 'answerText' => __( 'Answer', 'quiz-master-next' ),
60
- 'nonce' => wp_create_nonce( 'wp_rest' ),
61
- 'pages' => $pages,
62
- 'qpages' => $qpages,
63
- 'qsm_user_ve' => get_user_meta($user_id, 'rich_editing', true),
64
- 'saveNonce' => wp_create_nonce('ajax-nonce-sandy-page'),
65
- 'categories' => $question_categories,
66
- 'form_type' => $form_type,
67
- 'quiz_system' => $quiz_system,
68
- 'hide_desc_text' => __('Less Description', 'quiz-master-next'),
69
- 'show_desc_text' => __('Add Description', 'quiz-master-next'),
70
- 'show_correct_info_text' => __('Add Correct Answer Info', 'quiz-master-next'),
71
- 'question_bank_nonce' => wp_create_nonce("delete_question_question_bank_nonce"),
72
- 'single_question_nonce' => wp_create_nonce("delete_question_from_database")
73
  );
74
 
75
  // Scripts and styles.
76
  wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
 
 
 
77
  wp_enqueue_script( 'qsm_admin_question_js', plugins_url( '../../js/qsm-admin-question.js', __FILE__ ), array( 'backbone', 'underscore', 'jquery-ui-sortable', 'wp-util', 'micromodal_script', 'qmn_admin_js' ), $mlwQuizMasterNext->version, true );
78
  wp_localize_script( 'qsm_admin_question_js', 'qsmQuestionSettings', $json_data );
79
  wp_enqueue_style( 'qsm_admin_question_css', plugins_url( '../../css/qsm-admin-question.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
@@ -88,475 +101,537 @@ function qsm_options_questions_tab_content() {
88
  $pagination = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'pagination' );
89
  if ( 0 != $pagination ) {
90
  ?>
91
- <div class="notice notice-warning">
92
- <p><?php _e('This quiz has the "How many questions per page would you like?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.', 'quiz-master-next'); ?></p>
93
- </div>
94
- <?php
 
95
  }
96
  $from_total = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'question_from_total' );
97
  if ( 0 != $from_total ) {
98
  ?>
99
- <div class="notice notice-warning">
100
- <p><?php _e('This quiz has the "How many questions should be loaded for quiz?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.', 'quiz-master-next'); ?></p>
101
- </div>
102
- <?php
 
103
  }
104
  $randomness = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'randomness_order' );
105
  if ( 0 != $randomness ) {
106
  ?>
107
- <div class="notice notice-warning">
108
- <p><?php _e('This quiz has the "Are the questions random?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to "No".', 'quiz-master-next'); ?></p>
109
- </div>
110
- <?php
 
111
  }
112
  ?>
113
- <h3 style="display: none;">Questions</h3>
114
- <p style="text-align: right;"><a href="https://quizandsurveymaster.com/docs/v7/questions-tab/" target="_blank">View Documentation</a></p>
115
- <div class="question-controls">
116
- <span><b><?php _e('Total Questions:', 'quiz-master-next'); ?></b> <span id="total-questions"></span></span>
117
- <p class="search-box">
118
- <label class="screen-reader-text" for="question_search">Search Questions:</label>
119
- <input type="search" id="question_search" name="question_search" value="">
120
- <a href="#" class="button"><?php esc_html_e('Search Questions', 'quiz-master-next'); ?></a>
121
- </p>
 
 
 
 
 
 
122
  </div>
123
- <div class="questions quiz_form_type_<?php echo $form_type; ?> quiz_quiz_systen_<?php echo $quiz_system; ?>"><div class="qsm-showing-loader" style="text-align: center;margin-bottom: 20px;"><div class="qsm-spinner-loader"></div></div></div>
124
- <div class="question-create-page">
125
- <div>
126
- <button class="new-page-button button button-primary"><span class="dashicons dashicons-plus-alt2"></span> <?php _e('Create New Page', 'quiz-master-next'); ?></button>
127
- <button style="display: none;" class="save-page-button button button-primary"><?php _e('Save Questions and Pages', 'quiz-master-next'); ?></button>
128
- <span class="spinner" id="save-edit-quiz-pages" style="float: none;"></span>
129
- </div>
130
- </div>
131
- <!-- Popup for question bank -->
132
- <div class="qsm-popup qsm-popup-slide qsm-popup-bank" id="modal-2" aria-hidden="true">
133
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
134
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
135
- <header class="qsm-popup__header">
136
- <h2 class="qsm-popup__title" id="modal-2-title"><?php _e('Add Question From Question Bank', 'quiz-master-next'); ?></h2>
137
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
138
- </header>
139
- <main class="qsm-popup__content" id="modal-2-content">
140
- <input type="hidden" name="add-question-bank-page" id="add-question-bank-page" value="">
141
- <div id="question-bank"></div>
142
- </main>
143
- <footer class="qsm-popup__footer">
144
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window">Close</button>
145
- </footer>
146
- </div>
 
 
 
147
  </div>
148
  </div>
 
149
 
150
 
151
- <!-- Popup for editing question -->
152
- <div class="qsm-popup qsm-popup-slide" id="modal-1" aria-hidden="true">
153
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
154
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
155
- <header class="qsm-popup__header">
156
- <h2 class="qsm-popup__title" id="modal-1-title"><?php _e('Edit Question', 'quiz-master-next'); ?> [ ID: <span id="edit-question-id"></span> ]</h2>
157
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
158
- </header>
159
- <main class="qsm-popup__content" id="modal-1-content">
160
- <input type="hidden" name="edit_question_id" id="edit_question_id" value="">
161
- <div id="poststuff">
162
- <div id="post-body" class="metabox-holder columns-2">
163
- <div id="post-body-content" style="position: relative;">
164
- <div class="qsm-row">
165
- <input type="text" id="question_title" class="question-title" name="question-title" value="" placeholder="<?php _e('Type your question here','quiz-master-next'); ?>">
166
- </div>
167
- <a href="#" class="qsm-show-question-desc-box button button-default"><span class="dashicons dashicons-plus-alt2"></span> <?php _e('Add Description', 'quiz-master-next'); ?></a>
168
- <div class="qsm-row" style="display: none;">
169
- <textarea placeholder="<?php _e('Add your description here', 'quiz-master-next'); ?>" id="question-text"></textarea>
170
- </div>
171
- <hr/>
172
- <div class="qsm-row" style="margin-bottom: 0;">
173
- <?php
174
- $description_arr = array(
175
- array(
176
- 'question_type_id' => 11,
177
- 'description' => __('For this question type, users will see a file upload field on front end.', 'quiz-master-next')
178
- ),
179
- array(
180
- 'question_type_id' => '14',
181
- 'description' => __('Use %BLANK% variable in the description field to display input boxes.', 'quiz-master-next')
182
- ),
183
- array(
184
- 'question_type_id' => '12',
185
- 'description' => __('For this question type, users will see a date input field on front end.', 'quiz-master-next')
186
- ),
187
- array(
188
- 'question_type_id' => '3',
189
- 'description' => __('For this question type, users will see a standard input box on front end.', 'quiz-master-next')
190
- ),
191
- array(
192
- 'question_type_id' => '5',
193
- 'description' => __('For this question type, users will see a standard textarea input box on front end.', 'quiz-master-next')
194
- ),
195
- array(
196
- 'question_type_id' => '6',
197
- 'description' => __('Displays a simple section on front end.', 'quiz-master-next')
198
- ),
199
- array(
200
- 'question_type_id' => '7',
201
- 'description' => __('For this question type, users will see an input box which accepts only number values on front end.', 'quiz-master-next')
202
- ),
203
- array(
204
- 'question_type_id' => '8',
205
- 'description' => __("For this question type, users will see a checkbox on front end. The text in description field will act like it's label.", 'quiz-master-next')
206
- ),
207
- array(
208
- 'question_type_id' => '9',
209
- 'description' => __('For this question type, users will see a Captcha field on front end.', 'quiz-master-next')
210
- ),
211
- array(
212
- 'question_type_id' => '13',
213
- 'description' => __('Use points based grading system for Polar questions.', 'quiz-master-next')
214
- )
215
- );
216
- $description_arr = apply_filters('qsm_question_type_description', $description_arr);
217
- if( $description_arr ){
218
- foreach ( $description_arr as $value ) {
219
- $question_type_id = $value['question_type_id'];
220
- ?>
221
- <p id="question_type_<?php echo $question_type_id; ?>_description" class="question-type-description"><?php echo $value['description']; ?></p>
222
- <?php
223
- }
224
- }
225
- ?>
226
- </div>
227
- <?php
228
- $polar_class = $polar_question_use = '';
229
- if( $form_type == 0 && ($quiz_system == 1 || $quiz_system == 3) ){
230
- $polar_class = 'qsm_show_question_type_13';
231
- $polar_question_use = ',13';
232
- }
233
- ?>
234
- <div id="qsm_optoins_wrapper" class="qsm-row qsm_hide_for_other qsm_show_question_type_0 qsm_show_question_type_1 qsm_show_question_type_2 qsm_show_question_type_3 qsm_show_question_type_4 qsm_show_question_type_5 qsm_show_question_type_7 qsm_show_question_type_10 qsm_show_question_type_12 qsm_show_question_type_14 <?php echo $polar_class; ?>">
235
- <label class="answer-header">
236
- <?php _e( 'Answers', 'quiz-master-next' ); ?>
237
- <a class="qsm-question-doc" href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Answers" target="_blank" title="View Documentation">
238
- <span class="dashicons dashicons-media-document"></span>
239
- </a>
240
- </label>
241
- <div class="correct-header"><?php _e( 'Correct', 'quiz-master-next' ); ?></div>
242
- <div class="answers" id="answers">
243
-
244
- </div>
245
- <div class="new-answer-button">
246
- <a href="#" class="button" id="new-answer-button"><span class="dashicons dashicons-plus"></span> <?php _e( 'Add New Answer!', 'quiz-master-next'); ?></a>
247
- </div>
248
- </div>
249
- <hr style="margin-bottom:25px;">
250
- <a href="#" class="qsm-show-correct-info-box button button-default"><span class="dashicons dashicons-plus-alt2"></span> <?php _e('Add Correct Answer Info', 'quiz-master-next'); ?></a>
251
- <div class="qsm-row" style="display: none;">
252
- <?php
253
- $answer_area_option = array(
254
- 'correct_answer_info' => array(
255
- 'label' => __( 'Correct Answer Info', 'quiz-master-next' ),
256
- 'type' => 'textarea',
257
- 'default' => '',
258
- 'show' => '0,1,2,3,4,5,7,10,12,14' . $polar_question_use,
259
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Correct-Answer-Info'
260
- )
261
- );
262
- $answer_area_option = apply_filters('qsm_question_advanced_option', $answer_area_option);
263
- foreach($answer_area_option as $qo_key => $single_answer_option){
264
- echo qsm_display_question_option($qo_key, $single_answer_option);
265
- }
266
- ?>
267
- </div>
268
- <?php do_action('qsm_question_form_fields', $quiz_id);?>
269
- </div>
270
- <div id="postbox-container-1" class="postbox-container">
271
- <div id="side-sortables" class="meta-box-sortables ui-sortable" style="">
272
- <div id="submitdiv" class="postbox ">
273
- <h2 class="hndle ui-sortable-handle">
274
- <span><?php _e( 'Publish', 'quiz-master-next' ); ?></span>
275
- <span id="qsm-question-id"></span>
276
- </h2>
277
- <div class="inside">
278
- <div class="submitbox" id="submitpost">
279
- <div id="minor-publishing">
280
- <div class="qsm-row">
281
- <label>
282
- <?php _e( 'Question Type', 'quiz-master-next' ); ?>
283
- <?php
284
- $document_text = '';
285
- $document_text .= '<a class="qsm-question-doc" href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Question-Type" target="_blank" title="'. __('View Documentation', 'quiz-master-next') .'">';
286
- $document_text .= '<span class="dashicons dashicons-media-document"></span>';
287
- $document_text .= '</a>';
288
- echo $document_text;
289
- ?>
290
- </label>
291
- <select name="question_type" id="question_type">
292
- <?php
293
- foreach ( $question_types as $type ) {
294
- echo "<option value='{$type['slug']}'>{$type['name']}</option>";
295
- }
296
- ?>
297
- </select>
298
- <a class="question_info_tag hidden" target="_blank" href="https://quizandsurveymaster.com/docs/about-quiz-survey-master/question-types/"><?php _e('How to use this option?','quiz-master-next') ?></a>
299
- <p class="hidden" id="question_type_info"></p>
300
- </div>
301
- <?php
302
- $simple_question_option = array(
303
- 'change-answer-editor' => array(
304
- 'label' => __( 'Answers Type', 'quiz-master-next' ),
305
- 'type' => 'select',
306
- 'priority' => '1',
307
- 'options' => array(
308
- 'text' => __( 'Text Answers', 'quiz-master-next' ),
309
- 'rich' => __( 'Rich Answers', 'quiz-master-next' ),
310
- ),
311
- 'default' => 'text',
312
- 'show' => '0,1,2,4,13',
313
- //'tooltip' => __('You can use text and rich answer for question answers.', 'quiz-master-next'),.
314
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Answer-Type'
315
- ),
316
- 'required' => array(
317
- 'label' => __( 'Required?', 'quiz-master-next' ),
318
- 'type' => 'single_checkbox',
319
- 'priority' => '2',
320
- 'options' => array(
321
- //'1' => __( 'No', 'quiz-master-next' ),
322
- '0' => __( 'Yes', 'quiz-master-next' )
323
- ),
324
- 'default' => '0'
325
- ),
326
- );
327
- $simple_question_option = apply_filters('qsm_question_format_option', $simple_question_option);
328
- $keys = array_column($simple_question_option, 'priority');
329
- array_multisort($keys, SORT_ASC, $simple_question_option);
330
- foreach($simple_question_option as $qo_key => $single_option){
331
- echo qsm_display_question_option($qo_key, $single_option);
332
- }
333
- ?>
334
- </div>
335
- <div id="major-publishing-actions">
336
- <div id="delete-action">
337
- <a class="submitdelete deletion" data-micromodal-close aria-label="Close this">Cancel</a>
338
- </div>
339
- <div id="publishing-action">
340
- <span class="spinner" id="save-edit-question-spinner" style="float: none;"></span>
341
- <button id="save-popup-button" class="button button-primary">Save Question</button>
342
- </div>
343
- </div>
344
- </div>
345
- </div>
346
- </div>
347
- <div id="categorydiv" class="postbox">
348
- <h2 class="hndle ui-sortable-handle">
349
- <span><?php _e('Select Category', 'quiz-master-next'); ?></span>
350
- <a class="qsm-question-doc" href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Category" target="_blank" title="View Documentation"><span class="dashicons dashicons-media-document"></span></a>
351
- </h2>
352
- <div class="inside">
353
- <?php
354
- $category_question_option = array(
355
- 'categories' => array(
356
- 'label' => __( '', 'quiz-master-next' ),
357
- 'type' => 'category',
358
- 'priority' => '5',
359
- 'default' => '',
360
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Category'
361
- )
362
- );
363
- $category_question_option = apply_filters('qsm_question_category_option', $category_question_option);
364
- $keys = array_column($category_question_option, 'priority');
365
- array_multisort($keys, SORT_ASC, $category_question_option);
366
- foreach($category_question_option as $qo_key => $single_cat_option){
367
- echo qsm_display_question_option($qo_key, $single_cat_option);
368
- }
369
- ?>
370
- </div>
371
- </div>
372
- <div id="advanceddiv" class="postbox">
373
- <h2 class="hndle ui-sortable-handle"><span><?php _e('Advanced Option', 'quiz-master-next'); ?></span></h2>
374
- <div class="inside">
375
- <div class="advanced-content">
376
- <?php
377
- $advanced_question_option = array(
378
- 'comments' => array(
379
- 'label' => __( 'Comment Field', 'quiz-master-next' ),
380
- 'type' => 'select',
381
- 'priority' => '3',
382
- 'options' => array(
383
- '0' => __( 'Small Text Field', 'quiz-master-next' ),
384
- '2' => __( 'Large Text Field', 'quiz-master-next' ),
385
- '1' => __( 'None', 'quiz-master-next' )
386
- ),
387
- 'default' => '1',
388
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Comment-Field'
389
- ),
390
- 'hint' => array(
391
- 'label' => __( 'Hint', 'quiz-master-next' ),
392
- 'type' => 'text',
393
- 'default' => '',
394
- 'priority' => '4',
395
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Hints'
396
- ),
397
- 'autofill' => array(
398
- 'label' => __( 'Hide Autofill?', 'quiz-master-next' ),
399
- 'type' => 'select',
400
- 'priority' => '6',
401
- 'options' => array(
402
- '0' => __( 'No', 'quiz-master-next' ),
403
- '1' => __( 'Yes', 'quiz-master-next' )
404
- ),
405
- 'default' => '0',
406
- 'show' => '3, 14',
407
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Hide-Autofill'
408
- ),
409
- 'limit_text' => array(
410
- 'label' => __('Limit Text', 'quiz-master-next' ),
411
- 'type' => 'text',
412
- 'priority' => '7',
413
- 'default' => '',
414
- 'show' => '3, 5, 7, 14',
415
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Limit-Text'
416
- ),
417
- 'limit_multiple_response' => array(
418
- 'label' => __('Limit Multiple choice', 'quiz-master-next' ),
419
- 'type' => 'text',
420
- 'priority' => '8',
421
- 'default' => '',
422
- 'show' => '4,10',
423
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Limit-Multiple-Choice'
424
- ),
425
- 'file_upload_type' => array(
426
- 'label' => __('Allow File type', 'quiz-master-next' ),
427
- 'type' => 'multi_checkbox',
428
- 'priority' => '10',
429
- 'options' => array(
430
- 'text/plain' => __( 'Text File', 'quiz-master-next' ),
431
- 'image' => __( 'Image', 'quiz-master-next' ),
432
- 'application/pdf' => __( 'PDF File', 'quiz-master-next' ),
433
- 'doc' => __( 'Doc File', 'quiz-master-next' ),
434
- 'excel' => __( 'Excel File', 'quiz-master-next' ),
435
- 'video/mp4' => __( 'Video', 'quiz-master-next' ),
436
- ),
437
- 'default' => 'image',
438
- 'show' => '11',
439
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Allow-File-Type'
440
- ),
441
- 'file_upload_limit' => array(
442
- 'label' => __('File upload limit ( in MB )', 'quiz-master-next' ),
443
- 'type' => 'number',
444
- 'priority' => '9',
445
- 'default' => '',
446
- 'show' => '11',
447
- 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#File-Upload-Limit'
448
- ),
449
- );
450
- $advanced_question_option = apply_filters('qsm_question_advanced_option', $advanced_question_option);
451
- $keys = array_column($advanced_question_option, 'priority');
452
- array_multisort($keys, SORT_ASC, $advanced_question_option);
453
- foreach($advanced_question_option as $qo_key => $single_option){
454
- echo qsm_display_question_option($qo_key, $single_option);
455
- }
456
- ?>
457
- </div>
458
- </div>
459
- </div>
460
- <?php do_action('qsm_question_form_fields_side', $quiz_id);?>
461
- </div>
462
- </div>
463
- </div>
464
- </div>
465
- </main>
466
- </div>
467
- </div>
468
- </div>
469
 
470
- <!--Views-->
471
-
472
- <!-- Popup for question bank -->
473
- <div class="qsm-popup qsm-popup-slide qsm-popup-bank" id="modal-page-1" aria-hidden="true">
474
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
475
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
476
- <header class="qsm-popup__header">
477
- <h2 class="qsm-popup__title" id="modal-1-title"><?php _e('Edit Page', 'quiz-master-next'); ?> <span style="display: none;">[ ID: <span id="edit-page-id"></span> ]</span></h2>
478
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
479
- </header>
480
- <main class="qsm-popup__content" id="modal-page-1-content">
481
- <input type="hidden" name="edit_page_id" id="edit_page_id" value="">
482
- <div id="page-options">
483
- <div class="qsm-row">
484
- <label><?php _e('Page Name', 'quiz-master-next'); ?></label>
485
- <input type="text" id="pagekey" name="pagekey" value="">
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  </div>
487
- <div class="qsm-row">
488
- <label><?php _e('Hide Previous Button?', 'quiz-master-next'); ?></label>
489
- <select name="hide_prevbtn" id="hide_prevbtn">
490
- <option value="0" selected="selected"><?php _e( 'No', 'quiz-master-next' ); ?></option>
491
- <option value="1"><?php _e( 'Yes', 'quiz-master-next' ); ?></option>
492
- </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
493
  </div>
494
- <?php do_action('qsm_action_quiz_page_attributes_fields');?>
495
  </div>
496
- </main>
497
- <footer class="qsm-popup__footer">
498
- <button id="save-page-popup-button" class="qsm-popup__btn qsm-popup__btn-primary">Save Page</button>
499
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window">Close</button>
500
- </footer>
501
- </div>
502
  </div>
503
  </div>
 
504
 
505
- <!-- View for Page -->
506
- <script type="text/template" id="tmpl-page">
507
- <div class="page page-new" data-page-id="{{data.id }}">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  <div class="page-header">
509
  <div><span class="dashicons dashicons-move"></span> <a href="#" class="edit-page-button" title="Edit Page"><span class="dashicons dashicons-admin-generic"></span></a> <span class="page-number"></span></div>
510
  <div><a href="#" class="delete-page-button" title="Delete Page"><span class="dashicons dashicons-trash"></span></a></div>
511
  </div>
512
  <div class="page-footer">
513
  <div class="page-header-buttons">
514
- <a href="#" class="new-question-button button"><span class="dashicons dashicons-plus"></span> <?php _e('Create New Question', 'quiz-master-next'); ?></a>
515
- <a href="#" class="add-question-bank-button button"><span class="dashicons dashicons-plus"></span> <?php _e('Add Question From Question Bank', 'quiz-master-next'); ?></a>
516
  </div>
517
  </div>
518
  </div>
519
  </script>
520
-
521
- <!-- View for Question -->
522
- <script type="text/template" id="tmpl-question">
523
- <div class="question question-new" data-question-id="{{data.id }}">
524
  <div class="question-content">
525
  <div><span class="dashicons dashicons-move"></span></div>
526
- <div><a href="#" title="Edit Question" class="edit-question-button"><span class="dashicons dashicons-edit"></span></a></div>
527
  <div><a href="#" title="Clone Question" class="duplicate-question-button"><span class="dashicons dashicons-admin-page"></span></a></div>
528
  <div><a href="#" title="Delete Question" class="delete-question-button" data-question-iid="{{data.id }}"><span class="dashicons dashicons-trash"></span></a></div>
529
  <div class="question-content-text">{{{data.question}}}</div>
530
- <div class="question-category"><# if ( 0 !== data.category.length ) { #> <?php _e('Category:', 'quiz-master-next'); ?> {{data.category}} <# } #></div>
531
  </div>
532
  </div>
533
  </script>
534
 
535
- <!-- View for question in question bank -->
536
- <script type="text/template" id="tmpl-single-question-bank-question">
537
- <div class="question-bank-question" data-question-id="{{data.id}}" data-category-name="{{data.category}}">
538
  <div class="question-bank-selection">
539
  <input type="checkbox" name="qsm-question-checkbox[]" class="qsm-question-checkbox" />
540
  </div>
541
  <div><p>{{{data.question}}}</p><p style="font-size: 12px;color: gray;font-style: italic;"><b>Quiz Name:</b> {{data.quiz_name}} <# if ( data.category != '' ) { #> <b>Category:</b> {{data.category}} <# } #></p></div>
542
- <div><a href="#" class="import-button button"><?php _e('Add Question', 'quiz-master-next'); ?></a></div>
543
  </div>
544
  </script>
545
 
546
- <!-- View for single category -->
547
- <script type="text/template" id="tmpl-single-category">
548
- <div class="category">
549
  <label><input type="radio" name="category" class="category-radio" value="{{data.category}}">{{data.category}}</label>
550
  </div>
551
  </script>
552
 
553
- <!-- View for single answer -->
554
- <script type="text/template" id="tmpl-single-answer">
555
- <div class="answers-single">
556
  <div><a href="#" class="delete-answer-button"><span class="dashicons dashicons-trash"></span></a></div>
557
  <div class="answer-text-div">
558
  <# if ( 'rich' == data.answerType ) { #>
559
  <textarea id="answer-{{data.question_id}}-{{data.count}}"></textarea>
 
 
 
 
560
  <# } else { #>
561
  <input type="text" class="answer-text" value="{{data.answer}}" placeholder="Your answer"/>
562
  <# } #>
@@ -566,54 +641,54 @@ function qsm_options_questions_tab_content() {
566
  <div><input type="text" class="answer-points" value="{{data.points}}" placeholder="Points"/></div>
567
  <# } #>
568
  <# if ( 0 == data.quiz_system || 3 == data.quiz_system ) { #>
569
- <div><label class="correct-answer"><input type="checkbox" class="answer-correct" value="1" <# if ( 1 == data.correct ) { #> checked="checked" <# } #>/> <?php _e('Correct', 'quiz-master-next'); ?></label></div>
570
- <# } #>
571
  <# } #>
572
- <?php do_action('qsm_admin_single_answer_option_fields');?>
573
  </div>
574
  </script>
575
- <?php
576
-
577
- ?>
578
- <div class="qsm-popup qsm-popup-slide" id="modal-7" aria-hidden="false">
579
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close="">
580
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-7-title">
581
- <header class="qsm-popup__header">
582
- <h3 class="qsm-popup__title" id="modal-7-title"><?php _e('Delete Options', 'quiz-master-next'); ?></h3>
583
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close=""></a>
584
- </header>
585
- <hr/>
586
- <main class="qsm-popup__content" id="modal-7-content">
587
- <form action='' method='post' id="delete-question-form">
588
- <table class="modal-7-table">
589
- <tr>
590
- <td><strong style="color:#00449e"><?php _e('Unlink', 'quiz-master-next'); ?></strong></td>
591
- <td><?php _e('Removes the question only from this quiz.', 'quiz-master-next'); ?></td>
592
- <tr>
593
- <tr>
594
- <td><strong style="color:#dc3232"><?php _e('Delete', 'quiz-master-next'); ?></Strong></td>
595
- <td><?php _e('Removes this question from database and everywhere. This action cannot be reversed.', 'quiz-master-next'); ?></td>
596
- <tr>
597
- </table>
598
- </form>
599
- </main>
600
- <hr/>
601
- <footer class="qsm-popup__footer">
602
- <button id="unlink-question-button" class="qsm-popup__btn qsm-popup__btn-primary"><span class="dashicons dashicons-trash"></span><?php _e('Unlink', 'quiz-master-next'); ?></button>
603
- <button id="delete-question-button" class="qsm-popup__btn qsm-popup__btn-primary"><span class="dashicons dashicons-warning"></span><?php _e('Delete', 'quiz-master-next'); ?></button>
604
- <button id="cancel-button" class="qsm-popup__btn" data-micromodal-close="" aria-label="Close this dialog window"><?php _e('Cancel', 'quiz-master-next'); ?></button>
605
- </footer>
606
- </div>
607
- </div>
608
- </div>
609
-
610
- <?php
611
- }
612
 
 
 
613
 
614
  add_action( 'wp_ajax_qsm_save_pages', 'qsm_ajax_save_pages' );
615
- //add_action( 'wp_ajax_nopriv_qsm_save_pages', 'qsm_ajax_save_pages' );
616
-
617
 
618
  /**
619
  * Saves the pages and order from the Questions tab
@@ -621,22 +696,22 @@ add_action( 'wp_ajax_qsm_save_pages', 'qsm_ajax_save_pages' );
621
  * @since 5.2.0
622
  */
623
  function qsm_ajax_save_pages() {
624
-
625
- $nonce = $_POST['nonce'];
626
- if ( ! wp_verify_nonce( $nonce, 'ajax-nonce-sandy-page' ) )
627
- die ( 'Busted!');
628
-
629
  global $mlwQuizMasterNext;
630
- $json = array(
631
  'status' => 'error',
632
  );
633
  $quiz_id = intval( $_POST['quiz_id'] );
634
  $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id );
635
-
636
- $pages = isset( $_POST['pages'] ) ? $_POST['pages'] : array();
637
- $qpages = isset($_POST['qpages']) ? $_POST['qpages'] : array();
638
- $response_qpages = $mlwQuizMasterNext->pluginHelper->update_quiz_setting('qpages', $qpages);
639
- $response = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'pages', $pages );
640
  if ( $response ) {
641
  $json['status'] = 'success';
642
  }
@@ -645,7 +720,7 @@ function qsm_ajax_save_pages() {
645
  }
646
 
647
  add_action( 'wp_ajax_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
648
- //add_action( 'wp_ajax_nopriv_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
649
 
650
  /**
651
  * Loads all the questions and echos out JSON
@@ -675,118 +750,161 @@ function qsm_load_all_quiz_questions_ajax() {
675
  }
676
 
677
  add_action( 'wp_ajax_qsm_send_data_sendy', 'qsm_send_data_sendy' );
678
- //add_action( 'wp_ajax_nopriv_qsm_send_data_sendy', 'qsm_send_data_sendy' );
679
 
680
  /**
681
  * @version 6.3.2
682
  * Send data to sendy
683
  */
684
- function qsm_send_data_sendy(){
685
-
686
- $nonce = $_POST['nonce'];
687
- if ( ! wp_verify_nonce( $nonce, 'ajax-nonce-sendy-save' ) )
688
- die ( 'Busted!');
689
-
690
- $sendy_url = 'http://sendy.expresstech.io';
691
- $list = '4v8zvoyXyTHSS80jeavOpg';
692
- $name = sanitize_text_field($_POST['name']);
693
- $email = sanitize_email($_POST['email']);
694
-
695
- //subscribe
696
- $postdata = http_build_query(
697
- array(
698
- 'name' => $name,
699
- 'email' => $email,
700
- 'list' => $list,
701
- 'boolean' => 'true'
702
- )
703
- );
704
- $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
705
- $context = stream_context_create($opts);
706
- $result = wp_remote_post($sendy_url.'/subscribe', [ 'body' => array(
707
- 'name' => $name,
708
- 'email' => $email,
709
- 'list' => $list,
710
- 'boolean' => 'true'
711
- ) ] );
712
- echo isset($result['response']) && isset($result['response']['code']) && $result['response']['code'] == 200 ? $result['body'] : '';
713
- exit;
 
 
 
 
 
 
 
 
 
 
 
714
  }
715
-
716
  add_action( 'wp_ajax_qsm_dashboard_delete_result', 'qsm_dashboard_delete_result' );
717
- function qsm_dashboard_delete_result(){
718
- $result_id = isset($_POST['result_id']) ? sanitize_text_field($_POST['result_id']) : 0;
719
- if($result_id){
720
- global $wpdb;
721
- $wpdb->update(
722
- $wpdb->prefix."mlw_results",
723
- array(
724
- 'deleted' => 1,
725
- ),
726
- array( 'result_id' => $result_id ),
727
- array(
728
- '%d'
729
- ),
730
- array( '%d' )
731
- );
732
- echo 'success';
733
- exit;
734
- }
735
- echo 'failed';
736
- exit;
737
  }
738
 
739
  /**
740
  * Delete question from question bank
741
- *
742
  * @since 7.1.3
743
  */
744
- function qsm_delete_question_question_bank(){
745
- if ( !wp_verify_nonce( $_REQUEST['nonce'], "delete_question_question_bank_nonce") ) {
746
- echo wp_json_encode( array( 'success' => false, 'message' => __( 'Nonce verification failed.','quiz-master-next' ) ) );
747
- wp_die();
748
- }
749
- $question_ids = isset( $_POST['question_ids'] ) ? sanitize_textarea_field($_POST['question_ids']) : '';
750
- $question_arr = explode(',', $question_ids);
751
- $response = array();
752
- if( $question_arr ){
753
- global $wpdb;
754
- foreach ($question_arr as $key => $value) {
755
- $wpdb->update(
756
- $wpdb->prefix."mlw_questions",
757
- array(
758
- 'deleted_question_bank' => 1,
759
- ),
760
- array( 'question_id' => $value ),
761
- array(
762
- '%d'
763
- ),
764
- array( '%d' )
765
- );
766
- }
767
- echo wp_json_encode( array( 'success' => true, 'message' => __( 'Selected Questions are removed from question bank.','quiz-master-next' ) ) );
768
- }
769
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  }
771
  add_action( 'wp_ajax_qsm_delete_question_question_bank', 'qsm_delete_question_question_bank' );
772
  /**
773
- * Delete quiz question from Database
774
- *
775
  * @since 7.1.11
776
  */
777
- function qsm_delete_question_from_database(){
778
- if ( !wp_verify_nonce( $_REQUEST['nonce'], "delete_question_from_database") ) {
779
- echo wp_json_encode( array( 'success' => false, 'message' => __( 'Nonce verification failed.','quiz-master-next' ) ) );
780
- wp_die();
781
- }
782
- $question_id = $_POST['question_id'];
783
-
784
- if( $question_id ){
785
- global $wpdb;
786
- $wpdb->delete($wpdb->prefix.'mlw_questions',array('question_id'=> $question_id));
787
- echo wp_json_encode( array( 'success' => true,'message' => __( 'Question removed Successfully.','quiz-master-next' ) ) );
788
- }
789
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  }
791
  add_action( 'wp_ajax_qsm_delete_question_from_database', 'qsm_delete_question_from_database' );
792
- ?>
12
  * Adds the settings for questions tab to the Quiz Settings page.
13
  *
14
  * @return void
15
+ * @since 4.4.0
16
  */
17
  function qsm_settings_questions_tab() {
18
+ global $mlwQuizMasterNext;
19
  $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Questions', 'quiz-master-next' ), 'qsm_options_questions_tab_content' );
20
  }
21
  add_action( 'plugins_loaded', 'qsm_settings_questions_tab', 5 );
22
 
 
23
  /**
24
  * Adds the content for the options for questions tab.
25
  *
27
  * @since 4.4.0
28
  */
29
  function qsm_options_questions_tab_content() {
 
30
  global $wpdb;
31
  global $mlwQuizMasterNext;
32
  $question_categories = $wpdb->get_results( "SELECT DISTINCT category FROM {$wpdb->prefix}mlw_questions", 'ARRAY_A' );
33
+ $quiz_id = intval( $_GET['quiz_id'] );
34
+ $user_id = get_current_user_id();
35
+ $form_type = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'form_type' );
36
+ $quiz_system = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'system' );
37
+ $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() );
38
+ $db_qpages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'qpages', array() );
39
+ $qpages = array();
40
+ if ( ! empty( $pages ) ) {
41
+ $defaultQPage = array(
42
+ 'id' => 1,
43
+ 'quizID' => $quiz_id,
44
+ 'pagekey' => '',
45
+ 'hide_prevbtn' => 0,
46
+ 'questions' => array(),
47
+ );
48
+ foreach ( $pages as $k => $val ) {
49
+ $qpage = isset( $db_qpages[ $k ] ) ? $db_qpages[ $k ] : $defaultQPage;
50
+ $qpage['id'] = $k + 1;
51
+ $qpage['pagekey'] = ( isset( $qpage['pagekey'] ) && ! empty( $qpage['pagekey'] ) ) ? $qpage['pagekey'] : uniqid();
52
+ $qpage['hide_prevbtn'] = ( isset( $qpage['hide_prevbtn'] ) && ! empty( $qpage['hide_prevbtn'] ) ) ? $qpage['hide_prevbtn'] : 0;
53
+ $qpage['questions'] = $val;
54
+ $qpages[] = $qpage;
55
  }
56
  } else {
57
+ $defaultQPage = array(
58
+ 'id' => 1,
59
+ 'quizID' => $quiz_id,
60
+ 'pagekey' => uniqid(),
61
+ 'hide_prevbtn' => 0,
62
+ 'questions' => array(),
63
+ );
64
+ $qpages[] = $defaultQPage;
65
+ }
66
+ $qpages = apply_filters( 'qsm_filter_quiz_page_attributes', $qpages, $pages );
67
  $json_data = array(
68
+ 'quizID' => $quiz_id,
69
+ 'answerText' => __( 'Answer', 'quiz-master-next' ),
70
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
71
+ 'pages' => $pages,
72
+ 'qpages' => $qpages,
73
+ 'qsm_user_ve' => get_user_meta( $user_id, 'rich_editing', true ),
74
+ 'saveNonce' => wp_create_nonce( 'ajax-nonce-sandy-page' ),
75
+ 'categories' => $question_categories,
76
+ 'form_type' => $form_type,
77
+ 'quiz_system' => $quiz_system,
78
+ 'hide_desc_text' => __( 'Less Description', 'quiz-master-next' ),
79
+ 'show_desc_text' => __( 'Add Description', 'quiz-master-next' ),
80
+ 'show_correct_info_text' => __( 'Add Correct Answer Info', 'quiz-master-next' ),
81
+ 'question_bank_nonce' => wp_create_nonce( 'delete_question_question_bank_nonce' ),
82
+ 'single_question_nonce' => wp_create_nonce( 'delete_question_from_database' ),
83
  );
84
 
85
  // Scripts and styles.
86
  wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
87
+ if ( ! did_action( 'wp_enqueue_media' ) ) {
88
+ wp_enqueue_media();
89
+ }
90
  wp_enqueue_script( 'qsm_admin_question_js', plugins_url( '../../js/qsm-admin-question.js', __FILE__ ), array( 'backbone', 'underscore', 'jquery-ui-sortable', 'wp-util', 'micromodal_script', 'qmn_admin_js' ), $mlwQuizMasterNext->version, true );
91
  wp_localize_script( 'qsm_admin_question_js', 'qsmQuestionSettings', $json_data );
92
  wp_enqueue_style( 'qsm_admin_question_css', plugins_url( '../../css/qsm-admin-question.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
101
  $pagination = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'pagination' );
102
  if ( 0 != $pagination ) {
103
  ?>
104
+ <div class="notice notice-warning">
105
+ <p><?php _e( 'This quiz has the "How many questions per page would you like?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.', 'quiz-master-next' ); ?>
106
+ </p>
107
+ </div>
108
+ <?php
109
  }
110
  $from_total = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'question_from_total' );
111
  if ( 0 != $from_total ) {
112
  ?>
113
+ <div class="notice notice-warning">
114
+ <p><?php _e( 'This quiz has the "How many questions should be loaded for quiz?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.', 'quiz-master-next' ); ?>
115
+ </p>
116
+ </div>
117
+ <?php
118
  }
119
  $randomness = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'randomness_order' );
120
  if ( 0 != $randomness ) {
121
  ?>
122
+ <div class="notice notice-warning">
123
+ <p><?php _e( 'This quiz has the "Are the questions random?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to "No".', 'quiz-master-next' ); ?>
124
+ </p>
125
+ </div>
126
+ <?php
127
  }
128
  ?>
129
+ <h3 style="display: none;">Questions</h3>
130
+ <p style="text-align: right;"><a href="https://quizandsurveymaster.com/docs/v7/questions-tab/" rel="noopener"
131
+ target="_blank">View
132
+ Documentation</a></p>
133
+ <div class="question-controls">
134
+ <span><b><?php _e( 'Total Questions:', 'quiz-master-next' ); ?></b> <span id="total-questions"></span></span>
135
+ <p class="search-box">
136
+ <label class="screen-reader-text" for="question_search">Search Questions:</label>
137
+ <input type="search" id="question_search" name="question_search" value="">
138
+ <a href="#" class="button"><?php esc_html_e( 'Search Questions', 'quiz-master-next' ); ?></a>
139
+ </p>
140
+ </div>
141
+ <div class="questions quiz_form_type_<?php echo $form_type; ?> quiz_quiz_systen_<?php echo $quiz_system; ?>">
142
+ <div class="qsm-showing-loader" style="text-align: center;margin-bottom: 20px;">
143
+ <div class="qsm-spinner-loader"></div>
144
  </div>
145
+ </div>
146
+ <div class="question-create-page">
147
+ <div>
148
+ <button class="new-page-button button button-primary"><span class="dashicons dashicons-plus-alt2"></span>
149
+ <?php _e( 'Create New Page', 'quiz-master-next' ); ?></button>
150
+ <button style="display: none;"
151
+ class="save-page-button button button-primary"><?php _e( 'Save Questions and Pages', 'quiz-master-next' ); ?></button>
152
+ <span class="spinner" id="save-edit-quiz-pages" style="float: none;"></span>
153
+ </div>
154
+ </div>
155
+ <!-- Popup for question bank -->
156
+ <div class="qsm-popup qsm-popup-slide qsm-popup-bank" id="modal-2" aria-hidden="true">
157
+ <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
158
+ <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
159
+ <header class="qsm-popup__header">
160
+ <h2 class="qsm-popup__title" id="modal-2-title">
161
+ <?php _e( 'Add Question From Question Bank', 'quiz-master-next' ); ?></h2>
162
+ <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
163
+ </header>
164
+ <main class="qsm-popup__content" id="modal-2-content">
165
+ <input type="hidden" name="add-question-bank-page" id="add-question-bank-page" value="">
166
+ <div id="question-bank"></div>
167
+ </main>
168
+ <footer class="qsm-popup__footer">
169
+ <button class="qsm-popup__btn" data-micromodal-close
170
+ aria-label="Close this dialog window">Close</button>
171
+ </footer>
172
  </div>
173
  </div>
174
+ </div>
175
 
176
 
177
+ <!-- Popup for editing question -->
178
+ <div class="qsm-popup qsm-popup-slide" id="modal-1" aria-hidden="true">
179
+ <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
180
+ <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
181
+ <header class="qsm-popup__header">
182
+ <h2 class="qsm-popup__title" id="modal-1-title"><?php _e( 'Edit Question', 'quiz-master-next' ); ?> [
183
+ ID:
184
+ <span id="edit-question-id"></span> ]
185
+ </h2>
186
+ <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
187
+ </header>
188
+ <main class="qsm-popup__content" id="modal-1-content">
189
+ <input type="hidden" name="edit_question_id" id="edit_question_id" value="">
190
+ <div id="poststuff">
191
+ <div id="post-body" class="metabox-holder columns-2">
192
+ <div id="post-body-content" style="position: relative;">
193
+ <div class="qsm-row">
194
+ <input type="text" id="question_title" class="question-title" name="question-title"
195
+ value=""
196
+ placeholder="<?php _e( 'Type your question here', 'quiz-master-next' ); ?>">
197
+ </div>
198
+ <a href="#" class="qsm-show-question-desc-box button button-default"><span
199
+ class="dashicons dashicons-plus-alt2"></span>
200
+ <?php _e( 'Add Description', 'quiz-master-next' ); ?></a>
201
+ <div class="qsm-row" style="display: none;">
202
+ <textarea placeholder="<?php _e( 'Add your description here', 'quiz-master-next' ); ?>"
203
+ id="question-text"></textarea>
204
+ </div>
205
+ <hr />
206
+ <div class="qsm-row" style="margin-bottom: 0;">
207
+ <?php
208
+ $description_arr = array(
209
+ array(
210
+ 'question_type_id' => 11,
211
+ 'description' => __( 'For this question type, users will see a file upload field on front end.', 'quiz-master-next' ),
212
+ ),
213
+ array(
214
+ 'question_type_id' => '14',
215
+ 'description' => __( 'Use %BLANK% variable in the description field to display input boxes.', 'quiz-master-next' ),
216
+ ),
217
+ array(
218
+ 'question_type_id' => '12',
219
+ 'description' => __( 'For this question type, users will see a date input field on front end.', 'quiz-master-next' ),
220
+ ),
221
+ array(
222
+ 'question_type_id' => '3',
223
+ 'description' => __( 'For this question type, users will see a standard input box on front end.', 'quiz-master-next' ),
224
+ ),
225
+ array(
226
+ 'question_type_id' => '5',
227
+ 'description' => __( 'For this question type, users will see a standard textarea input box on front end.', 'quiz-master-next' ),
228
+ ),
229
+ array(
230
+ 'question_type_id' => '6',
231
+ 'description' => __( 'Displays a simple section on front end.', 'quiz-master-next' ),
232
+ ),
233
+ array(
234
+ 'question_type_id' => '7',
235
+ 'description' => __( 'For this question type, users will see an input box which accepts only number values on front end.', 'quiz-master-next' ),
236
+ ),
237
+ array(
238
+ 'question_type_id' => '8',
239
+ 'description' => __( "For this question type, users will see a checkbox on front end. The text in description field will act like it's label.", 'quiz-master-next' ),
240
+ ),
241
+ array(
242
+ 'question_type_id' => '9',
243
+ 'description' => __( 'For this question type, users will see a Captcha field on front end.', 'quiz-master-next' ),
244
+ ),
245
+ array(
246
+ 'question_type_id' => '13',
247
+ 'description' => __( 'Use points based grading system for Polar questions.', 'quiz-master-next' ),
248
+ ),
249
+ );
250
+ $description_arr = apply_filters( 'qsm_question_type_description', $description_arr );
251
+ if ( $description_arr ) {
252
+ foreach ( $description_arr as $value ) {
253
+ $question_type_id = $value['question_type_id'];
254
+ ?>
255
+ <p id="question_type_<?php echo $question_type_id; ?>_description"
256
+ class="question-type-description"><?php echo $value['description']; ?></p>
257
+ <?php
258
+ }
259
+ }
260
+ ?>
261
+ </div>
262
+ <?php
263
+ $polar_class = $polar_question_use = '';
264
+ if ( $form_type == 0 && ( $quiz_system == 1 || $quiz_system == 3 ) ) {
265
+ $polar_class = 'qsm_show_question_type_13';
266
+ $polar_question_use = ',13';
267
+ }
268
+ ?>
269
+ <div id="qsm_optoins_wrapper"
270
+ class="qsm-row qsm_hide_for_other qsm_show_question_type_0 qsm_show_question_type_1 qsm_show_question_type_2 qsm_show_question_type_3 qsm_show_question_type_4 qsm_show_question_type_5 qsm_show_question_type_7 qsm_show_question_type_10 qsm_show_question_type_12 qsm_show_question_type_14 <?php echo $polar_class; ?>">
271
+ <label class="answer-header">
272
+ <?php _e( 'Answers', 'quiz-master-next' ); ?>
273
+ <a class="qsm-question-doc" rel="noopener"
274
+ href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Answers"
275
+ target="_blank" title="View Documentation">
276
+ <span class="dashicons dashicons-media-document"></span>
277
+ </a>
278
+ </label>
279
+ <div class="correct-header"><?php _e( 'Correct', 'quiz-master-next' ); ?></div>
280
+ <div class="answers" id="answers">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
+ </div>
283
+ <div class="new-answer-button">
284
+ <a href="#" class="button" id="new-answer-button"><span
285
+ class="dashicons dashicons-plus"></span>
286
+ <?php _e( 'Add New Answer!', 'quiz-master-next' ); ?></a>
287
+ </div>
288
+ </div>
289
+ <hr style="margin-bottom:25px;">
290
+ <a href="#" class="qsm-show-correct-info-box button button-default"><span
291
+ class="dashicons dashicons-plus-alt2"></span>
292
+ <?php _e( 'Add Correct Answer Info', 'quiz-master-next' ); ?></a>
293
+ <div class="qsm-row" style="display: none;">
294
+ <?php
295
+ $answer_area_option = array(
296
+ 'correct_answer_info' => array(
297
+ 'label' => __( 'Correct Answer Info', 'quiz-master-next' ),
298
+ 'type' => 'textarea',
299
+ 'default' => '',
300
+ 'show' => '0,1,2,3,4,5,7,10,12,14' . $polar_question_use,
301
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Correct-Answer-Info',
302
+ ),
303
+ );
304
+ $answer_area_option = apply_filters( 'qsm_question_advanced_option', $answer_area_option );
305
+ foreach ( $answer_area_option as $qo_key => $single_answer_option ) {
306
+ echo qsm_display_question_option( $qo_key, $single_answer_option );
307
+ }
308
+ ?>
309
+ </div>
310
+ <?php do_action( 'qsm_question_form_fields', $quiz_id ); ?>
311
  </div>
312
+ <div id="postbox-container-1" class="postbox-container">
313
+ <div id="side-sortables" class="meta-box-sortables ui-sortable" style="">
314
+ <div id="submitdiv" class="postbox ">
315
+ <h2 class="hndle ui-sortable-handle">
316
+ <span><?php _e( 'Publish', 'quiz-master-next' ); ?></span>
317
+ <span id="qsm-question-id"></span>
318
+ </h2>
319
+ <div class="inside">
320
+ <div class="submitbox" id="submitpost">
321
+ <div id="minor-publishing">
322
+ <div class="qsm-row">
323
+ <label>
324
+ <?php _e( 'Question Type', 'quiz-master-next' ); ?>
325
+ <?php
326
+ $document_text = '';
327
+ $document_text .= '<a class="qsm-question-doc" href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Question-Type" target="_blank" title="' . __( 'View Documentation', 'quiz-master-next' ) . '">';
328
+ $document_text .= '<span class="dashicons dashicons-media-document"></span>';
329
+ $document_text .= '</a>';
330
+ echo $document_text;
331
+ ?>
332
+ </label>
333
+ <select name="question_type" id="question_type">
334
+ <?php
335
+ foreach ( $question_types as $type ) {
336
+ echo "<option value='{$type['slug']}'>{$type['name']}</option>";
337
+ }
338
+ ?>
339
+ </select>
340
+ <a class="question_info_tag hidden" target="_blank" rel="noopener"
341
+ href="https://quizandsurveymaster.com/docs/about-quiz-survey-master/question-types/"><?php _e( 'How to use this option?', 'quiz-master-next' ); ?></a>
342
+ <p class="hidden" id="question_type_info"></p>
343
+ </div>
344
+ <?php
345
+ $simple_question_option = array(
346
+ 'change-answer-editor' => array(
347
+ 'label' => __( 'Answers Type', 'quiz-master-next' ),
348
+ 'type' => 'select',
349
+ 'priority' => '1',
350
+ 'options' => array(
351
+ 'text' => __( 'Text Answers', 'quiz-master-next' ),
352
+ 'rich' => __( 'Rich Answers', 'quiz-master-next' ),
353
+ 'image' => __( 'Image Answers', 'quiz-master-next' ),
354
+ ),
355
+ 'default' => 'text',
356
+ 'show' => '0,1,2,4,13',
357
+ // 'tooltip' => __('You can use text and rich answer for question answers.', 'quiz-master-next'),.
358
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Answer-Type',
359
+ ),
360
+ 'required' => array(
361
+ 'label' => __( 'Required?', 'quiz-master-next' ),
362
+ 'type' => 'single_checkbox',
363
+ 'priority' => '2',
364
+ 'options' => array(
365
+ // '1' => __( 'No', 'quiz-master-next' ),
366
+ '0' => __( 'Yes', 'quiz-master-next' ),
367
+ ),
368
+ 'default' => '0',
369
+ ),
370
+ );
371
+ $simple_question_option = apply_filters( 'qsm_question_format_option', $simple_question_option );
372
+ $keys = array_column( $simple_question_option, 'priority' );
373
+ array_multisort( $keys, SORT_ASC, $simple_question_option );
374
+ foreach ( $simple_question_option as $qo_key => $single_option ) {
375
+ echo qsm_display_question_option( $qo_key, $single_option );
376
+ }
377
+ ?>
378
+ </div>
379
+ <div id="major-publishing-actions">
380
+ <div id="delete-action">
381
+ <a class="submitdelete deletion" data-micromodal-close
382
+ aria-label="Close this">Cancel</a>
383
+ </div>
384
+ <div id="publishing-action">
385
+ <span class="spinner" id="save-edit-question-spinner"
386
+ style="float: none;"></span>
387
+ <button id="save-popup-button" class="button button-primary">Save
388
+ Question</button>
389
+ </div>
390
+ </div>
391
+ </div>
392
+ </div>
393
+ </div>
394
+ <div id="categorydiv" class="postbox">
395
+ <h2 class="hndle ui-sortable-handle">
396
+ <span><?php _e( 'Select Category', 'quiz-master-next' ); ?></span>
397
+ <a class="qsm-question-doc" rel="noopener"
398
+ href="https://quizandsurveymaster.com/docs/v7/questions-tab/#Category"
399
+ target="_blank" title="View Documentation"><span
400
+ class="dashicons dashicons-media-document"></span></a>
401
+ </h2>
402
+ <div class="inside">
403
+ <?php
404
+ $category_question_option = array(
405
+ 'categories' => array(
406
+ 'label' => __( '', 'quiz-master-next' ),
407
+ 'type' => 'category',
408
+ 'priority' => '5',
409
+ 'default' => '',
410
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Category',
411
+ ),
412
+ );
413
+ $category_question_option = apply_filters( 'qsm_question_category_option', $category_question_option );
414
+ $keys = array_column( $category_question_option, 'priority' );
415
+ array_multisort( $keys, SORT_ASC, $category_question_option );
416
+ foreach ( $category_question_option as $qo_key => $single_cat_option ) {
417
+ echo qsm_display_question_option( $qo_key, $single_cat_option );
418
+ }
419
+ ?>
420
+ </div>
421
+ </div>
422
+ <div id="featureImagediv" class="postbox">
423
+ <h2 class="hndle ui-sortable-handle">
424
+ <span><?php _e( 'Feature Image', 'quiz-master-next' ); ?></span>
425
+ <a class="qsm-question-doc" href="#" target="_blank"
426
+ title="View Documentation"><span
427
+ class="dashicons dashicons-media-document"></span></a>
428
+ </h2>
429
+ <div class="inside">
430
+ <?php
431
+ echo '<a href="#" class="qsm-feature-image-upl">' . __( 'Upload Image', 'quiz-master-next' ) . '</a>
432
+ <a href="#" class="qsm-feature-image-rmv" style="display:none">' . __( 'Remove Image', 'quiz-master-next' ) . '</a>'
433
+ . '<input type="hidden" name="qsm-feature-image-id" class="qsm-feature-image-id" value="">'
434
+ . '<input type="hidden" name="qsm-feature-image-src" class="qsm-feature-image-src" value="">';
435
+
436
+ ?>
437
+ </div>
438
+ </div>
439
+ <div id="advanceddiv" class="postbox">
440
+ <h2 class="hndle ui-sortable-handle">
441
+ <span><?php _e( 'Advanced Option', 'quiz-master-next' ); ?></span>
442
+ </h2>
443
+ <div class="inside">
444
+ <div class="advanced-content">
445
+ <?php
446
+ $advanced_question_option = array(
447
+ 'comments' => array(
448
+ 'label' => __( 'Comment Field', 'quiz-master-next' ),
449
+ 'type' => 'select',
450
+ 'priority' => '3',
451
+ 'options' => array(
452
+ '0' => __( 'Small Text Field', 'quiz-master-next' ),
453
+ '2' => __( 'Large Text Field', 'quiz-master-next' ),
454
+ '1' => __( 'None', 'quiz-master-next' ),
455
+ ),
456
+ 'default' => '1',
457
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Comment-Field',
458
+ ),
459
+ 'hint' => array(
460
+ 'label' => __( 'Hint', 'quiz-master-next' ),
461
+ 'type' => 'text',
462
+ 'default' => '',
463
+ 'priority' => '4',
464
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/questions-tab/#Hints',
465
+ ),
466
+ 'autofill' => array(
467
+ 'label' => __( 'Hide Autofill?', 'quiz-master-next' ),
468
+ 'type' => 'select',
469
+ 'priority' => '6',
470
+ 'options' => array(
471
+ '0' => __( 'No', 'quiz-master-next' ),
472
+ '1' => __( 'Yes', 'quiz-master-next' ),
473
+ ),
474
+ 'default' => '0',
475
+ 'show' => '3, 14',
476
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Hide-Autofill',
477
+ ),
478
+ 'limit_text' => array(
479
+ 'label' => __( 'Limit Text', 'quiz-master-next' ),
480
+ 'type' => 'text',
481
+ 'priority' => '7',
482
+ 'default' => '',
483
+ 'show' => '3, 5, 7, 14',
484
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Limit-Text',
485
+ ),
486
+ 'limit_multiple_response' => array(
487
+ 'label' => __( 'Limit Multiple choice', 'quiz-master-next' ),
488
+ 'type' => 'text',
489
+ 'priority' => '8',
490
+ 'default' => '',
491
+ 'show' => '4,10',
492
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Limit-Multiple-Choice',
493
+ ),
494
+ 'file_upload_type' => array(
495
+ 'label' => __( 'Allow File type', 'quiz-master-next' ),
496
+ 'type' => 'multi_checkbox',
497
+ 'priority' => '10',
498
+ 'options' => array(
499
+ 'text/plain' => __( 'Text File', 'quiz-master-next' ),
500
+ 'image' => __( 'Image', 'quiz-master-next' ),
501
+ 'application/pdf' => __( 'PDF File', 'quiz-master-next' ),
502
+ 'doc' => __( 'Doc File', 'quiz-master-next' ),
503
+ 'excel' => __( 'Excel File', 'quiz-master-next' ),
504
+ 'video/mp4' => __( 'Video', 'quiz-master-next' ),
505
+ ),
506
+ 'default' => 'image',
507
+ 'show' => '11',
508
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#Allow-File-Type',
509
+ ),
510
+ 'file_upload_limit' => array(
511
+ 'label' => __( 'File upload limit ( in MB )', 'quiz-master-next' ),
512
+ 'type' => 'number',
513
+ 'priority' => '9',
514
+ 'default' => '',
515
+ 'show' => '11',
516
+ 'documentation_link' => 'https://quizandsurveymaster.com/docs/v7/advanced-options/#File-Upload-Limit',
517
+ ),
518
+ );
519
+ $advanced_question_option = apply_filters( 'qsm_question_advanced_option', $advanced_question_option );
520
+ $keys = array_column( $advanced_question_option, 'priority' );
521
+ array_multisort( $keys, SORT_ASC, $advanced_question_option );
522
+ foreach ( $advanced_question_option as $qo_key => $single_option ) {
523
+ echo qsm_display_question_option( $qo_key, $single_option );
524
+ }
525
+ ?>
526
+ </div>
527
+ </div>
528
+ </div>
529
+ <?php do_action( 'qsm_question_form_fields_side', $quiz_id ); ?>
530
+ </div>
531
  </div>
 
532
  </div>
533
+ </div>
534
+ </main>
 
 
 
 
535
  </div>
536
  </div>
537
+ </div>
538
 
539
+ <!--Views-->
540
+
541
+ <!-- Popup for question bank -->
542
+ <div class="qsm-popup qsm-popup-slide qsm-popup-bank" id="modal-page-1" aria-hidden="true">
543
+ <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
544
+ <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
545
+ <header class="qsm-popup__header">
546
+ <h2 class="qsm-popup__title" id="modal-1-title"><?php _e( 'Edit Page', 'quiz-master-next' ); ?> <span
547
+ style="display: none;">[ ID: <span id="edit-page-id"></span> ]</span></h2>
548
+ <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
549
+ </header>
550
+ <main class="qsm-popup__content" id="modal-page-1-content">
551
+ <input type="hidden" name="edit_page_id" id="edit_page_id" value="">
552
+ <div id="page-options">
553
+ <div class="qsm-row">
554
+ <label><?php _e( 'Page Name', 'quiz-master-next' ); ?></label>
555
+ <input type="text" id="pagekey" name="pagekey" value="">
556
+ </div>
557
+ <div class="qsm-row">
558
+ <label><?php _e( 'Hide Previous Button?', 'quiz-master-next' ); ?></label>
559
+ <select name="hide_prevbtn" id="hide_prevbtn">
560
+ <option value="0" selected="selected"><?php _e( 'No', 'quiz-master-next' ); ?></option>
561
+ <option value="1"><?php _e( 'Yes', 'quiz-master-next' ); ?></option>
562
+ </select>
563
+ </div>
564
+ <?php do_action( 'qsm_action_quiz_page_attributes_fields' ); ?>
565
+ </div>
566
+ </main>
567
+ <footer class="qsm-popup__footer">
568
+ <button id="save-page-popup-button" class="qsm-popup__btn qsm-popup__btn-primary">Save Page</button>
569
+ <button class="qsm-popup__btn" data-micromodal-close
570
+ aria-label="Close this dialog window">Close</button>
571
+ </footer>
572
+ </div>
573
+ </div>
574
+ </div>
575
+
576
+ <!-- View for Page -->
577
+ <script type="text/template" id="tmpl-page">
578
+ <div class="page page-new" data-page-id="{{data.id }}">
579
  <div class="page-header">
580
  <div><span class="dashicons dashicons-move"></span> <a href="#" class="edit-page-button" title="Edit Page"><span class="dashicons dashicons-admin-generic"></span></a> <span class="page-number"></span></div>
581
  <div><a href="#" class="delete-page-button" title="Delete Page"><span class="dashicons dashicons-trash"></span></a></div>
582
  </div>
583
  <div class="page-footer">
584
  <div class="page-header-buttons">
585
+ <a href="#" class="new-question-button button"><span class="dashicons dashicons-plus"></span> <?php _e( 'Create New Question', 'quiz-master-next' ); ?></a>
586
+ <a href="#" class="add-question-bank-button button"><span class="dashicons dashicons-plus"></span> <?php _e( 'Add Question From Question Bank', 'quiz-master-next' ); ?></a>
587
  </div>
588
  </div>
589
  </div>
590
  </script>
591
+
592
+ <!-- View for Question -->
593
+ <script type="text/template" id="tmpl-question">
594
+ <div class="question question-new" data-question-id="{{data.id }}">
595
  <div class="question-content">
596
  <div><span class="dashicons dashicons-move"></span></div>
597
+ <div><a href="#" title="Edit Question" class="edit-question-button"><span class="dashicons dashicons-edit"></span></a></div>
598
  <div><a href="#" title="Clone Question" class="duplicate-question-button"><span class="dashicons dashicons-admin-page"></span></a></div>
599
  <div><a href="#" title="Delete Question" class="delete-question-button" data-question-iid="{{data.id }}"><span class="dashicons dashicons-trash"></span></a></div>
600
  <div class="question-content-text">{{{data.question}}}</div>
601
+ <div class="question-category"><# if ( 0 !== data.category.length ) { #> <?php _e( 'Category:', 'quiz-master-next' ); ?> {{data.category}} <# } #></div>
602
  </div>
603
  </div>
604
  </script>
605
 
606
+ <!-- View for question in question bank -->
607
+ <script type="text/template" id="tmpl-single-question-bank-question">
608
+ <div class="question-bank-question" data-question-id="{{data.id}}" data-category-name="{{data.category}}">
609
  <div class="question-bank-selection">
610
  <input type="checkbox" name="qsm-question-checkbox[]" class="qsm-question-checkbox" />
611
  </div>
612
  <div><p>{{{data.question}}}</p><p style="font-size: 12px;color: gray;font-style: italic;"><b>Quiz Name:</b> {{data.quiz_name}} <# if ( data.category != '' ) { #> <b>Category:</b> {{data.category}} <# } #></p></div>
613
+ <div><a href="#" class="import-button button"><?php _e( 'Add Question', 'quiz-master-next' ); ?></a></div>
614
  </div>
615
  </script>
616
 
617
+ <!-- View for single category -->
618
+ <script type="text/template" id="tmpl-single-category">
619
+ <div class="category">
620
  <label><input type="radio" name="category" class="category-radio" value="{{data.category}}">{{data.category}}</label>
621
  </div>
622
  </script>
623
 
624
+ <!-- View for single answer -->
625
+ <script type="text/template" id="tmpl-single-answer">
626
+ <div class="answers-single">
627
  <div><a href="#" class="delete-answer-button"><span class="dashicons dashicons-trash"></span></a></div>
628
  <div class="answer-text-div">
629
  <# if ( 'rich' == data.answerType ) { #>
630
  <textarea id="answer-{{data.question_id}}-{{data.count}}"></textarea>
631
+ <# } else if ( 'image' == data.answerType ) { #>
632
+ <input type="text" class="answer-text" id="featured_image_textbox" value="{{data.answer}}" placeholder="Insert image URL"/>
633
+ <a href="#" id="set_featured_image"><span class="dashicons dashicons-insert"></span></a>
634
+ <input type="text" class="answer-caption" id="featured_image_caption" value="{{data.caption}}" placeholder="Image Caption"/>
635
  <# } else { #>
636
  <input type="text" class="answer-text" value="{{data.answer}}" placeholder="Your answer"/>
637
  <# } #>
641
  <div><input type="text" class="answer-points" value="{{data.points}}" placeholder="Points"/></div>
642
  <# } #>
643
  <# if ( 0 == data.quiz_system || 3 == data.quiz_system ) { #>
644
+ <div><label class="correct-answer"><input type="checkbox" class="answer-correct" value="1" <# if ( 1 == data.correct ) { #> checked="checked" <# } #>/> <?php _e( 'Correct', 'quiz-master-next' ); ?></label></div>
645
+ <# } #>
646
  <# } #>
647
+ <?php do_action( 'qsm_admin_single_answer_option_fields' ); ?>
648
  </div>
649
  </script>
650
+ <div class="qsm-popup qsm-popup-slide" id="modal-7" aria-hidden="false">
651
+ <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close="">
652
+ <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-7-title">
653
+ <header class="qsm-popup__header">
654
+ <h3 class="qsm-popup__title" id="modal-7-title"><?php _e( 'Delete Options', 'quiz-master-next' ); ?>
655
+ </h3>
656
+ <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close=""></a>
657
+ </header>
658
+ <hr />
659
+ <main class="qsm-popup__content" id="modal-7-content">
660
+ <form action='' method='post' id="delete-question-form">
661
+ <table class="modal-7-table">
662
+ <tr>
663
+ <td><strong style="color:#00449e"><?php _e( 'Unlink', 'quiz-master-next' ); ?></strong></td>
664
+ <td><?php _e( 'Removes the question only from this quiz.', 'quiz-master-next' ); ?></td>
665
+ <tr>
666
+ <tr>
667
+ <td><strong style="color:#dc3232"><?php _e( 'Delete', 'quiz-master-next' ); ?></Strong></td>
668
+ <td><?php _e( 'Removes this question from database and everywhere. This action cannot be reversed.', 'quiz-master-next' ); ?>
669
+ </td>
670
+ <tr>
671
+ </table>
672
+ </form>
673
+ </main>
674
+ <hr />
675
+ <footer class="qsm-popup__footer">
676
+ <button id="unlink-question-button" class="qsm-popup__btn qsm-popup__btn-primary"><span
677
+ class="dashicons dashicons-trash"></span><?php _e( 'Unlink', 'quiz-master-next' ); ?></button>
678
+ <button id="delete-question-button" class="qsm-popup__btn qsm-popup__btn-primary"><span
679
+ class="dashicons dashicons-warning"></span><?php _e( 'Delete', 'quiz-master-next' ); ?></button>
680
+ <button id="cancel-button" class="qsm-popup__btn" data-micromodal-close=""
681
+ aria-label="Close this dialog window"><?php _e( 'Cancel', 'quiz-master-next' ); ?></button>
682
+ </footer>
683
+ </div>
684
+ </div>
685
+ </div>
 
686
 
687
+ <?php
688
+ }
689
 
690
  add_action( 'wp_ajax_qsm_save_pages', 'qsm_ajax_save_pages' );
691
+ // add_action( 'wp_ajax_nopriv_qsm_save_pages', 'qsm_ajax_save_pages' );
 
692
 
693
  /**
694
  * Saves the pages and order from the Questions tab
696
  * @since 5.2.0
697
  */
698
  function qsm_ajax_save_pages() {
699
+ $nonce = $_POST['nonce'];
700
+ if ( ! wp_verify_nonce( $nonce, 'ajax-nonce-sandy-page' ) ) {
701
+ die( 'Busted!' );
702
+ }
703
+
704
  global $mlwQuizMasterNext;
705
+ $json = array(
706
  'status' => 'error',
707
  );
708
  $quiz_id = intval( $_POST['quiz_id'] );
709
  $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id );
710
+
711
+ $pages = isset( $_POST['pages'] ) ? $_POST['pages'] : array();
712
+ $qpages = isset( $_POST['qpages'] ) ? $_POST['qpages'] : array();
713
+ $response_qpages = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'qpages', $qpages );
714
+ $response = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'pages', $pages );
715
  if ( $response ) {
716
  $json['status'] = 'success';
717
  }
720
  }
721
 
722
  add_action( 'wp_ajax_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
723
+ // add_action( 'wp_ajax_nopriv_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
724
 
725
  /**
726
  * Loads all the questions and echos out JSON
750
  }
751
 
752
  add_action( 'wp_ajax_qsm_send_data_sendy', 'qsm_send_data_sendy' );
753
+ // add_action( 'wp_ajax_nopriv_qsm_send_data_sendy', 'qsm_send_data_sendy' );
754
 
755
  /**
756
  * @version 6.3.2
757
  * Send data to sendy
758
  */
759
+ function qsm_send_data_sendy() {
760
+ $nonce = $_POST['nonce'];
761
+ if ( ! wp_verify_nonce( $nonce, 'ajax-nonce-sendy-save' ) ) {
762
+ die( 'Busted!' );
763
+ }
764
+
765
+ $sendy_url = 'http://sendy.expresstech.io';
766
+ $list = '4v8zvoyXyTHSS80jeavOpg';
767
+ $name = sanitize_text_field( $_POST['name'] );
768
+ $email = sanitize_email( $_POST['email'] );
769
+
770
+ // subscribe
771
+ $postdata = http_build_query(
772
+ array(
773
+ 'name' => $name,
774
+ 'email' => $email,
775
+ 'list' => $list,
776
+ 'boolean' => 'true',
777
+ )
778
+ );
779
+ $opts = array(
780
+ 'http' => array(
781
+ 'method' => 'POST',
782
+ 'header' => 'Content-type: application/x-www-form-urlencoded',
783
+ 'content' => $postdata,
784
+ ),
785
+ );
786
+ $context = stream_context_create( $opts );
787
+ $result = wp_remote_post(
788
+ $sendy_url . '/subscribe',
789
+ array(
790
+ 'body' => array(
791
+ 'name' => $name,
792
+ 'email' => $email,
793
+ 'list' => $list,
794
+ 'boolean' => 'true',
795
+ ),
796
+ )
797
+ );
798
+ echo isset( $result['response'] ) && isset( $result['response']['code'] ) && $result['response']['code'] == 200 ? $result['body'] : '';
799
+ exit;
800
  }
801
+
802
  add_action( 'wp_ajax_qsm_dashboard_delete_result', 'qsm_dashboard_delete_result' );
803
+ function qsm_dashboard_delete_result() {
804
+ $result_id = isset( $_POST['result_id'] ) ? sanitize_text_field( $_POST['result_id'] ) : 0;
805
+ if ( $result_id ) {
806
+ global $wpdb;
807
+ $wpdb->update(
808
+ $wpdb->prefix . 'mlw_results',
809
+ array(
810
+ 'deleted' => 1,
811
+ ),
812
+ array( 'result_id' => $result_id ),
813
+ array(
814
+ '%d',
815
+ ),
816
+ array( '%d' )
817
+ );
818
+ echo 'success';
819
+ exit;
820
+ }
821
+ echo 'failed';
822
+ exit;
823
  }
824
 
825
  /**
826
  * Delete question from question bank
827
+ *
828
  * @since 7.1.3
829
  */
830
+ function qsm_delete_question_question_bank() {
831
+ if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'delete_question_question_bank_nonce' ) ) {
832
+ echo wp_json_encode(
833
+ array(
834
+ 'success' => false,
835
+ 'message' => __(
836
+ 'Nonce verification failed.',
837
+ 'quiz-master-next'
838
+ ),
839
+ )
840
+ );
841
+ wp_die();
842
+ }
843
+ $question_ids = isset( $_POST['question_ids'] ) ? sanitize_textarea_field( $_POST['question_ids'] ) : '';
844
+ $question_arr = explode( ',', $question_ids );
845
+ $response = array();
846
+ if ( $question_arr ) {
847
+ global $wpdb;
848
+ foreach ( $question_arr as $key => $value ) {
849
+ $wpdb->update(
850
+ $wpdb->prefix . 'mlw_questions',
851
+ array(
852
+ 'deleted_question_bank' => 1,
853
+ ),
854
+ array( 'question_id' => $value ),
855
+ array(
856
+ '%d',
857
+ ),
858
+ array( '%d' )
859
+ );
860
+ }
861
+ echo wp_json_encode(
862
+ array(
863
+ 'success' => true,
864
+ 'message' => __(
865
+ 'Selected Questions are removed from question bank.',
866
+ 'quiz-master-next'
867
+ ),
868
+ )
869
+ );
870
+ }
871
+ exit;
872
  }
873
  add_action( 'wp_ajax_qsm_delete_question_question_bank', 'qsm_delete_question_question_bank' );
874
  /**
875
+ * Delete quiz question from Database
876
+ *
877
  * @since 7.1.11
878
  */
879
+ function qsm_delete_question_from_database() {
880
+ if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'delete_question_from_database' ) ) {
881
+ echo wp_json_encode(
882
+ array(
883
+ 'success' => false,
884
+ 'message' => __(
885
+ 'Nonce verification failed.',
886
+ 'quiz-master-next'
887
+ ),
888
+ )
889
+ );
890
+ wp_die();
891
+ }
892
+ $question_id = $_POST['question_id'];
893
+
894
+ if ( $question_id ) {
895
+ global $wpdb;
896
+ $wpdb->delete( $wpdb->prefix . 'mlw_questions', array( 'question_id' => $question_id ) );
897
+ echo wp_json_encode(
898
+ array(
899
+ 'success' => true,
900
+ 'message' => __(
901
+ 'Question removed Successfully.',
902
+ 'quiz-master-next'
903
+ ),
904
+ )
905
+ );
906
+ }
907
+ exit;
908
  }
909
  add_action( 'wp_ajax_qsm_delete_question_from_database', 'qsm_delete_question_from_database' );
910
+ ?>
php/admin/options-page-style-tab.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  * @since 6.0.2
15
  */
16
  function qsm_settings_style_tab() {
17
- global $mlwQuizMasterNext;
18
  $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Style', 'quiz-master-next' ), 'qsm_options_styling_tab_content' );
19
  }
20
  add_action( 'plugins_loaded', 'qsm_settings_style_tab', 5 );
@@ -35,8 +35,8 @@ function qsm_options_styling_tab_content() {
35
  if ( isset( $_POST['qsm_style_tab_nonce'] ) && wp_verify_nonce( $_POST['qsm_style_tab_nonce'], 'qsm_style_tab_nonce_action' ) && isset( $_POST['save_style_options'] ) && 'confirmation' == $_POST['save_style_options'] ) {
36
 
37
  $style_quiz_id = intval( $_POST['style_quiz_id'] );
38
- $quiz_theme = sanitize_text_field( $_POST['save_quiz_theme'] );
39
- $quiz_style = sanitize_textarea_field( htmlspecialchars( stripslashes( $_POST['quiz_css'] ), ENT_QUOTES ) );
40
 
41
  // Saves the new css.
42
  $results = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}mlw_quizzes SET quiz_stye=%s, theme_selected=%s, last_activity=%s WHERE quiz_id=%d", $quiz_style, $quiz_theme, date( 'Y-m-d H:i:s' ), $style_quiz_id ) );
@@ -54,52 +54,382 @@ function qsm_options_styling_tab_content() {
54
  }
55
  $registered_templates = $mlwQuizMasterNext->pluginHelper->get_quiz_templates();
56
  ?>
57
- <script>
58
- function mlw_qmn_theme(theme)
59
- {
60
- document.getElementById('save_quiz_theme').value = theme;
61
- jQuery("div.mlw_qmn_themeBlockActive").toggleClass("mlw_qmn_themeBlockActive");
62
- jQuery("#mlw_qmn_theme_block_"+theme).toggleClass("mlw_qmn_themeBlockActive");
63
 
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  </script>
66
- <form action='' method='post' name='quiz_style_form'>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  <input type='hidden' name='save_style_options' value='confirmation' />
68
  <input type='hidden' name='style_quiz_id' value='<?php echo esc_attr( $quiz_id ); ?>' />
69
- <input type='hidden' name='save_quiz_theme' id='save_quiz_theme' value='<?php echo esc_attr( $mlw_quiz_options->theme_selected ); ?>' />
70
- <h3 style="display: none;"><?php _e( 'Quiz Styles', 'quiz-master-next' ); ?></h3>
 
71
  <p><?php _e( 'Choose your style:', 'quiz-master-next' ); ?></p>
72
  <style>
73
- div.mlw_qmn_themeBlockActive {
74
- background-color: yellow;
75
- }
76
  </style>
77
  <div class="qsm-styles">
78
  <?php
79
  foreach ( $registered_templates as $slug => $template ) {
80
  ?>
81
- <div onclick="mlw_qmn_theme('<?php echo $slug; ?>');" id="mlw_qmn_theme_block_<?php echo $slug; ?>" class="qsm-info-widget <?php if ($mlw_quiz_options->theme_selected == $slug) {echo 'mlw_qmn_themeBlockActive';} ?>"><?php echo $template["name"]; ?></div>
82
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
  ?>
85
- <div onclick="mlw_qmn_theme('default');" id="mlw_qmn_theme_block_default" class="qsm-info-widget <?php if ($mlw_quiz_options->theme_selected == 'default') {echo 'mlw_qmn_themeBlockActive';} ?>"><?php _e('Custom', 'quiz-master-next'); ?></div>
86
  <script>
87
- mlw_qmn_theme('<?php echo $mlw_quiz_options->theme_selected; ?>');
88
  </script>
89
  </div>
90
- <button id="save_styles_button" class="button-primary"><?php _e('Save Quiz Style', 'quiz-master-next'); ?></button>
91
- <hr />
92
- <h3><?php _e('Custom Style CSS', 'quiz-master-next'); ?></h3>
93
- <p><?php _e('For help and guidance along with a list of different classes used in this plugin, please visit the following link:', 'quiz-master-next'); ?>
94
- <a target="_blank" href="https://quizandsurveymaster.com/docs/advanced-topics/editing-design-styles-css/">CSS in QSM</a></p>
 
 
 
 
 
95
  <table class="form-table">
96
  <tr>
97
- <td><textarea style="width: 100%; height: 700px;" id="quiz_css" name="quiz_css"><?php echo $mlw_quiz_options->quiz_stye; ?></textarea></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  </tr>
 
 
 
99
  </table>
100
- <?php wp_nonce_field( 'qsm_style_tab_nonce_action', 'qsm_style_tab_nonce' ); ?>
101
- <button id="save_styles_button" class="button-primary"><?php _e('Save Quiz Style', 'quiz-master-next'); ?></button>
102
  </form>
103
- <?php
 
104
  }
105
- ?>
14
  * @since 6.0.2
15
  */
16
  function qsm_settings_style_tab() {
17
+ global $mlwQuizMasterNext;
18
  $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Style', 'quiz-master-next' ), 'qsm_options_styling_tab_content' );
19
  }
20
  add_action( 'plugins_loaded', 'qsm_settings_style_tab', 5 );
35
  if ( isset( $_POST['qsm_style_tab_nonce'] ) && wp_verify_nonce( $_POST['qsm_style_tab_nonce'], 'qsm_style_tab_nonce_action' ) && isset( $_POST['save_style_options'] ) && 'confirmation' == $_POST['save_style_options'] ) {
36
 
37
  $style_quiz_id = intval( $_POST['style_quiz_id'] );
38
+ $quiz_theme = sanitize_text_field( $_POST['save_quiz_theme'] );
39
+ $quiz_style = sanitize_textarea_field( htmlspecialchars( stripslashes( $_POST['quiz_css'] ), ENT_QUOTES ) );
40
 
41
  // Saves the new css.
42
  $results = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}mlw_quizzes SET quiz_stye=%s, theme_selected=%s, last_activity=%s WHERE quiz_id=%d", $quiz_style, $quiz_theme, date( 'Y-m-d H:i:s' ), $style_quiz_id ) );
54
  }
55
  $registered_templates = $mlwQuizMasterNext->pluginHelper->get_quiz_templates();
56
  ?>
57
+ <script>
58
+ function mlw_qmn_theme(theme) {
59
+ document.getElementById('save_quiz_theme').value = theme;
60
+ jQuery("div.mlw_qmn_themeBlockActive").toggleClass("mlw_qmn_themeBlockActive");
61
+ jQuery("#mlw_qmn_theme_block_" + theme).toggleClass("mlw_qmn_themeBlockActive");
 
62
 
63
+ }
64
+ jQuery(document).ready(function() {
65
+ jQuery('.quiz_style_tab').click(function(e) {
66
+ e.preventDefault();
67
+ var current_id = jQuery(this).attr('data-id');
68
+ jQuery('.quiz_style_tab').removeClass('current');
69
+ jQuery(this).addClass('current');
70
+ jQuery('.quiz_style_tab_content').hide();
71
+ jQuery('#' + current_id).show();
72
+ });
73
+ });
74
+ </script>
75
+
76
+ <div class="qsm-sub-tab-menu" style="display: inline-block;width: 100%;">
77
+ <ul class="subsubsub">
78
+ <li>
79
+ <a href="#" data-id="qsm_themes" class="current quiz_style_tab">
80
+ <?php _e( 'Themes', 'quiz-master-next' ); ?></a> |
81
+ </li>
82
+ <li>
83
+ <a href="#" data-id="custom_css" class="quiz_style_tab">
84
+ <?php _e( 'Custom CSS', 'quiz-master-next' ); ?>
85
+ </a> |
86
+ </li>
87
+ <li>
88
+ <a href="#" data-id="legacy" class="quiz_style_tab">
89
+ <?php _e( 'Legacy', 'quiz-master-next' ); ?>
90
+ </a>
91
+ </li>
92
+ </ul>
93
+ </div>
94
+ <div id="qsm_themes" class="quiz_style_tab_content">
95
+ <?php
96
+ // Include required custom js and css
97
+ wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
98
+ wp_enqueue_script( 'qsm_theme_color_js', plugins_url( '../../js/qsm-theme-color.js', __FILE__ ), array( 'jquery', 'wp-color-picker', 'micromodal_script' ), $mlwQuizMasterNext->version );
99
+ wp_enqueue_style( 'wp-color-picker' );
100
+ wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ) );
101
+ wp_enqueue_media();
102
+ ?>
103
+ <script type="text/javascript">
104
+ jQuery(document).ready(function() {
105
+ jQuery(document).on('click', '.qsm-activate-theme', function() {
106
+ jQuery(this).parents('.theme-wrapper').find('input[name=quiz_theme_id]').prop("checked", true);
107
+ });
108
+ jQuery(document).on('input', '.quiz_featured_image', function() {
109
+ jQuery('.qsm_featured_image_preview').attr('src', jQuery(this).val());
110
+ });
111
+
112
+ jQuery(document).on('click', '.filter-links a', function() {
113
+ current_id = jQuery(this).attr('data-id');
114
+ jQuery(this).parents('.filter-links').find('li a').each(function() {
115
+ jQuery(this).removeClass('current');
116
+ });
117
+ jQuery(this).addClass('current');
118
+ jQuery(this).parents('#qsm_themes').find('.themes-container').children('div').each(function() {
119
+ if (jQuery(this).hasClass(current_id)) {
120
+ jQuery(this).show();
121
+ } else {
122
+ jQuery(this).hide();
123
+ }
124
+ });
125
+ })
126
+ });
127
  </script>
128
+ <?php
129
+ if ( isset( $_POST['quiz_theme_integration_nouce'] ) && wp_verify_nonce( $_POST['quiz_theme_integration_nouce'], 'quiz_theme_integration' ) ) {
130
+ $quiz_id = (int) $_GET['quiz_id'];
131
+ $theme_id = (int) $_POST['quiz_theme_id'];
132
+ $mlwQuizMasterNext->theme_settings->activate_selected_theme( $quiz_id, $theme_id );
133
+ if ( $_POST['save_featured_image'] == 'Save' ) {
134
+ $mlwQuizMasterNext->alertManager->newAlert( __( 'Featured image updated successfully.', 'quiz-master-next' ), 'success' );
135
+ } else {
136
+ $mlwQuizMasterNext->alertManager->newAlert( __( 'The theme is applied successfully.', 'quiz-master-next' ), 'success' );
137
+ $mlwQuizMasterNext->audit_manager->new_audit( "Styles Have Been Saved For Quiz Number $quiz_id" );
138
+ }
139
+ $featured_image = isset( $_POST['quiz_featured_image'] ) ? trim( $_POST['quiz_featured_image'] ) : '';
140
+ if ( ! empty( $quiz_id ) ) {
141
+ update_option( "quiz_featured_image_$quiz_id", $featured_image );
142
+ }
143
+ } else {
144
+ $featured_image = get_option( "quiz_featured_image_$quiz_id" );
145
+ $featured_image = ! empty( trim( $featured_image ) ) ? trim( $featured_image ) : '';
146
+ }
147
+ // Read all the themes
148
+ $saved_quiz_theme = $mlwQuizMasterNext->theme_settings->get_active_quiz_theme( $quiz_id );
149
+
150
+ if ( isset( $_POST['save_theme_settings_nonce'] ) && wp_verify_nonce(
151
+ $_POST['save_theme_settings_nonce'],
152
+ 'save_theme_settings'
153
+ ) ) {
154
+ unset( $_POST['save_theme_settings_nonce'] );
155
+ unset( $_POST['_wp_http_referer'] );
156
+ $settings_array = array();
157
+ array_map( 'sanitize_text_field', $_POST['settings'] );
158
+ $settings_array = serialize( $_POST['settings'] );
159
+ $results = $mlwQuizMasterNext->theme_settings->update_quiz_theme_settings(
160
+ $quiz_id,
161
+ $saved_quiz_theme,
162
+ $settings_array
163
+ );
164
+ $mlwQuizMasterNext->alertManager->newAlert(
165
+ __( 'The theme settings saved successfully.', 'quiz-master-next' ),
166
+ 'success'
167
+ );
168
+ $mlwQuizMasterNext->audit_manager->new_audit( "Theme settings Have Been Saved For Quiz Number $quiz_id" );
169
+ }
170
+ $folder_name = QSM_THEME_PATH;
171
+ $folder_slug = QSM_THEME_SLUG;
172
+ $theme_folders = array();
173
+ $post_permalink = $edit_link = '';
174
+ // Get quiz post based on quiz id
175
+ $args = array(
176
+ 'posts_per_page' => 1,
177
+ 'post_type' => 'qsm_quiz',
178
+ 'meta_query' => array(
179
+ array(
180
+ 'key' => 'quiz_id',
181
+ 'value' => $quiz_id,
182
+ 'compare' => '=',
183
+ ),
184
+ ),
185
+ );
186
+ $the_query = new WP_Query( $args );
187
+ if ( $the_query->have_posts() ) {
188
+ while ( $the_query->have_posts() ) {
189
+ $the_query->the_post();
190
+ $post_permalink = get_the_permalink( get_the_ID() );
191
+ $edit_link = get_edit_post_link( get_the_ID() );
192
+ }
193
+ /* Restore original Post Data */
194
+ wp_reset_postdata();
195
+ }
196
+ ?>
197
+ <div class="wp-filter hide-if-no-js">
198
+ <ul class="filter-links">
199
+ <li>
200
+ <a href="#" class="current" data-id="theme-browser"><?php _e( 'Themes', 'quiz-master-next' ); ?></a>
201
+ </li>
202
+ <li>
203
+ <?php if ( $saved_quiz_theme ) { ?>
204
+ <a href="#" data-id="theme-featured-image"><?php _e( 'Featured Image', 'quiz-master-next' ); ?></a>
205
+ <?php } ?>
206
+ </li>
207
+ <?php do_action( 'qsm_add_filter_menu' ); ?>
208
+ </ul>
209
+ </div>
210
+ <?php
211
+ echo '<form method="POST" action="">';
212
+ wp_nonce_field( 'quiz_theme_integration', 'quiz_theme_integration_nouce' );
213
+ ?>
214
+ <div class="themes-container">
215
+ <style>
216
+ .downloaded-theme-button {
217
+ display: none;
218
+ }
219
+ </style>
220
+ <div class="theme-browser rendered current">
221
+ <div class="themes wp-clearfix">
222
+ <?php qsm_get_installed_theme( $saved_quiz_theme ); ?>
223
+ </div>
224
+ </div>
225
+ <div class="theme-featured-image" style="display:none;">
226
+ <input type="text" class="quiz_featured_image" name="quiz_featured_image"
227
+ value="<?php echo $featured_image; ?>" />
228
+ <a id="set_featured_image" class="button "><?php _e( 'Set Featured Image', 'quiz-master-next' ); ?></a>
229
+ <br><img alt="" class="qsm_featured_image_preview" src="<?php echo $featured_image; ?>"><br>
230
+ <input type="submit" name="save_featured_image" class="button button-primary"
231
+ value="<?php _e( 'Save', 'quiz-master-next' ); ?>" />
232
+
233
+ </div>
234
+ </div>
235
+ <?php
236
+ echo '</form>';
237
+ ?>
238
+ </div>
239
+ <form action='' method='post' name='quiz_style_form'>
240
+ <div id="legacy" class="quiz_style_tab_content" style="display: none;">
241
+ <p style="font-size: 18px;"><b><?php _e( 'Note: ', 'quiz-master-next' ); ?>
242
+ </b><?php _e( 'This option will be removed in future.', 'quiz-master-next' ); ?></p>
243
  <input type='hidden' name='save_style_options' value='confirmation' />
244
  <input type='hidden' name='style_quiz_id' value='<?php echo esc_attr( $quiz_id ); ?>' />
245
+ <input type='hidden' name='save_quiz_theme' id='save_quiz_theme'
246
+ value='<?php echo esc_attr( $mlw_quiz_options->theme_selected ); ?>' />
247
+ <h3 style="display: none;"><?php _e( 'Quiz Styles', 'quiz-master-next' ); ?></h3>
248
  <p><?php _e( 'Choose your style:', 'quiz-master-next' ); ?></p>
249
  <style>
250
+ div.mlw_qmn_themeBlockActive {
251
+ background-color: yellow;
252
+ }
253
  </style>
254
  <div class="qsm-styles">
255
  <?php
256
  foreach ( $registered_templates as $slug => $template ) {
257
  ?>
258
+ <div onclick="mlw_qmn_theme('<?php echo $slug; ?>');" id="mlw_qmn_theme_block_<?php echo $slug; ?>" class="qsm-info-widget
259
+ <?php
260
+ if ( $mlw_quiz_options->theme_selected == $slug ) {
261
+ echo 'mlw_qmn_themeBlockActive';
262
+ }
263
+ ?>
264
+ "><?php echo $template['name']; ?></div>
265
+ <?php
266
+ }
267
+ ?>
268
+ <div onclick="mlw_qmn_theme('default');" id="mlw_qmn_theme_block_default" class="qsm-info-widget
269
+ <?php
270
+ if ( $mlw_quiz_options->theme_selected == 'default' ) {
271
+ echo 'mlw_qmn_themeBlockActive';
272
  }
273
  ?>
274
+ "><?php _e( 'Custom', 'quiz-master-next' ); ?></div>
275
  <script>
276
+ mlw_qmn_theme('<?php echo $mlw_quiz_options->theme_selected; ?>');
277
  </script>
278
  </div>
279
+ <button id="save_styles_button" class="button-primary">
280
+ <?php _e( 'Save Quiz Style', 'quiz-master-next' ); ?>
281
+ </button>
282
+ </div>
283
+ <div id="custom_css" class="quiz_style_tab_content" style="display: none;">
284
+ <h3><?php _e( 'Custom Style CSS', 'quiz-master-next' ); ?></h3>
285
+ <p><?php _e( 'For help and guidance along with a list of different classes used in this plugin, please visit the following link:', 'quiz-master-next' ); ?>
286
+ <a target="_blank" rel="noopener"
287
+ href="https://quizandsurveymaster.com/docs/advanced-topics/editing-design-styles-css/">CSS in QSM</a>
288
+ </p>
289
  <table class="form-table">
290
  <tr>
291
+ <td><textarea style="width: 100%; height: 700px;" id="quiz_css"
292
+ name="quiz_css"><?php echo $mlw_quiz_options->quiz_stye; ?></textarea></td>
293
+ </tr>
294
+ </table>
295
+ <?php wp_nonce_field( 'qsm_style_tab_nonce_action', 'qsm_style_tab_nonce' ); ?>
296
+ <button id="save_styles_button"
297
+ class="button-primary"><?php _e( 'Save Quiz Style', 'quiz-master-next' ); ?></button>
298
+ </div>
299
+ </form>
300
+ <div class="qsm-popup qsm-popup-slide qsm-theme-color-settings" id="qsm-theme-color-settings" aria-hidden="true">
301
+ <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
302
+ <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-2-title">
303
+ <header class="qsm-popup__header">
304
+ <h2 class="qsm-popup__title" id="modal-2-title">
305
+ <?php _e( 'Customize Quiz Theme', 'quiz-master-next' ); ?>
306
+ </h2>
307
+ <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
308
+ </header>
309
+ <main class="qsm-popup__content" id="thme-color-settings-content">
310
+ <form action="" method="post" class="qsm-theme-settings-frm">
311
+ <?php wp_nonce_field( 'save_theme_settings', 'save_theme_settings_nonce' ); ?>
312
+ <table class="form-table" style="width: 100%;">
313
+ <?php
314
+ $get_theme_settings = $mlwQuizMasterNext->theme_settings->get_active_theme_settings( $quiz_id, $saved_quiz_theme );
315
+
316
+ if ( $get_theme_settings ) {
317
+ $i = 0;
318
+ foreach ( $get_theme_settings as $key => $theme_val ) {
319
+ ?>
320
+ <tr valign="top">
321
+ <th scope="row" class="qsm-opt-tr">
322
+ <label for="form_type"><?php echo $theme_val['label']; ?></label>
323
+ <input type="hidden" name="settings[<?php echo $i; ?>][label]"
324
+ value="<?php echo $theme_val['label']; ?>">
325
+ <input type="hidden" name="settings[<?php echo $i; ?>][id]"
326
+ value="<?php echo $theme_val['id']; ?>">
327
+ <input type="hidden" name="settings[<?php echo $i; ?>][type]" value="color">
328
+ </th>
329
+ <td>
330
+ <input name="settings[<?php echo $i; ?>][default]" type="text"
331
+ value="<?php echo $theme_val['default']; ?>"
332
+ data-default-color="<?php echo $theme_val['default']; ?>" class="my-color-field" />
333
+ </td>
334
+ </tr>
335
+ <?php
336
+ $i++;
337
+ }
338
+ } else {
339
+ ?>
340
+ <tr>
341
+ <td colspan="2">
342
+ <?php _e( 'No settings found', 'quiz-master-next' ); ?>
343
+ </td>
344
+ </tr>
345
+ <?php
346
+ }
347
+ ?>
348
+ </table>
349
+ </form>
350
+ </main>
351
+ <footer class="qsm-popup__footer">
352
+ <button id="qsm-save-theme-settings"
353
+ class="button button-primary"><?php _e( 'Save Settings', 'quiz-master-next' ); ?></button>
354
+ <button class="button" data-micromodal-close
355
+ aria-label="Close this dialog window"><?php _e( 'Cancel', 'quiz-master-next' ); ?></button>
356
+ </footer>
357
+ </div>
358
+ </div>
359
+ </div>
360
+ <?php
361
+ }
362
+
363
+ add_action( 'admin_menu', 'qsm_register_theme_Setting_submenu_page' );
364
+
365
+ function qsm_register_theme_Setting_submenu_page() {
366
+ add_submenu_page( null, __( 'Theme Settings', 'quiz-master-next' ), __( 'Theme Settings', 'quiz-master-next' ), 'manage_options', 'qmn_theme_settings', 'qsm_display_theme_settings' );
367
+ }
368
+
369
+ function qsm_display_theme_settings() {
370
+ global $mlwQuizMasterNext, $wpdb;
371
+ $quiz_id = isset( $_GET['quiz_id'] ) ? intval( $_GET['quiz_id'] ) : 0;
372
+ $theme_id = $mlwQuizMasterNext->theme_settings->get_active_quiz_theme( $quiz_id );
373
+
374
+ if ( isset( $_POST['save_theme_settings_nonce'] ) && wp_verify_nonce( $_POST['save_theme_settings_nonce'], 'save_theme_settings' ) ) {
375
+ unset( $_POST['save_theme_settings_nonce'] );
376
+ unset( $_POST['_wp_http_referer'] );
377
+ $settings_array = array();
378
+ array_map( 'sanitize_text_field', $_POST['settings'] );
379
+ $settings_array = serialize( $_POST['settings'] );
380
+ $results = $mlwQuizMasterNext->theme_settings->update_quiz_theme_settings( $quiz_id, $theme_id, $settings_array );
381
+ ?>
382
+ <div class="notice notice-success is-dismissible" style="margin-top:30px;">
383
+ <p><?php _e( 'Theme settings are saved!', 'quiz-master-next' ); ?></p>
384
+ </div>
385
+ <?php
386
+ }
387
+ $get_theme_settings = $mlwQuizMasterNext->theme_settings->get_active_theme_settings( $quiz_id, $theme_id )
388
+ ?>
389
+ <div class="wrap">
390
+ <h1 style="margin-bottom: 10px;">
391
+ <?php
392
+ $quiz_name = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $quiz_id ) );
393
+ echo $quiz_name;
394
+ ?>
395
+ <a href="<?php echo admin_url( 'admin.php?page=mlw_quiz_options&quiz_id=' ) . $quiz_id . '&tab=style'; ?>"
396
+ class="edit-quiz-name button button-primary"><?php _e( 'Back to themes', 'quiz-master-next' ); ?></a>
397
+ </h1>
398
+ <form action="" method="post">
399
+ <?php wp_nonce_field( 'save_theme_settings', 'save_theme_settings_nonce' ); ?>
400
+ <table class="form-table" style="width: 100%;">
401
+ <?php
402
+ $theme_settings = array();
403
+ $theme_settings = apply_filters( 'qsm_theme_settings', $theme_settings, $quiz_id );
404
+ if ( $theme_settings ) {
405
+ foreach ( $theme_settings as $key => $theme_val ) {
406
+ $setting_val = isset( $get_theme_settings[ $theme_val['id'] ] ) ? $get_theme_settings[ $theme_val['id'] ] : $theme_val['default'];
407
+ ?>
408
+ <tr valign="top">
409
+ <th scope="row" class="qsm-opt-tr">
410
+ <label for="form_type"><?php echo $theme_val['label']; ?></label>
411
+ </th>
412
+ <td>
413
+ <input name="<?php echo $theme_val['id']; ?>" type="text" value="<?php echo $setting_val; ?>"
414
+ data-default-color="<?php echo $setting_val; ?>" class="my-color-field" />
415
+ </td>
416
+ </tr>
417
+ <?php
418
+ }
419
+ } else {
420
+ ?>
421
+ <tr>
422
+ <td colspan="2">
423
+ <?php _e( 'No settings found', 'quiz-master-next' ); ?>
424
+ </td>
425
  </tr>
426
+ <?php
427
+ }
428
+ ?>
429
  </table>
430
+ <button class="button-primary"><?php _e( 'Save Changes', 'quiz-master-next' ); ?></button>
 
431
  </form>
432
+ </div>
433
+ <?php
434
  }
435
+ ?>
php/classes/class-qmn-plugin-helper.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
  }
5
 
6
  /**
@@ -10,628 +10,652 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  *
11
  * @since 4.0.0
12
  */
13
- class QMNPluginHelper {
14
-
15
-
16
- /**
17
- * Addon Page tabs array
18
- *
19
- * @var array
20
- * @since 4.0.0
21
- */
22
- public $addon_tabs = array();
23
-
24
- /**
25
- * Stats Page tabs array
26
- *
27
- * @var array
28
- * @since 4.0.0
29
- */
30
- public $stats_tabs = array();
31
-
32
- /**
33
- * Admin Results Page tabs array
34
- *
35
- * @var array
36
- * @since 5.0.0
37
- */
38
- public $admin_results_tabs = array();
39
-
40
- /**
41
- * Results Details Page tabs array
42
- *
43
- * @var array
44
- * @since 4.1.0
45
- */
46
- public $results_tabs = array();
47
-
48
- /**
49
- * Settings Page tabs array
50
- *
51
- * @var array
52
- * @since 4.0.0
53
- */
54
- public $settings_tabs = array();
55
-
56
- /**
57
- * Question types array
58
- *
59
- * @var array
60
- * @since 4.0.0
61
- */
62
- public $question_types = array();
63
-
64
- /**
65
- * Template array
66
- *
67
- * @var array
68
- * @since 4.5.0
69
- */
70
- public $quiz_templates = array();
71
-
72
- /**
73
- * Main Construct Function
74
- *
75
- * Call functions within class
76
- *
77
- * @since 4.0.0
78
- * @return void
79
- */
80
- public function __construct() {
81
- add_action( 'wp_ajax_qmn_question_type_change', array( $this, 'get_question_type_edit_content' ) );
82
- }
83
-
84
- /**
85
- * Calls all class functions to initialize quiz
86
- *
87
- * @param int $quiz_id The ID of the quiz or survey to load.
88
- * @return bool True or False if ID is valid.
89
- */
90
- public function prepare_quiz( $quiz_id ) {
91
- $quiz_id = intval( $quiz_id );
92
-
93
- // Tries to load quiz name to ensure this is a valid ID.
94
- global $wpdb;
95
- $quiz_name = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $quiz_id ) );
96
- if ( is_null( $quiz_name ) ) {
97
- return false;
98
- }
99
-
100
- global $mlwQuizMasterNext;
101
- $mlwQuizMasterNext->quizCreator->set_id( $quiz_id );
102
- $mlwQuizMasterNext->quiz_settings->prepare_quiz( $quiz_id );
103
-
104
- return true;
105
- }
106
-
107
- /**
108
- * Retrieves all quizzes.
109
- *
110
- * @param bool $include_deleted If set to true, returned array will include all deleted quizzes
111
- * @param string $order_by The column the quizzes should be ordered by
112
- * @param string $order whether the $order_by should be ordered as ascending or decending. Can be "ASC" or "DESC"
113
- * @param arr $user_role role of current user
114
- * @param int $user_id Get the quiz based on user id
115
- * @return array All of the quizzes as a numerical array of objects
116
- */
117
- public function get_quizzes( $include_deleted = false, $order_by = 'quiz_id', $order = 'DESC', $user_role = array(), $user_id = '', $limit = '', $offset = '', $where = '' ) {
118
- global $wpdb;
119
-
120
- // Set order direction
121
- $order_direction = 'DESC';
122
- if ( 'ASC' == $order ) {
123
- $order_direction = 'ASC';
124
- }
125
-
126
- // Set field to sort by
127
- switch ( $order_by ) {
128
- case 'last_activity':
129
- $order_field = 'last_activity';
130
- break;
131
-
132
- case 'quiz_views':
133
- $order_field = 'quiz_views';
134
- break;
135
-
136
- case 'quiz_taken':
137
- $order_field = 'quiz_taken';
138
- break;
139
-
140
- case 'title':
141
- $order_field = 'quiz_name';
142
- break;
143
-
144
- default:
145
- $order_field = 'quiz_id';
146
- break;
147
- }
148
-
149
- // Should we include deleted?
150
- $delete = 'WHERE deleted=0';
151
- if ( $where != '' ) {
152
- $delete = $delete . ' AND ' . $where;
153
- }
154
- if ( $include_deleted ) {
155
- $delete = '';
156
- }
157
- $user_str = '';
158
- if ( in_array( 'author', (array) $user_role ) ) {
159
- if ( $user_id && $delete == '' ) {
160
- $user_str = "WHERE quiz_author_id = '$user_id'";
161
- } elseif ( $user_id && $delete !== '' ) {
162
- $user_str = " AND quiz_author_id = '$user_id'";
163
- }
164
- }
165
- if ( $where != '' && $user_str != '' ) {
166
- $user_str = $user_str . ' AND ' . $where;
167
- }
168
- $where_str = '';
169
- if ( $user_str == '' && $delete === '' && $where != '' ) {
170
- $where_str = "WHERE $where";
171
- }
172
- if ( $limit != '' ) {
173
- $limit = ' limit ' . $offset . ', ' . $limit;
174
- }
175
- // Get quizzes and return them
176
- $quizzes = $wpdb->get_results( stripslashes( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes %1s %2s %3s ORDER BY %4s %5s %6s", $delete, $user_str, $where_str, $order_field, $order_direction, $limit ) ) );
177
- return $quizzes;
178
- }
179
-
180
- /**
181
- * Registers a quiz setting
182
- *
183
- * @since 5.0.0
184
- * @param array $field_array An array of the components for the settings field
185
- */
186
- public function register_quiz_setting( $field_array, $section = 'quiz_options' ) {
187
- global $mlwQuizMasterNext;
188
- $mlwQuizMasterNext->quiz_settings->register_setting( $field_array, $section );
189
- }
190
-
191
- /**
192
- * Retrieves a setting value from a section based on name of section and setting
193
- *
194
- * @since 5.0.0
195
- * @param string $section The name of the section the setting is registered in
196
- * @param string $setting The name of the setting whose value we need to retrieve
197
- * @param mixed $default What we need to return if no setting exists with given $setting
198
- * @return $mixed Value set for $setting or $default if setting does not exist
199
- */
200
- public function get_section_setting( $section, $setting, $default = false ) {
201
- global $mlwQuizMasterNext;
202
- return apply_filters( 'qsm_section_setting_text', $mlwQuizMasterNext->quiz_settings->get_section_setting( $section, $setting, $default ) );
203
- }
204
-
205
- /**
206
- * Retrieves setting value based on name of setting
207
- *
208
- * @since 4.0.0
209
- * @param string $setting The name of the setting whose value we need to retrieve
210
- * @param mixed $default What we need to return if no setting exists with given $setting
211
- * @return $mixed Value set for $setting or $default if setting does not exist
212
- */
213
- public function get_quiz_setting( $setting, $default = false ) {
214
- global $mlwQuizMasterNext;
215
- return $mlwQuizMasterNext->quiz_settings->get_setting( $setting, $default );
216
- }
217
-
218
- /**
219
- * Updates a settings value, adding it if it didn't already exist
220
- *
221
- * @since 4.0.0
222
- * @param string $setting The name of the setting whose value we need to retrieve
223
- * @param mixed $value The value that needs to be stored for the setting
224
- * @return bool True if successful or false if fails
225
- */
226
- public function update_quiz_setting( $setting, $value ) {
227
- global $mlwQuizMasterNext;
228
- return $mlwQuizMasterNext->quiz_settings->update_setting( $setting, $value );
229
- }
230
-
231
- /**
232
- * Outputs the section of input fields
233
- *
234
- * @since 5.0.0
235
- * @since 7.0 Added new parameter settings_fields for default setting
236
- * @param string $section The section that the settings were registered with
237
- */
238
- public function generate_settings_section( $section = 'quiz_options', $settings_fields = array() ) {
239
- global $mlwQuizMasterNext;
240
- if ( empty( $settings_fields ) ) {
241
- $settings_fields = $mlwQuizMasterNext->quiz_settings->load_setting_fields( $section );
242
- }
243
- QSM_Fields::generate_section( $settings_fields, $section );
244
- }
245
-
246
- /**
247
- * Registers Quiz Templates
248
- *
249
- * @since 4.5.0
250
- * @param $name String of the name of the template
251
- * @param $file_path String of the path to the css file
252
- */
253
- public function register_quiz_template( $name, $file_path ) {
254
- $slug = strtolower( str_replace( ' ', '-', $name ) );
255
- $this->quiz_templates[ $slug ] = array(
256
- 'name' => $name,
257
- 'path' => $file_path,
258
- );
259
- }
260
-
261
- /**
262
- * Returns Template Array
263
- *
264
- * @since 4.5.0
265
- * @param $name String of the name of the template. If left empty, will return all templates
266
- * @return array The array of quiz templates
267
- */
268
- public function get_quiz_templates( $slug = null ) {
269
- if ( is_null( $slug ) ) {
270
- return $this->quiz_templates;
271
- } elseif ( isset( $this->quiz_templates[ $slug ] ) ) {
272
- return $this->quiz_templates[ $slug ];
273
- } else {
274
- return false;
275
- }
276
- }
277
-
278
- /**
279
- * Register Question Types
280
- *
281
- * Adds a question type to the question type array using the parameters given
282
- *
283
- * @since 4.0.0
284
- * @param string $name The name of the Question Type which will be shown when selecting type
285
- * @param string $display_function The name of the function to call when displaying the question
286
- * @param bool $graded Tells the plugin if this question is graded or not. This will affect scoring.
287
- * @param string $review_function The name of the function to call when scoring the question
288
- * @param string $slug The slug of the question type to be stored with question in database
289
- * @return void
290
- */
291
- public function register_question_type( $name, $display_function, $graded, $review_function = null, $edit_args = null, $save_edit_function = null, $slug = null ) {
292
- if ( is_null( $slug ) ) {
293
- $slug = strtolower( str_replace( ' ', '-', $name ) );
294
- } else {
295
- $slug = strtolower( str_replace( ' ', '-', $slug ) );
296
- }
297
- if ( is_null( $edit_args ) || ! is_array( $edit_args ) ) {
298
- $validated_edit_function = array(
299
- 'inputs' => array(
300
- 'question',
301
- 'answer',
302
- 'hint',
303
- 'correct_info',
304
- 'comments',
305
- 'category',
306
- 'required',
307
- ),
308
- 'information' => '',
309
- 'extra_inputs' => array(),
310
- 'function' => '',
311
- );
312
- } else {
313
- $validated_edit_function = array(
314
- 'inputs' => $edit_args['inputs'],
315
- 'information' => $edit_args['information'],
316
- 'extra_inputs' => $edit_args['extra_inputs'],
317
- 'function' => $edit_args['function'],
318
- );
319
- }
320
- if ( is_null( $save_edit_function ) ) {
321
- $save_edit_function = '';
322
- }
323
- $new_type = array(
324
- 'name' => $name,
325
- 'display' => $display_function,
326
- 'review' => $review_function,
327
- 'graded' => $graded,
328
- 'edit' => $validated_edit_function,
329
- 'save' => $save_edit_function,
330
- 'slug' => $slug,
331
- );
332
- $this->question_types[] = $new_type;
333
- }
334
-
335
- /**
336
- * Retrieves List Of Question Types
337
- *
338
- * retrieves a list of the slugs and names of the question types
339
- *
340
- * @since 4.0.0
341
- * @return array An array which contains the slug and name of question types that have been registered
342
- */
343
- public function get_question_type_options() {
344
- $type_array = array();
345
- foreach ( $this->question_types as $type ) {
346
- $type_array[] = array(
347
- 'slug' => $type['slug'],
348
- 'name' => $type['name'],
349
- );
350
- }
351
- return $type_array;
352
- }
353
-
354
- public function get_question_type_edit_fields() {
355
- $type_array = array();
356
- foreach ( $this->question_types as $type ) {
357
- $type_array[ $type['slug'] ] = $type['edit'];
358
- }
359
- return $type_array;
360
- }
361
-
362
- /**
363
- * Displays A Question
364
- *
365
- * Retrieves the question types display function and creates the HTML for the question
366
- *
367
- * @since 4.0.0
368
- * @param string $slug The slug of the question type that the question is
369
- * @param int $question_id The id of the question
370
- * @param array $quiz_options An array of the columns of the quiz row from the database
371
- * @return string The HTML for the question
372
- */
373
- public function display_question( $slug, $question_id, $quiz_options ) {
374
- $display = '';
375
- global $wpdb;
376
- global $qmn_total_questions;
377
- $question = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'mlw_questions WHERE question_id=%d', intval( $question_id ) ) );
378
- $answers = array();
379
- if ( is_serialized( $question->answer_array ) && is_array( @unserialize( $question->answer_array ) ) ) {
380
- $answers = @unserialize( $question->answer_array );
381
- } else {
382
- $mlw_answer_array_correct = array( 0, 0, 0, 0, 0, 0 );
383
- $mlw_answer_array_correct[ $question->correct_answer - 1 ] = 1;
384
- $answers = array(
385
- array( $question->answer_one, $question->answer_one_points, $mlw_answer_array_correct[0] ),
386
- array( $question->answer_two, $question->answer_two_points, $mlw_answer_array_correct[1] ),
387
- array( $question->answer_three, $question->answer_three_points, $mlw_answer_array_correct[2] ),
388
- array( $question->answer_four, $question->answer_four_points, $mlw_answer_array_correct[3] ),
389
- array( $question->answer_five, $question->answer_five_points, $mlw_answer_array_correct[4] ),
390
- array( $question->answer_six, $question->answer_six_points, $mlw_answer_array_correct[5] ),
391
- );
392
- }
393
- if ( 2 == $quiz_options->randomness_order || 3 == $quiz_options->randomness_order ) {
394
- shuffle( $answers );
395
- }
396
- foreach ( $this->question_types as $type ) {
397
- if ( $type['slug'] == strtolower( str_replace( ' ', '-', $slug ) ) ) {
398
- if ( $type['graded'] ) {
399
- $qmn_total_questions += 1;
400
- if ( $quiz_options->question_numbering == 1 ) {
401
- $display .= "<span class='mlw_qmn_question_number'>$qmn_total_questions. </span>";
402
- }
403
- }
404
- if ( $quiz_options->show_category_on_front && $question->category != '' ) {
405
- $display .= '<div class="quiz-cat">[ ' . $question->category . ' ]</div>';
406
- }
407
- $display .= call_user_func( $type['display'], intval( $question_id ), $question->question_name, $answers );
408
- }
409
- }
410
- return $display;
411
- }
412
-
413
- /**
414
- * Calculates Score For Question
415
- *
416
- * Calculates the score for the question based on the question type
417
- *
418
- * @since 4.0.0
419
- * @param string $slug The slug of the question type that the question is
420
- * @param int $question_id The id of the question
421
- * @return array An array of the user's score from the question
422
- */
423
- public function display_review( $slug, $question_id ) {
424
- $results_array = array();
425
- global $wpdb;
426
- $question = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'mlw_questions WHERE question_id=%d', intval( $question_id ) ) );
427
- $answers = array();
428
- if ( is_serialized( $question->answer_array ) && is_array( @unserialize( $question->answer_array ) ) ) {
429
- $answers = @unserialize( $question->answer_array );
430
- } else {
431
- $mlw_answer_array_correct = array( 0, 0, 0, 0, 0, 0 );
432
- $mlw_answer_array_correct[ $question->correct_answer - 1 ] = 1;
433
- $answers = array(
434
- array( $question->answer_one, $question->answer_one_points, $mlw_answer_array_correct[0] ),
435
- array( $question->answer_two, $question->answer_two_points, $mlw_answer_array_correct[1] ),
436
- array( $question->answer_three, $question->answer_three_points, $mlw_answer_array_correct[2] ),
437
- array( $question->answer_four, $question->answer_four_points, $mlw_answer_array_correct[3] ),
438
- array( $question->answer_five, $question->answer_five_points, $mlw_answer_array_correct[4] ),
439
- array( $question->answer_six, $question->answer_six_points, $mlw_answer_array_correct[5] ),
440
- );
441
- }
442
- foreach ( $this->question_types as $type ) {
443
- if ( $type['slug'] == strtolower( str_replace( ' ', '-', $slug ) ) ) {
444
- if ( ! is_null( $type['review'] ) ) {
445
- $results_array = call_user_func( $type['review'], intval( $question_id ), $question->question_name, $answers );
446
- } else {
447
- $results_array = array( 'null_review' => true );
448
- }
449
- }
450
- }
451
- return $results_array;
452
- }
453
-
454
- /**
455
- * Retrieves A Question Setting
456
- *
457
- * Retrieves a setting stored in the question settings array
458
- *
459
- * @since 4.0.0
460
- * @param int $question_id The id of the question
461
- * @param string $setting The name of the setting
462
- * @return string The value stored for the setting
463
- */
464
- public function get_question_setting( $question_id, $setting ) {
465
- global $wpdb;
466
- $qmn_settings_array = '';
467
- $settings = $wpdb->get_var( $wpdb->prepare( 'SELECT question_settings FROM ' . $wpdb->prefix . 'mlw_questions WHERE question_id=%d', $question_id ) );
468
- if ( is_serialized( $settings ) && is_array( @unserialize( $settings ) ) ) {
469
- $qmn_settings_array = @unserialize( $settings );
470
- }
471
- if ( is_array( $qmn_settings_array ) && isset( $qmn_settings_array[ $setting ] ) ) {
472
- return $qmn_settings_array[ $setting ];
473
- } else {
474
- return '';
475
- }
476
- }
477
-
478
- /**
479
- * Registers Addon Settings Tab
480
- *
481
- * Registers a new tab on the addon settings page
482
- *
483
- * @since 4.0.0
484
- * @param string $title The name of the tab
485
- * @param string $function The function that displays the tab's content
486
- * @return void
487
- */
488
- public function register_addon_settings_tab( $title, $function ) {
489
- $slug = strtolower( str_replace( ' ', '-', $title ) );
490
- $new_tab = array(
491
- 'title' => $title,
492
- 'function' => $function,
493
- 'slug' => $slug,
494
- );
495
- $this->addon_tabs[] = $new_tab;
496
- }
497
-
498
- /**
499
- * Retrieves Addon Settings Tab Array
500
- *
501
- * Retrieves the array of titles and functions of the registered tabs
502
- *
503
- * @since 4.0.0
504
- * @return array The array of registered tabs
505
- */
506
- public function get_addon_tabs() {
507
- return $this->addon_tabs;
508
- }
509
-
510
- /**
511
- * Registers Stats Tab
512
- *
513
- * Registers a new tab on the stats page
514
- *
515
- * @since 4.3.0
516
- * @param string $title The name of the tab
517
- * @param string $function The function that displays the tab's content
518
- * @return void
519
- */
520
- public function register_stats_settings_tab( $title, $function ) {
521
- $slug = strtolower( str_replace( ' ', '-', $title ) );
522
- $new_tab = array(
523
- 'title' => $title,
524
- 'function' => $function,
525
- 'slug' => $slug,
526
- );
527
- $this->stats_tabs[] = $new_tab;
528
- }
529
-
530
- /**
531
- * Retrieves Stats Tab Array
532
- *
533
- * Retrieves the array of titles and functions of the registered tabs
534
- *
535
- * @since 4.3.0
536
- * @return array The array of registered tabs
537
- */
538
- public function get_stats_tabs() {
539
- return $this->stats_tabs;
540
- }
541
-
542
- /**
543
- * Registers tabs for the Admin Results page
544
- *
545
- * Registers a new tab on the admin results page
546
- *
547
- * @since 5.0.0
548
- * @param string $title The name of the tab
549
- * @param string $function The function that displays the tab's content
550
- * @return void
551
- */
552
- public function register_admin_results_tab( $title, $function ) {
553
- $slug = strtolower( str_replace( ' ', '-', $title ) );
554
- $new_tab = array(
555
- 'title' => $title,
556
- 'function' => $function,
557
- 'slug' => $slug,
558
- );
559
- $this->admin_results_tabs[] = $new_tab;
560
- }
561
-
562
- /**
563
- * Retrieves Admin Results Tab Array
564
- *
565
- * Retrieves the array of titles and functions for the tabs registered for the admin results page
566
- *
567
- * @since 5.0.0
568
- * @return array The array of registered tabs
569
- */
570
- public function get_admin_results_tabs() {
571
- return $this->admin_results_tabs;
572
- }
573
-
574
- /**
575
- * Registers Results Tab
576
- *
577
- * Registers a new tab on the results page
578
- *
579
- * @since 4.1.0
580
- * @param string $title The name of the tab
581
- * @param string $function The function that displays the tab's content
582
- * @return void
583
- */
584
- public function register_results_settings_tab( $title, $function ) {
585
- $slug = strtolower( str_replace( ' ', '-', $title ) );
586
- $new_tab = array(
587
- 'title' => $title,
588
- 'function' => $function,
589
- 'slug' => $slug,
590
- );
591
- $this->results_tabs[] = $new_tab;
592
- }
593
-
594
- /**
595
- * Retrieves Results Tab Array
596
- *
597
- * Retrieves the array of titles and functions of the registered tabs
598
- *
599
- * @since 4.1.0
600
- * @return array The array of registered tabs
601
- */
602
- public function get_results_tabs() {
603
- return $this->results_tabs;
604
- }
605
-
606
- /**
607
- * Registers Quiz Settings Tab
608
- *
609
- * Registers a new tab on the quiz settings page
610
- *
611
- * @since 4.0.0
612
- * @param string $title The name of the tab
613
- * @param string $function The function that displays the tab's content
614
- * @return void
615
- */
616
- public function register_quiz_settings_tabs( $title, $function ) {
617
- $slug = strtolower( str_replace( ' ', '-', $title ) );
618
- $new_tab = array(
619
- 'title' => $title,
620
- 'function' => $function,
621
- 'slug' => $slug,
622
- );
623
- $this->settings_tabs[] = $new_tab;
624
- }
625
-
626
- /**
627
- * Echos Registered Tabs Title Link
628
- *
629
- * Echos the title link of the registered tabs
630
- *
631
- * @since 4.0.0
632
- * @return array The array of registered tabs
633
- */
634
- public function get_settings_tabs() {
635
- return $this->settings_tabs;
636
- }
637
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ if (!defined('ABSPATH')) {
3
+ exit;
4
  }
5
 
6
  /**
10
  *
11
  * @since 4.0.0
12
  */
13
+ class QMNPluginHelper
14
+ {
15
+
16
+ /**
17
+ * Addon Page tabs array
18
+ *
19
+ * @var array
20
+ * @since 4.0.0
21
+ */
22
+ public $addon_tabs = array();
23
+
24
+ /**
25
+ * Stats Page tabs array
26
+ *
27
+ * @var array
28
+ * @since 4.0.0
29
+ */
30
+ public $stats_tabs = array();
31
+
32
+ /**
33
+ * Admin Results Page tabs array
34
+ *
35
+ * @var array
36
+ * @since 5.0.0
37
+ */
38
+ public $admin_results_tabs = array();
39
+
40
+ /**
41
+ * Results Details Page tabs array
42
+ *
43
+ * @var array
44
+ * @since 4.1.0
45
+ */
46
+ public $results_tabs = array();
47
+
48
+ /**
49
+ * Settings Page tabs array
50
+ *
51
+ * @var array
52
+ * @since 4.0.0
53
+ */
54
+ public $settings_tabs = array();
55
+
56
+ /**
57
+ * Question types array
58
+ *
59
+ * @var array
60
+ * @since 4.0.0
61
+ */
62
+ public $question_types = array();
63
+
64
+ /**
65
+ * Template array
66
+ *
67
+ * @var array
68
+ * @since 4.5.0
69
+ */
70
+ public $quiz_templates = array();
71
+
72
+ /**
73
+ * Main Construct Function
74
+ *
75
+ * Call functions within class
76
+ *
77
+ * @since 4.0.0
78
+ * @return void
79
+ */
80
+ public function __construct()
81
+ {
82
+ add_action('wp_ajax_qmn_question_type_change', array($this, 'get_question_type_edit_content'));
83
+ }
84
+
85
+ /**
86
+ * Calls all class functions to initialize quiz
87
+ *
88
+ * @param int $quiz_id The ID of the quiz or survey to load.
89
+ * @return bool True or False if ID is valid.
90
+ */
91
+ public function prepare_quiz($quiz_id)
92
+ {
93
+ $quiz_id = intval($quiz_id);
94
+
95
+ // Tries to load quiz name to ensure this is a valid ID.
96
+ global $wpdb;
97
+ $quiz_name = $wpdb->get_var($wpdb->prepare("SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $quiz_id));
98
+ if (is_null($quiz_name)) {
99
+ return false;
100
+ }
101
+
102
+ global $mlwQuizMasterNext;
103
+ $mlwQuizMasterNext->quizCreator->set_id($quiz_id);
104
+ $mlwQuizMasterNext->quiz_settings->prepare_quiz($quiz_id);
105
+
106
+ return true;
107
+ }
108
+
109
+ /**
110
+ * Retrieves all quizzes.
111
+ *
112
+ * @param bool $include_deleted If set to true, returned array will include all deleted quizzes
113
+ * @param string $order_by The column the quizzes should be ordered by
114
+ * @param string $order whether the $order_by should be ordered as ascending or decending. Can be "ASC" or "DESC"
115
+ * @param arr $user_role role of current user
116
+ * @param int $user_id Get the quiz based on user id
117
+ * @return array All of the quizzes as a numerical array of objects
118
+ */
119
+ public function get_quizzes($include_deleted = false, $order_by = 'quiz_id', $order = 'DESC', $user_role = array(), $user_id = '', $limit = '', $offset = '', $where = '')
120
+ {
121
+ global $wpdb;
122
+
123
+ // Set order direction
124
+ $order_direction = 'DESC';
125
+ if ('ASC' == $order) {
126
+ $order_direction = 'ASC';
127
+ }
128
+
129
+ // Set field to sort by
130
+ switch ($order_by) {
131
+ case 'last_activity':
132
+ $order_field = 'last_activity';
133
+ break;
134
+
135
+ case 'quiz_views':
136
+ $order_field = 'quiz_views';
137
+ break;
138
+
139
+ case 'quiz_taken':
140
+ $order_field = 'quiz_taken';
141
+ break;
142
+
143
+ case 'title':
144
+ $order_field = 'quiz_name';
145
+ break;
146
+
147
+ default:
148
+ $order_field = 'quiz_id';
149
+ break;
150
+ }
151
+
152
+ // Should we include deleted?
153
+ $delete = "WHERE deleted=0";
154
+ if ($where != '') {
155
+ $delete = $delete . ' AND ' . $where;
156
+ }
157
+ if ($include_deleted) {
158
+ $delete = '';
159
+ }
160
+ $user_str = '';
161
+ if (in_array('author', (array) $user_role)) {
162
+ if ($user_id && $delete == '') {
163
+ $user_str = "WHERE quiz_author_id = '$user_id'";
164
+ } else if ($user_id && $delete !== '') {
165
+ $user_str = " AND quiz_author_id = '$user_id'";
166
+ }
167
+ }
168
+ if ($where != '' && $user_str != '') {
169
+ $user_str = $user_str . ' AND ' . $where;
170
+ }
171
+ $where_str = '';
172
+ if ($user_str == '' && $delete === '' && $where != '') {
173
+ $where_str = "WHERE $where";
174
+ }
175
+ if ($limit != '') {
176
+ $limit = ' limit ' . $offset . ', ' . $limit;
177
+ }
178
+ // Get quizzes and return them
179
+ $quizzes = $wpdb->get_results(stripslashes($wpdb->prepare("SELECT * FROM {$wpdb->prefix}mlw_quizzes %1s %2s %3s ORDER BY %4s %5s %6s", $delete, $user_str, $where_str, $order_field, $order_direction, $limit)));
180
+ return $quizzes;
181
+ }
182
+
183
+ /**
184
+ * Registers a quiz setting
185
+ *
186
+ * @since 5.0.0
187
+ * @param array $field_array An array of the components for the settings field
188
+ */
189
+ public function register_quiz_setting($field_array, $section = 'quiz_options')
190
+ {
191
+ global $mlwQuizMasterNext;
192
+ $mlwQuizMasterNext->quiz_settings->register_setting($field_array, $section);
193
+ }
194
+
195
+ /**
196
+ * Retrieves a setting value from a section based on name of section and setting
197
+ *
198
+ * @since 5.0.0
199
+ * @param string $section The name of the section the setting is registered in
200
+ * @param string $setting The name of the setting whose value we need to retrieve
201
+ * @param mixed $default What we need to return if no setting exists with given $setting
202
+ * @return $mixed Value set for $setting or $default if setting does not exist
203
+ */
204
+ public function get_section_setting($section, $setting, $default = false)
205
+ {
206
+ global $mlwQuizMasterNext;
207
+ return apply_filters('qsm_section_setting_text', $mlwQuizMasterNext->quiz_settings->get_section_setting($section, $setting, $default));
208
+ }
209
+
210
+ /**
211
+ * Retrieves setting value based on name of setting
212
+ *
213
+ * @since 4.0.0
214
+ * @param string $setting The name of the setting whose value we need to retrieve
215
+ * @param mixed $default What we need to return if no setting exists with given $setting
216
+ * @return $mixed Value set for $setting or $default if setting does not exist
217
+ */
218
+ public function get_quiz_setting($setting, $default = false)
219
+ {
220
+ global $mlwQuizMasterNext;
221
+ return $mlwQuizMasterNext->quiz_settings->get_setting($setting, $default);
222
+ }
223
+
224
+ /**
225
+ * Updates a settings value, adding it if it didn't already exist
226
+ *
227
+ * @since 4.0.0
228
+ * @param string $setting The name of the setting whose value we need to retrieve
229
+ * @param mixed $value The value that needs to be stored for the setting
230
+ * @return bool True if successful or false if fails
231
+ */
232
+ public function update_quiz_setting($setting, $value)
233
+ {
234
+ global $mlwQuizMasterNext;
235
+ return $mlwQuizMasterNext->quiz_settings->update_setting($setting, $value);
236
+ }
237
+
238
+ /**
239
+ * Outputs the section of input fields
240
+ *
241
+ * @since 5.0.0
242
+ * @since 7.0 Added new parameter settings_fields for default setting
243
+ * @param string $section The section that the settings were registered with
244
+ */
245
+ public function generate_settings_section($section = 'quiz_options', $settings_fields = array())
246
+ {
247
+ global $mlwQuizMasterNext;
248
+ if (empty($settings_fields)) {
249
+ $settings_fields = $mlwQuizMasterNext->quiz_settings->load_setting_fields($section);
250
+ }
251
+ QSM_Fields::generate_section($settings_fields, $section);
252
+ }
253
+
254
+ /**
255
+ * Registers Quiz Templates
256
+ *
257
+ * @since 4.5.0
258
+ * @param $name String of the name of the template
259
+ * @param $file_path String of the path to the css file
260
+ */
261
+ public function register_quiz_template($name, $file_path)
262
+ {
263
+ $slug = strtolower(str_replace(" ", "-", $name));
264
+ $this->quiz_templates[$slug] = array(
265
+ "name" => $name,
266
+ "path" => $file_path,
267
+ );
268
+ }
269
+
270
+ /**
271
+ * Returns Template Array
272
+ *
273
+ * @since 4.5.0
274
+ * @param $name String of the name of the template. If left empty, will return all templates
275
+ * @return array The array of quiz templates
276
+ */
277
+ public function get_quiz_templates($slug = null)
278
+ {
279
+ if (is_null($slug)) {
280
+ return $this->quiz_templates;
281
+ } elseif (isset($this->quiz_templates[$slug])) {
282
+ return $this->quiz_templates[$slug];
283
+ } else {
284
+ return false;
285
+ }
286
+ }
287
+
288
+ /**
289
+ * Register Question Types
290
+ *
291
+ * Adds a question type to the question type array using the parameters given
292
+ *
293
+ * @since 4.0.0
294
+ * @param string $name The name of the Question Type which will be shown when selecting type
295
+ * @param string $display_function The name of the function to call when displaying the question
296
+ * @param bool $graded Tells the plugin if this question is graded or not. This will affect scoring.
297
+ * @param string $review_function The name of the function to call when scoring the question
298
+ * @param string $slug The slug of the question type to be stored with question in database
299
+ * @return void
300
+ */
301
+ public function register_question_type($name, $display_function, $graded, $review_function = null, $edit_args = null, $save_edit_function = null, $slug = null)
302
+ {
303
+ if (is_null($slug)) {
304
+ $slug = strtolower(str_replace(" ", "-", $name));
305
+ } else {
306
+ $slug = strtolower(str_replace(" ", "-", $slug));
307
+ }
308
+ if (is_null($edit_args) || !is_array($edit_args)) {
309
+ $validated_edit_function = array(
310
+ 'inputs' => array(
311
+ 'question',
312
+ 'answer',
313
+ 'hint',
314
+ 'correct_info',
315
+ 'comments',
316
+ 'category',
317
+ 'required',
318
+ ),
319
+ 'information' => '',
320
+ 'extra_inputs' => array(),
321
+ 'function' => '',
322
+ );
323
+ } else {
324
+ $validated_edit_function = array(
325
+ 'inputs' => $edit_args['inputs'],
326
+ 'information' => $edit_args['information'],
327
+ 'extra_inputs' => $edit_args['extra_inputs'],
328
+ 'function' => $edit_args['function'],
329
+ );
330
+ }
331
+ if (is_null($save_edit_function)) {
332
+ $save_edit_function = '';
333
+ }
334
+ $new_type = array(
335
+ 'name' => $name,
336
+ 'display' => $display_function,
337
+ 'review' => $review_function,
338
+ 'graded' => $graded,
339
+ 'edit' => $validated_edit_function,
340
+ 'save' => $save_edit_function,
341
+ 'slug' => $slug,
342
+ );
343
+ $this->question_types[] = $new_type;
344
+ }
345
+
346
+ /**
347
+ * Retrieves List Of Question Types
348
+ *
349
+ * retrieves a list of the slugs and names of the question types
350
+ *
351
+ * @since 4.0.0
352
+ * @return array An array which contains the slug and name of question types that have been registered
353
+ */
354
+ public function get_question_type_options()
355
+ {
356
+ $type_array = array();
357
+ foreach ($this->question_types as $type) {
358
+ $type_array[] = array(
359
+ 'slug' => $type["slug"],
360
+ 'name' => $type["name"],
361
+ );
362
+ }
363
+ return $type_array;
364
+ }
365
+
366
+ public function get_question_type_edit_fields()
367
+ {
368
+ $type_array = array();
369
+ foreach ($this->question_types as $type) {
370
+ $type_array[$type["slug"]] = $type["edit"];
371
+ }
372
+ return $type_array;
373
+ }
374
+
375
+ /**
376
+ * Displays A Question
377
+ *
378
+ * Retrieves the question types display function and creates the HTML for the question
379
+ *
380
+ * @since 4.0.0
381
+ * @param string $slug The slug of the question type that the question is
382
+ * @param int $question_id The id of the question
383
+ * @param array $quiz_options An array of the columns of the quiz row from the database
384
+ * @return string The HTML for the question
385
+ */
386
+ public function display_question($slug, $question_id, $quiz_options)
387
+ {
388
+ $display = '';
389
+ global $wpdb;
390
+ global $qmn_total_questions;
391
+ $question = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "mlw_questions WHERE question_id=%d", intval($question_id)));
392
+ $answers = array();
393
+ if (is_serialized($question->answer_array) && is_array(@unserialize($question->answer_array))) {
394
+ $answers = @unserialize($question->answer_array);
395
+ } else {
396
+ $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
397
+ $mlw_answer_array_correct[$question->correct_answer - 1] = 1;
398
+ $answers = array(
399
+ array($question->answer_one, $question->answer_one_points, $mlw_answer_array_correct[0]),
400
+ array($question->answer_two, $question->answer_two_points, $mlw_answer_array_correct[1]),
401
+ array($question->answer_three, $question->answer_three_points, $mlw_answer_array_correct[2]),
402
+ array($question->answer_four, $question->answer_four_points, $mlw_answer_array_correct[3]),
403
+ array($question->answer_five, $question->answer_five_points, $mlw_answer_array_correct[4]),
404
+ array($question->answer_six, $question->answer_six_points, $mlw_answer_array_correct[5]));
405
+ }
406
+ if (2 == $quiz_options->randomness_order || 3 == $quiz_options->randomness_order) {
407
+ shuffle($answers);
408
+ }
409
+ foreach ($this->question_types as $type) {
410
+ if ($type["slug"] == strtolower(str_replace(" ", "-", $slug))) {
411
+ if ($type["graded"]) {
412
+ $qmn_total_questions += 1;
413
+ if ($quiz_options->question_numbering == 1) {
414
+ $display .= "<span class='mlw_qmn_question_number'>$qmn_total_questions. </span>";
415
+ }
416
+ }
417
+ if ($quiz_options->show_category_on_front && $question->category != '') {
418
+ $display .= '<div class="quiz-cat">[ ' . $question->category . ' ]</div>';
419
+ }
420
+ $display .= call_user_func($type['display'], intval($question_id), $question->question_name, $answers);
421
+ }
422
+ }
423
+ return $display;
424
+ }
425
+
426
+ /**
427
+ * Calculates Score For Question
428
+ *
429
+ * Calculates the score for the question based on the question type
430
+ *
431
+ * @since 4.0.0
432
+ * @param string $slug The slug of the question type that the question is
433
+ * @param int $question_id The id of the question
434
+ * @return array An array of the user's score from the question
435
+ */
436
+ public function display_review($slug, $question_id)
437
+ {
438
+ $results_array = array();
439
+ global $wpdb;
440
+ $question = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "mlw_questions WHERE question_id=%d", intval($question_id)));
441
+ $answers = array();
442
+ if (is_serialized($question->answer_array) && is_array(@unserialize($question->answer_array))) {
443
+ $answers = @unserialize($question->answer_array);
444
+ } else {
445
+ $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
446
+ $mlw_answer_array_correct[$question->correct_answer - 1] = 1;
447
+ $answers = array(
448
+ array($question->answer_one, $question->answer_one_points, $mlw_answer_array_correct[0]),
449
+ array($question->answer_two, $question->answer_two_points, $mlw_answer_array_correct[1]),
450
+ array($question->answer_three, $question->answer_three_points, $mlw_answer_array_correct[2]),
451
+ array($question->answer_four, $question->answer_four_points, $mlw_answer_array_correct[3]),
452
+ array($question->answer_five, $question->answer_five_points, $mlw_answer_array_correct[4]),
453
+ array($question->answer_six, $question->answer_six_points, $mlw_answer_array_correct[5]));
454
+ }
455
+ foreach ($this->question_types as $type) {
456
+ if ($type["slug"] == strtolower(str_replace(" ", "-", $slug))) {
457
+ if (!is_null($type["review"])) {
458
+ $results_array = call_user_func($type['review'], intval($question_id), $question->question_name, $answers);
459
+ } else {
460
+ $results_array = array('null_review' => true);
461
+ }
462
+ }
463
+ }
464
+ return $results_array;
465
+ }
466
+
467
+ /**
468
+ * Retrieves A Question Setting
469
+ *
470
+ * Retrieves a setting stored in the question settings array
471
+ *
472
+ * @since 4.0.0
473
+ * @param int $question_id The id of the question
474
+ * @param string $setting The name of the setting
475
+ * @return string The value stored for the setting
476
+ */
477
+ public function get_question_setting($question_id, $setting)
478
+ {
479
+ global $wpdb;
480
+ $qmn_settings_array = '';
481
+ $settings = $wpdb->get_var($wpdb->prepare("SELECT question_settings FROM " . $wpdb->prefix . "mlw_questions WHERE question_id=%d", $question_id));
482
+ if (is_serialized($settings) && is_array(@unserialize($settings))) {
483
+ $qmn_settings_array = @unserialize($settings);
484
+ }
485
+ if (is_array($qmn_settings_array) && isset($qmn_settings_array[$setting])) {
486
+ return $qmn_settings_array[$setting];
487
+ } else {
488
+ return '';
489
+ }
490
+ }
491
+
492
+ /**
493
+ * Registers Addon Settings Tab
494
+ *
495
+ * Registers a new tab on the addon settings page
496
+ *
497
+ * @since 4.0.0
498
+ * @param string $title The name of the tab
499
+ * @param string $function The function that displays the tab's content
500
+ * @return void
501
+ */
502
+ public function register_addon_settings_tab($title, $function)
503
+ {
504
+ $slug = strtolower(str_replace(" ", "-", $title));
505
+ $new_tab = array(
506
+ 'title' => $title,
507
+ 'function' => $function,
508
+ 'slug' => $slug,
509
+ );
510
+ $this->addon_tabs[] = $new_tab;
511
+ }
512
+
513
+ /**
514
+ * Retrieves Addon Settings Tab Array
515
+ *
516
+ * Retrieves the array of titles and functions of the registered tabs
517
+ *
518
+ * @since 4.0.0
519
+ * @return array The array of registered tabs
520
+ */
521
+ public function get_addon_tabs()
522
+ {
523
+ return $this->addon_tabs;
524
+ }
525
+
526
+ /**
527
+ * Registers Stats Tab
528
+ *
529
+ * Registers a new tab on the stats page
530
+ *
531
+ * @since 4.3.0
532
+ * @param string $title The name of the tab
533
+ * @param string $function The function that displays the tab's content
534
+ * @return void
535
+ */
536
+ public function register_stats_settings_tab($title, $function)
537
+ {
538
+ $slug = strtolower(str_replace(" ", "-", $title));
539
+ $new_tab = array(
540
+ 'title' => $title,
541
+ 'function' => $function,
542
+ 'slug' => $slug,
543
+ );
544
+ $this->stats_tabs[] = $new_tab;
545
+ }
546
+
547
+ /**
548
+ * Retrieves Stats Tab Array
549
+ *
550
+ * Retrieves the array of titles and functions of the registered tabs
551
+ *
552
+ * @since 4.3.0
553
+ * @return array The array of registered tabs
554
+ */
555
+ public function get_stats_tabs()
556
+ {
557
+ return $this->stats_tabs;
558
+ }
559
+
560
+ /**
561
+ * Registers tabs for the Admin Results page
562
+ *
563
+ * Registers a new tab on the admin results page
564
+ *
565
+ * @since 5.0.0
566
+ * @param string $title The name of the tab
567
+ * @param string $function The function that displays the tab's content
568
+ * @return void
569
+ */
570
+ public function register_admin_results_tab($title, $function)
571
+ {
572
+ $slug = strtolower(str_replace(" ", "-", $title));
573
+ $new_tab = array(
574
+ 'title' => $title,
575
+ 'function' => $function,
576
+ 'slug' => $slug,
577
+ );
578
+ $this->admin_results_tabs[] = $new_tab;
579
+ }
580
+
581
+ /**
582
+ * Retrieves Admin Results Tab Array
583
+ *
584
+ * Retrieves the array of titles and functions for the tabs registered for the admin results page
585
+ *
586
+ * @since 5.0.0
587
+ * @return array The array of registered tabs
588
+ */
589
+ public function get_admin_results_tabs()
590
+ {
591
+ return $this->admin_results_tabs;
592
+ }
593
+
594
+ /**
595
+ * Registers Results Tab
596
+ *
597
+ * Registers a new tab on the results page
598
+ *
599
+ * @since 4.1.0
600
+ * @param string $title The name of the tab
601
+ * @param string $function The function that displays the tab's content
602
+ * @return void
603
+ */
604
+ public function register_results_settings_tab($title, $function)
605
+ {
606
+ $slug = strtolower(str_replace(" ", "-", $title));
607
+ $new_tab = array(
608
+ 'title' => $title,
609
+ 'function' => $function,
610
+ 'slug' => $slug,
611
+ );
612
+ $this->results_tabs[] = $new_tab;
613
+ }
614
+
615
+ /**
616
+ * Retrieves Results Tab Array
617
+ *
618
+ * Retrieves the array of titles and functions of the registered tabs
619
+ *
620
+ * @since 4.1.0
621
+ * @return array The array of registered tabs
622
+ */
623
+ public function get_results_tabs()
624
+ {
625
+ return $this->results_tabs;
626
+ }
627
+
628
+ /**
629
+ * Registers Quiz Settings Tab
630
+ *
631
+ * Registers a new tab on the quiz settings page
632
+ *
633
+ * @since 4.0.0
634
+ * @param string $title The name of the tab
635
+ * @param string $function The function that displays the tab's content
636
+ * @return void
637
+ */
638
+ public function register_quiz_settings_tabs($title, $function)
639
+ {
640
+ $slug = strtolower(str_replace(" ", "-", $title));
641
+ $new_tab = array(
642
+ 'title' => $title,
643
+ 'function' => $function,
644
+ 'slug' => $slug,
645
+ );
646
+ $this->settings_tabs[] = $new_tab;
647
+ }
648
+
649
+ /**
650
+ * Echos Registered Tabs Title Link
651
+ *
652
+ * Echos the title link of the registered tabs
653
+ *
654
+ * @since 4.0.0
655
+ * @return array The array of registered tabs
656
+ */
657
+ public function get_settings_tabs()
658
+ {
659
+ return $this->settings_tabs;
660
+ }
661
+ }
php/classes/class-qmn-quiz-creator.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
  }
5
 
6
  /**
@@ -12,704 +12,711 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  *
13
  * @since 3.7.1
14
  */
15
- class QMNQuizCreator {
 
16
 
 
 
 
 
 
 
 
17
 
18
- /**
19
- * QMN ID of quiz
20
- *
21
- * @var object
22
- * @since 3.7.1
23
- */
24
- private $quiz_id;
 
 
 
 
25
 
26
- /**
27
- * If the quiz ID is set, store it as the class quiz ID
28
- *
29
- * @since 3.7.1
30
- */
31
- public function __construct() {
32
- if ( isset( $_REQUEST['quiz_id'] ) ) {
33
- $this->quiz_id = intval( $_REQUEST['quiz_id'] );
34
- }
35
- }
 
 
36
 
37
- /**
38
- * Sets quiz ID
39
- *
40
- * @since 3.8.1
41
- * @param int $quiz_id The ID of the quiz.
42
- * @access public
43
- * @return void
44
- */
45
- public function set_id( $quiz_id ) {
46
- $this->quiz_id = intval( $quiz_id );
47
- }
 
 
 
48
 
49
- /**
50
- * Gets the quiz ID stored (for backwards compatibility)
51
- *
52
- * @since 5.0.0
53
- * @return int|false The ID of the quiz stored or false
54
- */
55
- public function get_id() {
56
- if ( $this->quiz_id ) {
57
- return intval( $this->quiz_id );
58
- } else {
59
- return false;
60
- }
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
- /**
64
- * Creates a new quiz with the default settings
65
- *
66
- * @access public
67
- * @since 3.7.1
68
- * @param string $quiz_name The name of the new quiz.
69
- * @return void
70
- */
71
- public function create_quiz( $quiz_name, $quiz_settings = '' ) {
72
- global $mlwQuizMasterNext;
73
- global $wpdb;
74
- $current_user = wp_get_current_user();
75
- $results = $wpdb->insert(
76
- $wpdb->prefix . 'mlw_quizzes',
77
- array(
78
- 'quiz_name' => $quiz_name,
79
- 'message_before' => __( 'Welcome to your %QUIZ_NAME%', 'quiz-master-next' ),
80
- 'message_after' => __( 'Thanks for submitting your response! You can edit this message on the "Results Pages" tab. <br>%CONTACT_ALL% <br>%QUESTIONS_ANSWERS%', 'quiz-master-next' ),
81
- 'message_comment' => __( 'Please fill in the comment box below.', 'quiz-master-next' ),
82
- 'message_end_template' => '',
83
- 'user_email_template' => '%QUESTIONS_ANSWERS_EMAIL%',
84
- 'admin_email_template' => '%QUESTIONS_ANSWERS_EMAIL%',
85
- 'submit_button_text' => __( 'Submit', 'quiz-master-next' ),
86
- 'name_field_text' => __( 'Name', 'quiz-master-next' ),
87
- 'business_field_text' => __( 'Business', 'quiz-master-next' ),
88
- 'email_field_text' => __( 'Email', 'quiz-master-next' ),
89
- 'phone_field_text' => __( 'Phone Number', 'quiz-master-next' ),
90
- 'comment_field_text' => __( 'Comments', 'quiz-master-next' ),
91
- 'email_from_text' => 'Wordpress',
92
- 'question_answer_template' => '%QUESTION%<br />%USER_ANSWERS_DEFAULT%',
93
- 'leaderboard_template' => '',
94
- 'quiz_system' => 0,
95
- 'randomness_order' => 0,
96
- 'loggedin_user_contact' => 0,
97
- 'show_score' => 0,
98
- 'send_user_email' => 0,
99
- 'send_admin_email' => 0,
100
- 'contact_info_location' => 0,
101
- 'user_name' => 2,
102
- 'user_comp' => 2,
103
- 'user_email' => 2,
104
- 'user_phone' => 2,
105
- 'admin_email' => get_option( 'admin_email', 'Enter email' ),
106
- 'comment_section' => 1,
107
- 'question_from_total' => 0,
108
- 'total_user_tries' => 0,
109
- 'total_user_tries_text' => __( 'You have utilized all of your attempts to pass this quiz.', 'quiz-master-next' ),
110
- 'certificate_template' => '',
111
- 'social_media' => 0,
112
- 'social_media_text' => __( 'I just scored %CORRECT_SCORE%% on %QUIZ_NAME%!', 'quiz-master-next' ),
113
- 'pagination' => 0,
114
- 'pagination_text' => __( 'Next', 'quiz-master-next' ),
115
- 'timer_limit' => 0,
116
- 'quiz_stye' => '',
117
- 'question_numbering' => 0,
118
- 'quiz_settings' => $quiz_settings,
119
- 'theme_selected' => 'primary',
120
- 'last_activity' => current_time( 'mysql' ),
121
- 'require_log_in' => 0,
122
- 'require_log_in_text' => __( 'This quiz is for logged in users only.', 'quiz-master-next' ),
123
- 'limit_total_entries' => 0,
124
- 'limit_total_entries_text' => __( 'Unfortunately, this quiz has a limited amount of entries it can recieve and has already reached that limit.', 'quiz-master-next' ),
125
- 'scheduled_timeframe' => '',
126
- 'scheduled_timeframe_text' => '',
127
- 'quiz_views' => 0,
128
- 'quiz_taken' => 0,
129
- 'deleted' => 0,
130
- 'quiz_author_id' => $current_user->ID,
131
- ),
132
- array(
133
- '%s',
134
- '%s',
135
- '%s',
136
- '%s',
137
- '%s',
138
- '%s',
139
- '%s',
140
- '%s',
141
- '%s',
142
- '%s',
143
- '%s',
144
- '%s',
145
- '%s',
146
- '%s',
147
- '%s',
148
- '%s',
149
- '%d',
150
- '%d',
151
- '%d',
152
- '%d',
153
- '%d',
154
- '%d',
155
- '%d',
156
- '%d',
157
- '%d',
158
- '%d',
159
- '%d',
160
- '%s',
161
- '%d',
162
- '%d',
163
- '%d',
164
- '%s',
165
- '%s',
166
- '%d',
167
- '%s',
168
- '%d',
169
- '%s',
170
- '%d',
171
- '%s',
172
- '%d',
173
- '%s',
174
- '%s',
175
- '%s',
176
- '%d',
177
- '%s',
178
- '%d',
179
- '%s',
180
- '%s',
181
- '%s',
182
- '%d',
183
- '%d',
184
- '%d',
185
- '%d',
186
- )
187
- );
188
- if ( false !== $results ) {
189
- $new_quiz = $wpdb->insert_id;
190
- $quiz_post = array(
191
- 'post_title' => $quiz_name,
192
- 'post_content' => "[mlw_quizmaster quiz=$new_quiz]",
193
- 'post_status' => 'draft',
194
- 'post_author' => $current_user->ID,
195
- 'post_type' => 'qsm_quiz',
196
- );
197
- $quiz_post_id = wp_insert_post( $quiz_post );
198
- add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
199
 
200
- $mlwQuizMasterNext->alertManager->newAlert( __( 'Your new quiz or survey has been created successfully. To begin editing, click the Edit link.', 'quiz-master-next' ), 'success' );
201
- $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz/Survey Has Been Created: $quiz_name" );
202
 
203
- // Hook called after new quiz or survey has been created. Passes quiz_id to hook
204
- do_action( 'qmn_quiz_created', $new_quiz );
205
- } else {
206
- $mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next' ), '0001' ), 'error' );
207
- $mlwQuizMasterNext->log_manager->add( 'Error 0001', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
208
- }
209
- }
210
 
211
- /**
212
- * Deletes a quiz with the given quiz_id
213
- *
214
- * @access public
215
- * @since 3.7.1
216
- * @return void
217
- */
218
- public function delete_quiz( $quiz_id, $quiz_name ) {
219
- global $mlwQuizMasterNext;
220
- global $wpdb;
221
- $results = $wpdb->update(
222
- $wpdb->prefix . 'mlw_quizzes',
223
- array(
224
- 'deleted' => 1,
225
- ),
226
- array( 'quiz_id' => $quiz_id ),
227
- array(
228
- '%d',
229
- ),
230
- array( '%d' )
231
- );
232
- $deleted = 0;
233
- if ( isset( $_POST['qsm_delete_question_from_qb'] ) && $_POST['qsm_delete_question_from_qb'] == 1 ) {
234
- $deleted = 1;
235
- }
236
- $delete_question_results = $wpdb->update(
237
- $wpdb->prefix . 'mlw_questions',
238
- array(
239
- 'deleted' => $deleted,
240
- ),
241
- array( 'quiz_id' => $quiz_id ),
242
- array(
243
- '%d',
244
- ),
245
- array( '%d' )
246
- );
247
- if ( $results != false ) {
248
- $my_query = new WP_Query(
249
- array(
250
- 'post_type' => 'qsm_quiz',
251
- 'meta_key' => 'quiz_id',
252
- 'meta_value' => $quiz_id,
253
- )
254
- );
255
- if ( $my_query->have_posts() ) {
256
- while ( $my_query->have_posts() ) {
257
- $my_query->the_post();
258
- $my_post = array(
259
- 'ID' => get_the_ID(),
260
- 'post_status' => 'trash',
261
- );
262
- wp_update_post( $my_post );
263
- }
264
- }
265
- wp_reset_postdata();
266
- $mlwQuizMasterNext->alertManager->newAlert( __( 'Your quiz or survey has been deleted successfully.', 'quiz-master-next' ), 'success' );
267
- $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Has Been Deleted: $quiz_name" );
268
- } else {
269
- $mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next' ), '0002' ), 'error' );
270
- $mlwQuizMasterNext->log_manager->add( 'Error 0002', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
271
- }
272
 
273
- // Hook called after quiz or survey is deleted. Hook passes quiz_id to function
274
- do_action( 'qmn_quiz_deleted', $quiz_id );
275
- }
276
 
277
- /**
278
- * Edits the name of the quiz with the given ID
279
- *
280
- * @access public
281
- * @since 3.7.1
282
- * @param int $quiz_id The ID of the quiz.
283
- * @param string $quiz_name The new name of the quiz.
284
- * @return void
285
- */
286
- public function edit_quiz_name( $quiz_id, $quiz_name ) {
287
- global $mlwQuizMasterNext;
288
- global $wpdb;
289
- $results = $wpdb->update(
290
- $wpdb->prefix . 'mlw_quizzes',
291
- array(
292
- 'quiz_name' => $quiz_name,
293
- ),
294
- array( 'quiz_id' => $quiz_id ),
295
- array(
296
- '%s',
297
- ),
298
- array( '%d' )
299
- );
300
- if ( false !== $results ) {
301
- $mlwQuizMasterNext->alertManager->newAlert( __( 'The name of your quiz or survey has been updated successfully.', 'quiz-master-next' ), 'success' );
302
- $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Name Has Been Edited: $quiz_name" );
303
- } else {
304
- $error = $wpdb->last_error;
305
- if ( empty( $error ) ) {
306
- $error = __( 'Unknown error', 'quiz-master-next' );
307
- }
308
- $mlwQuizMasterNext->alertManager->newAlert( __( 'An error occurred while trying to update the name of your quiz or survey. Please try again.', 'quiz-master-next' ), 'error' );
309
- $mlwQuizMasterNext->log_manager->add( 'Error when updating quiz name', "Tried {$wpdb->last_query} but got $error", 0, 'error' );
310
- }
 
311
 
312
- // Fires when the name of a quiz/survey is edited.
313
- do_action( 'qsm_quiz_name_edited', $quiz_id, $quiz_name );
314
 
315
- // Legacy code.
316
- do_action( 'qmn_quiz_name_edited', $quiz_id );
317
- }
318
 
319
- /**
320
- * Duplicates the quiz with the given ID and gives new quiz the given quiz name
321
- *
322
- * @access public
323
- * @since 3.7.1
324
- * @return void
325
- */
326
- public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions ) {
327
- global $mlwQuizMasterNext;
328
- global $wpdb;
329
- $current_user = wp_get_current_user();
330
- $table_name = $wpdb->prefix . 'mlw_quizzes';
331
- $logic_table = $wpdb->prefix . 'mlw_logic';
332
- $logic_table_exists = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $logic_table ) );
333
- $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE quiz_id=%d", $quiz_id ) );
334
- $quiz_settings = unserialize( $mlw_qmn_duplicate_data->quiz_settings );
335
- if ( $is_duplicating_questions == 0 ) {
336
- $quiz_settings['pages'] = '';
337
- }
338
- $qsm_create_quiz_system = 0;
339
- if ( isset( $mlw_qmn_duplicate_data->system ) ) {
340
- $qsm_create_quiz_system = $mlw_qmn_duplicate_data->system;
341
- } elseif ( isset( $mlw_qmn_duplicate_data->quiz_system ) ) {
342
- $qsm_create_quiz_system = $mlw_qmn_duplicate_data->quiz_system;
343
- }
344
- $results = $wpdb->insert(
345
- $table_name,
346
- array(
347
- 'quiz_name' => $quiz_name,
348
- 'message_before' => $mlw_qmn_duplicate_data->message_before,
349
- 'message_after' => $mlw_qmn_duplicate_data->message_after,
350
- 'message_comment' => $mlw_qmn_duplicate_data->message_comment,
351
- 'message_end_template' => $mlw_qmn_duplicate_data->message_end_template,
352
- 'user_email_template' => $mlw_qmn_duplicate_data->user_email_template,
353
- 'admin_email_template' => $mlw_qmn_duplicate_data->admin_email_template,
354
- 'submit_button_text' => $mlw_qmn_duplicate_data->submit_button_text,
355
- 'name_field_text' => $mlw_qmn_duplicate_data->name_field_text,
356
- 'business_field_text' => $mlw_qmn_duplicate_data->business_field_text,
357
- 'email_field_text' => $mlw_qmn_duplicate_data->email_field_text,
358
- 'phone_field_text' => $mlw_qmn_duplicate_data->phone_field_text,
359
- 'comment_field_text' => $mlw_qmn_duplicate_data->comment_field_text,
360
- 'email_from_text' => $mlw_qmn_duplicate_data->email_from_text,
361
- 'question_answer_template' => $mlw_qmn_duplicate_data->question_answer_template,
362
- 'leaderboard_template' => $mlw_qmn_duplicate_data->leaderboard_template,
363
- 'quiz_system' => $qsm_create_quiz_system,
364
- 'randomness_order' => $mlw_qmn_duplicate_data->randomness_order,
365
- 'loggedin_user_contact' => $mlw_qmn_duplicate_data->loggedin_user_contact,
366
- 'show_score' => $mlw_qmn_duplicate_data->show_score,
367
- 'send_user_email' => $mlw_qmn_duplicate_data->send_user_email,
368
- 'send_admin_email' => $mlw_qmn_duplicate_data->send_admin_email,
369
- 'contact_info_location' => $mlw_qmn_duplicate_data->contact_info_location,
370
- 'user_name' => $mlw_qmn_duplicate_data->user_name,
371
- 'user_comp' => $mlw_qmn_duplicate_data->user_comp,
372
- 'user_email' => $mlw_qmn_duplicate_data->user_email,
373
- 'user_phone' => $mlw_qmn_duplicate_data->user_phone,
374
- 'admin_email' => get_option( 'admin_email', 'Enter email' ),
375
- 'comment_section' => $mlw_qmn_duplicate_data->comment_section,
376
- 'question_from_total' => $mlw_qmn_duplicate_data->question_from_total,
377
- 'total_user_tries' => $mlw_qmn_duplicate_data->total_user_tries,
378
- 'total_user_tries_text' => $mlw_qmn_duplicate_data->total_user_tries_text,
379
- 'certificate_template' => $mlw_qmn_duplicate_data->certificate_template,
380
- 'social_media' => $mlw_qmn_duplicate_data->social_media,
381
- 'social_media_text' => $mlw_qmn_duplicate_data->social_media_text,
382
- 'pagination' => $mlw_qmn_duplicate_data->pagination,
383
- 'pagination_text' => $mlw_qmn_duplicate_data->pagination_text,
384
- 'timer_limit' => $mlw_qmn_duplicate_data->timer_limit,
385
- 'quiz_stye' => $mlw_qmn_duplicate_data->quiz_stye,
386
- 'question_numbering' => $mlw_qmn_duplicate_data->question_numbering,
387
- 'quiz_settings' => serialize( $quiz_settings ),
388
- 'theme_selected' => $mlw_qmn_duplicate_data->theme_selected,
389
- 'last_activity' => date( 'Y-m-d H:i:s' ),
390
- 'require_log_in' => $mlw_qmn_duplicate_data->require_log_in,
391
- 'require_log_in_text' => $mlw_qmn_duplicate_data->require_log_in_text,
392
- 'limit_total_entries' => $mlw_qmn_duplicate_data->limit_total_entries,
393
- 'limit_total_entries_text' => $mlw_qmn_duplicate_data->limit_total_entries_text,
394
- 'scheduled_timeframe' => $mlw_qmn_duplicate_data->scheduled_timeframe,
395
- 'scheduled_timeframe_text' => $mlw_qmn_duplicate_data->scheduled_timeframe_text,
396
- 'quiz_views' => 0,
397
- 'quiz_taken' => 0,
398
- 'deleted' => 0,
399
- 'quiz_author_id' => $current_user->ID,
400
- ),
401
- array(
402
- '%s',
403
- '%s',
404
- '%s',
405
- '%s',
406
- '%s',
407
- '%s',
408
- '%s',
409
- '%s',
410
- '%s',
411
- '%s',
412
- '%s',
413
- '%s',
414
- '%s',
415
- '%s',
416
- '%s',
417
- '%s',
418
- '%d',
419
- '%d',
420
- '%d',
421
- '%d',
422
- '%d',
423
- '%d',
424
- '%d',
425
- '%d',
426
- '%d',
427
- '%d',
428
- '%d',
429
- '%s',
430
- '%d',
431
- '%d',
432
- '%d',
433
- '%s',
434
- '%s',
435
- '%d',
436
- '%s',
437
- '%d',
438
- '%s',
439
- '%d',
440
- '%s',
441
- '%d',
442
- '%s',
443
- '%s',
444
- '%s',
445
- '%d',
446
- '%s',
447
- '%d',
448
- '%s',
449
- '%s',
450
- '%s',
451
- '%d',
452
- '%d',
453
- '%d',
454
- '%d',
455
- )
456
- );
457
- $mlw_new_id = $wpdb->insert_id;
 
458
 
459
- // Update quiz settings
460
- $update_quiz_settings = unserialize( $mlw_qmn_duplicate_data->quiz_settings );
461
- $update_pages = unserialize( $update_quiz_settings['pages'] );
462
- // get logic data from logic table first or else from quiz_settings
463
- if ( ! is_null( $logic_table_exists ) ) {
464
- $query = $wpdb->prepare( "SELECT * FROM $logic_table WHERE quiz_id = %d", $quiz_id );
465
- $logic_data = $wpdb->get_results( $query );
466
- $logic_rules = array();
467
- if ( ! empty( $logic_data ) ) {
468
- foreach ( $logic_data as $data ) {
469
- $logic_rules[] = unserialize( $data->logic );
470
- }
471
- }
472
- } else {
473
- $logic_rules = isset( $update_quiz_settings['logic_rules'] ) ? unserialize( unserialize( $update_quiz_settings['logic_rules'] ) ) : array();
474
- }
475
 
476
- if ( false != $results ) {
477
- $current_user = wp_get_current_user();
478
- $quiz_post = array(
479
- 'post_title' => $quiz_name,
480
- 'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
481
- 'post_status' => 'publish',
482
- 'post_author' => $current_user->ID,
483
- 'post_type' => 'qsm_quiz',
484
- );
485
- $quiz_post_id = wp_insert_post( $quiz_post );
486
- add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
487
- $mlwQuizMasterNext->alertManager->newAlert( __( 'Your quiz or survey has been duplicated successfully.', 'quiz-master-next' ), 'success' );
488
- $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz/Survey Has Been Created: $quiz_name" );
489
- do_action( 'qmn_quiz_duplicated', $quiz_id, $mlw_new_id );
490
- } else {
491
- $mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next' ), '0011' ), 'error' );
492
- $mlwQuizMasterNext->log_manager->add( 'Error 0011', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
493
- }
494
- if ( $is_duplicating_questions ) {
495
- $table_name = $wpdb->prefix . 'mlw_questions';
496
- $questions = array();
497
- if ( is_array( $update_pages ) ) {
498
- foreach ( $update_pages[0] as $ids ) {
499
- $questions[] = $ids;
500
- }
501
- }
502
- $question_ids = implode( ',', $questions );
503
- $mlw_current_questions = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table_name WHERE question_id IN (%1s)", $question_ids ) );
504
- foreach ( $mlw_current_questions as $mlw_question ) {
505
- $question_results = $wpdb->insert(
506
- $table_name,
507
- array(
508
- 'quiz_id' => $mlw_new_id,
509
- 'question_name' => $mlw_question->question_name,
510
- 'answer_array' => $mlw_question->answer_array,
511
- 'answer_one' => $mlw_question->answer_one,
512
- 'answer_one_points' => $mlw_question->answer_one_points,
513
- 'answer_two' => $mlw_question->answer_two,
514
- 'answer_two_points' => $mlw_question->answer_two_points,
515
- 'answer_three' => $mlw_question->answer_three,
516
- 'answer_three_points' => $mlw_question->answer_three_points,
517
- 'answer_four' => $mlw_question->answer_four,
518
- 'answer_four_points' => $mlw_question->answer_four_points,
519
- 'answer_five' => $mlw_question->answer_five,
520
- 'answer_five_points' => $mlw_question->answer_five_points,
521
- 'answer_six' => $mlw_question->answer_six,
522
- 'answer_six_points' => $mlw_question->answer_six_points,
523
- 'correct_answer' => $mlw_question->correct_answer,
524
- 'question_answer_info' => $mlw_question->question_answer_info,
525
- 'comments' => $mlw_question->comments,
526
- 'hints' => $mlw_question->hints,
527
- 'question_order' => $mlw_question->question_order,
528
- 'question_type_new' => $mlw_question->question_type_new,
529
- 'question_settings' => $mlw_question->question_settings,
530
- 'category' => $mlw_question->category,
531
- 'deleted' => 0,
532
- ),
533
- array(
534
- '%d',
535
- '%s',
536
- '%s',
537
- '%s',
538
- '%d',
539
- '%s',
540
- '%d',
541
- '%s',
542
- '%d',
543
- '%s',
544
- '%d',
545
- '%s',
546
- '%d',
547
- '%s',
548
- '%d',
549
- '%d',
550
- '%s',
551
- '%d',
552
- '%s',
553
- '%d',
554
- '%s',
555
- '%s',
556
- '%s',
557
- '%d',
558
- )
559
- );
560
- foreach ( $update_pages as $pages_key => $pages_value ) {
561
- foreach ( $pages_value as $pages_k_q => $page_q_id ) {
562
- if ( $page_q_id == $mlw_question->question_id ) {
563
- $update_pages[ $pages_key ][ $pages_k_q ] = $wpdb->insert_id;
564
- }
565
- }
566
- }
567
- // Fixed Rules Questions with new question ids
568
- if ( $logic_rules ) {
569
- foreach ( $logic_rules as $logic_key => $logic_value ) {
570
- foreach ( $logic_value as $logic_cond_k => $logic_cond ) {
571
- foreach ( $logic_cond as $l_cond_k => $logic_val ) {
572
- if ( $logic_val['question'] == $mlw_question->question_id ) {
573
- $logic_rules[ $logic_key ][ $logic_cond_k ][ $l_cond_k ]['question'] = $wpdb->insert_id;
574
- }
575
- }
576
- }
577
- }
578
- }
579
- if ( $question_results == false ) {
580
- $mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next' ), '0020' ), 'error' );
581
- $mlwQuizMasterNext->log_manager->add( 'Error 0020', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
582
- }
583
- }
584
- $update_quiz_settings['pages'] = serialize( $update_pages );
585
- // saves data in logic table first or else in quiz_settings
586
- $value_array = array();
587
- if ( is_array( $logic_rules ) && ! empty( $logic_rules ) ) {
588
- if ( is_null( $logic_table_exists ) ) {
589
- $update_quiz_settings['logic_rules'] = serialize( serialize( $logic_rules ) );
590
- } else {
591
- foreach ( $logic_rules as $logic_data ) {
592
- $data = array(
593
- $mlw_new_id,
594
- serialize( $logic_data ),
595
- );
596
- $value_array[] = stripslashes( $wpdb->prepare( '(%d, %s)', $data ) );
597
- }
598
- $values = implode( ',', $value_array );
599
- $query = "INSERT INTO $logic_table (quiz_id, logic) VALUES ";
600
- $query .= $values;
601
- $saved = $wpdb->query( $query );
602
- if ( $saved != false ) {
603
- update_option( "logic_rules_quiz_$mlw_new_id", date( time() ) );
604
- $update_quiz_settings['logic_rules'] = '';
605
- } else {
606
- $update_quiz_settings['logic_rules'] = serialize( serialize( $logic_rules ) );
607
- }
608
- }
609
- }
610
 
611
- $wpdb->update(
612
- $wpdb->prefix . 'mlw_quizzes',
613
- array(
614
- 'quiz_settings' => serialize( $update_quiz_settings ),
615
- ),
616
- array(
617
- 'quiz_id' => $mlw_new_id,
618
- )
619
- );
620
- }
621
- }
622
 
623
- /**
624
- * Retrieves setting store in quiz_settings
625
- *
626
- * @deprecated 6.0.3 Use the get_quiz_setting function in the pluginHelper object.
627
- * @since 3.8.1
628
- * @access public
629
- * @param string $setting_name The slug of the setting.
630
- * @return string The value of the setting
631
- */
632
- public function get_setting( $setting_name ) {
633
- global $wpdb;
634
- $qmn_settings_array = '';
635
- $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( 'SELECT quiz_settings FROM ' . $wpdb->prefix . 'mlw_quizzes' . ' WHERE quiz_id=%d', $this->quiz_id ) );
636
- if ( is_serialized( $qmn_quiz_settings ) && is_array( @unserialize( $qmn_quiz_settings ) ) ) {
637
- $qmn_settings_array = @unserialize( $qmn_quiz_settings );
638
- }
639
- if ( is_array( $qmn_settings_array ) && isset( $qmn_settings_array[ $setting_name ] ) ) {
640
- return $qmn_settings_array[ $setting_name ];
641
- } else {
642
- return '';
643
- }
 
644
 
645
- }
646
 
647
- /**
648
- * Updates setting stored in quiz_settings
649
- *
650
- * @deprecated 6.0.3 Use the update_quiz_setting function in the pluginHelper object.
651
- * @since 3.8.1
652
- * @access public
653
- * @param string $setting_name The slug of the setting.
654
- * @param mixed $setting_value The value for the setting.
655
- * @return bool True if update was successful
656
- */
657
- public function update_setting( $setting_name, $setting_value ) {
658
- global $wpdb;
659
- $qmn_settings_array = array();
660
- $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( 'SELECT quiz_settings FROM ' . $wpdb->prefix . 'mlw_quizzes' . ' WHERE quiz_id=%d', $this->quiz_id ) );
661
- if ( is_serialized( $qmn_quiz_settings ) && is_array( @unserialize( $qmn_quiz_settings ) ) ) {
662
- $qmn_settings_array = @unserialize( $qmn_quiz_settings );
663
- }
664
- $qmn_settings_array[ $setting_name ] = $setting_value;
665
- $qmn_serialized_array = serialize( $qmn_settings_array );
666
- $results = $wpdb->update(
667
- $wpdb->prefix . 'mlw_quizzes',
668
- array(
669
- 'quiz_settings' => $qmn_serialized_array,
670
- ),
671
- array( 'quiz_id' => $this->quiz_id ),
672
- array(
673
- '%s',
674
- ),
675
- array( '%d' )
676
- );
677
- if ( $results != false ) {
678
- return true;
679
- } else {
680
- return false;
681
- }
682
- }
 
683
 
684
- /**
685
- * Deletes setting stored in quiz_settings
686
- *
687
- * @deprecated 6.0.3
688
- * @since 3.8.1
689
- * @access public
690
- * @return void
691
- */
692
- public function delete_setting( $setting_name ) {
693
- global $wpdb;
694
- $qmn_settings_array = array();
695
- $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( 'SELECT quiz_settings FROM ' . $wpdb->prefix . 'mlw_quizzes' . ' WHERE quiz_id=%d', $this->quiz_id ) );
696
- if ( is_serialized( $qmn_quiz_settings ) && is_array( @unserialize( $qmn_quiz_settings ) ) ) {
697
- $qmn_settings_array = @unserialize( $qmn_quiz_settings );
698
- }
699
- if ( is_array( $qmn_settings_array ) && isset( $qmn_settings_array[ $setting_name ] ) ) {
700
- unset( $qmn_settings_array[ $setting_name ] );
701
- }
702
- $qmn_serialized_array = serialize( $qmn_settings_array );
703
- $results = $wpdb->update(
704
- $wpdb->prefix . 'mlw_quizzes',
705
- array(
706
- 'quiz_settings' => $qmn_serialized_array,
707
- ),
708
- array( 'quiz_id' => $this->quiz_id ),
709
- array(
710
- '%s',
711
- ),
712
- array( '%d' )
713
- );
714
- }
715
- }
 
1
  <?php
2
+ if (!defined('ABSPATH')) {
3
+ exit;
4
  }
5
 
6
  /**
12
  *
13
  * @since 3.7.1
14
  */
15
+ class QMNQuizCreator
16
+ {
17
 
18
+ /**
19
+ * QMN ID of quiz
20
+ *
21
+ * @var object
22
+ * @since 3.7.1
23
+ */
24
+ private $quiz_id;
25
 
26
+ /**
27
+ * If the quiz ID is set, store it as the class quiz ID
28
+ *
29
+ * @since 3.7.1
30
+ */
31
+ public function __construct()
32
+ {
33
+ if (isset($_REQUEST['quiz_id'])) {
34
+ $this->quiz_id = intval($_REQUEST['quiz_id']);
35
+ }
36
+ }
37
 
38
+ /**
39
+ * Sets quiz ID
40
+ *
41
+ * @since 3.8.1
42
+ * @param int $quiz_id The ID of the quiz.
43
+ * @access public
44
+ * @return void
45
+ */
46
+ public function set_id($quiz_id)
47
+ {
48
+ $this->quiz_id = intval($quiz_id);
49
+ }
50
 
51
+ /**
52
+ * Gets the quiz ID stored (for backwards compatibility)
53
+ *
54
+ * @since 5.0.0
55
+ * @return int|false The ID of the quiz stored or false
56
+ */
57
+ public function get_id()
58
+ {
59
+ if ($this->quiz_id) {
60
+ return intval($this->quiz_id);
61
+ } else {
62
+ return false;
63
+ }
64
+ }
65
 
66
+ /**
67
+ * Creates a new quiz with the default settings
68
+ *
69
+ * @access public
70
+ * @since 3.7.1
71
+ * @param string $quiz_name The name of the new quiz.
72
+ * @return void
73
+ */
74
+ public function create_quiz($quiz_name, $theme_id, $quiz_settings = '')
75
+ {
76
+ global $mlwQuizMasterNext;
77
+ global $wpdb;
78
+ $current_user = wp_get_current_user();
79
+ $results = $wpdb->insert(
80
+ $wpdb->prefix . 'mlw_quizzes',
81
+ array(
82
+ 'quiz_name' => $quiz_name,
83
+ 'message_before' => __('Welcome to your %QUIZ_NAME%', 'quiz-master-next'),
84
+ 'message_after' => __('Thanks for submitting your response! You can edit this message on the "Results Pages" tab. <br>%CONTACT_ALL% <br>%QUESTIONS_ANSWERS%', 'quiz-master-next'),
85
+ 'message_comment' => __('Please fill in the comment box below.', 'quiz-master-next'),
86
+ 'message_end_template' => '',
87
+ 'user_email_template' => '%QUESTIONS_ANSWERS_EMAIL%',
88
+ 'admin_email_template' => '%QUESTIONS_ANSWERS_EMAIL%',
89
+ 'submit_button_text' => __('Submit', 'quiz-master-next'),
90
+ 'name_field_text' => __('Name', 'quiz-master-next'),
91
+ 'business_field_text' => __('Business', 'quiz-master-next'),
92
+ 'email_field_text' => __('Email', 'quiz-master-next'),
93
+ 'phone_field_text' => __('Phone Number', 'quiz-master-next'),
94
+ 'comment_field_text' => __('Comments', 'quiz-master-next'),
95
+ 'email_from_text' => 'Wordpress',
96
+ 'question_answer_template' => '%QUESTION%<br />%USER_ANSWERS_DEFAULT%',
97
+ 'leaderboard_template' => '',
98
+ 'quiz_system' => 0,
99
+ 'randomness_order' => 0,
100
+ 'loggedin_user_contact' => 0,
101
+ 'show_score' => 0,
102
+ 'send_user_email' => 0,
103
+ 'send_admin_email' => 0,
104
+ 'contact_info_location' => 0,
105
+ 'user_name' => 2,
106
+ 'user_comp' => 2,
107
+ 'user_email' => 2,
108
+ 'user_phone' => 2,
109
+ 'admin_email' => get_option('admin_email', 'Enter email'),
110
+ 'comment_section' => 1,
111
+ 'question_from_total' => 0,
112
+ 'total_user_tries' => 0,
113
+ 'total_user_tries_text' => __('You have utilized all of your attempts to pass this quiz.', 'quiz-master-next'),
114
+ 'certificate_template' => '',
115
+ 'social_media' => 0,
116
+ 'social_media_text' => __('I just scored %CORRECT_SCORE%% on %QUIZ_NAME%!', 'quiz-master-next'),
117
+ 'pagination' => 0,
118
+ 'pagination_text' => __('Next', 'quiz-master-next'),
119
+ 'timer_limit' => 0,
120
+ 'quiz_stye' => '',
121
+ 'question_numbering' => 0,
122
+ 'quiz_settings' => $quiz_settings,
123
+ 'theme_selected' => 'primary',
124
+ 'last_activity' => current_time('mysql'),
125
+ 'require_log_in' => 0,
126
+ 'require_log_in_text' => __('This quiz is for logged in users only.', 'quiz-master-next'),
127
+ 'limit_total_entries' => 0,
128
+ 'limit_total_entries_text' => __('Unfortunately, this quiz has a limited amount of entries it can recieve and has already reached that limit.', 'quiz-master-next'),
129
+ 'scheduled_timeframe' => '',
130
+ 'scheduled_timeframe_text' => '',
131
+ 'quiz_views' => 0,
132
+ 'quiz_taken' => 0,
133
+ 'deleted' => 0,
134
+ 'quiz_author_id' => $current_user->ID,
135
+ ),
136
+ array(
137
+ '%s',
138
+ '%s',
139
+ '%s',
140
+ '%s',
141
+ '%s',
142
+ '%s',
143
+ '%s',
144
+ '%s',
145
+ '%s',
146
+ '%s',
147
+ '%s',
148
+ '%s',
149
+ '%s',
150
+ '%s',
151
+ '%s',
152
+ '%s',
153
+ '%d',
154
+ '%d',
155
+ '%d',
156
+ '%d',
157
+ '%d',
158
+ '%d',
159
+ '%d',
160
+ '%d',
161
+ '%d',
162
+ '%d',
163
+ '%d',
164
+ '%s',
165
+ '%d',
166
+ '%d',
167
+ '%d',
168
+ '%s',
169
+ '%s',
170
+ '%d',
171
+ '%s',
172
+ '%d',
173
+ '%s',
174
+ '%d',
175
+ '%s',
176
+ '%d',
177
+ '%s',
178
+ '%s',
179
+ '%s',
180
+ '%d',
181
+ '%s',
182
+ '%d',
183
+ '%s',
184
+ '%s',
185
+ '%s',
186
+ '%d',
187
+ '%d',
188
+ '%d',
189
+ '%d',
190
+ )
191
+ );
192
+ if (false !== $results) {
193
+ $new_quiz = $wpdb->insert_id;
194
+ $quiz_post = array(
195
+ 'post_title' => $quiz_name,
196
+ 'post_content' => "[mlw_quizmaster quiz=$new_quiz]",
197
+ 'post_status' => 'draft',
198
+ 'post_author' => $current_user->ID,
199
+ 'post_type' => 'qsm_quiz',
200
+ );
201
+ $quiz_post_id = wp_insert_post($quiz_post);
202
+ add_post_meta($quiz_post_id, 'quiz_id', $new_quiz);
203
 
204
+ // activating selected theme
205
+ $mlwQuizMasterNext->theme_settings->activate_selected_theme($new_quiz, $theme_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
+ $mlwQuizMasterNext->alertManager->newAlert(__('Your new quiz or survey has been created successfully. To begin editing, click the Edit link.', 'quiz-master-next'), 'success');
208
+ $mlwQuizMasterNext->audit_manager->new_audit("New Quiz/Survey Has Been Created: $quiz_name");
209
 
210
+ // Hook called after new quiz or survey has been created. Passes quiz_id to hook
211
+ do_action('qmn_quiz_created', $new_quiz);
212
+ } else {
213
+ $mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0001'), 'error');
214
+ $mlwQuizMasterNext->log_manager->add("Error 0001", $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error');
215
+ }
216
+ }
217
 
218
+ /**
219
+ * Deletes a quiz with the given quiz_id
220
+ *
221
+ * @access public
222
+ * @since 3.7.1
223
+ * @return void
224
+ */
225
+ public function delete_quiz($quiz_id, $quiz_name)
226
+ {
227
+ global $mlwQuizMasterNext;
228
+ global $wpdb;
229
+ $results = $wpdb->update(
230
+ $wpdb->prefix . "mlw_quizzes",
231
+ array(
232
+ 'deleted' => 1,
233
+ ),
234
+ array('quiz_id' => $quiz_id),
235
+ array(
236
+ '%d',
237
+ ),
238
+ array('%d')
239
+ );
240
+ $deleted = 0;
241
+ if (isset($_POST['qsm_delete_question_from_qb']) && $_POST['qsm_delete_question_from_qb'] == 1) {
242
+ $deleted = 1;
243
+ }
244
+ $delete_question_results = $wpdb->update(
245
+ $wpdb->prefix . "mlw_questions",
246
+ array(
247
+ 'deleted' => $deleted,
248
+ ),
249
+ array('quiz_id' => $quiz_id),
250
+ array(
251
+ '%d',
252
+ ),
253
+ array('%d')
254
+ );
255
+ if ($results != false) {
256
+ $my_query = new WP_Query(array('post_type' => 'qsm_quiz', 'meta_key' => 'quiz_id', 'meta_value' => $quiz_id));
257
+ if ($my_query->have_posts()) {
258
+ while ($my_query->have_posts()) {
259
+ $my_query->the_post();
260
+ $my_post = array(
261
+ 'ID' => get_the_ID(),
262
+ 'post_status' => 'trash',
263
+ );
264
+ wp_update_post($my_post);
265
+ }
266
+ }
267
+ wp_reset_postdata();
268
+ $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz or survey has been deleted successfully.', 'quiz-master-next'), 'success');
269
+ $mlwQuizMasterNext->audit_manager->new_audit("Quiz/Survey Has Been Deleted: $quiz_name");
270
+ } else {
271
+ $mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0002'), 'error');
272
+ $mlwQuizMasterNext->log_manager->add("Error 0002", $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error');
273
+ }
 
 
 
 
 
274
 
275
+ // Hook called after quiz or survey is deleted. Hook passes quiz_id to function
276
+ do_action('qmn_quiz_deleted', $quiz_id);
277
+ }
278
 
279
+ /**
280
+ * Edits the name of the quiz with the given ID
281
+ *
282
+ * @access public
283
+ * @since 3.7.1
284
+ * @param int $quiz_id The ID of the quiz.
285
+ * @param string $quiz_name The new name of the quiz.
286
+ * @return void
287
+ */
288
+ public function edit_quiz_name($quiz_id, $quiz_name)
289
+ {
290
+ global $mlwQuizMasterNext;
291
+ global $wpdb;
292
+ $results = $wpdb->update(
293
+ $wpdb->prefix . 'mlw_quizzes',
294
+ array(
295
+ 'quiz_name' => $quiz_name,
296
+ ),
297
+ array('quiz_id' => $quiz_id),
298
+ array(
299
+ '%s',
300
+ ),
301
+ array('%d')
302
+ );
303
+ if (false !== $results) {
304
+ $mlwQuizMasterNext->alertManager->newAlert(__('The name of your quiz or survey has been updated successfully.', 'quiz-master-next'), 'success');
305
+ $mlwQuizMasterNext->audit_manager->new_audit("Quiz/Survey Name Has Been Edited: $quiz_name");
306
+ } else {
307
+ $error = $wpdb->last_error;
308
+ if (empty($error)) {
309
+ $error = __('Unknown error', 'quiz-master-next');
310
+ }
311
+ $mlwQuizMasterNext->alertManager->newAlert(__('An error occurred while trying to update the name of your quiz or survey. Please try again.', 'quiz-master-next'), 'error');
312
+ $mlwQuizMasterNext->log_manager->add('Error when updating quiz name', "Tried {$wpdb->last_query} but got $error", 0, 'error');
313
+ }
314
 
315
+ // Fires when the name of a quiz/survey is edited.
316
+ do_action('qsm_quiz_name_edited', $quiz_id, $quiz_name);
317
 
318
+ // Legacy code.
319
+ do_action('qmn_quiz_name_edited', $quiz_id);
320
+ }
321
 
322
+ /**
323
+ * Duplicates the quiz with the given ID and gives new quiz the given quiz name
324
+ *
325
+ * @access public
326
+ * @since 3.7.1
327
+ * @return void
328
+ */
329
+ public function duplicate_quiz($quiz_id, $quiz_name, $is_duplicating_questions)
330
+ {
331
+ global $mlwQuizMasterNext;
332
+ global $wpdb;
333
+ $current_user = wp_get_current_user();
334
+ $table_name = $wpdb->prefix . "mlw_quizzes";
335
+ $logic_table = $wpdb->prefix . "mlw_logic";
336
+ $logic_table_exists = $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $logic_table));
337
+ $mlw_qmn_duplicate_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d", $quiz_id));
338
+ $quiz_settings = unserialize($mlw_qmn_duplicate_data->quiz_settings);
339
+ if ($is_duplicating_questions == 0) {
340
+ $quiz_settings['pages'] = '';
341
+ }
342
+ $qsm_create_quiz_system = 0;
343
+ if (isset($mlw_qmn_duplicate_data->system)) {
344
+ $qsm_create_quiz_system = $mlw_qmn_duplicate_data->system;
345
+ } else if (isset($mlw_qmn_duplicate_data->quiz_system)) {
346
+ $qsm_create_quiz_system = $mlw_qmn_duplicate_data->quiz_system;
347
+ }
348
+ $results = $wpdb->insert(
349
+ $table_name,
350
+ array(
351
+ 'quiz_name' => $quiz_name,
352
+ 'message_before' => $mlw_qmn_duplicate_data->message_before,
353
+ 'message_after' => $mlw_qmn_duplicate_data->message_after,
354
+ 'message_comment' => $mlw_qmn_duplicate_data->message_comment,
355
+ 'message_end_template' => $mlw_qmn_duplicate_data->message_end_template,
356
+ 'user_email_template' => $mlw_qmn_duplicate_data->user_email_template,
357
+ 'admin_email_template' => $mlw_qmn_duplicate_data->admin_email_template,
358
+ 'submit_button_text' => $mlw_qmn_duplicate_data->submit_button_text,
359
+ 'name_field_text' => $mlw_qmn_duplicate_data->name_field_text,
360
+ 'business_field_text' => $mlw_qmn_duplicate_data->business_field_text,
361
+ 'email_field_text' => $mlw_qmn_duplicate_data->email_field_text,
362
+ 'phone_field_text' => $mlw_qmn_duplicate_data->phone_field_text,
363
+ 'comment_field_text' => $mlw_qmn_duplicate_data->comment_field_text,
364
+ 'email_from_text' => $mlw_qmn_duplicate_data->email_from_text,
365
+ 'question_answer_template' => $mlw_qmn_duplicate_data->question_answer_template,
366
+ 'leaderboard_template' => $mlw_qmn_duplicate_data->leaderboard_template,
367
+ 'quiz_system' => $qsm_create_quiz_system,
368
+ 'randomness_order' => $mlw_qmn_duplicate_data->randomness_order,
369
+ 'loggedin_user_contact' => $mlw_qmn_duplicate_data->loggedin_user_contact,
370
+ 'show_score' => $mlw_qmn_duplicate_data->show_score,
371
+ 'send_user_email' => $mlw_qmn_duplicate_data->send_user_email,
372
+ 'send_admin_email' => $mlw_qmn_duplicate_data->send_admin_email,
373
+ 'contact_info_location' => $mlw_qmn_duplicate_data->contact_info_location,
374
+ 'user_name' => $mlw_qmn_duplicate_data->user_name,
375
+ 'user_comp' => $mlw_qmn_duplicate_data->user_comp,
376
+ 'user_email' => $mlw_qmn_duplicate_data->user_email,
377
+ 'user_phone' => $mlw_qmn_duplicate_data->user_phone,
378
+ 'admin_email' => get_option('admin_email', 'Enter email'),
379
+ 'comment_section' => $mlw_qmn_duplicate_data->comment_section,
380
+ 'question_from_total' => $mlw_qmn_duplicate_data->question_from_total,
381
+ 'total_user_tries' => $mlw_qmn_duplicate_data->total_user_tries,
382
+ 'total_user_tries_text' => $mlw_qmn_duplicate_data->total_user_tries_text,
383
+ 'certificate_template' => $mlw_qmn_duplicate_data->certificate_template,
384
+ 'social_media' => $mlw_qmn_duplicate_data->social_media,
385
+ 'social_media_text' => $mlw_qmn_duplicate_data->social_media_text,
386
+ 'pagination' => $mlw_qmn_duplicate_data->pagination,
387
+ 'pagination_text' => $mlw_qmn_duplicate_data->pagination_text,
388
+ 'timer_limit' => $mlw_qmn_duplicate_data->timer_limit,
389
+ 'quiz_stye' => $mlw_qmn_duplicate_data->quiz_stye,
390
+ 'question_numbering' => $mlw_qmn_duplicate_data->question_numbering,
391
+ 'quiz_settings' => serialize($quiz_settings),
392
+ 'theme_selected' => $mlw_qmn_duplicate_data->theme_selected,
393
+ 'last_activity' => date("Y-m-d H:i:s"),
394
+ 'require_log_in' => $mlw_qmn_duplicate_data->require_log_in,
395
+ 'require_log_in_text' => $mlw_qmn_duplicate_data->require_log_in_text,
396
+ 'limit_total_entries' => $mlw_qmn_duplicate_data->limit_total_entries,
397
+ 'limit_total_entries_text' => $mlw_qmn_duplicate_data->limit_total_entries_text,
398
+ 'scheduled_timeframe' => $mlw_qmn_duplicate_data->scheduled_timeframe,
399
+ 'scheduled_timeframe_text' => $mlw_qmn_duplicate_data->scheduled_timeframe_text,
400
+ 'quiz_views' => 0,
401
+ 'quiz_taken' => 0,
402
+ 'deleted' => 0,
403
+ 'quiz_author_id' => $current_user->ID,
404
+ ),
405
+ array(
406
+ '%s',
407
+ '%s',
408
+ '%s',
409
+ '%s',
410
+ '%s',
411
+ '%s',
412
+ '%s',
413
+ '%s',
414
+ '%s',
415
+ '%s',
416
+ '%s',
417
+ '%s',
418
+ '%s',
419
+ '%s',
420
+ '%s',
421
+ '%s',
422
+ '%d',
423
+ '%d',
424
+ '%d',
425
+ '%d',
426
+ '%d',
427
+ '%d',
428
+ '%d',
429
+ '%d',
430
+ '%d',
431
+ '%d',
432
+ '%d',
433
+ '%s',
434
+ '%d',
435
+ '%d',
436
+ '%d',
437
+ '%s',
438
+ '%s',
439
+ '%d',
440
+ '%s',
441
+ '%d',
442
+ '%s',
443
+ '%d',
444
+ '%s',
445
+ '%d',
446
+ '%s',
447
+ '%s',
448
+ '%s',
449
+ '%d',
450
+ '%s',
451
+ '%d',
452
+ '%s',
453
+ '%s',
454
+ '%s',
455
+ '%d',
456
+ '%d',
457
+ '%d',
458
+ '%d',
459
+ )
460
+ );
461
+ $mlw_new_id = $wpdb->insert_id;
462
 
463
+ //Update quiz settings
464
+ $update_quiz_settings = unserialize($mlw_qmn_duplicate_data->quiz_settings);
465
+ $update_pages = unserialize($update_quiz_settings['pages']);
466
+ //get logic data from logic table first or else from quiz_settings
467
+ if (!is_null($logic_table_exists)) {
468
+ $query = $wpdb->prepare("SELECT * FROM $logic_table WHERE quiz_id = %d", $quiz_id);
469
+ $logic_data = $wpdb->get_results($query);
470
+ $logic_rules = [];
471
+ if (!empty($logic_data)) {
472
+ foreach ($logic_data as $data) {
473
+ $logic_rules[] = unserialize($data->logic);
474
+ }
475
+ }
476
+ } else {
477
+ $logic_rules = isset($update_quiz_settings['logic_rules']) ? unserialize(unserialize($update_quiz_settings['logic_rules'])) : array();
478
+ }
479
 
480
+ if (false != $results) {
481
+ $current_user = wp_get_current_user();
482
+ $quiz_post = array(
483
+ 'post_title' => $quiz_name,
484
+ 'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
485
+ 'post_status' => 'publish',
486
+ 'post_author' => $current_user->ID,
487
+ 'post_type' => 'qsm_quiz',
488
+ );
489
+ $quiz_post_id = wp_insert_post($quiz_post);
490
+ add_post_meta($quiz_post_id, 'quiz_id', $mlw_new_id);
491
+ $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz or survey has been duplicated successfully.', 'quiz-master-next'), 'success');
492
+ $mlwQuizMasterNext->audit_manager->new_audit("New Quiz/Survey Has Been Created: $quiz_name");
493
+ do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
494
+ } else {
495
+ $mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0011'), 'error');
496
+ $mlwQuizMasterNext->log_manager->add("Error 0011", $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error');
497
+ }
498
+ if ($is_duplicating_questions) {
499
+ $table_name = $wpdb->prefix . "mlw_questions";
500
+ $questions = [];
501
+ if (is_array($update_pages)) {
502
+ foreach ($update_pages[0] as $ids) {
503
+ $questions[] = $ids;
504
+ }
505
+ }
506
+ $question_ids = implode(',', $questions);
507
+ $mlw_current_questions = $wpdb->get_results($wpdb->prepare("SELECT * FROM $table_name WHERE question_id IN (%1s)", $question_ids));
508
+ foreach ($mlw_current_questions as $mlw_question) {
509
+ $question_results = $wpdb->insert(
510
+ $table_name,
511
+ array(
512
+ 'quiz_id' => $mlw_new_id,
513
+ 'question_name' => $mlw_question->question_name,
514
+ 'answer_array' => $mlw_question->answer_array,
515
+ 'answer_one' => $mlw_question->answer_one,
516
+ 'answer_one_points' => $mlw_question->answer_one_points,
517
+ 'answer_two' => $mlw_question->answer_two,
518
+ 'answer_two_points' => $mlw_question->answer_two_points,
519
+ 'answer_three' => $mlw_question->answer_three,
520
+ 'answer_three_points' => $mlw_question->answer_three_points,
521
+ 'answer_four' => $mlw_question->answer_four,
522
+ 'answer_four_points' => $mlw_question->answer_four_points,
523
+ 'answer_five' => $mlw_question->answer_five,
524
+ 'answer_five_points' => $mlw_question->answer_five_points,
525
+ 'answer_six' => $mlw_question->answer_six,
526
+ 'answer_six_points' => $mlw_question->answer_six_points,
527
+ 'correct_answer' => $mlw_question->correct_answer,
528
+ 'question_answer_info' => $mlw_question->question_answer_info,
529
+ 'comments' => $mlw_question->comments,
530
+ 'hints' => $mlw_question->hints,
531
+ 'question_order' => $mlw_question->question_order,
532
+ 'question_type_new' => $mlw_question->question_type_new,
533
+ 'question_settings' => $mlw_question->question_settings,
534
+ 'category' => $mlw_question->category,
535
+ 'deleted' => 0,
536
+ ),
537
+ array(
538
+ '%d',
539
+ '%s',
540
+ '%s',
541
+ '%s',
542
+ '%d',
543
+ '%s',
544
+ '%d',
545
+ '%s',
546
+ '%d',
547
+ '%s',
548
+ '%d',
549
+ '%s',
550
+ '%d',
551
+ '%s',
552
+ '%d',
553
+ '%d',
554
+ '%s',
555
+ '%d',
556
+ '%s',
557
+ '%d',
558
+ '%s',
559
+ '%s',
560
+ '%s',
561
+ '%d',
562
+ )
563
+ );
564
+ foreach ($update_pages as $pages_key => $pages_value) {
565
+ foreach ($pages_value as $pages_k_q => $page_q_id) {
566
+ if ($page_q_id == $mlw_question->question_id) {
567
+ $update_pages[$pages_key][$pages_k_q] = $wpdb->insert_id;
568
+ }
569
+ }
570
+ }
571
+ // Fixed Rules Questions with new question ids
572
+ if ($logic_rules) {
573
+ foreach ($logic_rules as $logic_key => $logic_value) {
574
+ foreach ($logic_value as $logic_cond_k => $logic_cond) {
575
+ foreach ($logic_cond as $l_cond_k => $logic_val) {
576
+ if ($logic_val['question'] == $mlw_question->question_id) {
577
+ $logic_rules[$logic_key][$logic_cond_k][$l_cond_k]['question'] = $wpdb->insert_id;
578
+ }
579
+ }
580
+ }
581
+ }
582
+ }
583
+ if ($question_results == false) {
584
+ $mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0020'), 'error');
585
+ $mlwQuizMasterNext->log_manager->add("Error 0020", $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error');
586
+ }
587
+ }
588
+ $update_quiz_settings['pages'] = serialize($update_pages);
589
+ //saves data in logic table first or else in quiz_settings
590
+ $value_array = [];
591
+ if (is_array($logic_rules) && !empty($logic_rules)) {
592
+ if (is_null($logic_table_exists)) {
593
+ $update_quiz_settings['logic_rules'] = serialize(serialize($logic_rules));
594
+ } else {
595
+ foreach ($logic_rules as $logic_data) {
596
+ $data = array(
597
+ $mlw_new_id,
598
+ serialize($logic_data),
599
+ );
600
+ $value_array[] = stripslashes($wpdb->prepare("(%d, %s)", $data));
601
+ }
602
+ $values = implode(',', $value_array);
603
+ $query = "INSERT INTO $logic_table (quiz_id, logic) VALUES ";
604
+ $query .= $values;
605
+ $saved = $wpdb->query($query);
606
+ if ($saved != false) {
607
+ update_option("logic_rules_quiz_$mlw_new_id", date(time()));
608
+ $update_quiz_settings['logic_rules'] = '';
609
+ } else {
610
+ $update_quiz_settings['logic_rules'] = serialize(serialize($logic_rules));
611
+ }
612
+ }
613
+ }
614
 
615
+ $wpdb->update(
616
+ $wpdb->prefix . "mlw_quizzes",
617
+ array(
618
+ 'quiz_settings' => serialize($update_quiz_settings),
619
+ ),
620
+ array(
621
+ 'quiz_id' => $mlw_new_id,
622
+ )
623
+ );
624
+ }
625
+ }
626
 
627
+ /**
628
+ * Retrieves setting store in quiz_settings
629
+ *
630
+ * @deprecated 6.0.3 Use the get_quiz_setting function in the pluginHelper object.
631
+ * @since 3.8.1
632
+ * @access public
633
+ * @param string $setting_name The slug of the setting.
634
+ * @return string The value of the setting
635
+ */
636
+ public function get_setting($setting_name)
637
+ {
638
+ global $wpdb;
639
+ $qmn_settings_array = '';
640
+ $qmn_quiz_settings = $wpdb->get_var($wpdb->prepare("SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id));
641
+ if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings))) {
642
+ $qmn_settings_array = @unserialize($qmn_quiz_settings);
643
+ }
644
+ if (is_array($qmn_settings_array) && isset($qmn_settings_array[$setting_name])) {
645
+ return $qmn_settings_array[$setting_name];
646
+ } else {
647
+ return '';
648
+ }
649
 
650
+ }
651
 
652
+ /**
653
+ * Updates setting stored in quiz_settings
654
+ *
655
+ * @deprecated 6.0.3 Use the update_quiz_setting function in the pluginHelper object.
656
+ * @since 3.8.1
657
+ * @access public
658
+ * @param string $setting_name The slug of the setting.
659
+ * @param mixed $setting_value The value for the setting.
660
+ * @return bool True if update was successful
661
+ */
662
+ public function update_setting($setting_name, $setting_value)
663
+ {
664
+ global $wpdb;
665
+ $qmn_settings_array = array();
666
+ $qmn_quiz_settings = $wpdb->get_var($wpdb->prepare("SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id));
667
+ if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings))) {
668
+ $qmn_settings_array = @unserialize($qmn_quiz_settings);
669
+ }
670
+ $qmn_settings_array[$setting_name] = $setting_value;
671
+ $qmn_serialized_array = serialize($qmn_settings_array);
672
+ $results = $wpdb->update(
673
+ $wpdb->prefix . "mlw_quizzes",
674
+ array(
675
+ 'quiz_settings' => $qmn_serialized_array,
676
+ ),
677
+ array('quiz_id' => $this->quiz_id),
678
+ array(
679
+ '%s',
680
+ ),
681
+ array('%d')
682
+ );
683
+ if ($results != false) {
684
+ return true;
685
+ } else {
686
+ return false;
687
+ }
688
+ }
689
 
690
+ /**
691
+ * Deletes setting stored in quiz_settings
692
+ *
693
+ * @deprecated 6.0.3
694
+ * @since 3.8.1
695
+ * @access public
696
+ * @return void
697
+ */
698
+ public function delete_setting($setting_name)
699
+ {
700
+ global $wpdb;
701
+ $qmn_settings_array = array();
702
+ $qmn_quiz_settings = $wpdb->get_var($wpdb->prepare("SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id));
703
+ if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings))) {
704
+ $qmn_settings_array = @unserialize($qmn_quiz_settings);
705
+ }
706
+ if (is_array($qmn_settings_array) && isset($qmn_settings_array[$setting_name])) {
707
+ unset($qmn_settings_array[$setting_name]);
708
+ }
709
+ $qmn_serialized_array = serialize($qmn_settings_array);
710
+ $results = $wpdb->update(
711
+ $wpdb->prefix . "mlw_quizzes",
712
+ array(
713
+ 'quiz_settings' => $qmn_serialized_array,
714
+ ),
715
+ array('quiz_id' => $this->quiz_id),
716
+ array(
717
+ '%s',
718
+ ),
719
+ array('%d')
720
+ );
721
+ }
722
+ }
php/classes/class-qmn-quiz-manager.php CHANGED
@@ -71,6 +71,7 @@ class QMNQuizManager {
71
  if ( $file_upload_type ) {
72
  $file_type_exp = explode( ',', $file_upload_type );
73
  foreach ( $file_type_exp as $value ) {
 
74
  $value = trim( $value );
75
  if ( $value == 'image' ) {
76
  $mimes[] = 'image/jpeg';
@@ -83,8 +84,10 @@ class QMNQuizManager {
83
  } elseif ( $value == 'excel' ) {
84
  $mimes[] = 'application/excel, application/vnd.ms-excel, application/x-excel, application/x-msexcel';
85
  $mimes[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
 
86
  } elseif ( empty( $value ) ) {
87
  // don't add blank mime type
 
88
  } else {
89
  $mimes[] = $value;
90
  }
@@ -305,6 +308,12 @@ class QMNQuizManager {
305
  wp_enqueue_style( 'qmn_quiz_animation_style', plugins_url( '../../css/animate.css', __FILE__ ) );
306
  wp_enqueue_style( 'qmn_quiz_common_style', plugins_url( '../../css/common.css', __FILE__ ) );
307
  wp_enqueue_style( 'dashicons' );
 
 
 
 
 
 
308
 
309
  // Starts to prepare variable array for filters.
310
  $qmn_array_for_variables = array(
@@ -615,7 +624,9 @@ class QMNQuizManager {
615
  global $mlw_qmn_section_count;
616
  $mlw_qmn_section_count = 0;
617
  $auto_pagination_class = $options->pagination > 0 ? 'qsm_auto_pagination_enabled' : '';
618
- $quiz_display .= "<div class='qsm-quiz-container qmn_quiz_container mlw_qmn_quiz {$auto_pagination_class}'>";
 
 
619
  // Get quiz post based on quiz id
620
  $args = array(
621
  'posts_per_page' => 1,
@@ -712,6 +723,7 @@ class QMNQuizManager {
712
  ?>
713
  </div>
714
  <?php
 
715
  if ( 0 == $options->contact_info_location ) {
716
  echo QSM_Contact_Manager::display_fields( $options );
717
  }
@@ -719,6 +731,7 @@ class QMNQuizManager {
719
  </div>
720
  </section>
721
  <?php
 
722
  }
723
 
724
  // If there is only one page.
@@ -727,6 +740,7 @@ class QMNQuizManager {
727
  ?>
728
  <section class="qsm-page <?php echo $animation_effect; ?>">
729
  <?php
 
730
  if ( ! empty( $options->message_before ) || ( 0 == $options->contact_info_location && $contact_fields ) ) {
731
  $qmn_json_data['first_page'] = false;
732
  $message_before = wpautop( htmlspecialchars_decode( $options->message_before, ENT_QUOTES ) );
@@ -777,6 +791,7 @@ class QMNQuizManager {
777
  <textarea id='mlwQuizComments' name='mlwQuizComments' class='qsm-comments qmn_comment_section'></textarea>
778
  </div>
779
  <?php
 
780
  }
781
  if ( ! empty( $options->message_end_template ) || ( 1 == $options->contact_info_location && $contact_fields ) ) {
782
  $message_after = wpautop( htmlspecialchars_decode( $options->message_end_template, ENT_QUOTES ) );
@@ -834,6 +849,7 @@ class QMNQuizManager {
834
  ?>
835
  <span class="pages_count">
836
  <?php
 
837
  $text_c = $pages_count . __( ' out of ', 'quiz-master-next' ) . $total_pages_count;
838
  echo apply_filters( 'qsm_total_pages_count', $text_c, $pages_count, $total_pages_count );
839
  ?>
@@ -1026,9 +1042,14 @@ class QMNQuizManager {
1026
  public function display_comment_section( $qmn_quiz_options, $qmn_array_for_variables ) {
1027
  global $mlw_qmn_section_count;
1028
  $comment_display = '';
 
 
 
 
 
1029
  if ( 0 == $qmn_quiz_options->comment_section ) {
1030
  $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
1031
- $comment_display .= "<div class='quiz_section quiz_end qsm-auto-page-row qsm-quiz-comment-section slide" . $mlw_qmn_section_count . "' style='display: none;'>";
1032
  $message_comments = wpautop( htmlspecialchars_decode( $qmn_quiz_options->message_comment, ENT_QUOTES ) );
1033
  $message_comments = apply_filters( 'mlw_qmn_template_variable_quiz_page', $message_comments, $qmn_array_for_variables );
1034
  $comment_display .= "<label for='mlwQuizComments' class='mlw_qmn_comment_section_text'>$message_comments</label><br />";
@@ -1051,15 +1072,18 @@ class QMNQuizManager {
1051
  */
1052
  public function display_end_section( $qmn_quiz_options, $qmn_array_for_variables ) {
1053
  global $mlw_qmn_section_count;
1054
- $section_display = '';
1055
- $section_display .= '<br />';
 
1056
  $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
1057
  $pagination_optoin = $qmn_quiz_options->pagination;
1058
  $style = '';
1059
  if ( $pagination_optoin > 0 ) {
1060
  $style = "style='display: none;'";
1061
  }
1062
- $section_display .= "<div class='qsm-auto-page-row quiz_section quiz_end' {$style}>";
 
 
1063
  if ( ! empty( $qmn_quiz_options->message_end_template ) ) {
1064
  $message_end = wpautop( htmlspecialchars_decode( $qmn_quiz_options->message_end_template, ENT_QUOTES ) );
1065
  $message_end = apply_filters( 'mlw_qmn_template_variable_quiz_page', $message_end, $qmn_array_for_variables );
@@ -1070,15 +1094,22 @@ class QMNQuizManager {
1070
  $section_display .= QSM_Contact_Manager::display_fields( $qmn_quiz_options );
1071
  }
1072
 
1073
- // Legacy Code.
1074
- ob_start();
1075
  do_action( 'mlw_qmn_end_quiz_section' );
1076
  $section_display .= ob_get_contents();
1077
  ob_end_clean();
1078
- $section_display .= "<input type='submit' class='qsm-btn qsm-submit-btn qmn_btn' value='" . esc_attr( htmlspecialchars_decode( $qmn_quiz_options->submit_button_text, ENT_QUOTES ) ) . "' />";
1079
- $section_display .= '</div>';
 
 
 
 
 
 
 
 
 
1080
 
1081
- return $section_display;
1082
  }
1083
 
1084
  /**
71
  if ( $file_upload_type ) {
72
  $file_type_exp = explode( ',', $file_upload_type );
73
  foreach ( $file_type_exp as $value ) {
74
+
75
  $value = trim( $value );
76
  if ( $value == 'image' ) {
77
  $mimes[] = 'image/jpeg';
84
  } elseif ( $value == 'excel' ) {
85
  $mimes[] = 'application/excel, application/vnd.ms-excel, application/x-excel, application/x-msexcel';
86
  $mimes[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
87
+
88
  } elseif ( empty( $value ) ) {
89
  // don't add blank mime type
90
+
91
  } else {
92
  $mimes[] = $value;
93
  }
308
  wp_enqueue_style( 'qmn_quiz_animation_style', plugins_url( '../../css/animate.css', __FILE__ ) );
309
  wp_enqueue_style( 'qmn_quiz_common_style', plugins_url( '../../css/common.css', __FILE__ ) );
310
  wp_enqueue_style( 'dashicons' );
311
+ $saved_quiz_theme = $mlwQuizMasterNext->theme_settings->get_active_quiz_theme_path( $quiz );
312
+ $folder_name = QSM_THEME_PATH . $saved_quiz_theme . '/';
313
+ if ( file_exists( $folder_name . 'functions.php' ) ) {
314
+ include $folder_name . 'functions.php';
315
+ }
316
+ do_action( 'qsm_enqueue_script_style', $qmn_quiz_options );
317
 
318
  // Starts to prepare variable array for filters.
319
  $qmn_array_for_variables = array(
624
  global $mlw_qmn_section_count;
625
  $mlw_qmn_section_count = 0;
626
  $auto_pagination_class = $options->pagination > 0 ? 'qsm_auto_pagination_enabled' : '';
627
+ // $saved_quiz_theme = $mlwQuizMasterNext->quiz_settings->get_setting('quiz_new_theme');
628
+ $saved_quiz_theme = $mlwQuizMasterNext->theme_settings->get_active_quiz_theme_path( $options->quiz_id );
629
+ $quiz_display .= "<div class='qsm-quiz-container qmn_quiz_container mlw_qmn_quiz {$auto_pagination_class} quiz_theme_$saved_quiz_theme'>";
630
  // Get quiz post based on quiz id
631
  $args = array(
632
  'posts_per_page' => 1,
723
  ?>
724
  </div>
725
  <?php
726
+
727
  if ( 0 == $options->contact_info_location ) {
728
  echo QSM_Contact_Manager::display_fields( $options );
729
  }
731
  </div>
732
  </section>
733
  <?php
734
+
735
  }
736
 
737
  // If there is only one page.
740
  ?>
741
  <section class="qsm-page <?php echo $animation_effect; ?>">
742
  <?php
743
+
744
  if ( ! empty( $options->message_before ) || ( 0 == $options->contact_info_location && $contact_fields ) ) {
745
  $qmn_json_data['first_page'] = false;
746
  $message_before = wpautop( htmlspecialchars_decode( $options->message_before, ENT_QUOTES ) );
791
  <textarea id='mlwQuizComments' name='mlwQuizComments' class='qsm-comments qmn_comment_section'></textarea>
792
  </div>
793
  <?php
794
+
795
  }
796
  if ( ! empty( $options->message_end_template ) || ( 1 == $options->contact_info_location && $contact_fields ) ) {
797
  $message_after = wpautop( htmlspecialchars_decode( $options->message_end_template, ENT_QUOTES ) );
849
  ?>
850
  <span class="pages_count">
851
  <?php
852
+
853
  $text_c = $pages_count . __( ' out of ', 'quiz-master-next' ) . $total_pages_count;
854
  echo apply_filters( 'qsm_total_pages_count', $text_c, $pages_count, $total_pages_count );
855
  ?>
1042
  public function display_comment_section( $qmn_quiz_options, $qmn_array_for_variables ) {
1043
  global $mlw_qmn_section_count;
1044
  $comment_display = '';
1045
+ if ( $qmn_quiz_options->randomness_order == 0 ) {
1046
+ $display_style = 'display: none;';
1047
+ } else {
1048
+ $display_style = '';
1049
+ }
1050
  if ( 0 == $qmn_quiz_options->comment_section ) {
1051
  $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
1052
+ $comment_display .= "<div class='quiz_section quiz_end qsm-auto-page-row qsm-quiz-comment-section slide" . $mlw_qmn_section_count . "' style='" . $display_style . "'>";
1053
  $message_comments = wpautop( htmlspecialchars_decode( $qmn_quiz_options->message_comment, ENT_QUOTES ) );
1054
  $message_comments = apply_filters( 'mlw_qmn_template_variable_quiz_page', $message_comments, $qmn_array_for_variables );
1055
  $comment_display .= "<label for='mlwQuizComments' class='mlw_qmn_comment_section_text'>$message_comments</label><br />";
1072
  */
1073
  public function display_end_section( $qmn_quiz_options, $qmn_array_for_variables ) {
1074
  global $mlw_qmn_section_count;
1075
+ $end_section = '';
1076
+ $section_display = '';
1077
+ // $section_display .= '<br />';
1078
  $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
1079
  $pagination_optoin = $qmn_quiz_options->pagination;
1080
  $style = '';
1081
  if ( $pagination_optoin > 0 ) {
1082
  $style = "style='display: none;'";
1083
  }
1084
+ // $section_display .= "<div class='qsm-auto-page-row quiz_section quiz_end' {$style}>";
1085
+ // Legacy Code.
1086
+ ob_start();
1087
  if ( ! empty( $qmn_quiz_options->message_end_template ) ) {
1088
  $message_end = wpautop( htmlspecialchars_decode( $qmn_quiz_options->message_end_template, ENT_QUOTES ) );
1089
  $message_end = apply_filters( 'mlw_qmn_template_variable_quiz_page', $message_end, $qmn_array_for_variables );
1094
  $section_display .= QSM_Contact_Manager::display_fields( $qmn_quiz_options );
1095
  }
1096
 
 
 
1097
  do_action( 'mlw_qmn_end_quiz_section' );
1098
  $section_display .= ob_get_contents();
1099
  ob_end_clean();
1100
+ if ( ! empty( $section_display ) ) {
1101
+ $end_section = '<br />';
1102
+ $end_section .= "<div class='qsm-auto-page-row quiz_section quiz_end' {$style}>";
1103
+ $end_section .= $section_display;
1104
+ $end_section .= "<input type='submit' class='qsm-btn qsm-submit-btn qmn_btn' value='" . esc_attr( htmlspecialchars_decode( $qmn_quiz_options->submit_button_text, ENT_QUOTES ) ) . "' />";
1105
+ $end_section .= '</div>';
1106
+ } else {
1107
+ $end_section .= "<div class='qsm-auto-page-row quiz_section quiz_end empty_quiz_end' {$style}>";
1108
+ $end_section .= "<input type='submit' class='qsm-btn qsm-submit-btn qmn_btn' value='" . esc_attr( htmlspecialchars_decode( $qmn_quiz_options->submit_button_text, ENT_QUOTES ) ) . "' />";
1109
+ $end_section .= '</div>';
1110
+ }
1111
 
1112
+ return $end_section;
1113
  }
1114
 
1115
  /**
php/classes/class-qsm-install.php CHANGED
@@ -1233,6 +1233,8 @@ class QSM_Install {
1233
  $question_table_name = $wpdb->prefix . "mlw_questions";
1234
  $results_table_name = $wpdb->prefix . "mlw_results";
1235
  $audit_table_name = $wpdb->prefix . "mlw_qm_audit_trail";
 
 
1236
 
1237
  if( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_table_name'" ) != $quiz_table_name ) {
1238
  $sql = "CREATE TABLE $quiz_table_name (
@@ -1363,6 +1365,7 @@ class QSM_Install {
1363
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1364
  dbDelta( $sql );
1365
  }
 
1366
  if( $wpdb->get_var( "SHOW TABLES LIKE '$audit_table_name'" ) != $audit_table_name ) {
1367
  $sql = "CREATE TABLE $audit_table_name (
1368
  trail_id mediumint(9) NOT NULL AUTO_INCREMENT,
@@ -1375,9 +1378,45 @@ class QSM_Install {
1375
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1376
  dbDelta( $sql );
1377
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1379
  global $mlwQuizMasterNext;
1380
  $mlwQuizMasterNext->register_quiz_post_types();
 
 
 
 
 
 
 
 
1381
  flush_rewrite_rules();
1382
  }
1383
 
1233
  $question_table_name = $wpdb->prefix . "mlw_questions";
1234
  $results_table_name = $wpdb->prefix . "mlw_results";
1235
  $audit_table_name = $wpdb->prefix . "mlw_qm_audit_trail";
1236
+ $themes_table_name = $wpdb->prefix . "mlw_themes";
1237
+ $quiz_themes_settings_table_name = $wpdb->prefix . "mlw_quiz_theme_settings";
1238
 
1239
  if( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_table_name'" ) != $quiz_table_name ) {
1240
  $sql = "CREATE TABLE $quiz_table_name (
1365
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1366
  dbDelta( $sql );
1367
  }
1368
+
1369
  if( $wpdb->get_var( "SHOW TABLES LIKE '$audit_table_name'" ) != $audit_table_name ) {
1370
  $sql = "CREATE TABLE $audit_table_name (
1371
  trail_id mediumint(9) NOT NULL AUTO_INCREMENT,
1378
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1379
  dbDelta( $sql );
1380
  }
1381
+
1382
+ if( $wpdb->get_var( "SHOW TABLES LIKE '$themes_table_name'" ) != $themes_table_name ) {
1383
+ $sql = "CREATE TABLE $themes_table_name (
1384
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
1385
+ theme TEXT NOT NULL,
1386
+ theme_name TEXT NOT NULL,
1387
+ default_settings TEXT NOT NULL,
1388
+ theme_active BOOLEAN NOT NULL,
1389
+ PRIMARY KEY (id)
1390
+ ) $charset_collate;";
1391
+
1392
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1393
+ dbDelta( $sql );
1394
+ }
1395
 
1396
+ if( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_themes_settings_table_name'" ) != $quiz_themes_settings_table_name ) {
1397
+ $sql = "CREATE TABLE $quiz_themes_settings_table_name (
1398
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
1399
+ theme_id mediumint(9) NOT NULL,
1400
+ quiz_id mediumint(9) NOT NULL,
1401
+ quiz_theme_settings TEXT NOT NULL,
1402
+ active_theme BOOLEAN NOT NULL,
1403
+ PRIMARY KEY (id)
1404
+ ) $charset_collate;";
1405
+
1406
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1407
+ dbDelta( $sql );
1408
+ }
1409
+
1410
  global $mlwQuizMasterNext;
1411
  $mlwQuizMasterNext->register_quiz_post_types();
1412
+ // Will be removed
1413
+ //Create a folder in upload folder
1414
+ $upload = wp_upload_dir();
1415
+ $upload_dir = $upload['basedir'];
1416
+ $upload_dir = $upload_dir . '/qsm_themes';
1417
+ if (! is_dir($upload_dir)) {
1418
+ mkdir( $upload_dir, 0700 );
1419
+ }
1420
  flush_rewrite_rules();
1421
  }
1422
 
php/classes/class-qsm-questions.php CHANGED
@@ -22,7 +22,7 @@ class QSM_Questions {
22
  public static function load_question( $question_id ) {
23
  global $wpdb;
24
  $question_id = intval( $question_id );
25
- $question = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id = %d LIMIT 1", $question_id ), 'ARRAY_A' );
26
  if ( ! is_null( $question ) ) {
27
  // Prepare answers.
28
  $answers = maybe_unserialize( $question['answer_array'] );
@@ -37,7 +37,7 @@ class QSM_Questions {
37
  }
38
  $question['settings'] = $settings;
39
 
40
- return apply_filters('qsm_load_question',$question, $question_id);
41
  }
42
  return array();
43
  }
@@ -79,7 +79,7 @@ class QSM_Questions {
79
  $question_sql = implode( ', ', $question_ids );
80
 
81
  // Get all questions.
82
- $question_array = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id IN (%1s)",$question_sql), 'ARRAY_A' );
83
 
84
  // Loop through questions and prepare serialized data.
85
  foreach ( $question_array as $question ) {
@@ -111,7 +111,7 @@ class QSM_Questions {
111
  $questions[ $key ]['page'] = isset( $question['page'] ) ? $question['page'] : 0;
112
  }
113
  }
114
- return apply_filters('qsm_load_questions_by_pages',$questions,$quiz_id);
115
  }
116
 
117
  /**
@@ -128,7 +128,7 @@ class QSM_Questions {
128
 
129
  // Get all questions.
130
  if ( 0 !== $quiz_id ) {
131
- $quiz_id = intval( $quiz_id );
132
  $questions = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE quiz_id=%d AND deleted='0' ORDER BY question_order ASC", $quiz_id ), 'ARRAY_A' );
133
  } else {
134
  $questions = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted='0' ORDER BY question_order ASC", 'ARRAY_A' );
@@ -152,7 +152,7 @@ class QSM_Questions {
152
 
153
  $question_array[ $question['question_id'] ] = $question;
154
  }
155
- return apply_filters('qsm_load_questions',$question_array,$quiz_id);
156
  }
157
 
158
  /**
@@ -195,7 +195,7 @@ class QSM_Questions {
195
  */
196
  public static function delete_question( $question_id ) {
197
  global $wpdb;
198
-
199
  $results = $wpdb->update(
200
  $wpdb->prefix . 'mlw_questions',
201
  array(
@@ -244,7 +244,7 @@ class QSM_Questions {
244
  'order' => 1,
245
  'category' => '',
246
  );
247
- $data = wp_parse_args( $data, $defaults );
248
 
249
  $defaults = array(
250
  'required' => 1,
@@ -252,11 +252,15 @@ class QSM_Questions {
252
  $settings = wp_parse_args( $settings, $defaults );
253
 
254
  foreach ( $answers as $key => $answer ) {
255
- $answers[ $key ] = array(
256
  htmlspecialchars( $answer[0], ENT_QUOTES ),
257
  floatval( $answer[1] ),
258
  intval( $answer[2] ),
259
  );
 
 
 
 
260
  }
261
 
262
  $values = array(
@@ -315,4 +319,4 @@ class QSM_Questions {
315
  return $data['ID'];
316
  }
317
  }
318
- }
22
  public static function load_question( $question_id ) {
23
  global $wpdb;
24
  $question_id = intval( $question_id );
25
+ $question = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id = %d LIMIT 1", $question_id ), 'ARRAY_A' );
26
  if ( ! is_null( $question ) ) {
27
  // Prepare answers.
28
  $answers = maybe_unserialize( $question['answer_array'] );
37
  }
38
  $question['settings'] = $settings;
39
 
40
+ return apply_filters( 'qsm_load_question', $question, $question_id );
41
  }
42
  return array();
43
  }
79
  $question_sql = implode( ', ', $question_ids );
80
 
81
  // Get all questions.
82
+ $question_array = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id IN (%1s)", $question_sql ), 'ARRAY_A' );
83
 
84
  // Loop through questions and prepare serialized data.
85
  foreach ( $question_array as $question ) {
111
  $questions[ $key ]['page'] = isset( $question['page'] ) ? $question['page'] : 0;
112
  }
113
  }
114
+ return apply_filters( 'qsm_load_questions_by_pages', $questions, $quiz_id );
115
  }
116
 
117
  /**
128
 
129
  // Get all questions.
130
  if ( 0 !== $quiz_id ) {
131
+ $quiz_id = intval( $quiz_id );
132
  $questions = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE quiz_id=%d AND deleted='0' ORDER BY question_order ASC", $quiz_id ), 'ARRAY_A' );
133
  } else {
134
  $questions = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted='0' ORDER BY question_order ASC", 'ARRAY_A' );
152
 
153
  $question_array[ $question['question_id'] ] = $question;
154
  }
155
+ return apply_filters( 'qsm_load_questions', $question_array, $quiz_id );
156
  }
157
 
158
  /**
195
  */
196
  public static function delete_question( $question_id ) {
197
  global $wpdb;
198
+
199
  $results = $wpdb->update(
200
  $wpdb->prefix . 'mlw_questions',
201
  array(
244
  'order' => 1,
245
  'category' => '',
246
  );
247
+ $data = wp_parse_args( $data, $defaults );
248
 
249
  $defaults = array(
250
  'required' => 1,
252
  $settings = wp_parse_args( $settings, $defaults );
253
 
254
  foreach ( $answers as $key => $answer ) {
255
+ $answers_array = array(
256
  htmlspecialchars( $answer[0], ENT_QUOTES ),
257
  floatval( $answer[1] ),
258
  intval( $answer[2] ),
259
  );
260
+ if ( isset( $answer[3] ) ) {
261
+ array_push( $answers_array, htmlspecialchars( $answer[3], ENT_QUOTES ) );
262
+ }
263
+ $answers[ $key ] = $answers_array;
264
  }
265
 
266
  $values = array(
319
  return $data['ID'];
320
  }
321
  }
322
+ }
php/classes/class-qsm-theme-settings.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ /**
8
+ * This class will manage all data related to QSM Themes
9
+ *
10
+ * @since 7.2.0
11
+ */
12
+ class QSM_Theme_Settings {
13
+
14
+ /**
15
+ * ID of the quiz
16
+ */
17
+ private $quiz_id;
18
+
19
+ /**
20
+ * themes_table name
21
+ */
22
+ private $themes_table;
23
+
24
+ /**
25
+ * quiz_themes_settings_table name
26
+ */
27
+ private $settings_table;
28
+
29
+ public function __construct() {
30
+ $this->themes_table = 'mlw_themes';
31
+ $this->settings_table = 'mlw_quiz_theme_settings';
32
+ }
33
+
34
+ /**
35
+ * updates theme status active/inactive when theme plugin is activated/deactivated
36
+ *
37
+ * @param bool true for activate/ false for deactivate
38
+ * @param string theme folder name
39
+ * @param string theme name
40
+ * @param string serialized data quiz settings.
41
+ *
42
+ * @return bool true for successful update, false in failure
43
+ */
44
+ public function update_theme_status( $status = true, $path, $name = '', $default_settings = '' ) {
45
+ global $wpdb;
46
+ $theme_path = isset( $path ) ? $path : '';
47
+ $theme_name = isset( $name ) ? $name : '';
48
+ $theme_default_settings = $default_settings;
49
+
50
+ if ( $theme_path ) {
51
+ $theme_id = $this->get_theme_id( $theme_path );
52
+ if ( $theme_id ) {
53
+ if ( $status ) {
54
+ return $result = $this->update_theme( $theme_id, $status, $theme_name, $theme_default_settings );
55
+ } else {
56
+ return $reuslt = $this->update_theme( $theme_id, $status );
57
+ }
58
+ } else {
59
+ if ( $status ) {
60
+ return $result = $this->add_theme_active( $theme_path, $theme_name, $theme_default_settings );
61
+ }
62
+ }
63
+ }
64
+
65
+ }
66
+
67
+ /**
68
+ *
69
+ * Get theme id from theme_dir_basename
70
+ *
71
+ * @param string theme_dir_path
72
+ * @return int/null
73
+ */
74
+ private function get_theme_id( $theme_dir ) {
75
+ global $wpdb;
76
+ $theme_dir = isset( $theme_dir ) ? esc_attr( $theme_dir ) : '';
77
+ $theme_id = $wpdb->get_var(
78
+ $wpdb->prepare(
79
+ "SELECT id FROM {$wpdb->prefix}$this->themes_table WHERE theme = %s",
80
+ $theme_dir
81
+ )
82
+ );
83
+ return $theme_id;
84
+ }
85
+
86
+ /**
87
+ * updates and activate existing theme
88
+ */
89
+ public function update_theme( $theme_id, $status, $theme_name = '', $default_settings = '' ) {
90
+ global $wpdb;
91
+ $theme_id = (int) $theme_id;
92
+
93
+ $data = array(
94
+ 'theme_active' => $status,
95
+ );
96
+ $identifier = array( '%d' );
97
+ if ( $theme_name ) {
98
+ $data['theme_name'] = $theme_name;
99
+ $identifier[] = '%s';
100
+ }
101
+ if ( $default_settings ) {
102
+ $data['default_settings'] = $default_settings;
103
+ $identifier[] = '%s';
104
+ }
105
+ return $result = $wpdb->update(
106
+ $wpdb->prefix . $this->themes_table,
107
+ $data,
108
+ array( 'id' => $theme_id ),
109
+ $identifier,
110
+ array( '%d' )
111
+ );
112
+ }
113
+
114
+ /**
115
+ *
116
+ * Adds Record of new QSM themes
117
+ */
118
+ public function add_theme_active( $theme_path, $theme_name, $theme_default_settings ) {
119
+ global $wpdb;
120
+
121
+ $data = array(
122
+ 'theme_active' => true,
123
+ 'theme' => $theme_path,
124
+ 'theme_name' => $theme_name,
125
+ 'default_settings' => $theme_default_settings,
126
+ );
127
+
128
+ return $wpdb->insert(
129
+ $wpdb->prefix . $this->themes_table,
130
+ $data,
131
+ array( '%d', '%s', '%s', '%s' )
132
+ );
133
+
134
+ }
135
+
136
+ /**
137
+ * Get active themes from database
138
+ *
139
+ * @return array of active themes
140
+ */
141
+ public function get_active_themes() {
142
+ global $wpdb;
143
+ $query = "SELECT id, theme, theme_name FROM {$wpdb->prefix}$this->themes_table WHERE theme_active = 1";
144
+ return $results = $wpdb->get_results( $query, ARRAY_A );
145
+
146
+ }
147
+
148
+ /**
149
+ * Get all installed QSM themes from database
150
+ *
151
+ * @return array
152
+ */
153
+ public function get_installed_themes() {
154
+ global $wpdb;
155
+ $query = "SELECT theme, theme_name FROM {$wpdb->prefix}$this->themes_table";
156
+ return $results = $wpdb->get_results( $query, ARRAY_A );
157
+ }
158
+
159
+ /**
160
+ * Activates selected theme for a particular quiz
161
+ */
162
+ public function activate_selected_theme( $post_id, $theme_id ) {
163
+ global $wpdb;
164
+ $quiz_id = (int) $post_id;
165
+ $theme_id = (int) $theme_id;
166
+
167
+ $deactivated = $wpdb->update(
168
+ $wpdb->prefix . $this->settings_table,
169
+ array( 'active_theme' => false ),
170
+ array( 'quiz_id' => $quiz_id ),
171
+ '%d',
172
+ '%d'
173
+ );
174
+
175
+ if ( $theme_id === 0 ) {
176
+ return;
177
+ }
178
+
179
+ $id = $wpdb->get_var( $wpdb->prepare( "SELECT id from {$wpdb->prefix}$this->settings_table WHERE quiz_id = %d AND theme_id = %d", $quiz_id, $theme_id ) );
180
+
181
+ if ( $id ) {
182
+ $wpdb->update(
183
+ $wpdb->prefix . $this->settings_table,
184
+ array( 'active_theme' => true ),
185
+ array( 'id' => $id ),
186
+ '%d',
187
+ '%d'
188
+ );
189
+ } else {
190
+ $settings = $wpdb->get_var( $wpdb->prepare( "SELECT default_settings from {$wpdb->prefix}$this->themes_table WHERE id = %d", $theme_id ) );
191
+ $settings = $settings ? $settings : '';
192
+ $data = array(
193
+ 'active_theme' => true,
194
+ 'theme_id' => $theme_id,
195
+ 'quiz_id' => $quiz_id,
196
+ 'quiz_theme_settings' => $settings,
197
+ );
198
+ $wpdb->insert(
199
+ $wpdb->prefix . $this->settings_table,
200
+ $data,
201
+ array( '%d', '%d', '%d', '%s' )
202
+ );
203
+ $wpdb->insert_id;
204
+ }
205
+ }
206
+
207
+
208
+
209
+ /**
210
+ * This function return Active Quiz Theme id
211
+ */
212
+ public function get_active_quiz_theme( $quiz_id ) {
213
+ global $wpdb;
214
+ $query = $wpdb->prepare( "SELECT theme_id FROM {$wpdb->prefix}$this->settings_table WHERE quiz_id = %d AND active_theme = 1", $quiz_id );
215
+ $result = $wpdb->get_var( $query );
216
+ return $result ? $result : 0;
217
+ }
218
+
219
+ /**
220
+ * This function return Active Quiz Theme path
221
+ */
222
+ public function get_active_quiz_theme_path( $quiz_id ) {
223
+ global $wpdb;
224
+ $query = $wpdb->prepare( "SELECT a.theme FROM {$wpdb->prefix}$this->themes_table AS a, {$wpdb->prefix}$this->settings_table AS b WHERE b.quiz_id = %d AND b.active_theme = 1 AND b.theme_id = a.id", $quiz_id );
225
+ $result = $wpdb->get_var( $query );
226
+ return $result ? $result : 'default';
227
+ }
228
+
229
+ /**
230
+ * This function return Active Quiz Theme and Other Active Themes
231
+ */
232
+ public function get_active_theme_settings( $quiz_id, $theme_id ) {
233
+ global $wpdb;
234
+ $query = $wpdb->prepare( "SELECT quiz_theme_settings FROM {$wpdb->prefix}$this->settings_table WHERE quiz_id = %d AND theme_id = %d", $quiz_id, $theme_id );
235
+ $result = $wpdb->get_var( $query );
236
+ return unserialize( $result );
237
+ }
238
+
239
+ /**
240
+ * Updates personalizes setting for a particular quiz theme
241
+ */
242
+ public function update_quiz_theme_settings( $quiz_id, $theme_id, $settings ) {
243
+ global $wpdb;
244
+ return $wpdb->update(
245
+ $wpdb->prefix . $this->settings_table,
246
+ array( 'quiz_theme_settings' => $settings ),
247
+ array(
248
+ 'quiz_id' => $quiz_id,
249
+ 'theme_id' => $theme_id,
250
+ ),
251
+ '%s',
252
+ array( '%d', '%d' )
253
+ );
254
+ }
255
+
256
+
257
+
258
+ }
php/question-types.php CHANGED
@@ -46,7 +46,7 @@ function qmn_file_upload_display( $id, $question, $answers ) {
46
  $mlw_requireClass = '';}
47
  // $question_title = apply_filters('the_content', $question);
48
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
49
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
50
  $question_display .= "<div style=''></div><input type='file' class='mlw_answer_file_upload $mlw_requireClass'/>";
51
  $question_display .= "<div style='display: none;' class='loading-uploaded-file'><img src='" . get_site_url() . "/wp-includes/images/spinner-2x.gif'></div>";
52
  $question_display .= "<div style='display: none;' class='remove-uploaded-file'><span class='dashicons dashicons-trash'></span></div>";
@@ -66,33 +66,33 @@ function qmn_file_upload_display( $id, $question, $answers ) {
66
  * @since 5.3.7
67
  */
68
  function qmn_file_upload_review( $id, $question, $answers ) {
69
- $return_array = array(
70
- 'points' => 0,
71
- 'correct' => 'incorrect',
72
- 'user_text' => '',
73
- 'correct_text' => '',
74
- 'question_type' => 'file_upload',
75
- );
76
- if ( isset( $_POST[ 'question' . $id ] ) ) {
77
- $decode_user_answer = sanitize_text_field( $_POST[ 'question' . $id ] );
78
- $mlw_user_answer = trim( $decode_user_answer );
79
- } else {
80
- $mlw_user_answer = ' ';
81
- }
82
- $return_array['user_text'] = $mlw_user_answer;
83
- foreach ( $answers as $answer ) {
84
- $decode_correct_text = strval( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
85
- $return_array['correct_text'] = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", ' ', $decode_correct_text ) ) );
86
- if ( mb_strtoupper( $return_array['user_text'] ) == mb_strtoupper( $return_array['correct_text'] ) ) {
87
- $return_array['correct'] = 'correct';
88
- $return_array['points'] = $answer[1];
89
- break;
90
- }
91
  }
92
- /**
 
93
  * Hook to filter answers array
94
  */
95
- return apply_filters( 'qmn_file_upload_review', $return_array , $answers );
96
  }
97
 
98
  /**
@@ -115,7 +115,7 @@ function qmn_multiple_choice_display( $id, $question, $answers ) {
115
  } else {
116
  $mlw_requireClass = '';}
117
  // $question_title = apply_filters('the_content', $question);
118
- $question_display .= qsm_question_title_func( $question, 'multiple_choice', $new_question_title );
119
  $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
120
  if ( is_array( $answers ) ) {
121
  $mlw_answer_total = 0;
@@ -124,11 +124,21 @@ function qmn_multiple_choice_display( $id, $question, $answers ) {
124
  if ( $answer[0] != '' ) {
125
  if ( $answerEditor === 'rich' ) {
126
  $question_display .= "<div class='qmn_mc_answer_wrap' id='question$id-$mlw_answer_total'>";
 
 
127
  } else {
128
  $question_display .= "<div class='qmn_mc_answer_wrap' id='question" . $id . '-' . str_replace( ' ', '-', esc_attr( $answer[0] ) ) . "'>";
129
  }
130
  $question_display .= "<input type='radio' class='qmn_quiz_radio' name='question" . $id . "' id='question" . $id . '_' . $mlw_answer_total . "' value='" . $answer[0] . "' />";
131
- $question_display .= "<label for='question" . $id . '_' . $mlw_answer_total . "'>" . trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) ) . '</label>';
 
 
 
 
 
 
 
 
132
  $question_display .= '</div>';
133
  }
134
  }
@@ -204,7 +214,7 @@ function qmn_multiple_choice_review( $id, $question, $answers ) {
204
  /**
205
  * Hook to filter answers array
206
  */
207
- return apply_filters( 'qmn_multiple_choice_review', $return_array , $answers );
208
  }
209
 
210
  add_action( 'plugins_loaded', 'qmn_question_type_date' );
@@ -215,7 +225,7 @@ add_action( 'plugins_loaded', 'qmn_question_type_date' );
215
  * @since 6.3.7
216
  */
217
  function qmn_question_type_date() {
218
- global $mlwQuizMasterNext;
219
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Date', 'quiz-master-next' ), 'qmn_date_display', true, 'qmn_date_review', null, null, 12 );
220
  }
221
 
@@ -229,7 +239,7 @@ function qmn_question_type_date() {
229
  * @since 6.3.7
230
  */
231
  function qmn_date_display( $id, $question, $answers ) {
232
- $question_display = '';
233
  global $mlwQuizMasterNext;
234
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
235
  if ( $required == 0 ) {
@@ -238,7 +248,7 @@ function qmn_date_display( $id, $question, $answers ) {
238
  $mlw_requireClass = '';}
239
  // $question_title = apply_filters('the_content', $question);
240
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
241
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
242
  $question_display .= "<input type='date' class='mlw_answer_date $mlw_requireClass' name='question" . $id . "' id='question" . $id . "' value=''/>";
243
  // $question_display .= "<script>jQuery(document).ready(function () { jQuery('#question".$id."').datepicker(); });</script>";
244
  return apply_filters( 'qmn_date_display_front', $question_display, $id, $question, $answers );
@@ -279,7 +289,7 @@ function qmn_date_review( $id, $question, $answers ) {
279
  /**
280
  * Hook to filter answers array
281
  */
282
- return apply_filters( 'qmn_date_review', $return_array , $answers );
283
  }
284
 
285
  add_action( 'plugins_loaded', 'qmn_question_type_horizontal_multiple_choice' );
@@ -311,17 +321,27 @@ function qmn_horizontal_multiple_choice_display( $id, $question, $answers ) {
311
  if ( $required == 0 ) {
312
  $mlw_requireClass = 'mlwRequiredRadio';
313
  } else {
314
- $mlw_requireClass = '';}
 
 
315
  // $question_title = apply_filters('the_content', $question);
316
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
317
- $question_display .= qsm_question_title_func( $question, 'horizontal_multiple_choice', $new_question_title );
318
- $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
319
  if ( is_array( $answers ) ) {
320
  $mlw_answer_total = 0;
321
  foreach ( $answers as $answer ) {
322
  $mlw_answer_total++;
323
  if ( $answer[0] != '' ) {
324
- $question_display .= "<span class='mlw_horizontal_choice'><input type='radio' class='qmn_quiz_radio' name='question" . $id . "' id='question" . $id . '_' . $mlw_answer_total . "' value='" . $answer[0] . "' /><label for='question" . $id . '_' . $mlw_answer_total . "'>" . trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) ) . '</label></span>';
 
 
 
 
 
 
 
 
325
  }
326
  }
327
  $question_display .= "<input type='radio' style='display: none;' name='question" . $id . "' id='question" . $id . "_none' checked='checked' value='' />";
@@ -396,7 +416,7 @@ function qmn_horizontal_multiple_choice_review( $id, $question, $answers ) {
396
  /**
397
  * Hook to filter answers array
398
  */
399
- return apply_filters( 'qmn_horizontal_multiple_choice_review', $return_array , $answers );
400
  }
401
 
402
  add_action( 'plugins_loaded', 'qmn_question_type_drop_down' );
@@ -426,13 +446,13 @@ function qmn_drop_down_display( $id, $question, $answers ) {
426
  global $mlwQuizMasterNext;
427
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
428
  if ( 0 == $required ) {
429
- $require_class = 'qsmRequiredSelect';
430
  } else {
431
- $require_class = '';
432
  }
433
  // $question_title = apply_filters('the_content', $question);
434
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
435
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
436
  $question_display .= "<select class='qsm_select $require_class' name='question" . $id . "'>";
437
  $question_display .= "<option value=''>" . __( 'Please select your answer', 'quiz-master-next' ) . '</option>';
438
  if ( is_array( $answers ) ) {
@@ -458,7 +478,7 @@ function qmn_drop_down_display( $id, $question, $answers ) {
458
  * @since 4.4.0
459
  */
460
  function qmn_drop_down_review( $id, $question, $answers ) {
461
- global $mlwQuizMasterNext;
462
  $answerEditor = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'answerEditor' );
463
  $return_array = array(
464
  'points' => 0,
@@ -488,7 +508,7 @@ function qmn_drop_down_review( $id, $question, $answers ) {
488
  /**
489
  * Hook to filter answers array
490
  */
491
- return apply_filters( 'qmn_drop_down_review', $return_array , $answers );
492
  }
493
 
494
  add_action( 'plugins_loaded', 'qmn_question_type_small_open' );
@@ -527,7 +547,7 @@ function qmn_small_open_display( $id, $question, $answers ) {
527
  $mlw_requireClass = '';}
528
  // $question_title = apply_filters('the_content', $question);
529
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
530
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
531
  $question_display .= '<input ' . $autofill_att . $limit_text_att . " type='text' class='mlw_answer_open_text $mlw_requireClass' name='question" . $id . "' />";
532
  return apply_filters( 'qmn_small_open_display_front', $question_display, $id, $question, $answers );
533
  }
@@ -567,7 +587,7 @@ function qmn_small_open_review( $id, $question, $answers ) {
567
  /**
568
  * Hook to filter answers array
569
  */
570
- return apply_filters( 'qmn_small_open_review', $return_array ,$answers);
571
  }
572
 
573
  add_action( 'plugins_loaded', 'qmn_question_type_multiple_response' );
@@ -606,7 +626,8 @@ function qmn_multiple_response_display( $id, $question, $answers ) {
606
  $mlw_requireClass = '';}
607
  // $question_title = apply_filters('the_content', $question);
608
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
609
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
 
610
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
611
  if ( is_array( $answers ) ) {
612
  $mlw_answer_total = 0;
@@ -615,7 +636,13 @@ function qmn_multiple_response_display( $id, $question, $answers ) {
615
  if ( $answer[0] != '' ) {
616
  $question_display .= '<div class="qsm_check_answer">';
617
  $question_display .= "<input type='hidden' name='question" . $id . "' value='This value does not matter' />";
618
- $question_display .= "<input type='checkbox' " . $limit_mr_text . " name='question" . $id . '_' . $mlw_answer_total . "' id='question" . $id . '_' . $mlw_answer_total . "' value='" . esc_attr( $answer[0] ) . "' /> <label for='question" . $id . '_' . $mlw_answer_total . "'>" . trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) ) . '</label>';
 
 
 
 
 
 
619
  $question_display .= '</div>';
620
  }
621
  }
@@ -670,7 +697,7 @@ function qmn_multiple_response_review( $id, $question, $answers ) {
670
  /**
671
  * Hook to filter answers array
672
  */
673
- return apply_filters( 'qmn_multiple_response_review', $return_array , $answers );
674
  }
675
 
676
  add_action( 'plugins_loaded', 'qmn_question_type_large_open' );
@@ -706,7 +733,7 @@ function qmn_large_open_display( $id, $question, $answers ) {
706
  $limit_text_att = $limit_text ? "maxlength='" . $limit_text . "' " : '';
707
  // $question_title = apply_filters('the_content', $question);
708
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
709
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
710
  $question_display .= "<textarea class='mlw_answer_open_text {$mlw_requireClass}' {$limit_text_att} cols='70' rows='5' name='question{$id}' /></textarea>";
711
  return apply_filters( 'qmn_large_open_display_front', $question_display, $id, $question, $answers );
712
  }
@@ -729,14 +756,14 @@ function qmn_large_open_review( $id, $question, $answers ) {
729
  );
730
  if ( isset( $_POST[ 'question' . $id ] ) ) {
731
  $decode_user_answer = sanitize_textarea_field( strval( stripslashes( htmlspecialchars_decode( $_POST[ 'question' . $id ], ENT_QUOTES ) ) ) );
732
- $mlw_user_answer = trim(str_replace(' ','',preg_replace('/\s\s+/', '', $decode_user_answer )));
733
  } else {
734
  $mlw_user_answer = ' ';
735
  }
736
  $return_array['user_text'] = $decode_user_answer;
737
  foreach ( $answers as $answer ) {
738
  $return_array['correct_text'] = $decode_correct_text = strval( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
739
- $decode_correct_text = trim(str_replace(' ','', preg_replace('/\s\s+/', '', $decode_correct_text )));
740
  if ( mb_strtoupper( $mlw_user_answer ) == mb_strtoupper( $decode_correct_text ) ) {
741
  $return_array['correct'] = 'correct';
742
  $return_array['points'] = $answer[1];
@@ -746,7 +773,7 @@ function qmn_large_open_review( $id, $question, $answers ) {
746
  /**
747
  * Hook to filter answers array
748
  */
749
- return apply_filters( 'qmn_large_open_review', $return_array , $answers );
750
  }
751
 
752
  add_action( 'plugins_loaded', 'qmn_question_type_text_block' );
@@ -770,7 +797,6 @@ function qmn_question_type_text_block() {
770
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Text/HTML Section', 'quiz-master-next' ), 'qmn_text_block_display', false, null, $edit_args, null, 6 );
771
  }
772
 
773
-
774
  /**
775
  * This function displays the contents of the text block question type.
776
  *
@@ -802,7 +828,6 @@ function qmn_question_type_number() {
802
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Number', 'quiz-master-next' ), 'qmn_number_display', true, 'qmn_number_review', null, null, 7 );
803
  }
804
 
805
-
806
  /**
807
  * This function shows the content of the multiple choice question.
808
  *
@@ -824,12 +849,11 @@ function qmn_number_display( $id, $question, $answers ) {
824
  $mlw_requireClass = '';}
825
  // $question_title = apply_filters('the_content', $question);
826
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
827
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
828
  $question_display .= "<input type='number' $limit_text_att class='mlw_answer_number $mlw_requireClass' name='question" . $id . "' />";
829
  return apply_filters( 'qmn_number_display_front', $question_display, $id, $question, $answers );
830
  }
831
 
832
-
833
  /**
834
  * This function determines how the number question type is graded.
835
  *
@@ -863,7 +887,7 @@ function qmn_number_review( $id, $question, $answers ) {
863
  /**
864
  * Hook to filter answers array
865
  */
866
- return apply_filters( 'qmn_number_review', $return_array , $answers );
867
  }
868
 
869
  add_action( 'plugins_loaded', 'qmn_question_type_accept' );
@@ -933,7 +957,6 @@ function qmn_question_type_captcha() {
933
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Captcha', 'quiz-master-next' ), 'qmn_captcha_display', false, null, $edit_args, null, 9 );
934
  }
935
 
936
-
937
  /**
938
  * This function displays the captcha question
939
  *
@@ -956,7 +979,7 @@ function qmn_captcha_display( $id, $question, $answers ) {
956
  $question_display .= '</div>';
957
  $question_display .= "<span class='mlw_qmn_question'>";
958
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
959
- $question_title = qsm_question_title_func( $question, '', $new_question_title );
960
  $question_display .= $question_title . '</span>';
961
  $question_display .= "<input type='text' class='mlw_answer_open_text $mlw_requireClass' id='mlw_captcha_text' name='mlw_user_captcha'/>";
962
  $question_display .= "<input type='hidden' name='mlw_code_captcha' id='mlw_code_captcha' value='none' />";
@@ -993,7 +1016,6 @@ function qmn_question_type_horizontal_multiple_response() {
993
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Horizontal Multiple Response', 'quiz-master-next' ), 'qmn_horizontal_multiple_response_display', true, 'qmn_horizontal_multiple_response_review', null, null, 10 );
994
  }
995
 
996
-
997
  /**
998
  * This function displays the content of the multiple response question type
999
  *
@@ -1004,7 +1026,7 @@ function qmn_question_type_horizontal_multiple_response() {
1004
  * @since 4.4.0
1005
  */
1006
  function qmn_horizontal_multiple_response_display( $id, $question, $answers ) {
1007
- $question_display = '';
1008
  global $mlwQuizMasterNext;
1009
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
1010
  if ( $required == 0 ) {
@@ -1018,15 +1040,22 @@ function qmn_horizontal_multiple_response_display( $id, $question, $answers ) {
1018
  $limit_mr_text = 'onchange="qsmCheckMR(this,' . $limit_multiple_response . ')"';
1019
  }
1020
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
1021
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
1022
- $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
 
1023
  if ( is_array( $answers ) ) {
1024
  $mlw_answer_total = 0;
1025
  foreach ( $answers as $answer ) {
1026
  $mlw_answer_total++;
1027
  if ( $answer[0] != '' ) {
1028
  $question_display .= "<input type='hidden' name='question" . $id . "' value='This value does not matter' />";
1029
- $question_display .= "<span class='mlw_horizontal_multiple'><input type='checkbox' " . $limit_mr_text . " name='question" . $id . '_' . $mlw_answer_total . "' id='question" . $id . '_' . $mlw_answer_total . "' value='" . esc_attr( $answer[0] ) . "' /> <label for='question" . $id . '_' . $mlw_answer_total . "'>" . trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) ) . '&nbsp;</label></span>';
 
 
 
 
 
 
1030
  }
1031
  }
1032
  }
@@ -1034,7 +1063,6 @@ function qmn_horizontal_multiple_response_display( $id, $question, $answers ) {
1034
  return apply_filters( 'qmn_horizontal_multiple_response_display_front', $question_display, $id, $question, $answers );
1035
  }
1036
 
1037
-
1038
  /**
1039
  * This function determines how the multiple response is graded.
1040
  *
@@ -1081,7 +1109,7 @@ function qmn_horizontal_multiple_response_review( $id, $question, $answers ) {
1081
  /**
1082
  * Hook to filter answers array
1083
  */
1084
- return apply_filters( 'qmn_horizontal_multiple_response_review', $return_array , $answers );
1085
  }
1086
 
1087
  add_action( 'plugins_loaded', 'qmn_question_type_fill_blank' );
@@ -1113,7 +1141,6 @@ function qmn_question_type_fill_blank() {
1113
 
1114
  }
1115
 
1116
-
1117
  /**
1118
  * This function displays the fill in the blank question
1119
  *
@@ -1139,13 +1166,12 @@ function qmn_fill_blank_display( $id, $question, $answers ) {
1139
  if ( strpos( $question, '%BLANK%' ) !== false ) {
1140
  $question = str_replace( '%BLANK%', $input_text, do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) );
1141
  }
1142
- // $question_title = apply_filters('the_content', $question);
1143
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
1144
- $question_display .= qsm_question_title_func( $question, '', $new_question_title );
1145
  return apply_filters( 'qmn_fill_blank_display_front', $question_display, $id, $question, $answers );
1146
  }
1147
 
1148
-
1149
  /**
1150
  * This function determines how the fill in the blank question is graded.
1151
  *
@@ -1184,10 +1210,9 @@ function qmn_fill_blank_review( $id, $question, $answers ) {
1184
  /**
1185
  * Hook to filter answers array
1186
  */
1187
- return apply_filters( 'qmn_fill_blank_review', $return_array , $answers );
1188
  }
1189
 
1190
-
1191
  // Start polar question
1192
  add_action( 'plugins_loaded', 'qmn_question_type_polar' );
1193
 
@@ -1234,60 +1259,75 @@ function qmn_polar_display( $id, $question, $answers ) {
1234
  }
1235
  $total_answer = count( $answers );
1236
  ?>
1237
- <script type="text/javascript">
1238
- (function($) {
1239
- $(document).ready(function() {
1240
- $('#slider-' + '<?php echo $id; ?>').slider({
1241
- <?php if ( $total_answer == 2 && $is_reverse ) { ?>
1242
- max: <?php echo $answers[0][1]; ?>,
1243
- min: <?php echo $answers[1][1]; ?>,
1244
- isRTL: true,
1245
- <?php } else { ?>
1246
- min: <?php echo $answers[0][1]; ?>,
1247
- max: <?php echo $answers[1][1]; ?>,
1248
- <?php } ?>
1249
- step: 1,
1250
- value: <?php echo $check_point / 2; ?>,
1251
- change: function( event, ui ) {
1252
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.qmn_polar').val(ui.value);
1253
- if(ui.value == <?php echo $answers[0][1]; ?>){
1254
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.left-polar-title').css('font-weight','900');
1255
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.right-polar-title').css('font-weight','100');
1256
- } else if(ui.value == <?php echo $answers[1][1]; ?>){
1257
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.left-polar-title').css('font-weight','100');
1258
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.right-polar-title').css('font-weight','900');
1259
- } else if(ui.value == <?php echo $check_point / 2; ?>){
1260
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.left-polar-title').css('font-weight','400');
1261
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.right-polar-title').css('font-weight','400');
1262
- } else if(ui.value > <?php echo $check_point / 2; ?>){
1263
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.<?php echo $font_weight_rc; ?>').css('font-weight','400');
1264
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.<?php echo $font_weight_lc; ?>').css('font-weight','600');
1265
- } else if(ui.value < <?php echo $check_point / 2; ?>){
1266
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.<?php echo $font_weight_rc; ?>').css('font-weight','600');
1267
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.<?php echo $font_weight_lc; ?>').css('font-weight','400');
1268
- }
1269
- },
1270
- create: function( event, ui ) {
1271
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.left-polar-title').css('font-weight','400');
1272
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.right-polar-title').css('font-weight','400');
1273
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find('.qmn_polar').val(<?php echo $check_point / 2; ?>);
1274
- }
1275
- });
1276
- var maxHeight = Math.max.apply(null, $(".question-section-id-<?php echo $id; ?> .question-type-polar-s > div").map(function (){
1277
- return $(this).height();
1278
- }).get());
1279
- $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').height(maxHeight);
1280
- });
1281
- })(jQuery);
1282
- </script>
1283
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1284
  if ( $required == 0 ) {
1285
  $mlw_requireClass = 'mlwRequiredText';
1286
  } else {
1287
  $mlw_requireClass = '';
1288
  }
1289
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
1290
- $question_title = qsm_question_title_func( $question, '', $new_question_title );
1291
  // $question_title = "<div class='mlw_qmn_question polar-question-title'>". do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)) ."</div>";
1292
  $input_text .= "<div class='left-polar-title'>" . $answers[0][0] . '</div>';
1293
  $input_text .= "<div class='slider-main-wrapper'><input type='hidden' class='qmn_polar $mlw_requireClass' id='question" . $id . "' name='question" . $id . "' />";
@@ -1295,7 +1335,7 @@ function qmn_polar_display( $id, $question, $answers ) {
1295
  $input_text .= "<div class='right-polar-title'>" . $answers[1][0] . '</div>';
1296
  /*
1297
  if (strpos($question, '%POLAR_SLIDER%') !== false) {
1298
- $question = str_replace("%POLAR_SLIDER%", $input_text, do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
1299
  }*/
1300
  $question = $input_text;
1301
  // $question_title = apply_filters('the_content', $question);
@@ -1342,13 +1382,13 @@ function qmn_polar_review( $id, $question, $answers ) {
1342
  /**
1343
  * Hook to filter answers array
1344
  */
1345
- return apply_filters( 'qmn_polar_review', $return_array , $answers );
1346
  }
1347
 
1348
- function qsm_question_title_func( $question, $question_type = '', $new_question_title = '' ) {
1349
  // $question_title = apply_filters('the_content', $question);
1350
  $question_title = $question;
1351
- global $wp_embed,$mlwQuizMasterNext;
1352
  $question_title = $wp_embed->run_shortcode( $question_title );
1353
  $question_title = 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>', $question_title );
1354
  $polar_extra_class = '';
@@ -1362,12 +1402,18 @@ function qsm_question_title_func( $question, $question_type = '', $new_question_
1362
  $deselect_answer = '<a href="#" class="qsm-deselect-answer">Deselect Answer</a>';
1363
  }
1364
 
 
 
 
 
 
 
1365
  if ( $new_question_title != '' ) {
1366
  $question_display .= "<span class='mlw_qmn_new_question'>" . sanitize_text_field( htmlspecialchars_decode( $new_question_title, ENT_QUOTES ) ) . '</span>';
1367
  $polar_extra_class .= ' qsm_remove_bold';
1368
  }
1369
 
1370
- $question_display .= "<span class='mlw_qmn_question {$polar_extra_class}' >" . do_shortcode( htmlspecialchars_decode( $question_title, ENT_QUOTES )) . $deselect_answer . '</span>';
1371
  return $question_display;
1372
  }
1373
- ?>
46
  $mlw_requireClass = '';}
47
  // $question_title = apply_filters('the_content', $question);
48
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
49
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
50
  $question_display .= "<div style=''></div><input type='file' class='mlw_answer_file_upload $mlw_requireClass'/>";
51
  $question_display .= "<div style='display: none;' class='loading-uploaded-file'><img src='" . get_site_url() . "/wp-includes/images/spinner-2x.gif'></div>";
52
  $question_display .= "<div style='display: none;' class='remove-uploaded-file'><span class='dashicons dashicons-trash'></span></div>";
66
  * @since 5.3.7
67
  */
68
  function qmn_file_upload_review( $id, $question, $answers ) {
69
+ $return_array = array(
70
+ 'points' => 0,
71
+ 'correct' => 'incorrect',
72
+ 'user_text' => '',
73
+ 'correct_text' => '',
74
+ 'question_type' => 'file_upload',
75
+ );
76
+ if ( isset( $_POST[ 'question' . $id ] ) ) {
77
+ $decode_user_answer = sanitize_text_field( $_POST[ 'question' . $id ] );
78
+ $mlw_user_answer = trim( $decode_user_answer );
79
+ } else {
80
+ $mlw_user_answer = ' ';
81
+ }
82
+ $return_array['user_text'] = $mlw_user_answer;
83
+ foreach ( $answers as $answer ) {
84
+ $decode_correct_text = strval( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
85
+ $return_array['correct_text'] = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", ' ', $decode_correct_text ) ) );
86
+ if ( mb_strtoupper( $return_array['user_text'] ) == mb_strtoupper( $return_array['correct_text'] ) ) {
87
+ $return_array['correct'] = 'correct';
88
+ $return_array['points'] = $answer[1];
89
+ break;
 
90
  }
91
+ }
92
+ /**
93
  * Hook to filter answers array
94
  */
95
+ return apply_filters( 'qmn_file_upload_review', $return_array, $answers );
96
  }
97
 
98
  /**
115
  } else {
116
  $mlw_requireClass = '';}
117
  // $question_title = apply_filters('the_content', $question);
118
+ $question_display .= qsm_question_title_func( $question, 'multiple_choice', $new_question_title, $id );
119
  $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
120
  if ( is_array( $answers ) ) {
121
  $mlw_answer_total = 0;
124
  if ( $answer[0] != '' ) {
125
  if ( $answerEditor === 'rich' ) {
126
  $question_display .= "<div class='qmn_mc_answer_wrap' id='question$id-$mlw_answer_total'>";
127
+ } elseif ( $answerEditor === 'image' ) {
128
+ $question_display .= "<div class='qmn_mc_answer_wrap qmn_image_option' id='question$id-$mlw_answer_total'>";
129
  } else {
130
  $question_display .= "<div class='qmn_mc_answer_wrap' id='question" . $id . '-' . str_replace( ' ', '-', esc_attr( $answer[0] ) ) . "'>";
131
  }
132
  $question_display .= "<input type='radio' class='qmn_quiz_radio' name='question" . $id . "' id='question" . $id . '_' . $mlw_answer_total . "' value='" . $answer[0] . "' />";
133
+ $question_display .= "<label for='question" . $id . '_' . $mlw_answer_total . "'>";
134
+ if ( $answerEditor === 'image' ) {
135
+ $question_display .= '<img src="' . trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) . '" />';
136
+ $question_display .= '<span class="qsm_image_caption">' . trim( htmlspecialchars_decode( $answer[3], ENT_QUOTES ) ) . '</span>';
137
+ } else {
138
+ $question_display .= trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) );
139
+ }
140
+ $question_display .= '</label>';
141
+ $question_display = apply_filters( 'qsm_multiple_choice_display_loop', $question_display, $id, $question, $answers );
142
  $question_display .= '</div>';
143
  }
144
  }
214
  /**
215
  * Hook to filter answers array
216
  */
217
+ return apply_filters( 'qmn_multiple_choice_review', $return_array, $answers );
218
  }
219
 
220
  add_action( 'plugins_loaded', 'qmn_question_type_date' );
225
  * @since 6.3.7
226
  */
227
  function qmn_question_type_date() {
228
+ global $mlwQuizMasterNext;
229
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Date', 'quiz-master-next' ), 'qmn_date_display', true, 'qmn_date_review', null, null, 12 );
230
  }
231
 
239
  * @since 6.3.7
240
  */
241
  function qmn_date_display( $id, $question, $answers ) {
242
+ $question_display = '';
243
  global $mlwQuizMasterNext;
244
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
245
  if ( $required == 0 ) {
248
  $mlw_requireClass = '';}
249
  // $question_title = apply_filters('the_content', $question);
250
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
251
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
252
  $question_display .= "<input type='date' class='mlw_answer_date $mlw_requireClass' name='question" . $id . "' id='question" . $id . "' value=''/>";
253
  // $question_display .= "<script>jQuery(document).ready(function () { jQuery('#question".$id."').datepicker(); });</script>";
254
  return apply_filters( 'qmn_date_display_front', $question_display, $id, $question, $answers );
289
  /**
290
  * Hook to filter answers array
291
  */
292
+ return apply_filters( 'qmn_date_review', $return_array, $answers );
293
  }
294
 
295
  add_action( 'plugins_loaded', 'qmn_question_type_horizontal_multiple_choice' );
321
  if ( $required == 0 ) {
322
  $mlw_requireClass = 'mlwRequiredRadio';
323
  } else {
324
+ $mlw_requireClass = '';
325
+ }
326
+ $answerEditor = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'answerEditor' );
327
  // $question_title = apply_filters('the_content', $question);
328
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
329
+ $question_display .= qsm_question_title_func( $question, 'horizontal_multiple_choice', $new_question_title, $id );
330
+ $question_display .= "<div class='qmn_radio_answers qmn_radio_horizontal_answers $mlw_requireClass'>";
331
  if ( is_array( $answers ) ) {
332
  $mlw_answer_total = 0;
333
  foreach ( $answers as $answer ) {
334
  $mlw_answer_total++;
335
  if ( $answer[0] != '' ) {
336
+ $question_display .= "<span class='mlw_horizontal_choice'><input type='radio' class='qmn_quiz_radio' name='question" . $id . "' id='question" . $id . '_' . $mlw_answer_total . "' value='" . $answer[0] . "' /><label for='question" . $id . '_' . $mlw_answer_total . "'>";
337
+ if ( $answerEditor === 'image' ) {
338
+ $question_display .= '<img src="' . trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) . '" />';
339
+ } else {
340
+ $question_display .= trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) );
341
+ }
342
+ $question_display .= '</label>';
343
+ $question_display = apply_filters( 'qsm_multiple_choice_horizontal_display_loop', $question_display, $id, $question, $answers );
344
+ $question_display .= '</span>';
345
  }
346
  }
347
  $question_display .= "<input type='radio' style='display: none;' name='question" . $id . "' id='question" . $id . "_none' checked='checked' value='' />";
416
  /**
417
  * Hook to filter answers array
418
  */
419
+ return apply_filters( 'qmn_horizontal_multiple_choice_review', $return_array, $answers );
420
  }
421
 
422
  add_action( 'plugins_loaded', 'qmn_question_type_drop_down' );
446
  global $mlwQuizMasterNext;
447
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
448
  if ( 0 == $required ) {
449
+ $require_class = 'qsmRequiredSelect';
450
  } else {
451
+ $require_class = '';
452
  }
453
  // $question_title = apply_filters('the_content', $question);
454
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
455
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
456
  $question_display .= "<select class='qsm_select $require_class' name='question" . $id . "'>";
457
  $question_display .= "<option value=''>" . __( 'Please select your answer', 'quiz-master-next' ) . '</option>';
458
  if ( is_array( $answers ) ) {
478
  * @since 4.4.0
479
  */
480
  function qmn_drop_down_review( $id, $question, $answers ) {
481
+ global $mlwQuizMasterNext;
482
  $answerEditor = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'answerEditor' );
483
  $return_array = array(
484
  'points' => 0,
508
  /**
509
  * Hook to filter answers array
510
  */
511
+ return apply_filters( 'qmn_drop_down_review', $return_array, $answers );
512
  }
513
 
514
  add_action( 'plugins_loaded', 'qmn_question_type_small_open' );
547
  $mlw_requireClass = '';}
548
  // $question_title = apply_filters('the_content', $question);
549
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
550
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
551
  $question_display .= '<input ' . $autofill_att . $limit_text_att . " type='text' class='mlw_answer_open_text $mlw_requireClass' name='question" . $id . "' />";
552
  return apply_filters( 'qmn_small_open_display_front', $question_display, $id, $question, $answers );
553
  }
587
  /**
588
  * Hook to filter answers array
589
  */
590
+ return apply_filters( 'qmn_small_open_review', $return_array, $answers );
591
  }
592
 
593
  add_action( 'plugins_loaded', 'qmn_question_type_multiple_response' );
626
  $mlw_requireClass = '';}
627
  // $question_title = apply_filters('the_content', $question);
628
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
629
+ $answerEditor = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'answerEditor' );
630
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
631
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
632
  if ( is_array( $answers ) ) {
633
  $mlw_answer_total = 0;
636
  if ( $answer[0] != '' ) {
637
  $question_display .= '<div class="qsm_check_answer">';
638
  $question_display .= "<input type='hidden' name='question" . $id . "' value='This value does not matter' />";
639
+ $question_display .= "<input type='checkbox' " . $limit_mr_text . " name='question" . $id . '_' . $mlw_answer_total . "' id='question" . $id . '_' . $mlw_answer_total . "' value='" . esc_attr( $answer[0] ) . "' /> <label for='question" . $id . '_' . $mlw_answer_total . "'>";
640
+ if ( $answerEditor === 'image' ) {
641
+ $question_display .= '<img src="' . trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) . '" />';
642
+ } else {
643
+ $question_display .= trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) );
644
+ }
645
+ $question_display .= '</label>';
646
  $question_display .= '</div>';
647
  }
648
  }
697
  /**
698
  * Hook to filter answers array
699
  */
700
+ return apply_filters( 'qmn_multiple_response_review', $return_array, $answers );
701
  }
702
 
703
  add_action( 'plugins_loaded', 'qmn_question_type_large_open' );
733
  $limit_text_att = $limit_text ? "maxlength='" . $limit_text . "' " : '';
734
  // $question_title = apply_filters('the_content', $question);
735
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
736
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
737
  $question_display .= "<textarea class='mlw_answer_open_text {$mlw_requireClass}' {$limit_text_att} cols='70' rows='5' name='question{$id}' /></textarea>";
738
  return apply_filters( 'qmn_large_open_display_front', $question_display, $id, $question, $answers );
739
  }
756
  );
757
  if ( isset( $_POST[ 'question' . $id ] ) ) {
758
  $decode_user_answer = sanitize_textarea_field( strval( stripslashes( htmlspecialchars_decode( $_POST[ 'question' . $id ], ENT_QUOTES ) ) ) );
759
+ $mlw_user_answer = trim( str_replace( ' ', '', preg_replace( '/\s\s+/', '', $decode_user_answer ) ) );
760
  } else {
761
  $mlw_user_answer = ' ';
762
  }
763
  $return_array['user_text'] = $decode_user_answer;
764
  foreach ( $answers as $answer ) {
765
  $return_array['correct_text'] = $decode_correct_text = strval( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
766
+ $decode_correct_text = trim( str_replace( ' ', '', preg_replace( '/\s\s+/', '', $decode_correct_text ) ) );
767
  if ( mb_strtoupper( $mlw_user_answer ) == mb_strtoupper( $decode_correct_text ) ) {
768
  $return_array['correct'] = 'correct';
769
  $return_array['points'] = $answer[1];
773
  /**
774
  * Hook to filter answers array
775
  */
776
+ return apply_filters( 'qmn_large_open_review', $return_array, $answers );
777
  }
778
 
779
  add_action( 'plugins_loaded', 'qmn_question_type_text_block' );
797
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Text/HTML Section', 'quiz-master-next' ), 'qmn_text_block_display', false, null, $edit_args, null, 6 );
798
  }
799
 
 
800
  /**
801
  * This function displays the contents of the text block question type.
802
  *
828
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Number', 'quiz-master-next' ), 'qmn_number_display', true, 'qmn_number_review', null, null, 7 );
829
  }
830
 
 
831
  /**
832
  * This function shows the content of the multiple choice question.
833
  *
849
  $mlw_requireClass = '';}
850
  // $question_title = apply_filters('the_content', $question);
851
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
852
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
853
  $question_display .= "<input type='number' $limit_text_att class='mlw_answer_number $mlw_requireClass' name='question" . $id . "' />";
854
  return apply_filters( 'qmn_number_display_front', $question_display, $id, $question, $answers );
855
  }
856
 
 
857
  /**
858
  * This function determines how the number question type is graded.
859
  *
887
  /**
888
  * Hook to filter answers array
889
  */
890
+ return apply_filters( 'qmn_number_review', $return_array, $answers );
891
  }
892
 
893
  add_action( 'plugins_loaded', 'qmn_question_type_accept' );
957
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Captcha', 'quiz-master-next' ), 'qmn_captcha_display', false, null, $edit_args, null, 9 );
958
  }
959
 
 
960
  /**
961
  * This function displays the captcha question
962
  *
979
  $question_display .= '</div>';
980
  $question_display .= "<span class='mlw_qmn_question'>";
981
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
982
+ $question_title = qsm_question_title_func( $question, '', $new_question_title, $id );
983
  $question_display .= $question_title . '</span>';
984
  $question_display .= "<input type='text' class='mlw_answer_open_text $mlw_requireClass' id='mlw_captcha_text' name='mlw_user_captcha'/>";
985
  $question_display .= "<input type='hidden' name='mlw_code_captcha' id='mlw_code_captcha' value='none' />";
1016
  $mlwQuizMasterNext->pluginHelper->register_question_type( __( 'Horizontal Multiple Response', 'quiz-master-next' ), 'qmn_horizontal_multiple_response_display', true, 'qmn_horizontal_multiple_response_review', null, null, 10 );
1017
  }
1018
 
 
1019
  /**
1020
  * This function displays the content of the multiple response question type
1021
  *
1026
  * @since 4.4.0
1027
  */
1028
  function qmn_horizontal_multiple_response_display( $id, $question, $answers ) {
1029
+ $question_display = '';
1030
  global $mlwQuizMasterNext;
1031
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
1032
  if ( $required == 0 ) {
1040
  $limit_mr_text = 'onchange="qsmCheckMR(this,' . $limit_multiple_response . ')"';
1041
  }
1042
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
1043
+ $answerEditor = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'answerEditor' );
1044
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
1045
+ $question_display .= "<div class='qmn_check_answers qmn_multiple_horizontal_check $mlw_requireClass'>";
1046
  if ( is_array( $answers ) ) {
1047
  $mlw_answer_total = 0;
1048
  foreach ( $answers as $answer ) {
1049
  $mlw_answer_total++;
1050
  if ( $answer[0] != '' ) {
1051
  $question_display .= "<input type='hidden' name='question" . $id . "' value='This value does not matter' />";
1052
+ $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 . "'>";
1053
+ if ( $answerEditor === 'image' ) {
1054
+ $question_display .= '<img src="' . trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) . '" />';
1055
+ } else {
1056
+ $question_display .= trim( do_shortcode( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ) );
1057
+ }
1058
+ $question_display .= '&nbsp;</label></span>';
1059
  }
1060
  }
1061
  }
1063
  return apply_filters( 'qmn_horizontal_multiple_response_display_front', $question_display, $id, $question, $answers );
1064
  }
1065
 
 
1066
  /**
1067
  * This function determines how the multiple response is graded.
1068
  *
1109
  /**
1110
  * Hook to filter answers array
1111
  */
1112
+ return apply_filters( 'qmn_horizontal_multiple_response_review', $return_array, $answers );
1113
  }
1114
 
1115
  add_action( 'plugins_loaded', 'qmn_question_type_fill_blank' );
1141
 
1142
  }
1143
 
 
1144
  /**
1145
  * This function displays the fill in the blank question
1146
  *
1166
  if ( strpos( $question, '%BLANK%' ) !== false ) {
1167
  $question = str_replace( '%BLANK%', $input_text, do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) );
1168
  }
1169
+ // $question_title = apply_filters('the_content', $question);
1170
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
1171
+ $question_display .= qsm_question_title_func( $question, '', $new_question_title, $id );
1172
  return apply_filters( 'qmn_fill_blank_display_front', $question_display, $id, $question, $answers );
1173
  }
1174
 
 
1175
  /**
1176
  * This function determines how the fill in the blank question is graded.
1177
  *
1210
  /**
1211
  * Hook to filter answers array
1212
  */
1213
+ return apply_filters( 'qmn_fill_blank_review', $return_array, $answers );
1214
  }
1215
 
 
1216
  // Start polar question
1217
  add_action( 'plugins_loaded', 'qmn_question_type_polar' );
1218
 
1259
  }
1260
  $total_answer = count( $answers );
1261
  ?>
1262
+ <script type="text/javascript">
1263
+ (function($) {
1264
+ $(document).ready(function() {
1265
+ $('#slider-' + '<?php echo $id; ?>').slider({
1266
+ <?php if ( $total_answer == 2 && $is_reverse ) { ?>
1267
+ max: <?php echo $answers[0][1]; ?>,
1268
+ min: <?php echo $answers[1][1]; ?>,
1269
+ isRTL: true,
1270
+ <?php } else { ?>
1271
+ min: <?php echo $answers[0][1]; ?>,
1272
+ max: <?php echo $answers[1][1]; ?>,
1273
+ <?php } ?>
1274
+ step: 1,
1275
+ value: <?php echo $check_point / 2; ?>,
1276
+ change: function(event, ui) {
1277
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1278
+ '.qmn_polar').val(ui.value);
1279
+ if (ui.value == <?php echo $answers[0][1]; ?>) {
1280
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1281
+ '.left-polar-title').css('font-weight', '900');
1282
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1283
+ '.right-polar-title').css('font-weight', '100');
1284
+ } else if (ui.value == <?php echo $answers[1][1]; ?>) {
1285
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1286
+ '.left-polar-title').css('font-weight', '100');
1287
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1288
+ '.right-polar-title').css('font-weight', '900');
1289
+ } else if (ui.value == <?php echo $check_point / 2; ?>) {
1290
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1291
+ '.left-polar-title').css('font-weight', '400');
1292
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1293
+ '.right-polar-title').css('font-weight', '400');
1294
+ } else if (ui.value > <?php echo $check_point / 2; ?>) {
1295
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1296
+ '.<?php echo $font_weight_rc; ?>').css('font-weight', '400');
1297
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1298
+ '.<?php echo $font_weight_lc; ?>').css('font-weight', '600');
1299
+ } else if (ui.value < <?php echo $check_point / 2; ?>) {
1300
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1301
+ '.<?php echo $font_weight_rc; ?>').css('font-weight', '600');
1302
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1303
+ '.<?php echo $font_weight_lc; ?>').css('font-weight', '400');
1304
+ }
1305
+ },
1306
+ create: function(event, ui) {
1307
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1308
+ '.left-polar-title').css('font-weight', '400');
1309
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1310
+ '.right-polar-title').css('font-weight', '400');
1311
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').find(
1312
+ '.qmn_polar').val(<?php echo $check_point / 2; ?>);
1313
+ }
1314
+ });
1315
+ var maxHeight = Math.max.apply(null, $(
1316
+ ".question-section-id-<?php echo $id; ?> .question-type-polar-s > div").map(function() {
1317
+ return $(this).height();
1318
+ }).get());
1319
+ $('.question-section-id-<?php echo $id; ?> .question-type-polar-s').height(maxHeight);
1320
+ });
1321
+ })(jQuery);
1322
+ </script>
1323
+ <?php
1324
  if ( $required == 0 ) {
1325
  $mlw_requireClass = 'mlwRequiredText';
1326
  } else {
1327
  $mlw_requireClass = '';
1328
  }
1329
  $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
1330
+ $question_title = qsm_question_title_func( $question, '', $new_question_title, $id );
1331
  // $question_title = "<div class='mlw_qmn_question polar-question-title'>". do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)) ."</div>";
1332
  $input_text .= "<div class='left-polar-title'>" . $answers[0][0] . '</div>';
1333
  $input_text .= "<div class='slider-main-wrapper'><input type='hidden' class='qmn_polar $mlw_requireClass' id='question" . $id . "' name='question" . $id . "' />";
1335
  $input_text .= "<div class='right-polar-title'>" . $answers[1][0] . '</div>';
1336
  /*
1337
  if (strpos($question, '%POLAR_SLIDER%') !== false) {
1338
+ $question = str_replace("%POLAR_SLIDER%", $input_text, do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
1339
  }*/
1340
  $question = $input_text;
1341
  // $question_title = apply_filters('the_content', $question);
1382
  /**
1383
  * Hook to filter answers array
1384
  */
1385
+ return apply_filters( 'qmn_polar_review', $return_array, $answers );
1386
  }
1387
 
1388
+ function qsm_question_title_func( $question, $question_type = '', $new_question_title = '', $question_id = 0 ) {
1389
  // $question_title = apply_filters('the_content', $question);
1390
  $question_title = $question;
1391
+ global $wp_embed, $mlwQuizMasterNext;
1392
  $question_title = $wp_embed->run_shortcode( $question_title );
1393
  $question_title = 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>', $question_title );
1394
  $polar_extra_class = '';
1402
  $deselect_answer = '<a href="#" class="qsm-deselect-answer">Deselect Answer</a>';
1403
  }
1404
 
1405
+ if ( $question_id ) {
1406
+ $featureImageID = $mlwQuizMasterNext->pluginHelper->get_question_setting( $question_id, 'featureImageID' );
1407
+ if ( $featureImageID ) {
1408
+ $question_display .= '<div class="qsm-featured-image">' . wp_get_attachment_image( $featureImageID, apply_filters( 'qsm_filter_feature_image_size', 'full', $question_id ) ) . '</div>';
1409
+ }
1410
+ }
1411
  if ( $new_question_title != '' ) {
1412
  $question_display .= "<span class='mlw_qmn_new_question'>" . sanitize_text_field( htmlspecialchars_decode( $new_question_title, ENT_QUOTES ) ) . '</span>';
1413
  $polar_extra_class .= ' qsm_remove_bold';
1414
  }
1415
 
1416
+ $question_display .= "<span class='mlw_qmn_question {$polar_extra_class}' >" . do_shortcode( htmlspecialchars_decode( $question_title, ENT_QUOTES ) ) . $deselect_answer . '</span>';
1417
  return $question_display;
1418
  }
1419
+ ?>
php/rest-api.php CHANGED
@@ -14,251 +14,297 @@ add_action( 'rest_api_init', 'qsm_register_rest_routes' );
14
  * @since 5.2.0
15
  */
16
  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
- '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
 
83
  /**
84
  * Get questions for question bank
 
85
  * @since 6.4.10
86
  * @param WP_REST_Request $request
87
  */
88
  function qsm_rest_get_bank_questions( WP_REST_Request $request ) {
89
- if (is_user_logged_in()) {
90
- global $wpdb;
91
- $category = isset($_REQUEST['category']) ? sanitize_text_field($_REQUEST['category']) : '';
92
-
93
- if (!empty($category)) {
94
- $query = $wpdb->prepare( "SELECT COUNT(question_id) as total_question FROM {$wpdb->prefix}mlw_questions WHERE deleted=0 AND deleted_question_bank=0 AND category=%s", $category );
95
- } else {
96
- $query = "SELECT COUNT(question_id) as total_question FROM {$wpdb->prefix}mlw_questions WHERE deleted=0 AND deleted_question_bank=0";
97
- }
98
 
99
- $total_count_query = $wpdb->get_row( $query, 'ARRAY_A' );
100
- $total_count = isset($total_count_query['total_question']) ? $total_count_query['total_question'] : 0;
101
 
102
- $settings = (array) get_option( 'qmn-settings' );
103
- $limit = 20;
104
- if ( isset( $settings['items_per_page_question_bank'] ) ) {
105
- $limit = $settings['items_per_page_question_bank'];
106
- }
107
- $limit = $limit == '' || $limit == 0 ? 20 : $limit;
108
- $total_pages = ceil($total_count / $limit);
109
- $pageno = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
110
- $offset = ($pageno-1) * $limit;
111
-
112
- if (!empty($category)) {
113
- $query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted = 0 AND deleted_question_bank = 0 AND category = %s ORDER BY question_order ASC LIMIT %d, %d", $category, $offset, $limit );
114
- } else {
115
- $query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted = 0 AND deleted_question_bank = 0 ORDER BY question_order ASC LIMIT %d, %d", $offset, $limit );
116
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
- $questions = $wpdb->get_results( $query, 'ARRAY_A' );
119
- $question_array = array();
120
- $question_array['pagination'] = array(
121
- 'total_pages' => $total_pages,
122
- 'current_page' => $pageno,
123
- 'category' => $category
124
- );
125
-
126
- $question_array['questions'] = array();
127
- foreach ( $questions as $question ) {
128
- $quiz_name = $wpdb->get_row( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $question['quiz_id'] ), ARRAY_A );
129
- $question['page'] = isset( $question['page'] ) ? (int) $question['page'] : 0;
130
-
131
- $answers = maybe_unserialize( $question['answer_array'] );
132
- if ( ! is_array( $answers ) ) {
133
- $answers = array();
134
- }
135
- $question['answers'] = $answers;
136
 
137
- $settings = maybe_unserialize( $question['question_settings'] );
138
- if ( ! is_array( $settings ) ) {
139
- $settings = array( 'required' => 1 );
140
- }
141
- $question['settings'] = $settings;
142
-
143
- $question_data = array(
144
- 'id' => $question['question_id'],
145
- 'quizID' => $question['quiz_id'],
146
- 'type' => $question['question_type_new'],
147
- 'question_title' => isset($question['settings']['question_title']) ? $question['settings']['question_title'] : 0,
148
- 'name' => $question['question_name'],
149
- 'answerInfo' => $question['question_answer_info'],
150
- 'comments' => $question['comments'],
151
- 'hint' => $question['hints'],
152
- 'category' => $question['category'],
153
- 'required' => $question['settings']['required'],
154
- 'answers' => $question['answers'],
155
- 'page' => $question['page'],
156
- 'answerEditor' => isset($question['settings']['answerEditor']) ? $question['settings']['answerEditor'] : 'text',
157
- 'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
158
- 'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
159
- 'limit_multiple_response' => isset($question['settings']['limit_multiple_response']) ? $question['settings']['limit_multiple_response'] : 0,
160
- 'file_upload_limit' => isset($question['settings']['file_upload_limit']) ? $question['settings']['file_upload_limit'] : 0,
161
- 'file_upload_type' => isset($question['settings']['file_upload_type']) ? $question['settings']['file_upload_type'] : '',
162
- 'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
163
- 'question_title' => isset($question['settings']['question_title']) ? $question['settings']['question_title'] : '',
164
- );
165
- $question_data = apply_filters('qsm_rest_api_filter_question_data', $question_data, $question, $request);
166
  $question_array['questions'][] = $question_data;
167
- }
168
- return $question_array;
169
- }else{
170
- return array(
171
- 'status' => 'error',
172
- 'msg' => __('User not logged in', 'quiz-master-next'),
173
  );
174
- }
175
  }
176
 
177
  /**
178
  * Get the result of quiz from quiz id
179
- *
180
  * @since 6.3.5
181
  * @param WP_REST_Request $request
182
  */
183
- function qsm_get_result_of_quiz( WP_REST_Request $request ){
184
- $quiz_id = isset($request['id']) ? $request['id'] : 0;
185
- if($quiz_id > 0){
186
- global $wpdb;
187
- $mlw_quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE deleted='0' AND quiz_id = %d LIMIT 0,40", $quiz_id ) );
188
- if($mlw_quiz_data){
189
- $result_data = array();
190
- foreach ($mlw_quiz_data as $mlw_quiz_info) {
191
- $form_type = isset( $mlw_quiz_info->form_type ) ? $mlw_quiz_info->form_type : 0;
192
- if( $form_type == 1 || $form_type == 2 ){
193
- $quotes_list = "".__('Not Graded','quiz-master-next' )."";
194
- }else{
195
- if ( $mlw_quiz_info->quiz_system == 0 ) {
196
- $quotes_list = "" . $mlw_quiz_info->correct ." out of ".$mlw_quiz_info->total." or ".$mlw_quiz_info->correct_score."%";
197
- }
198
- if ( $mlw_quiz_info->quiz_system == 1 ) {
199
- $quotes_list = "" . $mlw_quiz_info->point_score . " Points";
200
- }
201
- if ( $mlw_quiz_info->quiz_system == 3 ) {
202
- $quotes_list = "" . $mlw_quiz_info->correct ." out of ".$mlw_quiz_info->total." or ".$mlw_quiz_info->correct_score."%<br/>";
203
- $quotes_list = "" . $mlw_quiz_info->point_score . " Points";
204
- }
205
- }
206
- //Time to complete
207
- $mlw_complete_time = '';
208
- $mlw_qmn_results_array = @unserialize($mlw_quiz_info->quiz_results);
209
- if ( is_array( $mlw_qmn_results_array ) ) {
210
- $mlw_complete_hours = floor($mlw_qmn_results_array[0] / 3600);
211
- if ( $mlw_complete_hours > 0 ) {
212
- $mlw_complete_time .= "$mlw_complete_hours hours ";
213
- }
214
- $mlw_complete_minutes = floor(($mlw_qmn_results_array[0] % 3600) / 60);
215
- if ( $mlw_complete_minutes > 0 ) {
216
- $mlw_complete_time .= "$mlw_complete_minutes minutes ";
217
- }
218
- $mlw_complete_seconds = $mlw_qmn_results_array[0] % 60;
219
- $mlw_complete_time .= "$mlw_complete_seconds seconds";
220
- }
221
- //Time taken
222
- $date = date_i18n( get_option( 'date_format' ), strtotime( $mlw_quiz_info->time_taken ) );
223
- $time = date( "h:i:s A", strtotime( $mlw_quiz_info->time_taken ) );
224
- $result_data[] = array(
225
- 'score' => $quotes_list,
226
- 'time_to_complete' => $mlw_complete_time,
227
- 'time_taken' => $date . ' ' .$time,
228
- );
229
- }
230
- print_r($result_data);
231
- exit;
232
- }else{
233
- return rest_ensure_response('No record found.');
234
- }
235
- }else{
236
- return rest_ensure_response('Quiz id is missing.');
237
- }
238
  }
239
 
240
  /**
241
  * Get the list of quizes
 
242
  * @since 6.3.5
243
  * @param WP_REST_Request $request
244
  */
245
- function qsm_get_basic_info_quiz( WP_REST_Request $request ){
246
- global $mlwQuizMasterNext;
247
- $quizzes = $mlwQuizMasterNext->pluginHelper->get_quizzes();
248
- if($quizzes){
249
- $quiz_data = array();
250
- foreach ($quizzes as $quiz) {
251
- $quiz_data[] = array(
252
- 'quiz_name' => $quiz->quiz_name,
253
- 'last_activity' => $quiz->last_activity,
254
- 'quiz_views' => $quiz->quiz_views,
255
- 'quiz_taken' => $quiz->quiz_taken,
256
- );
257
- }
258
- return rest_ensure_response($quiz_data);
259
- }else{
260
- return rest_ensure_response('No quiz found.');
261
- }
262
  }
263
 
264
  /**
@@ -282,7 +328,7 @@ function qsm_rest_get_emails( WP_REST_Request $request ) {
282
  }
283
  return array(
284
  'status' => 'error',
285
- 'msg' => __('User not logged in', 'quiz-master-next'),
286
  );
287
  }
288
 
@@ -309,7 +355,7 @@ function qsm_rest_save_emails( WP_REST_Request $request ) {
309
  }
310
  return array(
311
  'status' => 'error',
312
- 'msg' => __('User not logged in', 'quiz-master-next'),
313
  );
314
  }
315
 
@@ -334,7 +380,7 @@ function qsm_rest_get_results( WP_REST_Request $request ) {
334
  }
335
  return array(
336
  'status' => 'error',
337
- 'msg' => __('User not logged in', 'quiz-master-next'),
338
  );
339
  }
340
 
@@ -361,7 +407,7 @@ function qsm_rest_save_results( WP_REST_Request $request ) {
361
  }
362
  return array(
363
  'status' => 'error',
364
- 'msg' => __('User not logged in', 'quiz-master-next'),
365
  );
366
  }
367
 
@@ -379,20 +425,20 @@ function qsm_rest_get_question( WP_REST_Request $request ) {
379
  if ( 0 !== $current_user ) {
380
  $question = QSM_Questions::load_question( $request['id'] );
381
  if ( ! empty( $question ) ) {
382
- $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
383
- $question = array(
384
- 'id' => $question['question_id'],
385
- 'quizID' => $question['quiz_id'],
386
- 'type' => $question['question_type_new'],
387
- 'name' => $question['question_name'],
388
- 'answerInfo' => $question['question_answer_info'],
389
- 'comments' => $question['comments'],
390
- 'hint' => $question['hints'],
391
- 'category' => $question['category'],
392
- 'required' => $question['settings']['required'],
393
- 'answers' => $question['answers'],
394
- 'page' => $question['page'],
395
- 'question_title' => isset($question['settings']['question_title']) ? $question['settings']['question_title'] : '',
396
  );
397
  }
398
  return $question;
@@ -400,7 +446,7 @@ function qsm_rest_get_question( WP_REST_Request $request ) {
400
  }
401
  return array(
402
  'status' => 'error',
403
- 'msg' => __('User not logged in', 'quiz-master-next'),
404
  );
405
  }
406
 
@@ -413,51 +459,53 @@ function qsm_rest_get_question( WP_REST_Request $request ) {
413
  */
414
  function qsm_rest_get_questions( WP_REST_Request $request ) {
415
  // Makes sure user is logged in.
416
- if ( is_user_logged_in() ) {
417
  $current_user = wp_get_current_user();
418
  if ( 0 !== $current_user ) {
419
  $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0;
420
  if ( 0 !== $quiz_id ) {
421
  $questions = QSM_Questions::load_questions_by_pages( $quiz_id );
422
  } else {
423
- $questions = QSM_Questions::load_questions( 0 );
424
  }
425
- global $wpdb;
426
  $question_array = array();
427
- foreach ( $questions as $question ) {
428
- $quiz_name = $wpdb->get_row( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $question['quiz_id'] ), ARRAY_A );
429
- $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
430
- $question_data = array(
431
- 'id' => $question['question_id'],
432
- 'quizID' => $question['quiz_id'],
433
- 'type' => $question['question_type_new'],
434
- 'name' => $question['question_name'],
435
- 'answerInfo' => htmlspecialchars_decode( $question['question_answer_info'], ENT_QUOTES ),
436
- 'comments' => $question['comments'],
437
- 'hint' => $question['hints'],
438
- 'category' => $question['category'],
439
- 'required' => $question['settings']['required'],
440
- 'answers' => $question['answers'],
441
- 'page' => $question['page'],
442
- 'answerEditor' => isset($question['settings']['answerEditor']) ? $question['settings']['answerEditor'] : 'text',
443
- 'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
444
- 'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
445
- 'limit_multiple_response' => isset($question['settings']['limit_multiple_response']) ? $question['settings']['limit_multiple_response'] : 0,
446
- 'file_upload_limit' => isset($question['settings']['file_upload_limit']) ? $question['settings']['file_upload_limit'] : 0,
447
- 'file_upload_type' => isset($question['settings']['file_upload_type']) ? $question['settings']['file_upload_type'] : '',
448
- 'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
449
- 'question_title' => isset($question['settings']['question_title']) ? $question['settings']['question_title'] : '',
450
- 'settings' => $question['settings']
 
 
451
  );
452
- $question_data = apply_filters('qsm_rest_api_filter_question_data', $question_data, $question, $request);
453
  $question_array[] = $question_data;
454
- }
455
  return $question_array;
456
  }
457
  }
458
  return array(
459
  'status' => 'error',
460
- 'msg' => __('User not logged in', 'quiz-master-next'),
461
  );
462
  }
463
 
@@ -475,7 +523,7 @@ function qsm_rest_create_question( WP_REST_Request $request ) {
475
  $current_user = wp_get_current_user();
476
  if ( 0 !== $current_user ) {
477
  try {
478
- $data = array(
479
  'quiz_id' => $request['quizID'],
480
  'type' => $request['type'],
481
  'name' => $request['name'],
@@ -485,19 +533,19 @@ function qsm_rest_create_question( WP_REST_Request $request ) {
485
  'order' => 1,
486
  'category' => $request['category'],
487
  );
488
- $settings = array(
489
- 'required' => $request['required'],
490
- 'answerEditor' => 'text',
491
- 'question_title' => $request['name']
492
  );
493
  $intial_answers = $request['answers'];
494
- $answers = array();
495
  if ( is_array( $intial_answers ) ) {
496
  $answers = $intial_answers;
497
  }
498
  $question_id = QSM_Questions::create_question( $data, $answers, $settings );
499
 
500
- do_action('qsm_saved_question_data', $question_id, $request);
501
 
502
  return array(
503
  'status' => 'success',
@@ -514,7 +562,7 @@ function qsm_rest_create_question( WP_REST_Request $request ) {
514
  }
515
  return array(
516
  'status' => 'error',
517
- 'msg' => __('User not logged in', 'quiz-master-next'),
518
  );
519
  }
520
 
@@ -526,14 +574,14 @@ function qsm_rest_create_question( WP_REST_Request $request ) {
526
  * @return array An array that contains the key 'id' for the new question.
527
  */
528
  function qsm_rest_save_question( WP_REST_Request $request ) {
529
-
530
  // Makes sure user is logged in.
531
  if ( is_user_logged_in() ) {
532
  $current_user = wp_get_current_user();
533
  if ( 0 !== $current_user ) {
534
  try {
535
- $id = intval( $request['id'] );
536
- $data = array(
537
  'quiz_id' => $request['quizID'],
538
  'type' => $request['type'],
539
  'name' => $request['name'],
@@ -543,33 +591,36 @@ function qsm_rest_save_question( WP_REST_Request $request ) {
543
  'order' => 1,
544
  'category' => $request['category'],
545
  );
546
- $settings = array();
547
- $settings['answerEditor'] = $request['answerEditor'];
548
- $settings['question_title'] = sanitize_text_field( $request['question_title'] );
549
- if( isset($request['other_settings']) && is_array($request['other_settings']) ){
550
- foreach ($request['other_settings'] as $setting_key => $setting_value) {
551
- $settings[$setting_key] = $setting_value;
552
- }
553
- }
554
- /* Old code
 
 
 
555
  $settings = array(
556
- 'required' => $request['required'],
557
- 'autofill' => $request['autofill'],
558
- 'limit_text' => $request['limit_text'],
559
- 'limit_multiple_response' => $request['limit_multiple_response'],
560
- 'file_upload_limit' => $request['file_upload_limit'],
561
- 'file_upload_type' => $request['file_upload_type'],
562
- 'question_title' => $request['question_title'],
563
- 'answerEditor' => $request['answerEditor'],
564
  ); */
565
  $intial_answers = $request['answers'];
566
- $answers = array();
567
  if ( is_array( $intial_answers ) ) {
568
  $answers = $intial_answers;
569
  }
570
  $question_id = QSM_Questions::save_question( $id, $data, $answers, $settings );
571
 
572
- do_action('qsm_saved_question_data', $question_id, $request);
573
 
574
  return array(
575
  'status' => 'success',
@@ -585,6 +636,6 @@ function qsm_rest_save_question( WP_REST_Request $request ) {
585
  }
586
  return array(
587
  'status' => 'error',
588
- 'msg' => __('User not logged in', 'quiz-master-next'),
589
  );
590
- }
14
  * @since 5.2.0
15
  */
16
  function qsm_register_rest_routes() {
17
+ register_rest_route(
18
+ 'quiz-survey-master/v1',
19
+ '/questions/',
20
+ array(
21
+ 'methods' => WP_REST_Server::READABLE,
22
+ 'callback' => 'qsm_rest_get_questions',
23
+ 'permission_callback' => '__return_true',
24
+ )
25
+ );
26
+ register_rest_route(
27
+ 'quiz-survey-master/v1',
28
+ '/questions/',
29
+ array(
30
+ 'methods' => WP_REST_Server::CREATABLE,
31
+ 'callback' => 'qsm_rest_create_question',
32
+ 'permission_callback' => function () {
33
+ return current_user_can( 'edit_posts' );
34
+ },
35
+ )
36
+ );
37
+ register_rest_route(
38
+ 'quiz-survey-master/v1',
39
+ '/questions/(?P<id>\d+)',
40
+ array(
41
+ 'methods' => WP_REST_Server::EDITABLE,
42
+ 'callback' => 'qsm_rest_save_question',
43
+ 'permission_callback' => '__return_true',
44
+ )
45
+ );
46
+ register_rest_route(
47
+ 'quiz-survey-master/v1',
48
+ '/questions/(?P<id>\d+)',
49
+ array(
50
+ 'methods' => WP_REST_Server::READABLE,
51
+ 'callback' => 'qsm_rest_get_question',
52
+ 'permission_callback' => '__return_true',
53
+ )
54
+ );
55
+ register_rest_route(
56
+ 'quiz-survey-master/v1',
57
+ '/quizzes/(?P<id>\d+)/results',
58
+ array(
59
+ 'methods' => WP_REST_Server::READABLE,
60
+ 'callback' => 'qsm_rest_get_results',
61
+ 'permission_callback' => '__return_true',
62
+ )
63
+ );
64
+ register_rest_route(
65
+ 'quiz-survey-master/v1',
66
+ '/quizzes/(?P<id>\d+)/results',
67
+ array(
68
+ 'methods' => WP_REST_Server::EDITABLE,
69
+ 'callback' => 'qsm_rest_save_results',
70
+ 'permission_callback' => '__return_true',
71
+ )
72
+ );
73
+ register_rest_route(
74
+ 'quiz-survey-master/v1',
75
+ '/quizzes/(?P<id>\d+)/emails',
76
+ array(
77
+ 'methods' => WP_REST_Server::READABLE,
78
+ 'callback' => 'qsm_rest_get_emails',
79
+ 'permission_callback' => '__return_true',
80
+ )
81
+ );
82
+ register_rest_route(
83
+ 'quiz-survey-master/v1',
84
+ '/quizzes/(?P<id>\d+)/emails',
85
+ array(
86
+ 'methods' => WP_REST_Server::EDITABLE,
87
+ 'callback' => 'qsm_rest_save_emails',
88
+ 'permission_callback' => function () {
89
+ return current_user_can( 'edit_posts' );
90
+ },
91
+ )
92
+ );
93
+ // Register rest api to get quiz list
94
+ register_rest_route(
95
+ 'qsm',
96
+ '/list_quiz',
97
+ array(
98
+ 'methods' => 'GET',
99
+ 'callback' => 'qsm_get_basic_info_quiz',
100
+ 'permission_callback' => '__return_true',
101
+ )
102
+ );
103
+ // Register rest api to get result of quiz
104
+ register_rest_route(
105
+ 'qsm',
106
+ '/list_results/(?P<id>\d+)',
107
+ array(
108
+ 'methods' => 'GET',
109
+ 'callback' => 'qsm_get_result_of_quiz',
110
+ 'permission_callback' => '__return_true',
111
+ )
112
+ );
113
+ // Get questions for question bank
114
+ register_rest_route(
115
+ 'quiz-survey-master/v1',
116
+ '/bank_questions/(?P<id>\d+)',
117
+ array(
118
+ 'methods' => WP_REST_Server::READABLE,
119
+ 'callback' => 'qsm_rest_get_bank_questions',
120
+ 'permission_callback' => function () {
121
+ return current_user_can( 'edit_posts' );
122
+ },
123
+ )
124
+ );
125
  }
126
 
127
  /**
128
  * Get questions for question bank
129
+ *
130
  * @since 6.4.10
131
  * @param WP_REST_Request $request
132
  */
133
  function qsm_rest_get_bank_questions( WP_REST_Request $request ) {
134
+ if ( is_user_logged_in() ) {
135
+ global $wpdb;
136
+ $category = isset( $_REQUEST['category'] ) ? sanitize_text_field( $_REQUEST['category'] ) : '';
137
+
138
+ if ( ! empty( $category ) ) {
139
+ $query = $wpdb->prepare( "SELECT COUNT(question_id) as total_question FROM {$wpdb->prefix}mlw_questions WHERE deleted=0 AND deleted_question_bank=0 AND category=%s", $category );
140
+ } else {
141
+ $query = "SELECT COUNT(question_id) as total_question FROM {$wpdb->prefix}mlw_questions WHERE deleted=0 AND deleted_question_bank=0";
142
+ }
143
 
144
+ $total_count_query = $wpdb->get_row( $query, 'ARRAY_A' );
145
+ $total_count = isset( $total_count_query['total_question'] ) ? $total_count_query['total_question'] : 0;
146
 
147
+ $settings = (array) get_option( 'qmn-settings' );
148
+ $limit = 20;
149
+ if ( isset( $settings['items_per_page_question_bank'] ) ) {
150
+ $limit = $settings['items_per_page_question_bank'];
151
+ }
152
+ $limit = $limit == '' || $limit == 0 ? 20 : $limit;
153
+ $total_pages = ceil( $total_count / $limit );
154
+ $pageno = isset( $_REQUEST['page'] ) ? (int) $_REQUEST['page'] : 1;
155
+ $offset = ( $pageno - 1 ) * $limit;
156
+
157
+ if ( ! empty( $category ) ) {
158
+ $query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted = 0 AND deleted_question_bank = 0 AND category = %s ORDER BY question_order ASC LIMIT %d, %d", $category, $offset, $limit );
159
+ } else {
160
+ $query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE deleted = 0 AND deleted_question_bank = 0 ORDER BY question_order ASC LIMIT %d, %d", $offset, $limit );
161
+ }
162
+
163
+ $questions = $wpdb->get_results( $query, 'ARRAY_A' );
164
+ $question_array = array();
165
+ $question_array['pagination'] = array(
166
+ 'total_pages' => $total_pages,
167
+ 'current_page' => $pageno,
168
+ 'category' => $category,
169
+ );
170
+
171
+ $question_array['questions'] = array();
172
+ foreach ( $questions as $question ) {
173
+ $quiz_name = $wpdb->get_row( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $question['quiz_id'] ), ARRAY_A );
174
+ $question['page'] = isset( $question['page'] ) ? (int) $question['page'] : 0;
175
+
176
+ $answers = maybe_unserialize( $question['answer_array'] );
177
+ if ( ! is_array( $answers ) ) {
178
+ $answers = array();
179
+ }
180
+ $question['answers'] = $answers;
181
 
182
+ $settings = maybe_unserialize( $question['question_settings'] );
183
+ if ( ! is_array( $settings ) ) {
184
+ $settings = array( 'required' => 1 );
185
+ }
186
+ $question['settings'] = $settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
+ $question_data = array(
189
+ 'id' => $question['question_id'],
190
+ 'quizID' => $question['quiz_id'],
191
+ 'type' => $question['question_type_new'],
192
+ 'question_title' => isset( $question['settings']['question_title'] ) ? $question['settings']['question_title'] : 0,
193
+ 'name' => $question['question_name'],
194
+ 'answerInfo' => $question['question_answer_info'],
195
+ 'comments' => $question['comments'],
196
+ 'hint' => $question['hints'],
197
+ 'category' => $question['category'],
198
+ 'required' => $question['settings']['required'],
199
+ 'answers' => $question['answers'],
200
+ 'page' => $question['page'],
201
+ 'answerEditor' => isset( $question['settings']['answerEditor'] ) ? $question['settings']['answerEditor'] : 'text',
202
+ 'autofill' => isset( $question['settings']['autofill'] ) ? $question['settings']['autofill'] : 0,
203
+ 'limit_text' => isset( $question['settings']['limit_text'] ) ? $question['settings']['limit_text'] : 0,
204
+ 'limit_multiple_response' => isset( $question['settings']['limit_multiple_response'] ) ? $question['settings']['limit_multiple_response'] : 0,
205
+ 'file_upload_limit' => isset( $question['settings']['file_upload_limit'] ) ? $question['settings']['file_upload_limit'] : 0,
206
+ 'file_upload_type' => isset( $question['settings']['file_upload_type'] ) ? $question['settings']['file_upload_type'] : '',
207
+ 'quiz_name' => isset( $quiz_name['quiz_name'] ) ? $quiz_name['quiz_name'] : '',
208
+ 'question_title' => isset( $question['settings']['question_title'] ) ? $question['settings']['question_title'] : '',
209
+ );
210
+ $question_data = apply_filters( 'qsm_rest_api_filter_question_data', $question_data, $question, $request );
 
 
 
 
 
 
211
  $question_array['questions'][] = $question_data;
212
+ }
213
+ return $question_array;
214
+ } else {
215
+ return array(
216
+ 'status' => 'error',
217
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
218
  );
219
+ }
220
  }
221
 
222
  /**
223
  * Get the result of quiz from quiz id
224
+ *
225
  * @since 6.3.5
226
  * @param WP_REST_Request $request
227
  */
228
+ function qsm_get_result_of_quiz( WP_REST_Request $request ) {
229
+ $quiz_id = isset( $request['id'] ) ? $request['id'] : 0;
230
+ if ( $quiz_id > 0 ) {
231
+ global $wpdb;
232
+ $mlw_quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE deleted='0' AND quiz_id = %d LIMIT 0,40", $quiz_id ) );
233
+ if ( $mlw_quiz_data ) {
234
+ $result_data = array();
235
+ foreach ( $mlw_quiz_data as $mlw_quiz_info ) {
236
+ $form_type = isset( $mlw_quiz_info->form_type ) ? $mlw_quiz_info->form_type : 0;
237
+ if ( $form_type == 1 || $form_type == 2 ) {
238
+ $quotes_list = '' . __( 'Not Graded', 'quiz-master-next' ) . '';
239
+ } else {
240
+ if ( $mlw_quiz_info->quiz_system == 0 ) {
241
+ $quotes_list = '' . $mlw_quiz_info->correct . ' out of ' . $mlw_quiz_info->total . ' or ' . $mlw_quiz_info->correct_score . '%';
242
+ }
243
+ if ( $mlw_quiz_info->quiz_system == 1 ) {
244
+ $quotes_list = '' . $mlw_quiz_info->point_score . ' Points';
245
+ }
246
+ if ( $mlw_quiz_info->quiz_system == 3 ) {
247
+ $quotes_list = '' . $mlw_quiz_info->correct . ' out of ' . $mlw_quiz_info->total . ' or ' . $mlw_quiz_info->correct_score . '%<br/>';
248
+ $quotes_list = '' . $mlw_quiz_info->point_score . ' Points';
249
+ }
250
+ }
251
+ // Time to complete
252
+ $mlw_complete_time = '';
253
+ $mlw_qmn_results_array = @unserialize( $mlw_quiz_info->quiz_results );
254
+ if ( is_array( $mlw_qmn_results_array ) ) {
255
+ $mlw_complete_hours = floor( $mlw_qmn_results_array[0] / 3600 );
256
+ if ( $mlw_complete_hours > 0 ) {
257
+ $mlw_complete_time .= "$mlw_complete_hours hours ";
258
+ }
259
+ $mlw_complete_minutes = floor( ( $mlw_qmn_results_array[0] % 3600 ) / 60 );
260
+ if ( $mlw_complete_minutes > 0 ) {
261
+ $mlw_complete_time .= "$mlw_complete_minutes minutes ";
262
+ }
263
+ $mlw_complete_seconds = $mlw_qmn_results_array[0] % 60;
264
+ $mlw_complete_time .= "$mlw_complete_seconds seconds";
265
+ }
266
+ // Time taken
267
+ $date = date_i18n( get_option( 'date_format' ), strtotime( $mlw_quiz_info->time_taken ) );
268
+ $time = date( 'h:i:s A', strtotime( $mlw_quiz_info->time_taken ) );
269
+ $result_data[] = array(
270
+ 'score' => $quotes_list,
271
+ 'time_to_complete' => $mlw_complete_time,
272
+ 'time_taken' => $date . ' ' . $time,
273
+ );
274
+ }
275
+ print_r( $result_data );
276
+ exit;
277
+ } else {
278
+ return rest_ensure_response( 'No record found.' );
279
+ }
280
+ } else {
281
+ return rest_ensure_response( 'Quiz id is missing.' );
282
+ }
283
  }
284
 
285
  /**
286
  * Get the list of quizes
287
+ *
288
  * @since 6.3.5
289
  * @param WP_REST_Request $request
290
  */
291
+ function qsm_get_basic_info_quiz( WP_REST_Request $request ) {
292
+ global $mlwQuizMasterNext;
293
+ $quizzes = $mlwQuizMasterNext->pluginHelper->get_quizzes();
294
+ if ( $quizzes ) {
295
+ $quiz_data = array();
296
+ foreach ( $quizzes as $quiz ) {
297
+ $quiz_data[] = array(
298
+ 'quiz_name' => $quiz->quiz_name,
299
+ 'last_activity' => $quiz->last_activity,
300
+ 'quiz_views' => $quiz->quiz_views,
301
+ 'quiz_taken' => $quiz->quiz_taken,
302
+ );
303
+ }
304
+ return rest_ensure_response( $quiz_data );
305
+ } else {
306
+ return rest_ensure_response( 'No quiz found.' );
307
+ }
308
  }
309
 
310
  /**
328
  }
329
  return array(
330
  'status' => 'error',
331
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
332
  );
333
  }
334
 
355
  }
356
  return array(
357
  'status' => 'error',
358
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
359
  );
360
  }
361
 
380
  }
381
  return array(
382
  'status' => 'error',
383
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
384
  );
385
  }
386
 
407
  }
408
  return array(
409
  'status' => 'error',
410
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
411
  );
412
  }
413
 
425
  if ( 0 !== $current_user ) {
426
  $question = QSM_Questions::load_question( $request['id'] );
427
  if ( ! empty( $question ) ) {
428
+ $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
429
+ $question = array(
430
+ 'id' => $question['question_id'],
431
+ 'quizID' => $question['quiz_id'],
432
+ 'type' => $question['question_type_new'],
433
+ 'name' => $question['question_name'],
434
+ 'answerInfo' => $question['question_answer_info'],
435
+ 'comments' => $question['comments'],
436
+ 'hint' => $question['hints'],
437
+ 'category' => $question['category'],
438
+ 'required' => $question['settings']['required'],
439
+ 'answers' => $question['answers'],
440
+ 'page' => $question['page'],
441
+ 'question_title' => isset( $question['settings']['question_title'] ) ? $question['settings']['question_title'] : '',
442
  );
443
  }
444
  return $question;
446
  }
447
  return array(
448
  'status' => 'error',
449
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
450
  );
451
  }
452
 
459
  */
460
  function qsm_rest_get_questions( WP_REST_Request $request ) {
461
  // Makes sure user is logged in.
462
+ if ( is_user_logged_in() ) {
463
  $current_user = wp_get_current_user();
464
  if ( 0 !== $current_user ) {
465
  $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0;
466
  if ( 0 !== $quiz_id ) {
467
  $questions = QSM_Questions::load_questions_by_pages( $quiz_id );
468
  } else {
469
+ $questions = QSM_Questions::load_questions( 0 );
470
  }
471
+ global $wpdb;
472
  $question_array = array();
473
+ foreach ( $questions as $question ) {
474
+ $quiz_name = $wpdb->get_row( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $question['quiz_id'] ), ARRAY_A );
475
+ $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
476
+ $question_data = array(
477
+ 'id' => $question['question_id'],
478
+ 'quizID' => $question['quiz_id'],
479
+ 'type' => $question['question_type_new'],
480
+ 'name' => $question['question_name'],
481
+ 'answerInfo' => htmlspecialchars_decode( $question['question_answer_info'], ENT_QUOTES ),
482
+ 'comments' => $question['comments'],
483
+ 'hint' => $question['hints'],
484
+ 'category' => $question['category'],
485
+ 'required' => $question['settings']['required'],
486
+ 'answers' => $question['answers'],
487
+ 'page' => $question['page'],
488
+ 'answerEditor' => isset( $question['settings']['answerEditor'] ) ? $question['settings']['answerEditor'] : 'text',
489
+ 'autofill' => isset( $question['settings']['autofill'] ) ? $question['settings']['autofill'] : 0,
490
+ 'limit_text' => isset( $question['settings']['limit_text'] ) ? $question['settings']['limit_text'] : 0,
491
+ 'limit_multiple_response' => isset( $question['settings']['limit_multiple_response'] ) ? $question['settings']['limit_multiple_response'] : 0,
492
+ 'file_upload_limit' => isset( $question['settings']['file_upload_limit'] ) ? $question['settings']['file_upload_limit'] : 0,
493
+ 'file_upload_type' => isset( $question['settings']['file_upload_type'] ) ? $question['settings']['file_upload_type'] : '',
494
+ 'quiz_name' => isset( $quiz_name['quiz_name'] ) ? $quiz_name['quiz_name'] : '',
495
+ 'question_title' => isset( $question['settings']['question_title'] ) ? $question['settings']['question_title'] : '',
496
+ 'featureImageID' => isset( $question['settings']['featureImageID'] ) ? $question['settings']['featureImageID'] : '',
497
+ 'featureImageSrc' => isset( $question['settings']['featureImageSrc'] ) ? $question['settings']['featureImageSrc'] : '',
498
+ 'settings' => $question['settings'],
499
  );
500
+ $question_data = apply_filters( 'qsm_rest_api_filter_question_data', $question_data, $question, $request );
501
  $question_array[] = $question_data;
502
+ }
503
  return $question_array;
504
  }
505
  }
506
  return array(
507
  'status' => 'error',
508
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
509
  );
510
  }
511
 
523
  $current_user = wp_get_current_user();
524
  if ( 0 !== $current_user ) {
525
  try {
526
+ $data = array(
527
  'quiz_id' => $request['quizID'],
528
  'type' => $request['type'],
529
  'name' => $request['name'],
533
  'order' => 1,
534
  'category' => $request['category'],
535
  );
536
+ $settings = array(
537
+ 'required' => $request['required'],
538
+ 'answerEditor' => 'text',
539
+ 'question_title' => $request['name'],
540
  );
541
  $intial_answers = $request['answers'];
542
+ $answers = array();
543
  if ( is_array( $intial_answers ) ) {
544
  $answers = $intial_answers;
545
  }
546
  $question_id = QSM_Questions::create_question( $data, $answers, $settings );
547
 
548
+ do_action( 'qsm_saved_question_data', $question_id, $request );
549
 
550
  return array(
551
  'status' => 'success',
562
  }
563
  return array(
564
  'status' => 'error',
565
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
566
  );
567
  }
568
 
574
  * @return array An array that contains the key 'id' for the new question.
575
  */
576
  function qsm_rest_save_question( WP_REST_Request $request ) {
577
+
578
  // Makes sure user is logged in.
579
  if ( is_user_logged_in() ) {
580
  $current_user = wp_get_current_user();
581
  if ( 0 !== $current_user ) {
582
  try {
583
+ $id = intval( $request['id'] );
584
+ $data = array(
585
  'quiz_id' => $request['quizID'],
586
  'type' => $request['type'],
587
  'name' => $request['name'],
591
  'order' => 1,
592
  'category' => $request['category'],
593
  );
594
+ $settings = array();
595
+ $settings['answerEditor'] = $request['answerEditor'];
596
+ $settings['question_title'] = sanitize_text_field( $request['question_title'] );
597
+ $settings['featureImageID'] = sanitize_text_field( $request['featureImageID'] );
598
+ $settings['featureImageSrc'] = sanitize_text_field( $request['featureImageSrc'] );
599
+ if ( isset( $request['other_settings'] ) && is_array( $request['other_settings'] ) ) {
600
+ foreach ( $request['other_settings'] as $setting_key => $setting_value ) {
601
+ $settings[ $setting_key ] = $setting_value;
602
+ }
603
+ }
604
+ /*
605
+ Old code
606
  $settings = array(
607
+ 'required' => $request['required'],
608
+ 'autofill' => $request['autofill'],
609
+ 'limit_text' => $request['limit_text'],
610
+ 'limit_multiple_response' => $request['limit_multiple_response'],
611
+ 'file_upload_limit' => $request['file_upload_limit'],
612
+ 'file_upload_type' => $request['file_upload_type'],
613
+ 'question_title' => $request['question_title'],
614
+ 'answerEditor' => $request['answerEditor'],
615
  ); */
616
  $intial_answers = $request['answers'];
617
+ $answers = array();
618
  if ( is_array( $intial_answers ) ) {
619
  $answers = $intial_answers;
620
  }
621
  $question_id = QSM_Questions::save_question( $id, $data, $answers, $settings );
622
 
623
+ do_action( 'qsm_saved_question_data', $question_id, $request );
624
 
625
  return array(
626
  'status' => 'success',
636
  }
637
  return array(
638
  'status' => 'error',
639
+ 'msg' => __( 'User not logged in', 'quiz-master-next' ),
640
  );
641
+ }
php/template-variables.php CHANGED
@@ -1,127 +1,126 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
 
 
3
 
4
  /**
5
- * This file contains all the variables that are in the plugin. It registers them and then makes them available for use.
6
- *
7
- * This plugin also contains the social media variables and all of there uses.
8
- *
9
- * @since 4.4.0
10
- */
11
  /*
12
-
13
  Results Array For Reference:
14
 
15
  $mlw_qmn_result_array = array(
16
- 'quiz_id' => $mlw_quiz_id,
17
- 'quiz_name' => $mlw_quiz_options->quiz_name,
18
- 'quiz_system' => $mlw_quiz_options->system,
19
- 'total_points' => $mlw_points,
20
- 'total_score' => $mlw_total_score,
21
- 'total_correct' => $mlw_correct,
22
- 'total_questions' => $mlw_total_questions,
23
- 'user_name' => $mlw_user_name,
24
- 'user_business' => $mlw_user_comp,
25
- 'user_email' => $mlw_user_email,
26
- 'user_phone' => $mlw_user_phone,
27
- 'user_id' => get_current_user_id(),
28
- 'question_answers_display' => $mlw_question_answers,
29
- 'question_answers_array' => $mlw_qmn_answer_array,
30
- 'timer' => $mlw_qmn_timer,
31
- 'comments' => $mlw_qm_quiz_comments
32
- );
33
 
34
- */
35
  add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_all_contact_fields_variable', 10, 2 );
36
  add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_contact_field_variable', 10, 2 );
37
- add_filter('mlw_qmn_template_variable_results_page', 'qmn_variable_category_points',10,2);
38
- add_filter('mlw_qmn_template_variable_results_page', 'qmn_variable_average_category_points',10,2);
39
- add_filter('mlw_qmn_template_variable_results_page', 'qmn_variable_category_score',10,2);
40
- add_filter('mlw_qmn_template_variable_results_page', 'qmn_variable_category_average_score',10,2);
41
- add_filter('mlw_qmn_template_variable_results_page', 'qmn_variable_category_average_points',10,2);
42
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_point_score',10,2);
43
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_average_point',10,2);
44
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_amount_correct',10,2);
45
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_amount_incorrect',10,2);
46
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_total_questions',10,2);
47
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_correct_score',10,2);
48
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_quiz_name',10,2);
49
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_quiz_links',10,2);
50
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_name',10,2);
51
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_business',10,2);
52
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_phone',10,2);
53
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_email',10,2);
54
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_question_answers',10,2);
55
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_comments',10,2);
56
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer',10,2);
57
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer_minutes',10,2);
58
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date',10,2);
59
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date_taken',10,2);
60
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_social_share',10,2);
61
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_result_id',10,2);
62
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_single_question_answer',20,2);
63
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_total_possible_points',10,2);
64
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_total_attempted_questions',10,2);
65
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_full_name',10,2);
66
-
67
- add_filter('qmn_end_results', 'qsm_variable_poll_result',10,3);
68
-
69
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
70
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_links',10,2);
71
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_date',10,2);
72
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user',10,2);
73
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_social_share',10,2);
74
 
75
  /**
76
  * @since 6.4.11
77
  * @since 7.1.3 Changed the display structure to new structure.
78
- * @param str $content
79
  * @param array $mlw_quiz_array
80
  * Show particular question answer.
81
  */
82
- function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
83
- $quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
84
- while ( false !== strpos($content, '%QUESTION_ANSWER_') ) {
85
- $question_id = mlw_qmn_get_string_between($content, '%QUESTION_ANSWER_', '%');
86
- if( $question_id === 'X'){
87
- $content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , '', $content);
88
- return $content;
89
- }else if( $question_id === 'CORRECT' || $question_id === 'INCORRECT' || $question_id === 'GROUP' ){
90
- return $content;
91
- }
92
- $question_answers_array = isset($mlw_quiz_array['question_answers_array']) ? $mlw_quiz_array['question_answers_array'] : array();
93
- $key = array_search( $question_id, array_column($question_answers_array, 'id'));
94
- if( isset($question_answers_array[$key]) ){
95
- global $mlwQuizMasterNext;
96
- $answer = $question_answers_array[$key];
97
- if( isset( $mlw_quiz_array['email_processed'] ) && $mlw_quiz_array['email_processed'] == 'yes' ){
98
- if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
99
- $quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
100
- $qmn_question_answer_template = isset( $quiz_text_settings['question_answer_email_template'] ) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_email_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
101
- }else{
102
- $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
103
- }
104
- } else {
105
- if( isset( $mlw_quiz_array['quiz_settings'] ) && !empty($mlw_quiz_array['quiz_settings']) ){
106
- $quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
107
- $qmn_question_answer_template = isset( $quiz_text_settings['question_answer_template'] ) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
108
- }else{
109
- $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
110
- }
111
- }
112
- $mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
113
- $questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
114
- $qmn_questions = array();
115
- foreach ( $questions as $question ) {
116
- $qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
117
- }
118
- $total_question_cnt = 2;
119
- $qsm_question_cnt = 1;
120
- $display = qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $mlw_question_answer_display, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt);
121
- $content = str_replace( "%QUESTION_ANSWER_". $question_id ."%" , $display, $content);
122
- }
123
- }
124
- return $content;
125
  }
126
 
127
  /**
@@ -130,14 +129,14 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ){
130
  * @since 7.0.2
131
  *
132
  * @param string $content
133
- * @param array $mlw_quiz_array
134
  * @return string $content
135
  */
136
- function qsm_variable_total_possible_points( $content, $mlw_quiz_array ){
137
- if( isset( $mlw_quiz_array["total_possible_points"] ) ){
138
- $content = str_replace( "%MAXIMUM_POINTS%" , $mlw_quiz_array["total_possible_points"], $content);
139
- }
140
- return $content;
141
  }
142
 
143
  /**
@@ -146,113 +145,117 @@ function qsm_variable_total_possible_points( $content, $mlw_quiz_array ){
146
  * @since 7.0.2
147
  *
148
  * @param string $content
149
- * @param array $mlw_quiz_array
150
  * @return string $content
151
  */
152
- function qsm_variable_total_attempted_questions( $content, $mlw_quiz_array ){
153
- $total_attempted_questions = isset( $mlw_quiz_array["total_attempted_questions"] ) ? $mlw_quiz_array["total_attempted_questions"] : 0;
154
- $content = str_replace( "%AMOUNT_ATTEMPTED%" , $total_attempted_questions, $content);
155
- return $content;
156
  }
157
 
158
  /**
159
  * Show poll result
 
160
  * @param str $content
161
  * @param arr $mlw_quiz_array
162
  */
163
- function qsm_variable_poll_result($content, $mlw_quiz_array, $variables){
164
- $quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
165
- while ( false !== strpos($content, '%POLL_RESULTS_') ) {
166
- $question_id = mlw_qmn_get_string_between($content, '%POLL_RESULTS_', '%');
167
- if( $question_id === 'X'){
168
- $content = str_replace( "%POLL_RESULTS_". $question_id ."%" , '', $content);
169
- return $content;
170
- }
171
- global $wpdb;
172
- $total_query = $wpdb->get_row( $wpdb->prepare( "SELECT count(*) AS total_count FROM {$wpdb->prefix}mlw_results WHERE quiz_id = %d", $quiz_id ),ARRAY_A);
173
- $total_result = $total_query['total_count'];
174
- $ser_answer = $wpdb->get_row( $wpdb->prepare( "SELECT answer_array FROM {$wpdb->prefix}mlw_questions WHERE question_id = %d", $question_id ) ,ARRAY_A);
175
- $ser_answer_arry = unserialize($ser_answer['answer_array']);
176
- $ser_answer_arry_change = array_filter(array_merge(array(0), $ser_answer_arry));
177
- $total_quiz_results = $wpdb->get_results( $wpdb->prepare( "SELECT quiz_results FROM {$wpdb->prefix}mlw_results WHERE quiz_id = %d", $quiz_id ) ,ARRAY_A);
178
- $answer_array = array();
179
- if($total_quiz_results){
180
- foreach ($total_quiz_results as $key => $value) {
181
- $userdb = unserialize($value['quiz_results']);
182
- if(!empty($userdb)){
183
- $key = array_search($question_id, array_column($userdb[1], 'id'));
184
- $answer_array[] = isset($userdb[1][$key]) ? $userdb[1][$key][1] : '';
185
- }
186
- }
187
- }
188
- $vals = array_count_values($answer_array);
189
- $str = '';
190
- if($vals){
191
- $str .= '<h4>' . __('Poll Result', 'quiz-master-next') . ':</h4>';
192
- foreach ($vals as $answer_str => $answer_count) {
193
- if($answer_str != '' && qsm_find_key_from_array($answer_str, $ser_answer_arry_change)){
194
- $percentage = number_format($answer_count / $total_result * 100,2) ;
195
- $str .= $answer_str . ' : ' . $percentage .'%<br/>';
196
- $str .= '<progress value="'. $percentage .'" max="100">'. $percentage .' %</progress><br/>';
197
- }
198
- }
199
- }
200
- $content = str_replace( "%POLL_RESULTS_". $question_id ."%" , $str, $content);
201
- }
202
- return $content;
203
  }
204
 
205
- function mlw_qmn_get_string_between($string, $start, $end){
206
- $string = ' ' . $string;
207
- $ini = strpos($string, $start);
208
- if ($ini == 0) return '';
209
- $ini += strlen($start);
210
- $len = strpos($string, $end, $ini) - $ini;
211
- return substr($string, $ini, $len);
 
 
 
212
  }
213
 
214
- function qsm_find_key_from_array($search_value,$array){
215
- if($array){
216
- $search_value = htmlspecialchars_decode( $search_value, ENT_QUOTES );
217
- foreach ($array as $key => $value) {
218
- $value_val = $value[0];
219
- if( $value_val == $search_value ){
220
- return true;
221
- }
222
- }
223
- }
224
- return false;
225
  }
226
 
227
  /**
228
  * Adds Social sharing links
229
  */
230
- function mlw_qmn_variable_social_share($content, $mlw_quiz_array) {
231
  global $wpdb, $mlwQuizMasterNext;
232
- $page_link = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
233
- if (false !== strpos($content, '%FACEBOOK_SHARE%') || false !== strpos($content, '%TWITTER_SHARE%')) {
234
- //wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( '../../js/qmn_social_share.js' , __FILE__ ) );
235
  }
236
- if (false !== strpos($content, '%FACEBOOK_SHARE%')) {
237
- $settings = (array) get_option('qmn-settings');
238
  $facebook_app_id = '594986844960937';
239
- if (isset($settings['facebook_app_id'])) {
240
- $facebook_app_id = esc_js($settings['facebook_app_id']);
241
  }
242
- $url = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
243
- $page_link = $url . '?result_id=' . '%FB_RESULT_ID%';
244
- $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '%QUIZ_NAME%' );
245
- $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
246
- $fb_image = plugins_url('', dirname(__FILE__) ) . '/assets/facebook.png';
247
- $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."', '$facebook_app_id', '$page_link');\"><img src='". $fb_image ."' alt='" . __('Facebbok Share', 'quiz-master-next') . "' /></a>";
248
- $content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
249
  }
250
- if (false !== strpos($content, '%TWITTER_SHARE%')) {
251
- $tw_image = plugins_url('', dirname(__FILE__)) . '/assets/twitter.png';
252
- $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_text', 'twitter_sharing_text', '%QUIZ_NAME%');
253
- $sharing = apply_filters('mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
254
- $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '" . esc_js($sharing) . "', '" . esc_js($mlw_quiz_array["quiz_name"]) . "');\"><img src='" . $tw_image . "' alt='" . __('Twitter Share', 'quiz-master-next') . "' /></a>";
255
- $content = str_replace("%TWITTER_SHARE%", $social_display, $content);
256
  }
257
  return $content;
258
  }
@@ -261,44 +264,42 @@ function mlw_qmn_variable_social_share($content, $mlw_quiz_array) {
261
  * Adds result id using the %RESULT_ID% variable
262
  */
263
  function qsm_variable_result_id( $content, $mlw_quiz_array ) {
264
- while ( false !== strpos($content, '%RESULT_ID%') ) {
265
- global $wpdb;
266
- $get_last_id = $wpdb->get_row("SELECT result_id FROM {$wpdb->prefix}mlw_results ORDER BY result_id DESC",ARRAY_A);
267
- $content = str_replace( "%RESULT_ID%" , $get_last_id['result_id'], $content);
268
  }
269
  return $content;
270
  }
271
 
272
- function mlw_qmn_variable_point_score($content, $mlw_quiz_array)
273
- {
274
- $content = str_replace( "%POINT_SCORE%" , (isset($mlw_quiz_array["total_points"]) ? $mlw_quiz_array["total_points"] : ''), $content);
275
  return $content;
276
  }
277
- function mlw_qmn_variable_average_point($content, $mlw_quiz_array){
278
- $question_total = 0;
279
- if( isset( $mlw_quiz_array['question_answers_array'] ) ){
280
- foreach( $mlw_quiz_array['question_answers_array'] as $single_question ){
281
- if( $single_question['question_type'] !== '11' ){
282
- $question_total++;
283
- }
284
- }
285
- }
286
- if (isset($mlw_quiz_array['total_questions']) && $mlw_quiz_array["total_questions"] != 0 && $question_total != 0){
287
- if(qsm_is_allow_score_roundoff())
288
- $mlw_average_points = round($mlw_quiz_array["total_points"]/$question_total);
289
- else
290
- $mlw_average_points = round($mlw_quiz_array["total_points"]/$question_total, 2);
291
  }
292
- else
293
- {
 
 
 
 
 
294
  $mlw_average_points = 0;
295
  }
296
- $content = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $content);
297
  return $content;
298
  }
299
 
300
- function mlw_qmn_variable_amount_correct($content, $mlw_quiz_array) {
301
- $content = str_replace("%AMOUNT_CORRECT%", (isset($mlw_quiz_array["total_correct"]) ? $mlw_quiz_array["total_correct"] : ''), $content);
302
  return $content;
303
  }
304
 
@@ -307,59 +308,59 @@ function mlw_qmn_variable_amount_correct($content, $mlw_quiz_array) {
307
  *
308
  * @since 7.0.3
309
  * @param string $content
310
- * @param array $mlw_quiz_array
311
  * @return string
312
  */
313
- function mlw_qmn_variable_amount_incorrect($content, $mlw_quiz_array) {
314
- if (false !== strpos($content, '%AMOUNT_INCORRECT%')) {
315
- $total_question = $mlw_quiz_array["total_questions"];
316
- $total_correct = $mlw_quiz_array["total_correct"];
317
  $total_incorrect = $total_question - $total_correct;
318
- $content = str_replace("%AMOUNT_INCORRECT%", max($total_incorrect, 0), $content);
319
  }
320
  return $content;
321
  }
322
 
323
- function mlw_qmn_variable_total_questions($content, $mlw_quiz_array) {
324
- $content = str_replace("%TOTAL_QUESTIONS%", (isset($mlw_quiz_array["total_questions"]) ? $mlw_quiz_array["total_questions"] : ''), $content);
325
  return $content;
326
  }
327
 
328
- function mlw_qmn_variable_correct_score($content, $mlw_quiz_array) {
329
- $content = str_replace("%CORRECT_SCORE%", (isset($mlw_quiz_array["total_score"]) ? round($mlw_quiz_array["total_score"]) : ''), $content);
330
  return $content;
331
  }
332
 
333
- function mlw_qmn_variable_quiz_name($content, $mlw_quiz_array) {
334
- $content = str_replace("%QUIZ_NAME%", (isset($mlw_quiz_array["quiz_name"]) ? $mlw_quiz_array["quiz_name"] : ''), $content);
335
  return $content;
336
  }
337
 
338
- function mlw_qmn_variable_quiz_links($content, $mlw_quiz_array) {
339
  global $wpdb;
340
- $quiz_link = qsm_get_post_id_from_quiz_id($mlw_quiz_array['quiz_id']);
341
- if (false !== strpos($content, '%QUIZ_LINK%')) {
342
- $content = str_replace("%QUIZ_LINK%", $quiz_link, $content);
343
  }
344
- if (false !== strpos($content, '%RESULT_LINK%')) {
345
  $result_link = $quiz_link;
346
- if (isset($mlw_quiz_array['result_id'])) {
347
- $unique_id = $wpdb->get_var( $wpdb->prepare( "SELECT unique_id FROM {$wpdb->prefix}mlw_results WHERE quiz_id=%d AND result_id=%d", $mlw_quiz_array['quiz_id'], $mlw_quiz_array['result_id'] ) );
348
- $result_link = add_query_arg('result_id', $unique_id, $quiz_link);
349
  }
350
- $content = str_replace("%RESULT_LINK%", $result_link, $content);
351
  }
352
  return $content;
353
  }
354
 
355
- function mlw_qmn_variable_user_name($content, $mlw_quiz_array) {
356
- $content = str_replace("%USER_NAME%", (isset($mlw_quiz_array["user_name"]) ? $mlw_quiz_array["user_name"] : ''), $content);
357
  return $content;
358
  }
359
 
360
- function mlw_qmn_variable_current_user($content, $mlw_quiz_array) {
361
  $current_user = wp_get_current_user();
362
- $content = str_replace("%USER_NAME%", $current_user->display_name, $content);
363
  return $content;
364
  }
365
  /**
@@ -367,35 +368,37 @@ function mlw_qmn_variable_current_user($content, $mlw_quiz_array) {
367
  *
368
  * @since 7.1.11
369
  * @param string $content
370
- * @param array $mlw_quiz_array
371
  * @return string
372
  */
373
- function mlw_qmn_variable_user_full_name($content, $mlw_quiz_array) {
374
- if (false !== strpos($content, '%FULL_NAME%')) {
375
  $current_user = wp_get_current_user();
376
- $firstname = get_user_meta( $current_user->ID, 'first_name', true );
377
- $lastname = get_user_meta( $current_user->ID, 'last_name', true );
378
- if(!empty($firstname) && !empty($lastname))
379
- $full_name = $firstname." ".$lastname;
380
- else
381
  $full_name = $current_user->display_name;
382
- $content = str_replace("%FULL_NAME%", (isset($full_name) ? $full_name : ''), $content);
383
  }
 
 
 
384
  return $content;
385
  }
386
 
387
- function mlw_qmn_variable_user_business($content, $mlw_quiz_array) {
388
- $content = str_replace("%USER_BUSINESS%", (isset($mlw_quiz_array["user_business"]) ? $mlw_quiz_array["user_business"] : ''), $content);
389
  return $content;
390
  }
391
 
392
- function mlw_qmn_variable_user_phone($content, $mlw_quiz_array) {
393
- $content = str_replace("%USER_PHONE%", (isset($mlw_quiz_array["user_phone"]) ? $mlw_quiz_array["user_phone"] : ''), $content);
394
  return $content;
395
  }
396
 
397
- function mlw_qmn_variable_user_email($content, $mlw_quiz_array) {
398
- $content = str_replace("%USER_EMAIL%", (isset($mlw_quiz_array["user_email"]) ? $mlw_quiz_array["user_email"] : ''), $content);
399
  return $content;
400
  }
401
 
@@ -405,10 +408,10 @@ function mlw_qmn_variable_user_email($content, $mlw_quiz_array) {
405
  * @since 5.0.0
406
  * @return string The HTML for the content
407
  */
408
- function qsm_contact_field_variable($content, $results_array) {
409
- preg_match_all("~%CONTACT_(.*?)%~i", $content, $matches);
410
- for ($i = 0; $i < count($matches[0]); $i++) {
411
- $content = str_replace("%CONTACT_" . $matches[1][$i] . "%", $results_array["contact"][$matches[1][$i] - 1]["value"], $content);
412
  }
413
  return $content;
414
  }
@@ -419,14 +422,14 @@ function qsm_contact_field_variable($content, $results_array) {
419
  * @since 5.0.0
420
  * @return string The HTML for the content
421
  */
422
- function qsm_all_contact_fields_variable($content, $results) {
423
  $return = '';
424
- if (isset($results["contact"]) && ( is_array($results["contact"]) || is_object($results["contact"]) )) {
425
- for ($i = 0; $i < count($results["contact"]); $i++) {
426
- $return .= $results["contact"][$i]["label"] . ": " . $results["contact"][$i]["value"] . "<br>";
427
  }
428
  }
429
- $content = str_replace("%CONTACT_ALL%", $return, $content);
430
  return $content;
431
  }
432
 
@@ -436,69 +439,69 @@ function qsm_all_contact_fields_variable($content, $results) {
436
  * @param string $content The content to be checked for the template
437
  * @param array $mlw_quiz_array The array for the response data
438
  */
439
- function mlw_qmn_variable_question_answers($content, $mlw_quiz_array) {
440
  global $mlwQuizMasterNext;
441
- $logic_rules = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('logic_rules');
442
- $logic_rules = unserialize($logic_rules);
443
- $hidden_questions = isset($mlw_quiz_array['hidden_questions']) ? $mlw_quiz_array['hidden_questions'] : array();
444
- if (empty($hidden_questions)) {
445
- $hidden_questions = isset($mlw_quiz_array['results']['hidden_questions']) ? $mlw_quiz_array['results']['hidden_questions'] : array();
446
  }
447
  // Checks if the variable is present in the content.
448
- while (strpos($content, '%QUESTIONS_ANSWERS%') !== false || strpos($content, '%QUESTIONS_ANSWERS_EMAIL%') !== false) {
449
  global $wpdb;
450
  $display = '';
451
- if (strpos($content, '%QUESTIONS_ANSWERS_EMAIL%') !== false) {
452
- if (isset($mlw_quiz_array['quiz_settings']) && !empty($mlw_quiz_array['quiz_settings'])) {
453
- $quiz_text_settings = isset($mlw_quiz_array['quiz_settings']['quiz_text']) ? @unserialize(stripslashes($mlw_quiz_array['quiz_settings']['quiz_text'])) : array();
454
- $qmn_question_answer_template = isset($quiz_text_settings['question_answer_email_template']) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_email_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%');
455
  } else {
456
- $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%');
457
  }
458
  } else {
459
- if (isset($mlw_quiz_array['quiz_settings']) && !empty($mlw_quiz_array['quiz_settings'])) {
460
- $quiz_text_settings = isset($mlw_quiz_array['quiz_settings']['quiz_text']) ? @unserialize(stripslashes($mlw_quiz_array['quiz_settings']['quiz_text'])) : array();
461
- $qmn_question_answer_template = isset($quiz_text_settings['question_answer_template']) ? apply_filters('qsm_section_setting_text', $quiz_text_settings['question_answer_template']) : $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%');
462
  } else {
463
- $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%');
464
  }
465
  }
466
- $questions = QSM_Questions::load_questions_by_pages($mlw_quiz_array['quiz_id']);
467
  $qmn_questions = array();
468
- foreach ($questions as $question) {
469
- $qmn_questions[$question['question_id']] = $question['question_answer_info'];
470
  }
471
 
472
  // Cycles through each answer in the responses.
473
- $total_question_cnt = count($mlw_quiz_array['question_answers_array']);
474
- $qsm_question_cnt = 1;
475
- foreach ($mlw_quiz_array['question_answers_array'] as $answer) {
476
- if (in_array($answer['id'], $hidden_questions)) {
477
  continue;
478
  }
479
- $display .= qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $qmn_question_answer_template, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt);
480
  $qsm_question_cnt++;
481
  }
482
  $display = "<div class='qsm_questions_answers_section'>{$display}</div>";
483
- $content = str_replace("%QUESTIONS_ANSWERS%", $display, $content);
484
- $content = str_replace("%QUESTIONS_ANSWERS_EMAIL%", $display, $content);
485
  }
486
  return $content;
487
  }
488
 
489
- function mlw_qmn_variable_comments($content, $mlw_quiz_array) {
490
- $content = str_replace("%COMMENT_SECTION%", (isset($mlw_quiz_array["comments"]) ? $mlw_quiz_array["comments"] : ''), $content);
491
  return $content;
492
  }
493
 
494
- function mlw_qmn_variable_timer($content, $mlw_quiz_array) {
495
- $content = str_replace("%TIMER%", (isset($mlw_quiz_array["timer"]) ? $mlw_quiz_array["timer"] : ''), $content);
496
  return $content;
497
  }
498
 
499
- function mlw_qmn_variable_timer_minutes($content, $mlw_quiz_array) {
500
- $mlw_minutes = (isset($mlw_quiz_array["timer"]) ? round($mlw_quiz_array["timer"] / 60, 2) : '');
501
- $content = str_replace("%TIMER_MINUTES%", $mlw_minutes, $content);
502
  return $content;
503
  }
504
 
@@ -506,12 +509,12 @@ function mlw_qmn_variable_timer_minutes($content, $mlw_quiz_array) {
506
  * Replaces the variable %CURRENT_DATE% and displays the current date
507
  *
508
  * @param string $content The contents of the results page
509
- * @param array $results The array of all the results from user taking the quiz
510
  * @return string Returns the contents for the results page
511
  */
512
- function mlw_qmn_variable_date($content, $results) {
513
- $date = date_i18n(get_option('date_format'), time());
514
- $content = str_replace("%CURRENT_DATE%", $date, $content);
515
  return $content;
516
  }
517
 
@@ -519,291 +522,264 @@ function mlw_qmn_variable_date($content, $results) {
519
  * Replaces the variable %DATE_TAKEN% and returns the date the user submitted his or her responses
520
  *
521
  * @param string $content The contents of the results page
522
- * @param array $results The array of all the results from user taking the quiz
523
  * @return string Returns the contents for the results page
524
  */
525
- function mlw_qmn_variable_date_taken($content, $mlw_quiz_array) {
526
  $date = '';
527
- if (isset($mlw_quiz_array["time_taken"])) {
528
- $date = date_i18n(get_option('date_format'), strtotime($mlw_quiz_array["time_taken"]));
529
  }
530
- $content = str_replace("%DATE_TAKEN%", $date, $content);
531
  return $content;
532
  }
533
 
534
  /*
535
- * Replaces variable %CATEGORY_POINTS% with the points for that category
536
- *
537
- * Filter function that replaces variable %CATEGORY_POINTS% with the points from the category inside the variable tags. i.e. %CATEGORY_POINTS%category 1%/CATEGORY_POINTS%
538
- *
539
- * @since 4.0.0
540
- * @param string $content The contents of the results page
541
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
542
- * @return string Returns the contents for the results page
543
- */
544
- function qmn_variable_category_points($content, $mlw_quiz_array)
545
- {
546
  $return_points = 0;
547
- while (strpos($content, '%CATEGORY_POINTS%') !== false || false !== strpos($content, '%CATEGORY_POINTS_'))
548
- {
549
  $return_points = 0;
550
- preg_match("~%CATEGORY_POINTS%(.*?)%/CATEGORY_POINTS%~i",$content,$answer_text);
551
- if(empty($answer_text)){
552
- $category_name = mlw_qmn_get_string_between($content, '%CATEGORY_POINTS_', '%');
553
- }else{
554
- $category_name = $answer_text[1];
555
- }
556
 
557
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
558
- {
559
- if ($answer["category"] == $category_name)
560
- {
561
- $return_points += $answer["points"];
562
  }
563
  }
564
- if(empty($answer_text)){
565
- $content = str_replace( '%CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
566
- }else{
567
- $content = str_replace( $answer_text[0] , $return_points, $content);
568
- }
569
  }
570
  return $content;
571
  }
572
 
573
  /*
574
- * Replaces variable %CATEGORY_POINTS% with the average points for that category
575
- *
576
- * Filter function that replaces variable %CATEGORY_POINTS% with the average points from the category inside the variable tags. i.e. %CATEGORY_POINTS%category 1%/CATEGORY_POINTS%
577
- *
578
- * @since 4.0.0
579
- * @param string $content The contents of the results page
580
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
581
- * @return string Returns the contents for the results page
582
- */
583
  function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
584
  $return_points = 0;
585
- while ( strpos( $content, '%AVERAGE_CATEGORY_POINTS%' ) !== false || false !== strpos($content, '%AVERAGE_CATEGORY_POINTS_') ) {
586
- $return_points = 0;
587
  $total_questions = 0;
588
- preg_match( "~%AVERAGE_CATEGORY_POINTS%(.*?)%/AVERAGE_CATEGORY_POINTS%~i", $content, $answer_text );
589
- if(empty($answer_text)){
590
- $category_name = mlw_qmn_get_string_between($content, '%AVERAGE_CATEGORY_POINTS_', '%');
591
- }else{
592
- $category_name = $answer_text[1];
593
- }
594
  foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
595
- if ( $answer["category"] == $category_name ) {
596
- if( $answer['question_type'] !== '11' ){
597
- $total_questions += 1;
598
- }
599
- $return_points += $answer["points"];
600
  }
601
  }
602
  if ( $total_questions !== 0 ) {
603
- if(qsm_is_allow_score_roundoff())
604
- $return_points = round( $return_points / $total_questions);
605
- else
606
  $return_points = round( $return_points / $total_questions, 2 );
 
607
  } else {
608
  $return_points = 0;
609
  }
610
- if(empty($answer_text)){
611
- $content = str_replace( '%AVERAGE_CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
612
- }else{
613
- $content = str_replace( $answer_text[0] , $return_points, $content);
614
- }
615
  }
616
  return $content;
617
  }
618
 
619
  /*
620
- * Replaces variable %CATEGORY_SCORE% with the score for that category
621
- *
622
- * Filter function that replaces variable %CATEGORY_SCORE% with the score from the category inside the variable tags. i.e. %CATEGORY_SCORE%category 1%/CATEGORY_SCORE%
623
- *
624
- * @since 4.0.0
625
- * @param string $content The contents of the results page
626
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
627
- * @return string Returns the contents for the results page
628
- */
629
- function qmn_variable_category_score($content, $mlw_quiz_array)
630
- {
631
- $return_score = 0;
632
  $total_questions = 0;
633
- $amount_correct = 0;
634
- while (strpos($content, '%CATEGORY_SCORE%') !== false || false !== strpos($content, '%CATEGORY_SCORE_'))
635
- {
636
- $return_score = 0;
637
  $total_questions = 0;
638
- $amount_correct = 0;
639
- preg_match("~%CATEGORY_SCORE%(.*?)%/CATEGORY_SCORE%~i",$content,$answer_text);
640
- if(empty($answer_text)){
641
- $category_name = mlw_qmn_get_string_between($content, '%CATEGORY_SCORE_', '%');
642
- }else{
643
- $category_name = $answer_text[1];
644
- }
645
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
646
- {
647
- if ($answer["category"] == $category_name)
648
- {
649
  $total_questions += 1;
650
- if ($answer["correct"] == 'correct')
651
- {
652
  $amount_correct += 1;
653
  }
654
  }
655
  }
656
- if ($total_questions != 0)
657
- {
658
- if(qsm_is_allow_score_roundoff())
659
- $return_score = round((($amount_correct/$total_questions)*100));
660
- else
661
- $return_score = round((($amount_correct/$total_questions)*100), 2);
662
- }
663
- else
664
- {
665
  $return_score = 0;
666
  }
667
 
668
- if(empty($answer_text)){
669
- $content = str_replace( '%CATEGORY_SCORE_'.$category_name.'%' , $return_score, $content);
670
- }else{
671
- $content = str_replace( $answer_text[0] , $return_score, $content);
672
- }
673
-
674
  }
675
  return $content;
676
  }
677
 
678
  /*
679
- * Replaces variable %CATEGORY_AVERAGE_SCORE% with the average score for all categories
680
- *
681
- * Filter function that replaces variable %CATEGORY_AVERAGE_SCORE% with the score from all categories.
682
- *
683
- * @since 4.0.0
684
- * @param string $content The contents of the results page
685
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
686
- * @return string Returns the contents for the results page
687
- */
688
- function qmn_variable_category_average_score($content, $mlw_quiz_array)
689
- {
690
- $return_score = 0;
691
  $total_categories = 0;
692
- $total_score = 0;
693
- $category_scores = array();
694
- while (strpos($content, '%CATEGORY_AVERAGE_SCORE%') !== false)
695
- {
696
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
697
- {
698
- if (!isset($category_scores[$answer["category"]]['total_questions']))
699
- {
700
- $category_scores[$answer["category"]]['total_questions'] = 0;
701
  }
702
- if (!isset($category_scores[$answer["category"]]['amount_correct']))
703
- {
704
- $category_scores[$answer["category"]]['amount_correct'] = 0;
705
  }
706
- $category_scores[$answer["category"]]['total_questions'] += 1;
707
- if ($answer["correct"] == 'correct')
708
- {
709
- $category_scores[$answer["category"]]['amount_correct'] += 1;
710
  }
711
  }
712
- foreach($category_scores as $category)
713
- {
714
- $total_score += $category["amount_correct"]/$category["total_questions"];
715
  $total_categories += 1;
716
  }
717
- if ($total_categories != 0)
718
- {
719
- if(qsm_is_allow_score_roundoff())
720
- $return_score = round((($total_score/$total_categories)*100));
721
- else
722
- $return_score = round((($total_score/$total_categories)*100), 2);
723
- }
724
- else
725
- {
726
  $return_score = 0;
727
  }
728
- $content = str_replace( "%CATEGORY_AVERAGE_SCORE%" , $return_score, $content);
729
  }
730
  return $content;
731
  }
732
 
733
  /*
734
- * Replaces variable %CATEGORY_AVERAGE_POINTS% with the average points for all categories
735
- *
736
- * Filter function that replaces variable %CATEGORY_AVERAGE_POINTS% with the points from all categories.
737
- *
738
- * @since 4.0.0
739
- * @param string $content The contents of the results page
740
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
741
- * @return string Returns the contents for the results page
742
- */
743
- function qmn_variable_category_average_points($content, $mlw_quiz_array)
744
- {
745
- $return_score = 0;
746
  $total_categories = 0;
747
- $total_points = 0;
748
- $category_scores = array();
749
- while (strpos($content, '%CATEGORY_AVERAGE_POINTS%') !== false)
750
- {
751
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
752
- {
753
- if (!isset($category_scores[$answer["category"]]['points']))
754
- {
755
- $category_scores[$answer["category"]]['points'] = 0;
756
  }
757
- $category_scores[$answer["category"]]['points'] += $answer["points"];
758
  }
759
- foreach($category_scores as $category)
760
- {
761
- $total_points += $category["points"];
762
  $total_categories += 1;
763
  }
764
- $return_score = $total_points/$total_categories;
765
- $content = str_replace( '%CATEGORY_AVERAGE_POINTS%' , $return_score, $content);
766
  }
767
  return $content;
768
  }
769
 
770
-
771
- add_filter('qmn_end_results', 'qsm_end_results_rank', 9999, 3);
772
- function qsm_end_results_rank($result_display, $qmn_quiz_options, $qmn_array_for_variables)
773
- {
774
- while (strpos($result_display, '%RANK%') !== false){
775
- global $wpdb;
776
- $mlw_quiz_id = $qmn_array_for_variables['quiz_id'];
777
- $mlw_result_id = $wpdb->get_var( $wpdb->prepare( "SELECT MAX(result_id) FROM {$wpdb->prefix}mlw_results WHERE quiz_id=%d AND deleted=0", $mlw_quiz_id ) );
778
- $mlw_result_data = $wpdb->get_results( $wpdb->prepare( "SELECT result_id, correct_score, point_score, quiz_results FROM {$wpdb->prefix}mlw_results WHERE quiz_id=%d AND deleted=0", $mlw_quiz_id ) );
779
- if (!empty($mlw_result_data)) {
780
- foreach ($mlw_result_data as $key => $mlw_eaches) {
781
- $time_taken = 0;
782
- $mlw_qmn_results_array = @unserialize($mlw_eaches->quiz_results);
783
- if (is_array($mlw_qmn_results_array)) {
784
- $time_taken = $mlw_qmn_results_array[0];
785
- if (isset($mlw_qmn_results_array['timer_ms']) && $mlw_qmn_results_array['timer_ms'] > 0) {
786
- $time_taken = $mlw_qmn_results_array['timer_ms'];
787
- } else {
788
- $time_taken = ($time_taken * 1000);
789
  }
 
790
  }
791
- $mlw_result_data[$key]->total_time_taken = $time_taken;
792
- }
793
- array_multisort(array_column($mlw_result_data, 'correct_score'), SORT_DESC, array_column($mlw_result_data, 'total_time_taken'), SORT_ASC, $mlw_result_data);
794
- /**
795
- * Find Rank
796
- */
797
- $rank = 0;
798
- foreach ($mlw_result_data as $mlw_eaches) {
799
- $rank++;
800
- if ($mlw_eaches->result_id == $mlw_result_id) {
801
- $mlw_rank = $rank;
802
  }
803
  }
 
804
  }
805
- $result_display = str_replace("%RANK%", $mlw_rank, $result_display);
806
- }
807
  return $result_display;
808
  }
809
 
@@ -821,21 +797,21 @@ function qsm_end_results_rank($result_display, $qmn_quiz_options, $qmn_array_for
821
  function qsm_custom_wpkses_post_tags( $tags, $context ) {
822
 
823
  if ( 'post' === $context ) {
824
- $tags['iframe'] = array(
825
- 'src' => true,
826
- 'height' => true,
827
- 'width' => true,
828
- 'frameborder' => true,
829
- 'allowfullscreen' => true,
830
- );
831
- $tags['video'] = array(
832
- 'width' => true,
833
- 'height' => true
834
- );
835
- $tags['source'] = array(
836
- 'src' => true,
837
- 'type' => true
838
- );
839
  }
840
 
841
  return $tags;
@@ -855,393 +831,427 @@ add_filter( 'wp_kses_allowed_html', 'qsm_custom_wpkses_post_tags', 10, 2 );
855
  * @param int $total_question_cnt
856
  * @return string
857
  */
858
- function qsm_questions_answers_shortcode_to_text($mlw_quiz_array, $qmn_question_answer_template, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt) {
859
- global $mlwQuizMasterNext;
860
- if (is_admin() && isset($_GET['page']) && $_GET['page'] == 'qsm_quiz_result_details') {
861
- $user_answer_class = "";
862
- $question_answer_class = "";
863
- if (isset($mlw_quiz_array['form_type']) && $mlw_quiz_array['form_type'] == 0) {
864
- if ($mlw_quiz_array['quiz_system'] == 0 || $mlw_quiz_array['quiz_system'] == 3) {
865
- if ($answer["correct"] === "correct") {
866
- $user_answer_class = "qmn_user_correct_answer";
867
- $question_answer_class = "qmn_question_answer_correct";
868
- } else {
869
- $user_answer_class = "qmn_user_incorrect_answer";
870
- $question_answer_class = "qmn_question_answer_incorrect";
871
- }
872
- }
873
- }
874
- } else {
875
- if ($answer["correct"] === "correct") {
876
- $user_answer_class = "qmn_user_correct_answer";
877
- $question_answer_class = "qmn_question_answer_correct";
878
- } else {
879
- $user_answer_class = "qmn_user_incorrect_answer";
880
- $question_answer_class = "qmn_question_answer_incorrect";
881
- }
882
- }
883
 
884
- $mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
885
- $disable_description_on_result = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'disable_description_on_result');
886
- //Get question setting
887
- $question_settings = isset( $questions[$answer['id']]['settings'] ) ? $questions[$answer['id']]['settings'] : array();
888
- if (isset($answer['question_title']) && $answer['question_title'] != '') {
889
- $add_br = '';
890
- if ($answer[0] != '') {
891
- $add_br = '<br/>';
892
- }
893
- if ($disable_description_on_result == 1) {
894
- $mlw_question_answer_display = str_replace("%QUESTION%", '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
895
- } else {
896
- $mlw_question_answer_display = str_replace("%QUESTION%", '<b>' . htmlspecialchars_decode($answer['question_title'], ENT_QUOTES) . '</b>' . $add_br . htmlspecialchars_decode($answer[0], ENT_QUOTES), $mlw_question_answer_display);
897
- }
898
- } else {
899
- $mlw_question_answer_display = str_replace("%QUESTION%", '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
900
- }
901
- $mlw_question_answer_display = qsm_question_title_func($mlw_question_answer_display);
902
- $extra_border_bottom_class = '';
903
- $remove_border = true;
904
- if (strpos($mlw_question_answer_display, '%USER_ANSWERS_DEFAULT%') !== false) {
905
- $remove_border = false;
906
- $question_with_answer_text = '';
907
- $extra_border_bottom_class = 'qsm-add-border-bottom';
908
- $show_two_option_questions = array(
909
- 3, 12, 5, 7, 14
910
- );
911
- $form_type = isset($mlw_quiz_array['form_type']) ? $mlw_quiz_array['form_type'] : 0;
912
- $quiz_system = isset($mlw_quiz_array['quiz_system']) ? $mlw_quiz_array['quiz_system'] : 0;
913
- if (isset($answer['id']) && isset($questions[$answer['id']]) && !empty($questions[$answer['id']])) {
914
- $total_answers = isset($questions[$answer['id']]['answers']) ? $questions[$answer['id']]['answers'] : array();
915
- if ($total_answers) {
916
- if (isset($answer['question_type']) && in_array($answer['question_type'], $show_two_option_questions)) {
917
- $do_show_wrong = true;
918
- foreach ($total_answers as $single_answer) {
919
- $current_answer_zero = trim( htmlspecialchars_decode($single_answer[0], ENT_QUOTES) );
920
- if ($form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 )) {
921
- if (isset($single_answer[2]) && $single_answer[2] == 1) {
922
- $actual_answer = htmlspecialchars_decode($answer[1], ENT_QUOTES);
923
- if($answer['question_type'] == 5){
924
- $actual_answer = trim(str_replace(' ','', preg_replace('/\s\s+/', '', $actual_answer )));
925
- $current_answer_zero = trim(str_replace(' ','', preg_replace('/\s\s+/', '', $current_answer_zero )));
 
 
 
 
926
  }
927
-
928
- if(strcasecmp( $actual_answer, $current_answer_zero ) == 0 ) {
929
- $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode($answer[1], ENT_QUOTES) . '</span>';
930
- $do_show_wrong = false;
931
  }
932
- }
933
- } else {
934
- if ( isset($single_answer[2]) && strcasecmp( htmlspecialchars_decode($answer[1], ENT_QUOTES), $current_answer_zero ) == 0 ) {
935
- $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
936
- $do_show_wrong = false;
937
- }
938
- }
939
- }
940
- if ($do_show_wrong) {
941
- if ($form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 )) {
942
- $user_given_answer = $answer[1] == '' ? __('No answer provided', 'quiz-master-next') : $answer[1];
943
- $question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode($user_given_answer, ENT_QUOTES) . '</span>';
944
- foreach ($total_answers as $single_answer) {
945
- if (isset($single_answer[2]) && $single_answer[2] == 1) {
946
- $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
947
- break;
948
- }
949
- }
950
- } else {
951
- $user_given_answer = $answer[1] == '' ? __('No answer provided', 'quiz-master-next') : $answer[1];
952
- $question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($user_given_answer, ENT_QUOTES) . '</span>';
953
- }
954
- }
955
- } else if (isset($answer['question_type']) && $answer['question_type'] == 11) {
956
- $file_extension = substr($answer[1], -4);
957
- if ($file_extension == '.jpg' || $file_extension == '.jpeg' || $file_extension == '.png' || $file_extension == '.gif') {
958
- $question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
959
- } else {
960
- $question_with_answer_text .= "<span class='$user_answer_class'>" . trim(htmlspecialchars_decode($answer[1], ENT_QUOTES)) . '</span>';
961
- }
962
- } else {
963
- if ($form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 )) {
964
- if (isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 )) {
965
- $user_selected_answer = htmlspecialchars_decode($answer[1], ENT_QUOTES);
966
- $new_array_user_answer = isset( $answer['user_compare_text'] ) ? explode('=====', $answer['user_compare_text']) : array();
967
- foreach ($total_answers as $single_answer) {
968
- $current_answer_text = trim( stripslashes( htmlspecialchars_decode($single_answer[0], ENT_QUOTES) ) );
969
- $is_answer_correct = false;
970
- if( $new_array_user_answer ){
971
- foreach( $new_array_user_answer as $new_array_value ){
972
- $new_array_value = trim( stripslashes( htmlspecialchars_decode($new_array_value, ENT_QUOTES) ) );
973
- if( $current_answer_text == $new_array_value ){
974
- $is_answer_correct = true;
975
- break;
976
- }
977
- }
978
- }
979
- if (isset($single_answer[2]) && $single_answer[2] == 1 && $is_answer_correct ) {
980
- $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
981
- } else if (isset($single_answer[2]) && $single_answer[2] == 1) {
982
- $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
983
- } else if ( $is_answer_correct && $single_answer[2] !== 1) {
984
- $question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
985
- } else {
986
- $question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
987
- }
988
- }
989
- } else {
990
- if($answer['question_type'] == 13)
991
- {
992
- $questionid = $questions[$answer['id']]['question_id'];
993
- $question_with_answer_text .= qmn_polar_display_on_resultspage($questionid, $questions, $total_answers,$answer);
994
  }
995
- else {
996
- foreach ($total_answers as $single_answer) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
  $single_answer_option = $single_answer[0];
998
- if( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'rich' ){
999
- $single_answer_option = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
1000
- $single_answer_option = htmlentities( $single_answer_option );
1001
- if( strpos($single_answer_option, '&lt;') !== false || strpos($single_answer_option, '&quot;') !== false ){
1002
- $single_answer_option = htmlspecialchars( $single_answer_option );
1003
- }
1004
- if( strpos($answer[1], '&lt;') !== false || strpos($answer[1], '&quot;') !== false ){
1005
- $answer_value = htmlentities( $answer[1] );
1006
- }else {
1007
- $answer_value = htmlspecialchars_decode($answer[1], ENT_QUOTES);
1008
- $answer_value = htmlspecialchars_decode($answer_value, ENT_QUOTES);
1009
- $answer_value = htmlentities($answer_value);
1010
- $answer_value = htmlspecialchars($answer_value);
1011
- }
1012
- } else {
1013
- $answer_value = htmlspecialchars_decode($answer[1], ENT_QUOTES);
1014
  }
1015
- if (isset($single_answer[2]) && $single_answer[2] == 1 && $answer_value == $single_answer_option ) {
1016
- $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
1017
- } else if (isset($single_answer[2]) && $single_answer[2] == 1) {
1018
- $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
1019
- } else if ($answer_value == $single_answer_option && $single_answer[2] !== 1) {
1020
- $question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
1021
  } else {
1022
- $question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
 
 
 
 
 
 
 
 
 
 
1023
  }
1024
  }
1025
  }
1026
- }
1027
- } else {
1028
- if (isset($answer['question_type']) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 )) {
1029
- $user_selected_answer = htmlspecialchars_decode($answer[1], ENT_QUOTES);
1030
- foreach ($total_answers as $single_answer) {
1031
- if (strpos($user_selected_answer, $single_answer[0]) !== false) {
1032
- $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
1033
- } else {
1034
- $question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
1035
- }
1036
- }
1037
- } else {
1038
- if($answer['question_type'] == 13)
1039
- {
1040
- $questionid = $questions[$answer['id']]['question_id'];
1041
-
1042
- $question_with_answer_text .= qmn_polar_display_on_resultspage($questionid, $questions, $total_answers,$answer);
 
1043
  }
1044
- else
1045
- {
1046
- foreach ($total_answers as $single_answer) {
1047
- if (htmlspecialchars_decode($answer[1], ENT_QUOTES) == $single_answer[0]) {
1048
- $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
 
 
 
 
 
 
 
 
 
 
 
 
1049
  } else {
1050
- $question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode($single_answer[0], ENT_QUOTES) . '</span>';
1051
  }
1052
  }
1053
  }
1054
- }
1055
- }
1056
- }
1057
- } else {
1058
- if (isset($answer['question_type']) && $answer['question_type'] == 11) {
1059
- $file_extension = substr($answer[1], -4);
1060
- if ($file_extension == '.jpg' || $file_extension == '.jpeg' || $file_extension == '.png' || $file_extension == '.gif') {
1061
- $question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
1062
- } else {
1063
- $question_with_answer_text .= "<span class='$user_answer_class'>" . trim(htmlspecialchars_decode($answer[1], ENT_QUOTES)) . '</span>';
1064
- }
1065
- } else {
1066
- $question_with_answer_text .= '<span class="qsm-user-answer-text">' . htmlspecialchars_decode($answer[1], ENT_QUOTES) . '</span>';
1067
- }
1068
- }
1069
- }
1070
- $mlw_question_answer_display = str_replace("%USER_ANSWERS_DEFAULT%", do_shortcode( $question_with_answer_text ), $mlw_question_answer_display);
1071
- }
1072
- if (isset($answer['question_type']) && $answer['question_type'] == 11) {
1073
- $file_extension = substr($answer[1], -4);
1074
- if ($file_extension == '.jpg' || $file_extension == '.jpeg' || $file_extension == '.png' || $file_extension == '.gif') {
1075
- $mlw_question_answer_display = str_replace("%USER_ANSWER%", "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display);
1076
- } else {
1077
- $mlw_question_answer_display = str_replace("%USER_ANSWER%", "<span class='$user_answer_class'>" . trim(htmlspecialchars_decode($answer[1], ENT_QUOTES)) . '</span>', $mlw_question_answer_display);
1078
- }
1079
- } else {
1080
- $user_answer_new = $answer[1];
1081
- if( ( $answer['question_type'] == 0 || $answer['question_type'] == 1 || $answer['question_type'] == 2 ) && $answer[1] == '' ){
1082
- $user_answer_new = __('No Answer Provided', 'quiz-master-next');
1083
- }
1084
- $mlw_question_answer_display = str_replace("%USER_ANSWER%", "<span class='$user_answer_class'>" . htmlspecialchars_decode($user_answer_new, ENT_QUOTES) . '</span>', $mlw_question_answer_display);
1085
- }
1086
- $answer_2 = !empty($answer[2]) ? $answer[2] : 'NA';
1087
- $mlw_question_answer_display = str_replace("%CORRECT_ANSWER%", htmlspecialchars_decode($answer_2, ENT_QUOTES), $mlw_question_answer_display);
1088
- $answer_3 = !empty($answer[3]) ? $answer[3] : 'NA';
1089
- $mlw_question_answer_display = str_replace("%USER_COMMENTS%", $answer_3, $mlw_question_answer_display);
1090
- $answer_4 = !empty($qmn_questions[$answer['id']]) ? $qmn_questions[$answer['id']] : 'NA';
1091
- $mlw_question_answer_display = str_replace("%CORRECT_ANSWER_INFO%", htmlspecialchars_decode($answer_4, ENT_QUOTES), $mlw_question_answer_display);
1092
- //Point score of the particular question.
1093
- $question_point = isset( $answer['points'] ) ? $answer['points'] : '0';
1094
- $mlw_question_answer_display = str_replace("%QUESTION_POINT_SCORE%", htmlspecialchars_decode($question_point, ENT_QUOTES), $mlw_question_answer_display);
 
 
 
 
 
 
 
 
 
 
1095
 
1096
- $question_max_point = (isset($questions[$answer['id']]) ? qsm_get_question_maximum_points($questions[$answer['id']]) : 0 );
1097
- $mlw_question_answer_display = str_replace("%QUESTION_MAX_POINTS%", $question_max_point, $mlw_question_answer_display);
1098
 
1099
- $mlw_question_answer_display = wp_kses_post($mlw_question_answer_display);
1100
- if ($total_question_cnt == $qsm_question_cnt && $remove_border == false ) {
1101
- $extra_border_bottom_class = 'qsm-remove-border-bottom';
1102
- }
1103
- $mlw_question_answer_display = apply_filters('qsm_question_answers_template_variable', $mlw_question_answer_display, $mlw_quiz_array, $answer);
1104
- $question_obj = (isset($questions[$answer['id']]) ? $questions[$answer['id']] : null );
1105
- $display = "<div class='qmn_question_answer $extra_border_bottom_class $question_answer_class'>" . apply_filters('qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array, $question_obj) . '</div>';
1106
- return $display;
1107
  }
1108
- function qsm_get_question_maximum_points($question = array()) {
1109
  $question_max_point = 0;
1110
- if (!empty($question) && isset($question['answers'])) {
1111
- $answer_points = array(0);
1112
- foreach ($question['answers'] as $ans) {
1113
- if (isset($ans[1])) {
1114
- $answer_points[] = intval($ans[1]);
1115
  }
1116
  }
1117
- $question_max_point = max($answer_points);
1118
- if ($question['question_type_new'] == 4 || $question['question_type_new'] == 10) {
1119
- $limit_multiple_response = (isset($question['settings']['limit_multiple_response'])) ? intval($question['settings']['limit_multiple_response']) : 0;
1120
- if ($limit_multiple_response > 0 && count($answer_points) > $limit_multiple_response) {
1121
- rsort($answer_points);
1122
- $answer_points = array_slice($answer_points, 0, $limit_multiple_response, true);
1123
  }
1124
- $question_max_point = array_sum($answer_points);
1125
  }
1126
  }
1127
  return $question_max_point;
1128
  }
1129
  /**
1130
- * check is allow round off
1131
- *
1132
- * @since 7.1.10
1133
- */
1134
- function qsm_is_allow_score_roundoff()
1135
- {
1136
  global $mlwQuizMasterNext;
1137
- $score_roundoff = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'score_roundoff');
1138
- $form_type = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'form_type');
1139
- $system = $mlwQuizMasterNext->pluginHelper->get_section_setting('quiz_options', 'system');
1140
 
1141
  // check if quiz type Quiz and Geading system Correct/Incorrect Or Both Type
1142
- if($score_roundoff && $form_type ==0 && ($system ==0 || $system == 3))
1143
  return 1;
1144
- else
1145
  return 0;
 
 
1146
  }
1147
  /**
1148
- * Display Polor Question on Result page
1149
- *
1150
- * @params $id The ID of the multiple choice question
1151
- * @params $question The question that is being edited.
1152
- * @params @answers The array that contains the answers to the question.
1153
- * @params @answer The array that contains the answers choose by user.
1154
- * @return $question_display Returns the content of the question
1155
- * @since 7.1.10
1156
- */
1157
- function qmn_polar_display_on_resultspage($id, $question, $answers,$answer) {
1158
- $question_display = '';
1159
- global $mlwQuizMasterNext;
1160
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
1161
- $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
1162
- $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_text');
1163
- $autofill_att = $autofill ? "autocomplete='off' " : '';
1164
- $limit_text_att = $limit_text ? "maxlength='" . $limit_text . "' " : '';
1165
- $input_text = '';
1166
- $first_point = isset($answers[0][1]) ? $answers[0][1] : 0;
1167
- $second_point = isset($answers[1][1]) ? $answers[1][1] : 0;
1168
- $is_reverse = false;
1169
- $check_point = $second_point;
1170
- $font_weight_lc = 'right-polar-title';
1171
- $font_weight_rc = 'left-polar-title';
1172
- if($first_point > $second_point){
1173
- $is_reverse = true;
1174
- $check_point = $first_point;
1175
- $font_weight_lc = 'left-polar-title';
1176
- $font_weight_rc = 'right-polar-title';
1177
- }
1178
- $total_answer = count($answers);
1179
- ?>
1180
- <script type="text/javascript">
1181
- (function($) {
1182
- $(document).ready(function() {
1183
-
1184
- $('#slider-' + '<?php echo $id; ?>').slider({
1185
- <?php if ($total_answer == 2 && $is_reverse) { ?>
1186
- max: <?php echo $answers[0][1]; ?>,
1187
- min: <?php echo $answers[1][1]; ?>,
1188
- isRTL: true,
1189
- <?php }else{ ?>
1190
- min: <?php echo $answers[0][1]; ?>,
1191
- max: <?php echo $answers[1][1]; ?>,
1192
- <?php } ?>
1193
- step: 1,
1194
- range: false,
1195
- value: <?php echo $answer['points']; ?>,
1196
- slide: function slider_slide(event, ui) {
1197
- return false; // this code not allow to dragging
1198
- }
1199
- });
1200
- var maxHeight = Math.max.apply(null, $(".mlw-qmn-question-result-<?php echo $id; ?>> div").map(function (){
1201
- return $(this).height();
1202
- }).get());
1203
- $('.mlw-qmn-question-result-<?php echo $id; ?>').height(maxHeight);
1204
- });
1205
- })(jQuery);
1206
- </script>
1207
- <?php
1208
- if ($required == 0) {
1209
- $mlw_requireClass = "mlwRequiredText";
1210
- } else {
1211
- $mlw_requireClass = "";
1212
- }
1213
- if($answer['points'] == $answers[0][1])
1214
- {
1215
- $left_polar_title_style = "style='font-weight:900;'";
1216
- $right_polar_title_style = "style='font-weight:100';";
1217
- }
1218
- else if($answer['points'] == $check_point / 2)
1219
- {
1220
- $left_polar_title_style = "style='font-weight:400;'";
1221
- $right_polar_title_style = "style='font-weight400;'";
1222
- }
1223
- else if($answer['points'] > $check_point / 2)
1224
- {
1225
- $left_polar_title_style = "style='font-weight:400;'";
1226
- $right_polar_title_style = "style='font-weight:600;'";
1227
  }
1228
- else if($answer['points'] < $check_point / 2)
1229
- {
1230
- $left_polar_title_style = "style='font-weight:600;'";
1231
- $right_polar_title_style = "style='font-weight:400;'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1232
  }
1233
- else
1234
- {
1235
- $left_polar_title_style = "style='font-weight:400;'";
1236
- $right_polar_title_style = "style='font-weight:400;'";
 
 
 
 
 
 
 
 
 
 
 
1237
  }
1238
- $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'question_title');
1239
- $question_title = qsm_question_title_func($question, '', $new_question_title);
1240
- $input_text .= "<div class='left-polar-title' $left_polar_title_style>" . $answers[0][0] ."</div>";
1241
- $input_text .= "<div class='slider-main-wrapper'><input type='hidden' class='qmn_polar $mlw_requireClass' id='question" . $id . "' name='question" . $id . "' />";
1242
- $input_text .= '<div id="slider-'. $id .'"></div></div>';
1243
- $input_text .= "<div class='right-polar-title' $right_polar_title_style>" . $answers[1][0] . "</div>";
1244
- $question = $input_text;
1245
- $question_display .= "<span class='mlw_qmn_question mlw-qmn-question-result-$id question-type-polar-s'>" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . "</span>";;
1246
- return apply_filters('qmn_polar_display_front', $question_display, $id, $question, $answers);
1247
- }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
 
6
  /**
7
+ * This file contains all the variables that are in the plugin. It registers them and then makes them available for use.
8
+ *
9
+ * This plugin also contains the social media variables and all of there uses.
10
+ *
11
+ * @since 4.4.0
12
+ */
13
  /*
 
14
  Results Array For Reference:
15
 
16
  $mlw_qmn_result_array = array(
17
+ 'quiz_id' => $mlw_quiz_id,
18
+ 'quiz_name' => $mlw_quiz_options->quiz_name,
19
+ 'quiz_system' => $mlw_quiz_options->system,
20
+ 'total_points' => $mlw_points,
21
+ 'total_score' => $mlw_total_score,
22
+ 'total_correct' => $mlw_correct,
23
+ 'total_questions' => $mlw_total_questions,
24
+ 'user_name' => $mlw_user_name,
25
+ 'user_business' => $mlw_user_comp,
26
+ 'user_email' => $mlw_user_email,
27
+ 'user_phone' => $mlw_user_phone,
28
+ 'user_id' => get_current_user_id(),
29
+ 'question_answers_display' => $mlw_question_answers,
30
+ 'question_answers_array' => $mlw_qmn_answer_array,
31
+ 'timer' => $mlw_qmn_timer,
32
+ 'comments' => $mlw_qm_quiz_comments
33
+ );
34
 
35
+ */
36
  add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_all_contact_fields_variable', 10, 2 );
37
  add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_contact_field_variable', 10, 2 );
38
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qmn_variable_category_points', 10, 2 );
39
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qmn_variable_average_category_points', 10, 2 );
40
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qmn_variable_category_score', 10, 2 );
41
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qmn_variable_category_average_score', 10, 2 );
42
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qmn_variable_category_average_points', 10, 2 );
43
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_point_score', 10, 2 );
44
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_average_point', 10, 2 );
45
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_amount_correct', 10, 2 );
46
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_amount_incorrect', 10, 2 );
47
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_total_questions', 10, 2 );
48
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_correct_score', 10, 2 );
49
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_quiz_name', 10, 2 );
50
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_quiz_links', 10, 2 );
51
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_name', 10, 2 );
52
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_business', 10, 2 );
53
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_phone', 10, 2 );
54
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_email', 10, 2 );
55
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_question_answers', 10, 2 );
56
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_comments', 10, 2 );
57
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer', 10, 2 );
58
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer_minutes', 10, 2 );
59
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date', 10, 2 );
60
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date_taken', 10, 2 );
61
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_social_share', 10, 2 );
62
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_variable_result_id', 10, 2 );
63
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_variable_single_question_answer', 20, 2 );
64
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_variable_total_possible_points', 10, 2 );
65
+ add_filter( 'mlw_qmn_template_variable_results_page', 'qsm_variable_total_attempted_questions', 10, 2 );
66
+ add_filter( 'mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_full_name', 10, 2 );
67
+ add_filter( 'qmn_end_results', 'qsm_variable_poll_result', 10, 3 );
68
+ add_filter( 'mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name', 10, 2 );
69
+ add_filter( 'mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_links', 10, 2 );
70
+ add_filter( 'mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_date', 10, 2 );
71
+ add_filter( 'mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user', 10, 2 );
72
+ add_filter( 'mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_social_share', 10, 2 );
 
 
73
 
74
  /**
75
  * @since 6.4.11
76
  * @since 7.1.3 Changed the display structure to new structure.
77
+ * @param str $content
78
  * @param array $mlw_quiz_array
79
  * Show particular question answer.
80
  */
81
+ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ) {
82
+ $quiz_id = is_object( $mlw_quiz_array ) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
83
+ while ( false !== strpos( $content, '%QUESTION_ANSWER_' ) ) {
84
+ $question_id = mlw_qmn_get_string_between( $content, '%QUESTION_ANSWER_', '%' );
85
+ if ( $question_id === 'X' ) {
86
+ $content = str_replace( '%QUESTION_ANSWER_' . $question_id . '%', '', $content );
87
+ return $content;
88
+ } elseif ( $question_id === 'CORRECT' || $question_id === 'INCORRECT' || $question_id === 'GROUP' ) {
89
+ return $content;
90
+ }
91
+ $question_answers_array = isset( $mlw_quiz_array['question_answers_array'] ) ? $mlw_quiz_array['question_answers_array'] : array();
92
+ $key = array_search( $question_id, array_column( $question_answers_array, 'id' ) );
93
+ if ( isset( $question_answers_array[ $key ] ) ) {
94
+ global $mlwQuizMasterNext;
95
+ $answer = $question_answers_array[ $key ];
96
+ if ( isset( $mlw_quiz_array['email_processed'] ) && $mlw_quiz_array['email_processed'] == 'yes' ) {
97
+ if ( isset( $mlw_quiz_array['quiz_settings'] ) && ! empty( $mlw_quiz_array['quiz_settings'] ) ) {
98
+ $quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
99
+ $qmn_question_answer_template = isset( $quiz_text_settings['question_answer_email_template'] ) ? apply_filters( 'qsm_section_setting_text', $quiz_text_settings['question_answer_email_template'] ) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
100
+ } else {
101
+ $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
102
+ }
103
+ } else {
104
+ if ( isset( $mlw_quiz_array['quiz_settings'] ) && ! empty( $mlw_quiz_array['quiz_settings'] ) ) {
105
+ $quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
106
+ $qmn_question_answer_template = isset( $quiz_text_settings['question_answer_template'] ) ? apply_filters( 'qsm_section_setting_text', $quiz_text_settings['question_answer_template'] ) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
107
+ } else {
108
+ $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
109
+ }
110
+ }
111
+ $mlw_question_answer_display = htmlspecialchars_decode( $qmn_question_answer_template, ENT_QUOTES );
112
+ $questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
113
+ $qmn_questions = array();
114
+ foreach ( $questions as $question ) {
115
+ $qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
116
+ }
117
+ $total_question_cnt = 2;
118
+ $qsm_question_cnt = 1;
119
+ $display = qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $mlw_question_answer_display, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt );
120
+ $content = str_replace( '%QUESTION_ANSWER_' . $question_id . '%', $display, $content );
121
+ }
122
+ }
123
+ return $content;
124
  }
125
 
126
  /**
129
  * @since 7.0.2
130
  *
131
  * @param string $content
132
+ * @param array $mlw_quiz_array
133
  * @return string $content
134
  */
135
+ function qsm_variable_total_possible_points( $content, $mlw_quiz_array ) {
136
+ if ( isset( $mlw_quiz_array['total_possible_points'] ) ) {
137
+ $content = str_replace( '%MAXIMUM_POINTS%', $mlw_quiz_array['total_possible_points'], $content );
138
+ }
139
+ return $content;
140
  }
141
 
142
  /**
145
  * @since 7.0.2
146
  *
147
  * @param string $content
148
+ * @param array $mlw_quiz_array
149
  * @return string $content
150
  */
151
+ function qsm_variable_total_attempted_questions( $content, $mlw_quiz_array ) {
152
+ $total_attempted_questions = isset( $mlw_quiz_array['total_attempted_questions'] ) ? $mlw_quiz_array['total_attempted_questions'] : 0;
153
+ $content = str_replace( '%AMOUNT_ATTEMPTED%', $total_attempted_questions, $content );
154
+ return $content;
155
  }
156
 
157
  /**
158
  * Show poll result
159
+ *
160
  * @param str $content
161
  * @param arr $mlw_quiz_array
162
  */
163
+ function qsm_variable_poll_result( $content, $mlw_quiz_array, $variables ) {
164
+ $quiz_id = is_object( $mlw_quiz_array ) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
165
+ while ( false !== strpos( $content, '%POLL_RESULTS_' ) ) {
166
+ $question_id = mlw_qmn_get_string_between( $content, '%POLL_RESULTS_', '%' );
167
+ if ( $question_id === 'X' ) {
168
+ $content = str_replace( '%POLL_RESULTS_' . $question_id . '%', '', $content );
169
+ return $content;
170
+ }
171
+ global $wpdb;
172
+ $total_query = $wpdb->get_row( $wpdb->prepare( "SELECT count(*) AS total_count FROM {$wpdb->prefix}mlw_results WHERE quiz_id = %d", $quiz_id ), ARRAY_A );
173
+ $total_result = $total_query['total_count'];
174
+ $ser_answer = $wpdb->get_row( $wpdb->prepare( "SELECT answer_array FROM {$wpdb->prefix}mlw_questions WHERE question_id = %d", $question_id ), ARRAY_A );
175
+ $ser_answer_arry = unserialize( $ser_answer['answer_array'] );
176
+ $ser_answer_arry_change = array_filter( array_merge( array( 0 ), $ser_answer_arry ) );
177
+ $total_quiz_results = $wpdb->get_results( $wpdb->prepare( "SELECT quiz_results FROM {$wpdb->prefix}mlw_results WHERE quiz_id = %d", $quiz_id ), ARRAY_A );
178
+ $answer_array = array();
179
+ if ( $total_quiz_results ) {
180
+ foreach ( $total_quiz_results as $key => $value ) {
181
+ $userdb = unserialize( $value['quiz_results'] );
182
+ if ( ! empty( $userdb ) ) {
183
+ $key = array_search( $question_id, array_column( $userdb[1], 'id' ) );
184
+ $answer_array[] = isset( $userdb[1][ $key ] ) ? $userdb[1][ $key ][1] : '';
185
+ }
186
+ }
187
+ }
188
+ $vals = array_count_values( $answer_array );
189
+ $str = '';
190
+ if ( $vals ) {
191
+ $str .= '<h4>' . __( 'Poll Result', 'quiz-master-next' ) . ':</h4>';
192
+ foreach ( $vals as $answer_str => $answer_count ) {
193
+ if ( $answer_str != '' && qsm_find_key_from_array( $answer_str, $ser_answer_arry_change ) ) {
194
+ $percentage = number_format( $answer_count / $total_result * 100, 2 );
195
+ $str .= $answer_str . ' : ' . $percentage . '%<br/>';
196
+ $str .= '<progress value="' . $percentage . '" max="100">' . $percentage . ' %</progress><br/>';
197
+ }
198
+ }
199
+ }
200
+ $content = str_replace( '%POLL_RESULTS_' . $question_id . '%', $str, $content );
201
+ }
202
+ return $content;
203
  }
204
 
205
+ function mlw_qmn_get_string_between( $string, $start, $end ) {
206
+ $string = ' ' . $string;
207
+ $ini = strpos( $string, $start );
208
+ if ( $ini == 0 ) {
209
+ return '';
210
+ }
211
+
212
+ $ini += strlen( $start );
213
+ $len = strpos( $string, $end, $ini ) - $ini;
214
+ return substr( $string, $ini, $len );
215
  }
216
 
217
+ function qsm_find_key_from_array( $search_value, $array ) {
218
+ if ( $array ) {
219
+ $search_value = htmlspecialchars_decode( $search_value, ENT_QUOTES );
220
+ foreach ( $array as $key => $value ) {
221
+ $value_val = $value[0];
222
+ if ( $value_val == $search_value ) {
223
+ return true;
224
+ }
225
+ }
226
+ }
227
+ return false;
228
  }
229
 
230
  /**
231
  * Adds Social sharing links
232
  */
233
+ function mlw_qmn_variable_social_share( $content, $mlw_quiz_array ) {
234
  global $wpdb, $mlwQuizMasterNext;
235
+ $page_link = qsm_get_post_id_from_quiz_id( $mlw_quiz_array['quiz_id'] );
236
+ if ( false !== strpos( $content, '%FACEBOOK_SHARE%' ) || false !== strpos( $content, '%TWITTER_SHARE%' ) ) {
237
+ // wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( '../../js/qmn_social_share.js' , __FILE__ ) );
238
  }
239
+ if ( false !== strpos( $content, '%FACEBOOK_SHARE%' ) ) {
240
+ $settings = (array) get_option( 'qmn-settings' );
241
  $facebook_app_id = '594986844960937';
242
+ if ( isset( $settings['facebook_app_id'] ) ) {
243
+ $facebook_app_id = esc_js( $settings['facebook_app_id'] );
244
  }
245
+ $url = qsm_get_post_id_from_quiz_id( $mlw_quiz_array['quiz_id'] );
246
+ $page_link = $url . '?result_id=' . '%FB_RESULT_ID%';
247
+ $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '%QUIZ_NAME%' );
248
+ $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array );
249
+ $fb_image = plugins_url( '', dirname( __FILE__ ) ) . '/assets/facebook.png';
250
+ $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '" . esc_js( $sharing ) . "', '" . esc_js( $mlw_quiz_array['quiz_name'] ) . "', '$facebook_app_id', '$page_link');\"><img src='" . $fb_image . "' alt='" . __( 'Facebbok Share', 'quiz-master-next' ) . "' /></a>";
251
+ $content = str_replace( '%FACEBOOK_SHARE%', $social_display, $content );
252
  }
253
+ if ( false !== strpos( $content, '%TWITTER_SHARE%' ) ) {
254
+ $tw_image = plugins_url( '', dirname( __FILE__ ) ) . '/assets/twitter.png';
255
+ $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'twitter_sharing_text', '%QUIZ_NAME%' );
256
+ $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array );
257
+ $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '" . esc_js( $sharing ) . "', '" . esc_js( $mlw_quiz_array['quiz_name'] ) . "');\"><img src='" . $tw_image . "' alt='" . __( 'Twitter Share', 'quiz-master-next' ) . "' /></a>";
258
+ $content = str_replace( '%TWITTER_SHARE%', $social_display, $content );
259
  }
260
  return $content;
261
  }
264
  * Adds result id using the %RESULT_ID% variable
265
  */
266
  function qsm_variable_result_id( $content, $mlw_quiz_array ) {
267
+ while ( false !== strpos( $content, '%RESULT_ID%' ) ) {
268
+ global $wpdb;
269
+ $get_last_id = $wpdb->get_row( "SELECT result_id FROM {$wpdb->prefix}mlw_results ORDER BY result_id DESC", ARRAY_A );
270
+ $content = str_replace( '%RESULT_ID%', $get_last_id['result_id'], $content );
271
  }
272
  return $content;
273
  }
274
 
275
+ function mlw_qmn_variable_point_score( $content, $mlw_quiz_array ) {
276
+ $content = str_replace( '%POINT_SCORE%', ( isset( $mlw_quiz_array['total_points'] ) ? $mlw_quiz_array['total_points'] : '' ), $content );
 
277
  return $content;
278
  }
279
+ function mlw_qmn_variable_average_point( $content, $mlw_quiz_array ) {
280
+ $question_total = 0;
281
+ if ( isset( $mlw_quiz_array['question_answers_array'] ) ) {
282
+ foreach ( $mlw_quiz_array['question_answers_array'] as $single_question ) {
283
+ if ( $single_question['question_type'] !== '11' ) {
284
+ $question_total++;
285
+ }
286
+ }
 
 
 
 
 
 
287
  }
288
+ if ( isset( $mlw_quiz_array['total_questions'] ) && $mlw_quiz_array['total_questions'] != 0 && $question_total != 0 ) {
289
+ if ( qsm_is_allow_score_roundoff() ) {
290
+ $mlw_average_points = round( $mlw_quiz_array['total_points'] / $question_total );
291
+ } else {
292
+ $mlw_average_points = round( $mlw_quiz_array['total_points'] / $question_total, 2 );
293
+ }
294
+ } else {
295
  $mlw_average_points = 0;
296
  }
297
+ $content = str_replace( '%AVERAGE_POINT%', $mlw_average_points, $content );
298
  return $content;
299
  }
300
 
301
+ function mlw_qmn_variable_amount_correct( $content, $mlw_quiz_array ) {
302
+ $content = str_replace( '%AMOUNT_CORRECT%', ( isset( $mlw_quiz_array['total_correct'] ) ? $mlw_quiz_array['total_correct'] : '' ), $content );
303
  return $content;
304
  }
305
 
308
  *
309
  * @since 7.0.3
310
  * @param string $content
311
+ * @param array $mlw_quiz_array
312
  * @return string
313
  */
314
+ function mlw_qmn_variable_amount_incorrect( $content, $mlw_quiz_array ) {
315
+ if ( false !== strpos( $content, '%AMOUNT_INCORRECT%' ) ) {
316
+ $total_question = $mlw_quiz_array['total_questions'];
317
+ $total_correct = $mlw_quiz_array['total_correct'];
318
  $total_incorrect = $total_question - $total_correct;
319
+ $content = str_replace( '%AMOUNT_INCORRECT%', max( $total_incorrect, 0 ), $content );
320
  }
321
  return $content;
322
  }
323
 
324
+ function mlw_qmn_variable_total_questions( $content, $mlw_quiz_array ) {
325
+ $content = str_replace( '%TOTAL_QUESTIONS%', ( isset( $mlw_quiz_array['total_questions'] ) ? $mlw_quiz_array['total_questions'] : '' ), $content );
326
  return $content;
327
  }
328
 
329
+ function mlw_qmn_variable_correct_score( $content, $mlw_quiz_array ) {
330
+ $content = str_replace( '%CORRECT_SCORE%', ( isset( $mlw_quiz_array['total_score'] ) ? round( $mlw_quiz_array['total_score'] ) : '' ), $content );
331
  return $content;
332
  }
333
 
334
+ function mlw_qmn_variable_quiz_name( $content, $mlw_quiz_array ) {
335
+ $content = str_replace( '%QUIZ_NAME%', ( isset( $mlw_quiz_array['quiz_name'] ) ? $mlw_quiz_array['quiz_name'] : '' ), $content );
336
  return $content;
337
  }
338
 
339
+ function mlw_qmn_variable_quiz_links( $content, $mlw_quiz_array ) {
340
  global $wpdb;
341
+ $quiz_link = qsm_get_post_id_from_quiz_id( $mlw_quiz_array['quiz_id'] );
342
+ if ( false !== strpos( $content, '%QUIZ_LINK%' ) ) {
343
+ $content = str_replace( '%QUIZ_LINK%', $quiz_link, $content );
344
  }
345
+ if ( false !== strpos( $content, '%RESULT_LINK%' ) ) {
346
  $result_link = $quiz_link;
347
+ if ( isset( $mlw_quiz_array['result_id'] ) ) {
348
+ $unique_id = $wpdb->get_var( $wpdb->prepare( "SELECT unique_id FROM {$wpdb->prefix}mlw_results WHERE quiz_id=%d AND result_id=%d", $mlw_quiz_array['quiz_id'], $mlw_quiz_array['result_id'] ) );
349
+ $result_link = add_query_arg( 'result_id', $unique_id, $quiz_link );
350
  }
351
+ $content = str_replace( '%RESULT_LINK%', $result_link, $content );
352
  }
353
  return $content;
354
  }
355
 
356
+ function mlw_qmn_variable_user_name( $content, $mlw_quiz_array ) {
357
+ $content = str_replace( '%USER_NAME%', ( isset( $mlw_quiz_array['user_name'] ) ? $mlw_quiz_array['user_name'] : '' ), $content );
358
  return $content;
359
  }
360
 
361
+ function mlw_qmn_variable_current_user( $content, $mlw_quiz_array ) {
362
  $current_user = wp_get_current_user();
363
+ $content = str_replace( '%USER_NAME%', $current_user->display_name, $content );
364
  return $content;
365
  }
366
  /**
368
  *
369
  * @since 7.1.11
370
  * @param string $content
371
+ * @param array $mlw_quiz_array
372
  * @return string
373
  */
374
+ function mlw_qmn_variable_user_full_name( $content, $mlw_quiz_array ) {
375
+ if ( false !== strpos( $content, '%FULL_NAME%' ) ) {
376
  $current_user = wp_get_current_user();
377
+ $firstname = get_user_meta( $current_user->ID, 'first_name', true );
378
+ $lastname = get_user_meta( $current_user->ID, 'last_name', true );
379
+ if ( ! empty( $firstname ) && ! empty( $lastname ) ) {
380
+ $full_name = $firstname . ' ' . $lastname;
381
+ } else {
382
  $full_name = $current_user->display_name;
 
383
  }
384
+
385
+ $content = str_replace( '%FULL_NAME%', ( isset( $full_name ) ? $full_name : '' ), $content );
386
+ }
387
  return $content;
388
  }
389
 
390
+ function mlw_qmn_variable_user_business( $content, $mlw_quiz_array ) {
391
+ $content = str_replace( '%USER_BUSINESS%', ( isset( $mlw_quiz_array['user_business'] ) ? $mlw_quiz_array['user_business'] : '' ), $content );
392
  return $content;
393
  }
394
 
395
+ function mlw_qmn_variable_user_phone( $content, $mlw_quiz_array ) {
396
+ $content = str_replace( '%USER_PHONE%', ( isset( $mlw_quiz_array['user_phone'] ) ? $mlw_quiz_array['user_phone'] : '' ), $content );
397
  return $content;
398
  }
399
 
400
+ function mlw_qmn_variable_user_email( $content, $mlw_quiz_array ) {
401
+ $content = str_replace( '%USER_EMAIL%', ( isset( $mlw_quiz_array['user_email'] ) ? $mlw_quiz_array['user_email'] : '' ), $content );
402
  return $content;
403
  }
404
 
408
  * @since 5.0.0
409
  * @return string The HTML for the content
410
  */
411
+ function qsm_contact_field_variable( $content, $results_array ) {
412
+ preg_match_all( '~%CONTACT_(.*?)%~i', $content, $matches );
413
+ for ( $i = 0; $i < count( $matches[0] ); $i++ ) {
414
+ $content = str_replace( '%CONTACT_' . $matches[1][ $i ] . '%', $results_array['contact'][ $matches[1][ $i ] - 1 ]['value'], $content );
415
  }
416
  return $content;
417
  }
422
  * @since 5.0.0
423
  * @return string The HTML for the content
424
  */
425
+ function qsm_all_contact_fields_variable( $content, $results ) {
426
  $return = '';
427
+ if ( isset( $results['contact'] ) && ( is_array( $results['contact'] ) || is_object( $results['contact'] ) ) ) {
428
+ for ( $i = 0; $i < count( $results['contact'] ); $i++ ) {
429
+ $return .= $results['contact'][ $i ]['label'] . ': ' . $results['contact'][ $i ]['value'] . '<br>';
430
  }
431
  }
432
+ $content = str_replace( '%CONTACT_ALL%', $return, $content );
433
  return $content;
434
  }
435
 
439
  * @param string $content The content to be checked for the template
440
  * @param array $mlw_quiz_array The array for the response data
441
  */
442
+ function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
443
  global $mlwQuizMasterNext;
444
+ $logic_rules = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'logic_rules' );
445
+ $logic_rules = unserialize( $logic_rules );
446
+ $hidden_questions = isset( $mlw_quiz_array['hidden_questions'] ) ? $mlw_quiz_array['hidden_questions'] : array();
447
+ if ( empty( $hidden_questions ) ) {
448
+ $hidden_questions = isset( $mlw_quiz_array['results']['hidden_questions'] ) ? $mlw_quiz_array['results']['hidden_questions'] : array();
449
  }
450
  // Checks if the variable is present in the content.
451
+ while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false || strpos( $content, '%QUESTIONS_ANSWERS_EMAIL%' ) !== false ) {
452
  global $wpdb;
453
  $display = '';
454
+ if ( strpos( $content, '%QUESTIONS_ANSWERS_EMAIL%' ) !== false ) {
455
+ if ( isset( $mlw_quiz_array['quiz_settings'] ) && ! empty( $mlw_quiz_array['quiz_settings'] ) ) {
456
+ $quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
457
+ $qmn_question_answer_template = isset( $quiz_text_settings['question_answer_email_template'] ) ? apply_filters( 'qsm_section_setting_text', $quiz_text_settings['question_answer_email_template'] ) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
458
  } else {
459
+ $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_email_template', '%QUESTION%<br/>Answer Provided: %USER_ANSWER%<br/>Correct Answer: %CORRECT_ANSWER%<br/>Comments Entered: %USER_COMMENTS%' );
460
  }
461
  } else {
462
+ if ( isset( $mlw_quiz_array['quiz_settings'] ) && ! empty( $mlw_quiz_array['quiz_settings'] ) ) {
463
+ $quiz_text_settings = isset( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ? @unserialize( stripslashes( $mlw_quiz_array['quiz_settings']['quiz_text'] ) ) : array();
464
+ $qmn_question_answer_template = isset( $quiz_text_settings['question_answer_template'] ) ? apply_filters( 'qsm_section_setting_text', $quiz_text_settings['question_answer_template'] ) : $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
465
  } else {
466
+ $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br/>%USER_ANSWERS_DEFAULT%' );
467
  }
468
  }
469
+ $questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
470
  $qmn_questions = array();
471
+ foreach ( $questions as $question ) {
472
+ $qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
473
  }
474
 
475
  // Cycles through each answer in the responses.
476
+ $total_question_cnt = count( $mlw_quiz_array['question_answers_array'] );
477
+ $qsm_question_cnt = 1;
478
+ foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
479
+ if ( in_array( $answer['id'], $hidden_questions ) ) {
480
  continue;
481
  }
482
+ $display .= qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question_answer_template, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt );
483
  $qsm_question_cnt++;
484
  }
485
  $display = "<div class='qsm_questions_answers_section'>{$display}</div>";
486
+ $content = str_replace( '%QUESTIONS_ANSWERS%', $display, $content );
487
+ $content = str_replace( '%QUESTIONS_ANSWERS_EMAIL%', $display, $content );
488
  }
489
  return $content;
490
  }
491
 
492
+ function mlw_qmn_variable_comments( $content, $mlw_quiz_array ) {
493
+ $content = str_replace( '%COMMENT_SECTION%', ( isset( $mlw_quiz_array['comments'] ) ? $mlw_quiz_array['comments'] : '' ), $content );
494
  return $content;
495
  }
496
 
497
+ function mlw_qmn_variable_timer( $content, $mlw_quiz_array ) {
498
+ $content = str_replace( '%TIMER%', ( isset( $mlw_quiz_array['timer'] ) ? $mlw_quiz_array['timer'] : '' ), $content );
499
  return $content;
500
  }
501
 
502
+ function mlw_qmn_variable_timer_minutes( $content, $mlw_quiz_array ) {
503
+ $mlw_minutes = ( isset( $mlw_quiz_array['timer'] ) ? round( $mlw_quiz_array['timer'] / 60, 2 ) : '' );
504
+ $content = str_replace( '%TIMER_MINUTES%', $mlw_minutes, $content );
505
  return $content;
506
  }
507
 
509
  * Replaces the variable %CURRENT_DATE% and displays the current date
510
  *
511
  * @param string $content The contents of the results page
512
+ * @param array $results The array of all the results from user taking the quiz
513
  * @return string Returns the contents for the results page
514
  */
515
+ function mlw_qmn_variable_date( $content, $results ) {
516
+ $date = date_i18n( get_option( 'date_format' ), time() );
517
+ $content = str_replace( '%CURRENT_DATE%', $date, $content );
518
  return $content;
519
  }
520
 
522
  * Replaces the variable %DATE_TAKEN% and returns the date the user submitted his or her responses
523
  *
524
  * @param string $content The contents of the results page
525
+ * @param array $results The array of all the results from user taking the quiz
526
  * @return string Returns the contents for the results page
527
  */
528
+ function mlw_qmn_variable_date_taken( $content, $mlw_quiz_array ) {
529
  $date = '';
530
+ if ( isset( $mlw_quiz_array['time_taken'] ) ) {
531
+ $date = date_i18n( get_option( 'date_format' ), strtotime( $mlw_quiz_array['time_taken'] ) );
532
  }
533
+ $content = str_replace( '%DATE_TAKEN%', $date, $content );
534
  return $content;
535
  }
536
 
537
  /*
538
+ * Replaces variable %CATEGORY_POINTS% with the points for that category
539
+ *
540
+ * Filter function that replaces variable %CATEGORY_POINTS% with the points from the category inside the variable tags. i.e. %CATEGORY_POINTS%category 1%/CATEGORY_POINTS%
541
+ *
542
+ * @since 4.0.0
543
+ * @param string $content The contents of the results page
544
+ * @param array $mlw_quiz_array The array of all the results from user taking the quiz
545
+ * @return string Returns the contents for the results page
546
+ */
547
+ function qmn_variable_category_points( $content, $mlw_quiz_array ) {
 
548
  $return_points = 0;
549
+ while ( strpos( $content, '%CATEGORY_POINTS%' ) !== false || false !== strpos( $content, '%CATEGORY_POINTS_' ) ) {
 
550
  $return_points = 0;
551
+ preg_match( '~%CATEGORY_POINTS%(.*?)%/CATEGORY_POINTS%~i', $content, $answer_text );
552
+ if ( empty( $answer_text ) ) {
553
+ $category_name = mlw_qmn_get_string_between( $content, '%CATEGORY_POINTS_', '%' );
554
+ } else {
555
+ $category_name = $answer_text[1];
556
+ }
557
 
558
+ foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
559
+ if ( $answer['category'] == $category_name ) {
560
+ $return_points += $answer['points'];
 
 
561
  }
562
  }
563
+ if ( empty( $answer_text ) ) {
564
+ $content = str_replace( '%CATEGORY_POINTS_' . $category_name . '%', $return_points, $content );
565
+ } else {
566
+ $content = str_replace( $answer_text[0], $return_points, $content );
567
+ }
568
  }
569
  return $content;
570
  }
571
 
572
  /*
573
+ * Replaces variable %CATEGORY_POINTS% with the average points for that category
574
+ *
575
+ * Filter function that replaces variable %CATEGORY_POINTS% with the average points from the category inside the variable tags. i.e. %CATEGORY_POINTS%category 1%/CATEGORY_POINTS%
576
+ *
577
+ * @since 4.0.0
578
+ * @param string $content The contents of the results page
579
+ * @param array $mlw_quiz_array The array of all the results from user taking the quiz
580
+ * @return string Returns the contents for the results page
581
+ */
582
  function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
583
  $return_points = 0;
584
+ while ( strpos( $content, '%AVERAGE_CATEGORY_POINTS%' ) !== false || false !== strpos( $content, '%AVERAGE_CATEGORY_POINTS_' ) ) {
585
+ $return_points = 0;
586
  $total_questions = 0;
587
+ preg_match( '~%AVERAGE_CATEGORY_POINTS%(.*?)%/AVERAGE_CATEGORY_POINTS%~i', $content, $answer_text );
588
+ if ( empty( $answer_text ) ) {
589
+ $category_name = mlw_qmn_get_string_between( $content, '%AVERAGE_CATEGORY_POINTS_', '%' );
590
+ } else {
591
+ $category_name = $answer_text[1];
592
+ }
593
  foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
594
+ if ( $answer['category'] == $category_name ) {
595
+ if ( $answer['question_type'] !== '11' ) {
596
+ $total_questions += 1;
597
+ }
598
+ $return_points += $answer['points'];
599
  }
600
  }
601
  if ( $total_questions !== 0 ) {
602
+ if ( qsm_is_allow_score_roundoff() ) {
603
+ $return_points = round( $return_points / $total_questions );
604
+ } else {
605
  $return_points = round( $return_points / $total_questions, 2 );
606
+ }
607
  } else {
608
  $return_points = 0;
609
  }
610
+ if ( empty( $answer_text ) ) {
611
+ $content = str_replace( '%AVERAGE_CATEGORY_POINTS_' . $category_name . '%', $return_points, $content );
612
+ } else {
613
+ $content = str_replace( $answer_text[0], $return_points, $content );
614
+ }
615
  }
616
  return $content;
617
  }
618
 
619
  /*
620
+ * Replaces variable %CATEGORY_SCORE% with the score for that category
621
+ *
622
+ * Filter function that replaces variable %CATEGORY_SCORE% with the score from the category inside the variable tags. i.e. %CATEGORY_SCORE%category 1%/CATEGORY_SCORE%
623
+ *
624
+ * @since 4.0.0
625
+ * @param string $content The contents of the results page
626
+ * @param array $mlw_quiz_array The array of all the results from user taking the quiz
627
+ * @return string Returns the contents for the results page
628
+ */
629
+ function qmn_variable_category_score( $content, $mlw_quiz_array ) {
630
+ $return_score = 0;
 
631
  $total_questions = 0;
632
+ $amount_correct = 0;
633
+ while ( strpos( $content, '%CATEGORY_SCORE%' ) !== false || false !== strpos( $content, '%CATEGORY_SCORE_' ) ) {
634
+ $return_score = 0;
 
635
  $total_questions = 0;
636
+ $amount_correct = 0;
637
+ preg_match( '~%CATEGORY_SCORE%(.*?)%/CATEGORY_SCORE%~i', $content, $answer_text );
638
+ if ( empty( $answer_text ) ) {
639
+ $category_name = mlw_qmn_get_string_between( $content, '%CATEGORY_SCORE_', '%' );
640
+ } else {
641
+ $category_name = $answer_text[1];
642
+ }
643
+ foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
644
+ if ( $answer['category'] == $category_name ) {
 
 
645
  $total_questions += 1;
646
+ if ( $answer['correct'] == 'correct' ) {
 
647
  $amount_correct += 1;
648
  }
649
  }
650
  }
651
+ if ( $total_questions != 0 ) {
652
+ if ( qsm_is_allow_score_roundoff() ) {
653
+ $return_score = round( ( ( $amount_correct / $total_questions ) * 100 ) );
654
+ } else {
655
+ $return_score = round( ( ( $amount_correct / $total_questions ) * 100 ), 2 );
656
+ }
657
+ } else {
 
 
658
  $return_score = 0;
659
  }
660
 
661
+ if ( empty( $answer_text ) ) {
662
+ $content = str_replace( '%CATEGORY_SCORE_' . $category_name . '%', $return_score, $content );
663
+ } else {
664
+ $content = str_replace( $answer_text[0], $return_score, $content );
665
+ }
 
666
  }
667
  return $content;
668
  }
669
 
670
  /*
671
+ * Replaces variable %CATEGORY_AVERAGE_SCORE% with the average score for all categories
672
+ *
673
+ * Filter function that replaces variable %CATEGORY_AVERAGE_SCORE% with the score from all categories.
674
+ *
675
+ * @since 4.0.0
676
+ * @param string $content The contents of the results page
677
+ * @param array $mlw_quiz_array The array of all the results from user taking the quiz
678
+ * @return string Returns the contents for the results page
679
+ */
680
+ function qmn_variable_category_average_score( $content, $mlw_quiz_array ) {
681
+ $return_score = 0;
 
682
  $total_categories = 0;
683
+ $total_score = 0;
684
+ $category_scores = array();
685
+ while ( strpos( $content, '%CATEGORY_AVERAGE_SCORE%' ) !== false ) {
686
+ foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
687
+ if ( ! isset( $category_scores[ $answer['category'] ]['total_questions'] ) ) {
688
+ $category_scores[ $answer['category'] ]['total_questions'] = 0;
 
 
 
689
  }
690
+ if ( ! isset( $category_scores[ $answer['category'] ]['amount_correct'] ) ) {
691
+ $category_scores[ $answer['category'] ]['amount_correct'] = 0;
 
692
  }
693
+ $category_scores[ $answer['category'] ]['total_questions'] += 1;
694
+ if ( $answer['correct'] == 'correct' ) {
695
+ $category_scores[ $answer['category'] ]['amount_correct'] += 1;
 
696
  }
697
  }
698
+ foreach ( $category_scores as $category ) {
699
+ $total_score += $category['amount_correct'] / $category['total_questions'];
 
700
  $total_categories += 1;
701
  }
702
+ if ( $total_categories != 0 ) {
703
+ if ( qsm_is_allow_score_roundoff() ) {
704
+ $return_score = round( ( ( $total_score / $total_categories ) * 100 ) );
705
+ } else {
706
+ $return_score = round( ( ( $total_score / $total_categories ) * 100 ), 2 );
707
+ }
708
+ } else {
 
 
709
  $return_score = 0;
710
  }
711
+ $content = str_replace( '%CATEGORY_AVERAGE_SCORE%', $return_score, $content );
712
  }
713
  return $content;
714
  }
715
 
716
  /*
717
+ * Replaces variable %CATEGORY_AVERAGE_POINTS% with the average points for all categories
718
+ *
719
+ * Filter function that replaces variable %CATEGORY_AVERAGE_POINTS% with the points from all categories.
720
+ *
721
+ * @since 4.0.0
722
+ * @param string $content The contents of the results page
723
+ * @param array $mlw_quiz_array The array of all the results from user taking the quiz
724
+ * @return string Returns the contents for the results page
725
+ */
726
+ function qmn_variable_category_average_points( $content, $mlw_quiz_array ) {
727
+ $return_score = 0;
 
728
  $total_categories = 0;
729
+ $total_points = 0;
730
+ $category_scores = array();
731
+ while ( strpos( $content, '%CATEGORY_AVERAGE_POINTS%' ) !== false ) {
732
+ foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
733
+ if ( ! isset( $category_scores[ $answer['category'] ]['points'] ) ) {
734
+ $category_scores[ $answer['category'] ]['points'] = 0;
 
 
 
735
  }
736
+ $category_scores[ $answer['category'] ]['points'] += $answer['points'];
737
  }
738
+ foreach ( $category_scores as $category ) {
739
+ $total_points += $category['points'];
 
740
  $total_categories += 1;
741
  }
742
+ $return_score = $total_points / $total_categories;
743
+ $content = str_replace( '%CATEGORY_AVERAGE_POINTS%', $return_score, $content );
744
  }
745
  return $content;
746
  }
747
 
748
+ add_filter( 'qmn_end_results', 'qsm_end_results_rank', 9999, 3 );
749
+ function qsm_end_results_rank( $result_display, $qmn_quiz_options, $qmn_array_for_variables ) {
750
+ while ( strpos( $result_display, '%RANK%' ) !== false ) {
751
+ global $wpdb;
752
+ $mlw_quiz_id = $qmn_array_for_variables['quiz_id'];
753
+ $mlw_result_id = $wpdb->get_var( $wpdb->prepare( "SELECT MAX(result_id) FROM {$wpdb->prefix}mlw_results WHERE quiz_id=%d AND deleted=0", $mlw_quiz_id ) );
754
+ $mlw_result_data = $wpdb->get_results( $wpdb->prepare( "SELECT result_id, correct_score, point_score, quiz_results FROM {$wpdb->prefix}mlw_results WHERE quiz_id=%d AND deleted=0", $mlw_quiz_id ) );
755
+ if ( ! empty( $mlw_result_data ) ) {
756
+ foreach ( $mlw_result_data as $key => $mlw_eaches ) {
757
+ $time_taken = 0;
758
+ $mlw_qmn_results_array = @unserialize( $mlw_eaches->quiz_results );
759
+ if ( is_array( $mlw_qmn_results_array ) ) {
760
+ $time_taken = $mlw_qmn_results_array[0];
761
+ if ( isset( $mlw_qmn_results_array['timer_ms'] ) && $mlw_qmn_results_array['timer_ms'] > 0 ) {
762
+ $time_taken = $mlw_qmn_results_array['timer_ms'];
763
+ } else {
764
+ $time_taken = ( $time_taken * 1000 );
765
+ }
 
766
  }
767
+ $mlw_result_data[ $key ]->total_time_taken = $time_taken;
768
  }
769
+ array_multisort( array_column( $mlw_result_data, 'correct_score' ), SORT_DESC, array_column( $mlw_result_data, 'total_time_taken' ), SORT_ASC, $mlw_result_data );
770
+ /**
771
+ * Find Rank
772
+ */
773
+ $rank = 0;
774
+ foreach ( $mlw_result_data as $mlw_eaches ) {
775
+ $rank++;
776
+ if ( $mlw_eaches->result_id == $mlw_result_id ) {
777
+ $mlw_rank = $rank;
778
+ }
 
779
  }
780
  }
781
+ $result_display = str_replace( '%RANK%', $mlw_rank, $result_display );
782
  }
 
 
783
  return $result_display;
784
  }
785
 
797
  function qsm_custom_wpkses_post_tags( $tags, $context ) {
798
 
799
  if ( 'post' === $context ) {
800
+ $tags['iframe'] = array(
801
+ 'src' => true,
802
+ 'height' => true,
803
+ 'width' => true,
804
+ 'frameborder' => true,
805
+ 'allowfullscreen' => true,
806
+ );
807
+ $tags['video'] = array(
808
+ 'width' => true,
809
+ 'height' => true,
810
+ );
811
+ $tags['source'] = array(
812
+ 'src' => true,
813
+ 'type' => true,
814
+ );
815
  }
816
 
817
  return $tags;
831
  * @param int $total_question_cnt
832
  * @return string
833
  */
834
+ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question_answer_template, $questions, $qmn_questions, $answer, $qsm_question_cnt, $total_question_cnt ) {
835
+ global $mlwQuizMasterNext;
836
+ if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'qsm_quiz_result_details' ) {
837
+ $user_answer_class = '';
838
+ $question_answer_class = '';
839
+ if ( isset( $mlw_quiz_array['form_type'] ) && $mlw_quiz_array['form_type'] == 0 ) {
840
+ if ( $mlw_quiz_array['quiz_system'] == 0 || $mlw_quiz_array['quiz_system'] == 3 ) {
841
+ if ( $answer['correct'] === 'correct' ) {
842
+ $user_answer_class = 'qmn_user_correct_answer';
843
+ $question_answer_class = 'qmn_question_answer_correct';
844
+ } else {
845
+ $user_answer_class = 'qmn_user_incorrect_answer';
846
+ $question_answer_class = 'qmn_question_answer_incorrect';
847
+ }
848
+ }
849
+ }
850
+ } else {
851
+ if ( $answer['correct'] === 'correct' ) {
852
+ $user_answer_class = 'qmn_user_correct_answer';
853
+ $question_answer_class = 'qmn_question_answer_correct';
854
+ } else {
855
+ $user_answer_class = 'qmn_user_incorrect_answer';
856
+ $question_answer_class = 'qmn_question_answer_incorrect';
857
+ }
858
+ }
859
 
860
+ $mlw_question_answer_display = htmlspecialchars_decode( $qmn_question_answer_template, ENT_QUOTES );
861
+ $disable_description_on_result = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'disable_description_on_result' );
862
+ // Get question setting
863
+ $question_settings = isset( $questions[ $answer['id'] ]['settings'] ) ? $questions[ $answer['id'] ]['settings'] : array();
864
+ if ( isset( $answer['question_title'] ) && $answer['question_title'] != '' ) {
865
+ $add_br = '';
866
+ if ( $answer[0] != '' ) {
867
+ $add_br = '<br/>';
868
+ }
869
+ if ( $disable_description_on_result == 1 ) {
870
+ $mlw_question_answer_display = str_replace( '%QUESTION%', '<b>' . htmlspecialchars_decode( $answer['question_title'], ENT_QUOTES ) . '</b>', $mlw_question_answer_display );
871
+ } else {
872
+ $mlw_question_answer_display = str_replace( '%QUESTION%', '<b>' . htmlspecialchars_decode( $answer['question_title'], ENT_QUOTES ) . '</b>' . $add_br . htmlspecialchars_decode( $answer[0], ENT_QUOTES ), $mlw_question_answer_display );
873
+ }
874
+ } else {
875
+ $mlw_question_answer_display = str_replace( '%QUESTION%', '<b>' . htmlspecialchars_decode( $answer[0], ENT_QUOTES ) . '</b>', $mlw_question_answer_display );
876
+ }
877
+ $mlw_question_answer_display = qsm_question_title_func( $mlw_question_answer_display );
878
+ $extra_border_bottom_class = '';
879
+ $remove_border = true;
880
+ if ( strpos( $mlw_question_answer_display, '%USER_ANSWERS_DEFAULT%' ) !== false ) {
881
+ $remove_border = false;
882
+ $question_with_answer_text = '';
883
+ $extra_border_bottom_class = 'qsm-add-border-bottom';
884
+ $show_two_option_questions = array(
885
+ 3,
886
+ 12,
887
+ 5,
888
+ 7,
889
+ 14,
890
+ );
891
+ $form_type = isset( $mlw_quiz_array['form_type'] ) ? $mlw_quiz_array['form_type'] : 0;
892
+ $quiz_system = isset( $mlw_quiz_array['quiz_system'] ) ? $mlw_quiz_array['quiz_system'] : 0;
893
+ if ( isset( $answer['id'] ) && isset( $questions[ $answer['id'] ] ) && ! empty( $questions[ $answer['id'] ] ) ) {
894
+ $total_answers = isset( $questions[ $answer['id'] ]['answers'] ) ? $questions[ $answer['id'] ]['answers'] : array();
895
+ if ( $total_answers ) {
896
+ if ( isset( $answer['question_type'] ) && in_array( $answer['question_type'], $show_two_option_questions ) ) {
897
+ $do_show_wrong = true;
898
+ foreach ( $total_answers as $single_answer ) {
899
+ $current_answer_zero = trim( htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) );
900
+ if ( $form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 ) ) {
901
+ if ( isset( $single_answer[2] ) && $single_answer[2] == 1 ) {
902
+ $actual_answer = htmlspecialchars_decode( $answer[1], ENT_QUOTES );
903
+ if ( $answer['question_type'] == 5 ) {
904
+ $actual_answer = trim( str_replace( ' ', '', preg_replace( '/\s\s+/', '', $actual_answer ) ) );
905
+ $current_answer_zero = trim( str_replace( ' ', '', preg_replace( '/\s\s+/', '', $current_answer_zero ) ) );
906
  }
907
+
908
+ if ( strcasecmp( $actual_answer, $current_answer_zero ) == 0 ) {
909
+ $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode( $answer[1], ENT_QUOTES ) . '</span>';
910
+ $do_show_wrong = false;
911
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912
  }
913
+ } else {
914
+ if ( isset( $single_answer[2] ) && strcasecmp( htmlspecialchars_decode( $answer[1], ENT_QUOTES ), $current_answer_zero ) == 0 ) {
915
+ $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) . '</span>';
916
+ $do_show_wrong = false;
917
+ }
918
+ }
919
+ }
920
+ if ( $do_show_wrong ) {
921
+ if ( $form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 ) ) {
922
+ $user_given_answer = $answer[1] == '' ? __( 'No answer provided', 'quiz-master-next' ) : $answer[1];
923
+ $question_with_answer_text .= '<span class="qsm-text-wrong-option">' . htmlspecialchars_decode( $user_given_answer, ENT_QUOTES ) . '</span>';
924
+ foreach ( $total_answers as $single_answer ) {
925
+ if ( isset( $single_answer[2] ) && $single_answer[2] == 1 ) {
926
+ $question_with_answer_text .= '<span class="qsm-text-correct-option">' . htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) . '</span>';
927
+ break;
928
+ }
929
+ }
930
+ } else {
931
+ $user_given_answer = $answer[1] == '' ? __( 'No answer provided', 'quiz-master-next' ) : $answer[1];
932
+ $question_with_answer_text .= '<span class="qsm-text-simple-option">' . htmlspecialchars_decode( $user_given_answer, ENT_QUOTES ) . '</span>';
933
+ }
934
+ }
935
+ } elseif ( isset( $answer['question_type'] ) && $answer['question_type'] == 11 ) {
936
+ $file_extension = substr( $answer[1], -4 );
937
+ if ( $file_extension == '.jpg' || $file_extension == '.jpeg' || $file_extension == '.png' || $file_extension == '.gif' ) {
938
+ $question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
939
+ } else {
940
+ $question_with_answer_text .= "<span class='$user_answer_class'>" . trim( htmlspecialchars_decode( $answer[1], ENT_QUOTES ) ) . '</span>';
941
+ }
942
+ } else {
943
+ if ( $form_type == 0 && ( $quiz_system == 0 || $quiz_system == 3 ) ) {
944
+ if ( isset( $answer['question_type'] ) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 ) ) {
945
+ $user_selected_answer = htmlspecialchars_decode( $answer[1], ENT_QUOTES );
946
+ $new_array_user_answer = isset( $answer['user_compare_text'] ) ? explode( '=====', $answer['user_compare_text'] ) : array();
947
+ foreach ( $total_answers as $single_answer ) {
948
+ $current_answer_text = trim( stripslashes( htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) ) );
949
+ $is_answer_correct = false;
950
+ if ( $new_array_user_answer ) {
951
+ foreach ( $new_array_user_answer as $new_array_value ) {
952
+ $new_array_value = trim( stripslashes( htmlspecialchars_decode( $new_array_value, ENT_QUOTES ) ) );
953
+ if ( $current_answer_text == $new_array_value ) {
954
+ $is_answer_correct = true;
955
+ break;
956
+ }
957
+ }
958
+ }
959
+ $image_class = '';
960
+ if ( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'image' ) {
961
+ $show_user_answer = '<img src="' . htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) . '"/>';
962
+ $image_class = 'qmn_image_option';
963
+ } else {
964
+ $show_user_answer = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
965
+ $image_class = '';
966
+ }
967
+ if ( isset( $single_answer[2] ) && $single_answer[2] == 1 && $is_answer_correct ) {
968
+ $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer ' . $image_class . '">' . $show_user_answer . '</span>';
969
+ } elseif ( isset( $single_answer[2] ) && $single_answer[2] == 1 ) {
970
+ $question_with_answer_text .= '<span class="qsm-text-correct-option ' . $image_class . '">' . $show_user_answer . '</span>';
971
+ } elseif ( $is_answer_correct && $single_answer[2] !== 1 ) {
972
+ $question_with_answer_text .= '<span class="qsm-text-wrong-option ' . $image_class . '">' . $show_user_answer . '</span>';
973
+ } else {
974
+ $question_with_answer_text .= '<span class="qsm-text-simple-option ' . $image_class . '">' . $show_user_answer . '</span>';
975
+ }
976
+ }
977
+ } else {
978
+ if ( $answer['question_type'] == 13 ) {
979
+ $questionid = $questions[ $answer['id'] ]['question_id'];
980
+ $question_with_answer_text .= qmn_polar_display_on_resultspage( $questionid, $questions, $total_answers, $answer );
981
+ } else {
982
+ foreach ( $total_answers as $single_answer ) {
983
  $single_answer_option = $single_answer[0];
984
+ if ( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'rich' ) {
985
+ $single_answer_option = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
986
+ $single_answer_option = htmlentities( $single_answer_option );
987
+ if ( strpos( $single_answer_option, '&lt;' ) !== false || strpos( $single_answer_option, '&quot;' ) !== false ) {
988
+ $single_answer_option = htmlspecialchars( $single_answer_option );
989
+ }
990
+ if ( strpos( $answer[1], '&lt;' ) !== false || strpos( $answer[1], '&quot;' ) !== false ) {
991
+ $answer_value = htmlentities( $answer[1] );
992
+ } else {
993
+ $answer_value = htmlspecialchars_decode( $answer[1], ENT_QUOTES );
994
+ $answer_value = htmlspecialchars_decode( $answer_value, ENT_QUOTES );
995
+ $answer_value = htmlentities( $answer_value );
996
+ $answer_value = htmlspecialchars( $answer_value );
997
+ }
998
+ } else {
999
+ $answer_value = htmlspecialchars_decode( $answer[1], ENT_QUOTES );
1000
  }
1001
+ $image_class = '';
1002
+ if ( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'image' ) {
1003
+ $show_user_answer = '<img src="' . htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) . '"/>';
1004
+ $image_class = 'qmn_image_option';
 
 
1005
  } else {
1006
+ $show_user_answer = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
1007
+ $image_class = '';
1008
+ }
1009
+ if ( isset( $single_answer[2] ) && $single_answer[2] == 1 && $answer_value == $single_answer_option ) {
1010
+ $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer ' . $image_class . '">' . $show_user_answer . '</span>';
1011
+ } elseif ( isset( $single_answer[2] ) && $single_answer[2] == 1 ) {
1012
+ $question_with_answer_text .= '<span class="qsm-text-correct-option ' . $image_class . '">' . $show_user_answer . '</span>';
1013
+ } elseif ( $answer_value == $single_answer_option && $single_answer[2] !== 1 ) {
1014
+ $question_with_answer_text .= '<span class="qsm-text-wrong-option ' . $image_class . '">' . $show_user_answer . '</span>';
1015
+ } else {
1016
+ $question_with_answer_text .= '<span class="qsm-text-simple-option ' . $image_class . '">' . $show_user_answer . '</span>';
1017
  }
1018
  }
1019
  }
1020
+ }
1021
+ } else {
1022
+ if ( isset( $answer['question_type'] ) && ( $answer['question_type'] == 4 || $answer['question_type'] == 10 ) ) {
1023
+ $user_selected_answer = htmlspecialchars_decode( $answer[1], ENT_QUOTES );
1024
+ foreach ( $total_answers as $single_answer ) {
1025
+ $image_class = '';
1026
+ if ( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'image' ) {
1027
+ $show_user_answer = '<img src="' . htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) . '"/>';
1028
+ $image_class = 'qmn_image_option';
1029
+ } else {
1030
+ $show_user_answer = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
1031
+ $image_class = '';
1032
+ }
1033
+ if ( strpos( $user_selected_answer, $single_answer[0] ) !== false ) {
1034
+ $question_with_answer_text .= '<span class="qsm-text-correct-option ' . $image_class . '">' . $show_user_answer . '</span>';
1035
+ } else {
1036
+ $question_with_answer_text .= '<span class="qsm-text-simple-option ' . $image_class . '">' . $show_user_answer . '</span>';
1037
+ }
1038
  }
1039
+ } else {
1040
+ if ( $answer['question_type'] == 13 ) {
1041
+ $questionid = $questions[ $answer['id'] ]['question_id'];
1042
+
1043
+ $question_with_answer_text .= qmn_polar_display_on_resultspage( $questionid, $questions, $total_answers, $answer );
1044
+ } else {
1045
+ foreach ( $total_answers as $single_answer ) {
1046
+ $image_class = '';
1047
+ if ( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'image' ) {
1048
+ $show_user_answer = '<img src="' . htmlspecialchars_decode( $single_answer[0], ENT_QUOTES ) . '"/>';
1049
+ $image_class = 'qmn_image_option';
1050
+ } else {
1051
+ $show_user_answer = htmlspecialchars_decode( $single_answer[0], ENT_QUOTES );
1052
+ $image_class = '';
1053
+ }
1054
+ if ( htmlspecialchars_decode( $answer[1], ENT_QUOTES ) == $single_answer[0] ) {
1055
+ $question_with_answer_text .= '<span class="qsm-text-correct-option ' . $image_class . '">' . $show_user_answer . '</span>';
1056
  } else {
1057
+ $question_with_answer_text .= '<span class="qsm-text-simple-option ' . $image_class . '">' . $show_user_answer . '</span>';
1058
  }
1059
  }
1060
  }
1061
+ }
1062
+ }
1063
+ }
1064
+ } else {
1065
+ if ( isset( $answer['question_type'] ) && $answer['question_type'] == 11 ) {
1066
+ $file_extension = substr( $answer[1], -4 );
1067
+ if ( $file_extension == '.jpg' || $file_extension == '.jpeg' || $file_extension == '.png' || $file_extension == '.gif' ) {
1068
+ $question_with_answer_text .= "<span class='$user_answer_class'><img src='$answer[1]'/></span>";
1069
+ } else {
1070
+ $question_with_answer_text .= "<span class='$user_answer_class'>" . trim( htmlspecialchars_decode( $answer[1], ENT_QUOTES ) ) . '</span>';
1071
+ }
1072
+ } else {
1073
+ $question_with_answer_text .= '<span class="qsm-user-answer-text">' . htmlspecialchars_decode( $answer[1], ENT_QUOTES ) . '</span>';
1074
+ }
1075
+ }
1076
+ }
1077
+ $mlw_question_answer_display = str_replace( '%USER_ANSWERS_DEFAULT%', do_shortcode( $question_with_answer_text ), $mlw_question_answer_display );
1078
+ }
1079
+ if ( isset( $answer['question_type'] ) && $answer['question_type'] == 11 ) {
1080
+ $file_extension = substr( $answer[1], -4 );
1081
+ if ( $file_extension == '.jpg' || $file_extension == '.jpeg' || $file_extension == '.png' || $file_extension == '.gif' ) {
1082
+ $mlw_question_answer_display = str_replace( '%USER_ANSWER%', "<span class='$user_answer_class'><img src='$answer[1]'/></span>", $mlw_question_answer_display );
1083
+ } else {
1084
+ $mlw_question_answer_display = str_replace( '%USER_ANSWER%', "<span class='$user_answer_class'>" . trim( htmlspecialchars_decode( $answer[1], ENT_QUOTES ) ) . '</span>', $mlw_question_answer_display );
1085
+ }
1086
+ } else {
1087
+ $user_answer_new = $answer[1];
1088
+ if ( ( $answer['question_type'] == 0 || $answer['question_type'] == 1 || $answer['question_type'] == 2 ) && $answer[1] == '' ) {
1089
+ $user_answer_new = __( 'No Answer Provided', 'quiz-master-next' );
1090
+ }
1091
+ if ( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'image' && $user_answer_new != '' ) {
1092
+ $image_url = htmlspecialchars_decode( $user_answer_new, ENT_QUOTES );
1093
+ $mlw_question_answer_display = str_replace( '%USER_ANSWER%', "<span class='$user_answer_class'><img src='$image_url'/></span>", $mlw_question_answer_display );
1094
+ } else {
1095
+ $mlw_question_answer_display = str_replace( '%USER_ANSWER%', "<span class='$user_answer_class'>" . htmlspecialchars_decode( $user_answer_new, ENT_QUOTES ) . '</span>', $mlw_question_answer_display );
1096
+ }
1097
+ }
1098
+ $answer_2 = ! empty( $answer[2] ) ? $answer[2] : 'NA';
1099
+ if ( isset( $question_settings['answerEditor'] ) && $question_settings['answerEditor'] == 'image' && $answer_2 != 'NA' ) {
1100
+ $image_url = htmlspecialchars_decode( $answer_2, ENT_QUOTES );
1101
+ $mlw_question_answer_display = str_replace( '%CORRECT_ANSWER%', '<img src="' . $image_url . '"/>', $mlw_question_answer_display );
1102
+ } else {
1103
+ $mlw_question_answer_display = str_replace( '%CORRECT_ANSWER%', htmlspecialchars_decode( $answer_2, ENT_QUOTES ), $mlw_question_answer_display );
1104
+ }
1105
+ $answer_3 = ! empty( $answer[3] ) ? $answer[3] : 'NA';
1106
+ $mlw_question_answer_display = str_replace( '%USER_COMMENTS%', $answer_3, $mlw_question_answer_display );
1107
+ $answer_4 = ! empty( $qmn_questions[ $answer['id'] ] ) ? $qmn_questions[ $answer['id'] ] : 'NA';
1108
+ $mlw_question_answer_display = str_replace( '%CORRECT_ANSWER_INFO%', htmlspecialchars_decode( $answer_4, ENT_QUOTES ), $mlw_question_answer_display );
1109
+ // Point score of the particular question.
1110
+ $question_point = isset( $answer['points'] ) ? $answer['points'] : '0';
1111
+ $mlw_question_answer_display = str_replace( '%QUESTION_POINT_SCORE%', htmlspecialchars_decode( $question_point, ENT_QUOTES ), $mlw_question_answer_display );
1112
 
1113
+ $question_max_point = ( isset( $questions[ $answer['id'] ] ) ? qsm_get_question_maximum_points( $questions[ $answer['id'] ] ) : 0 );
1114
+ $mlw_question_answer_display = str_replace( '%QUESTION_MAX_POINTS%', $question_max_point, $mlw_question_answer_display );
1115
 
1116
+ $mlw_question_answer_display = wp_kses_post( $mlw_question_answer_display );
1117
+ if ( $total_question_cnt == $qsm_question_cnt && $remove_border == false ) {
1118
+ $extra_border_bottom_class = 'qsm-remove-border-bottom';
1119
+ }
1120
+ $mlw_question_answer_display = apply_filters( 'qsm_question_answers_template_variable', $mlw_question_answer_display, $mlw_quiz_array, $answer );
1121
+ $question_obj = ( isset( $questions[ $answer['id'] ] ) ? $questions[ $answer['id'] ] : null );
1122
+ $display = "<div class='qmn_question_answer $extra_border_bottom_class $question_answer_class'>" . apply_filters( 'qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array, $question_obj ) . '</div>';
1123
+ return $display;
1124
  }
1125
+ function qsm_get_question_maximum_points( $question = array() ) {
1126
  $question_max_point = 0;
1127
+ if ( ! empty( $question ) && isset( $question['answers'] ) ) {
1128
+ $answer_points = array( 0 );
1129
+ foreach ( $question['answers'] as $ans ) {
1130
+ if ( isset( $ans[1] ) ) {
1131
+ $answer_points[] = intval( $ans[1] );
1132
  }
1133
  }
1134
+ $question_max_point = max( $answer_points );
1135
+ if ( $question['question_type_new'] == 4 || $question['question_type_new'] == 10 ) {
1136
+ $limit_multiple_response = ( isset( $question['settings']['limit_multiple_response'] ) ) ? intval( $question['settings']['limit_multiple_response'] ) : 0;
1137
+ if ( $limit_multiple_response > 0 && count( $answer_points ) > $limit_multiple_response ) {
1138
+ rsort( $answer_points );
1139
+ $answer_points = array_slice( $answer_points, 0, $limit_multiple_response, true );
1140
  }
1141
+ $question_max_point = array_sum( $answer_points );
1142
  }
1143
  }
1144
  return $question_max_point;
1145
  }
1146
  /**
1147
+ * check is allow round off
1148
+ *
1149
+ * @since 7.1.10
1150
+ */
1151
+ function qsm_is_allow_score_roundoff() {
 
1152
  global $mlwQuizMasterNext;
1153
+ $score_roundoff = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'score_roundoff' );
1154
+ $form_type = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'form_type' );
1155
+ $system = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'system' );
1156
 
1157
  // check if quiz type Quiz and Geading system Correct/Incorrect Or Both Type
1158
+ if ( $score_roundoff && $form_type == 0 && ( $system == 0 || $system == 3 ) ) {
1159
  return 1;
1160
+ } else {
1161
  return 0;
1162
+ }
1163
+
1164
  }
1165
  /**
1166
+ * Display Polor Question on Result page
1167
+ *
1168
+ * @params $id The ID of the multiple choice question
1169
+ * @params $question The question that is being edited.
1170
+ * @params @answers The array that contains the answers to the question.
1171
+ * @params @answer The array that contains the answers choose by user.
1172
+ * @return $question_display Returns the content of the question
1173
+ * @since 7.1.10
1174
+ */
1175
+ function qmn_polar_display_on_resultspage( $id, $question, $answers, $answer ) {
1176
+ $question_display = '';
1177
+ global $mlwQuizMasterNext;
1178
+ $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
1179
+ $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'autofill' );
1180
+ $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' );
1181
+ $autofill_att = $autofill ? "autocomplete='off' " : '';
1182
+ $limit_text_att = $limit_text ? "maxlength='" . $limit_text . "' " : '';
1183
+ $input_text = '';
1184
+ $first_point = isset( $answers[0][1] ) ? $answers[0][1] : 0;
1185
+ $second_point = isset( $answers[1][1] ) ? $answers[1][1] : 0;
1186
+ $is_reverse = false;
1187
+ $check_point = $second_point;
1188
+ $font_weight_lc = 'right-polar-title';
1189
+ $font_weight_rc = 'left-polar-title';
1190
+ if ( $first_point > $second_point ) {
1191
+ $is_reverse = true;
1192
+ $check_point = $first_point;
1193
+ $font_weight_lc = 'left-polar-title';
1194
+ $font_weight_rc = 'right-polar-title';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1195
  }
1196
+ $total_answer = count( $answers );
1197
+ ?>
1198
+ <script type="text/javascript">
1199
+ (function($) {
1200
+ $(document).ready(function() {
1201
+
1202
+ $('#slider-' + '<?php echo $id; ?>').slider({
1203
+ <?php if ( $total_answer == 2 && $is_reverse ) { ?>
1204
+ max: <?php echo $answers[0][1]; ?>,
1205
+ min: <?php echo $answers[1][1]; ?>,
1206
+ isRTL: true,
1207
+ <?php } else { ?>
1208
+ min: <?php echo $answers[0][1]; ?>,
1209
+ max: <?php echo $answers[1][1]; ?>,
1210
+ <?php } ?>
1211
+ step: 1,
1212
+ range: false,
1213
+ value: <?php echo $answer['points']; ?>,
1214
+ slide: function slider_slide(event, ui) {
1215
+ return false; // this code not allow to dragging
1216
+ }
1217
+ });
1218
+ var maxHeight = Math.max.apply(null, $(".mlw-qmn-question-result-<?php echo $id; ?>> div").map(
1219
+ function() {
1220
+ return $(this).height();
1221
+ }).get());
1222
+ $('.mlw-qmn-question-result-<?php echo $id; ?>').height(maxHeight);
1223
+ });
1224
+ })(jQuery);
1225
+ </script>
1226
+ <?php
1227
+ if ( $required == 0 ) {
1228
+ $mlw_requireClass = 'mlwRequiredText';
1229
+ } else {
1230
+ $mlw_requireClass = '';
1231
  }
1232
+ if ( $answer['points'] == $answers[0][1] ) {
1233
+ $left_polar_title_style = "style='font-weight:900;'";
1234
+ $right_polar_title_style = "style='font-weight:100';";
1235
+ } elseif ( $answer['points'] == $check_point / 2 ) {
1236
+ $left_polar_title_style = "style='font-weight:400;'";
1237
+ $right_polar_title_style = "style='font-weight400;'";
1238
+ } elseif ( $answer['points'] > $check_point / 2 ) {
1239
+ $left_polar_title_style = "style='font-weight:400;'";
1240
+ $right_polar_title_style = "style='font-weight:600;'";
1241
+ } elseif ( $answer['points'] < $check_point / 2 ) {
1242
+ $left_polar_title_style = "style='font-weight:600;'";
1243
+ $right_polar_title_style = "style='font-weight:400;'";
1244
+ } else {
1245
+ $left_polar_title_style = "style='font-weight:400;'";
1246
+ $right_polar_title_style = "style='font-weight:400;'";
1247
  }
1248
+ $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
1249
+ $question_title = qsm_question_title_func( $question, '', $new_question_title );
1250
+ $input_text .= "<div class='left-polar-title' $left_polar_title_style>" . $answers[0][0] . '</div>';
1251
+ $input_text .= "<div class='slider-main-wrapper'><input type='hidden' class='qmn_polar $mlw_requireClass' id='question" . $id . "' name='question" . $id . "' />";
1252
+ $input_text .= '<div id="slider-' . $id . '"></div></div>';
1253
+ $input_text .= "<div class='right-polar-title' $right_polar_title_style>" . $answers[1][0] . '</div>';
1254
+ $question = $input_text;
1255
+ $question_display .= "<span class='mlw_qmn_question mlw-qmn-question-result-$id question-type-polar-s'>" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . '</span>';
1256
+ return apply_filters( 'qmn_polar_display_front', $question_display, $id, $question, $answers );
1257
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress q
4
  Requires at least: 4.9
5
  Tested up to: 5.7
6
  Requires PHP: 5.4
7
- Stable tag: 7.1.19
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -140,6 +140,11 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
140
 
141
  == Changelog ==
142
 
 
 
 
 
 
143
  = 7.1.19 (June 3, 2021) =
144
  * Bug: Fixed security issue related to IP address sanitization.
145
 
4
  Requires at least: 4.9
5
  Tested up to: 5.7
6
  Requires PHP: 5.4
7
+ Stable tag: 7.2.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
140
 
141
  == Changelog ==
142
 
143
+ = 7.2.0 (June 21, 2021) =
144
+ * Feature: Introduced QSM Themes.
145
+ * Feature: Introduced image type answers.
146
+ * Bug: Fixed issue where there is an empty last page while using auto pagination.
147
+
148
  = 7.1.19 (June 3, 2021) =
149
  * Bug: Fixed security issue related to IP address sanitization.
150
 
templates/qmn_primary.css CHANGED
@@ -5,14 +5,16 @@
5
  }
6
 
7
  .ui-tooltip {
8
- max-width: 500px !important;
9
  }
 
10
  .ui-tooltip-content {
11
- max-width: 500px !important;
12
  }
 
13
  .mlw_qmn_hint_link {
14
- text-decoration:underline;
15
- color:rgb(0,0,255);
16
  }
17
 
18
  @-moz-keyframes spinner-loader {
@@ -20,16 +22,19 @@
20
  -moz-transform: rotate(0deg);
21
  transform: rotate(0deg);
22
  }
 
23
  100% {
24
  -moz-transform: rotate(360deg);
25
  transform: rotate(360deg);
26
  }
27
  }
 
28
  @-webkit-keyframes spinner-loader {
29
  0% {
30
  -webkit-transform: rotate(0deg);
31
  transform: rotate(0deg);
32
  }
 
33
  100% {
34
  -webkit-transform: rotate(360deg);
35
  transform: rotate(360deg);
@@ -43,6 +48,7 @@
43
  -webkit-transform: rotate(0deg);
44
  transform: rotate(0deg);
45
  }
 
46
  100% {
47
  -moz-transform: rotate(360deg);
48
  -ms-transform: rotate(360deg);
@@ -81,7 +87,9 @@
81
  border-bottom: 1px solid #f3f3f3;
82
  }
83
 
84
- .mlw_qmn_message_before p { margin: 0 0 10px 0; }
 
 
85
 
86
  .quiz_section {
87
  display: block;
@@ -101,8 +109,8 @@
101
  margin: 0 0 5px 0;
102
  font-weight: bold;
103
  -webkit-box-sizing: border-box;
104
- -moz-box-sizing: border-box;
105
- box-sizing: border-box;
106
  }
107
 
108
  /*.quiz_section > .mlw_qmn_question,
@@ -110,20 +118,20 @@
110
  display: inline-block;
111
  }*/
112
 
113
- .quiz_section > .quiz-cat{
114
- margin-left: 15px;
115
- font-size: 14px;
116
- font-weight: bold;
117
- float: right;
118
  }
119
 
120
  .qsm_contact_div {
121
- margin: 10px 0;
122
  }
123
 
124
  .quiz_section .qsm-contact-type-checkbox label,
125
  .quiz_section .qsm-contact-type-checkbox input {
126
- display: inline;
127
  }
128
 
129
  label.inline,
@@ -138,7 +146,9 @@ label.inline .mlw_qmn_question,
138
  color: #999;
139
  }
140
 
141
- .quiz_section iframe { margin-bottom: 10px; }
 
 
142
 
143
  .qmn_mc_answer_wrap {
144
  display: block;
@@ -146,7 +156,7 @@ label.inline .mlw_qmn_question,
146
  }
147
 
148
  .qmn_radio_answers .qmn_mc_answer_wrap {
149
- cursor: pointer;
150
  }
151
 
152
  .quiz_section .qmn_radio_answers label,
@@ -169,26 +179,28 @@ label.inline .mlw_qmn_question,
169
  .quiz_section input[type="text"],
170
  .quiz_section input[type="email"],
171
  .quiz_section input[type="number"] {
172
- width: 70%;
173
- min-height: 35px;
174
- display: inline-block;
175
- padding: 10px 8px 10px 8px;
176
- font-size: 14px;
177
- color: #555;
178
- background: #fff;
179
- border: 1px solid #e3e3e3;
180
- -webkit-border-radius: 3px;
181
- -moz-border-radius: 3px;
182
- border-radius: 3px;
183
- -webkit-box-sizing: border-box;
184
- -moz-box-sizing: border-box;
185
- box-sizing: border-box;
186
- -webkit-transition: all .5s ease-in-out;
187
- -moz-transition: all .5s ease-in-out;
188
- transition: all .5s ease-in-out;
189
- }
190
-
191
- .quiz_section select { height: 38px; }
 
 
192
 
193
  .quiz_section select:hover,
194
  .quiz_section textarea:hover,
@@ -203,9 +215,35 @@ border: 1px solid #e3e3e3;
203
  outline: 0;
204
  background: #f7f7f7;
205
  border: 1px solid #bdc3c7;
206
- -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.15);
207
- -moz-box-shadow: 0 0 10px rgba(0,0,0,0.15);
208
- box-shadow: 0 0 10px rgba(0,0,0,0.15);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
210
 
211
  .qmn_fill_blank {
@@ -213,9 +251,17 @@ border: 1px solid #e3e3e3;
213
  width: 100px !important;
214
  }
215
 
216
- .qmn_fill_blank.small { width: 50px; }
217
- .qmn_fill_blank.medium { width: 100px; }
218
- .qmn_fill_blank.large { width: 150px; }
 
 
 
 
 
 
 
 
219
 
220
 
221
  /* Alerts and error state */
@@ -228,8 +274,8 @@ border: 1px solid #e3e3e3;
228
  padding: 10px;
229
  margin: 10px 0 10px 0;
230
  -webkit-border-radius: 3px;
231
- -moz-border-radius: 3px;
232
- border-radius: 3px;
233
  }
234
 
235
  .quiz_section.qmn_error select,
@@ -252,16 +298,18 @@ border: 1px solid #e3e3e3;
252
  .quiz_section.qmn_error input[type="number"]:focus,
253
  .quiz_section.qmn_error input[type="email"]:focus,
254
  .quiz_section.qmn_error input[type="checkbox"]:focus,
255
- .quiz_section.qmn_error input[type="file"]:focus {
256
  position: relative;
257
  border: 1px solid #da4f49;
258
  background: #F2DEDE;
259
  -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
260
- -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
261
- box-shadow: 0 0 10px rgba(218, 79, 73, .35);
262
  }
263
 
264
- .quiz_section.qmn_error { position: relative; }
 
 
265
 
266
  .quiz_section.qmn_error:after {
267
  content: '-';
@@ -278,8 +326,8 @@ border: 1px solid #e3e3e3;
278
  right: 0;
279
  top: 12px;
280
  -webkit-border-radius: 20px;
281
- -moz-border-radius: 20px;
282
- border-radius: 20px;
283
 
284
  }
285
 
@@ -290,11 +338,12 @@ border: 1px solid #e3e3e3;
290
  background: #F2DEDE;
291
  padding: 5px;
292
  -webkit-border-radius: 3px;
293
- -moz-border-radius: 3px;
294
- border-radius: 3px;
295
  }
296
 
297
- .qmn_btn, .qmn_quiz_container .btn {
 
298
  display: relative;
299
  display: inline-block;
300
  color: #666 !important;
@@ -303,36 +352,37 @@ border: 1px solid #e3e3e3;
303
  padding: 10px 20px 10px 20px !important;
304
  text-decoration: none !important;
305
  -webkit-border-radius: 3px;
306
- -moz-border-radius: 3px;
307
- border-radius: 3px;
308
- -webkit-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
309
- -moz-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
310
- box-shadow: 0px 0px 6px rgba(0,0,0,.05);
311
- -webkit-transition: background .25s ease-out;
312
- -moz-transition: background .25s ease-out;
313
- transition: background .25s ease-out;
314
- }
315
-
316
- .qmn_btn:hover, .qmn_quiz_container .btn:hover {
 
317
  color: #fff;
318
  background: #666;
319
  }
320
 
321
  .qmn_pagination {
322
- position: relative;
323
- display: flex;
324
- align-items: stretch;
325
- flex-direction: column;
326
- padding: 15px 0 15px 0;
327
- border-top: 1px solid #f3f3f3;
328
  }
329
 
330
  @media screen and (min-width: 500px) {
331
- .qmn_pagination {
332
- justify-content: space-between;
333
- align-items: center;
334
- flex-direction: row;
335
- }
336
  }
337
 
338
  /* .qmn_page_counter_message {
@@ -355,12 +405,12 @@ border: 1px solid #e3e3e3;
355
  padding: 0 20px;
356
  background: #34495e;
357
  color: #fff;
358
- -webkit-border-radius: 50px;
359
- -moz-border-radius: 50px;
360
- border-radius: 50px;
361
- -webkit-box-shadow: 0 4px 8px rgba(0,0,0,.10);
362
- -moz-box-shadow: 0 4px 8px rgba(0,0,0,.10);
363
- box-shadow: 0 4px 8px rgba(0,0,0,.10);
364
  }
365
 
366
  .qmn_quiz_container select,
@@ -381,31 +431,40 @@ border: 1px solid #e3e3e3;
381
  .qmn_quiz_container textarea:focus,
382
  .qmn_quiz_container input[type="text"]:focus,
383
  .qmn_quiz_container input[type="email"]:focus,
384
- .qmn_quiz_container input[type="number"]:focus{
385
  outline: 0;
386
  background: #fff;
387
  border: 1px solid #3498db;
388
  -webkit-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
389
- -moz-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
390
- box-shadow: 0 0 10px rgba(52, 152, 219, .35);
391
  }
392
 
393
- .qmn_quiz_container .qmn_btn, .qmn_quiz_container .btn {
 
394
  color: #fff !important;
395
  background: #3498db !important;
396
  }
397
 
398
- .qmn_quiz_container .qmn_btn:hover, .qmn_quiz_container .btn:hover { background: #2980b9 !important; }
 
 
 
399
 
400
  .quiz_section.quiz_end .qsm-submit-btn {
401
- display: block;
402
- margin: 10px 0;
403
  }
404
 
405
  /* Helper classes */
406
 
407
- .border-none { border: 0; }
408
- .margin-bottom { margin-bottom: 20px; }
 
 
 
 
 
409
 
410
 
411
  @media (max-width: 768px) {
@@ -419,7 +478,9 @@ border: 1px solid #e3e3e3;
419
  font-size: 18px;
420
  }
421
 
422
- .quiz_section p.form-help { font-size: 14px; }
 
 
423
 
424
  .quiz_section select,
425
  .quiz_section textarea,
@@ -441,46 +502,50 @@ border: 1px solid #e3e3e3;
441
  right: 0;
442
  }
443
 
444
- .mlw_qmn_timer { top: 20px; }
 
 
445
 
446
  }
447
 
448
  .quick-question-res-p {
449
- border: 2px solid;
450
- padding: 5px 10px;
451
- margin: 0;
452
- border-radius: 5px;
453
  }
454
 
455
- .mlw_qmn_quiz_link{
456
- cursor: pointer;
457
  }
458
 
459
- .qsm-results-page .qmn_question_answer{
460
- margin-bottom: 30px;
461
  }
462
 
463
- .page-timer-wrapper{
464
- display: flex;
465
- max-width: 100%;
466
- box-sizing: border-box;
467
- text-align: center;
468
- align-items: center;
469
- justify-content: space-between;
470
- margin-bottom: 10px;
471
  }
472
- .page-timer-wrapper .qsm-pagetimer{
473
- font-size: 18px;
474
- font-weight: bold;
475
- line-height: 24px;
476
- color: #333;
477
- padding: 5px 10px;
478
- box-shadow: 0 0 10px 1px #eee;
479
- border-radius: 5px;
480
- }
481
- .page-timer-wrapper .qsm-pagetimer-warning{
482
- box-sizing: border-box;
483
- color: red;
484
- font-size: 18px;
485
- line-height: 24px;
 
 
486
  }
5
  }
6
 
7
  .ui-tooltip {
8
+ max-width: 500px !important;
9
  }
10
+
11
  .ui-tooltip-content {
12
+ max-width: 500px !important;
13
  }
14
+
15
  .mlw_qmn_hint_link {
16
+ text-decoration: underline;
17
+ color: rgb(0, 0, 255);
18
  }
19
 
20
  @-moz-keyframes spinner-loader {
22
  -moz-transform: rotate(0deg);
23
  transform: rotate(0deg);
24
  }
25
+
26
  100% {
27
  -moz-transform: rotate(360deg);
28
  transform: rotate(360deg);
29
  }
30
  }
31
+
32
  @-webkit-keyframes spinner-loader {
33
  0% {
34
  -webkit-transform: rotate(0deg);
35
  transform: rotate(0deg);
36
  }
37
+
38
  100% {
39
  -webkit-transform: rotate(360deg);
40
  transform: rotate(360deg);
48
  -webkit-transform: rotate(0deg);
49
  transform: rotate(0deg);
50
  }
51
+
52
  100% {
53
  -moz-transform: rotate(360deg);
54
  -ms-transform: rotate(360deg);
87
  border-bottom: 1px solid #f3f3f3;
88
  }
89
 
90
+ .mlw_qmn_message_before p {
91
+ margin: 0 0 10px 0;
92
+ }
93
 
94
  .quiz_section {
95
  display: block;
109
  margin: 0 0 5px 0;
110
  font-weight: bold;
111
  -webkit-box-sizing: border-box;
112
+ -moz-box-sizing: border-box;
113
+ box-sizing: border-box;
114
  }
115
 
116
  /*.quiz_section > .mlw_qmn_question,
118
  display: inline-block;
119
  }*/
120
 
121
+ .quiz_section>.quiz-cat {
122
+ margin-left: 15px;
123
+ font-size: 14px;
124
+ font-weight: bold;
125
+ float: right;
126
  }
127
 
128
  .qsm_contact_div {
129
+ margin: 10px 0;
130
  }
131
 
132
  .quiz_section .qsm-contact-type-checkbox label,
133
  .quiz_section .qsm-contact-type-checkbox input {
134
+ display: inline;
135
  }
136
 
137
  label.inline,
146
  color: #999;
147
  }
148
 
149
+ .quiz_section iframe {
150
+ margin-bottom: 10px;
151
+ }
152
 
153
  .qmn_mc_answer_wrap {
154
  display: block;
156
  }
157
 
158
  .qmn_radio_answers .qmn_mc_answer_wrap {
159
+ cursor: pointer;
160
  }
161
 
162
  .quiz_section .qmn_radio_answers label,
179
  .quiz_section input[type="text"],
180
  .quiz_section input[type="email"],
181
  .quiz_section input[type="number"] {
182
+ width: 70%;
183
+ min-height: 35px;
184
+ display: inline-block;
185
+ padding: 10px 8px 10px 8px;
186
+ font-size: 14px;
187
+ color: #555;
188
+ background: #fff;
189
+ border: 1px solid #e3e3e3;
190
+ -webkit-border-radius: 3px;
191
+ -moz-border-radius: 3px;
192
+ border-radius: 3px;
193
+ -webkit-box-sizing: border-box;
194
+ -moz-box-sizing: border-box;
195
+ box-sizing: border-box;
196
+ -webkit-transition: all .5s ease-in-out;
197
+ -moz-transition: all .5s ease-in-out;
198
+ transition: all .5s ease-in-out;
199
+ }
200
+
201
+ .quiz_section select {
202
+ height: 38px;
203
+ }
204
 
205
  .quiz_section select:hover,
206
  .quiz_section textarea:hover,
215
  outline: 0;
216
  background: #f7f7f7;
217
  border: 1px solid #bdc3c7;
218
+ -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
219
+ -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
220
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
221
+ }
222
+
223
+ .qsm-results-page .qmn_image_option,
224
+ .quiz_section .qmn_image_option {
225
+ width: 47%;
226
+ height: 250px;
227
+ display: inline-flex !important;
228
+ /* position: relative; */
229
+ }
230
+
231
+ .qsm-results-page .qmn_image_option input[type="radio"],
232
+ .qsm-results-page .qmn_image_option input[type="checkbox"],
233
+ .quiz_section .qmn_image_option input[type="radio"],
234
+ .quiz_section .qmn_image_option input[type="checkbox"] {
235
+ margin-top: 263px;
236
+ }
237
+
238
+ .qsm-results-page .qmn_image_option img,
239
+ .quiz_section .qmn_image_option img {
240
+ width: 100%;
241
+ height: 100%;
242
+ object-fit: cover;
243
+ }
244
+
245
+ .qsm-results-page .qmn_image_option img {
246
+ overflow: hidden;
247
  }
248
 
249
  .qmn_fill_blank {
251
  width: 100px !important;
252
  }
253
 
254
+ .qmn_fill_blank.small {
255
+ width: 50px;
256
+ }
257
+
258
+ .qmn_fill_blank.medium {
259
+ width: 100px;
260
+ }
261
+
262
+ .qmn_fill_blank.large {
263
+ width: 150px;
264
+ }
265
 
266
 
267
  /* Alerts and error state */
274
  padding: 10px;
275
  margin: 10px 0 10px 0;
276
  -webkit-border-radius: 3px;
277
+ -moz-border-radius: 3px;
278
+ border-radius: 3px;
279
  }
280
 
281
  .quiz_section.qmn_error select,
298
  .quiz_section.qmn_error input[type="number"]:focus,
299
  .quiz_section.qmn_error input[type="email"]:focus,
300
  .quiz_section.qmn_error input[type="checkbox"]:focus,
301
+ .quiz_section.qmn_error input[type="file"]:focus {
302
  position: relative;
303
  border: 1px solid #da4f49;
304
  background: #F2DEDE;
305
  -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
306
+ -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
307
+ box-shadow: 0 0 10px rgba(218, 79, 73, .35);
308
  }
309
 
310
+ .quiz_section.qmn_error {
311
+ position: relative;
312
+ }
313
 
314
  .quiz_section.qmn_error:after {
315
  content: '-';
326
  right: 0;
327
  top: 12px;
328
  -webkit-border-radius: 20px;
329
+ -moz-border-radius: 20px;
330
+ border-radius: 20px;
331
 
332
  }
333
 
338
  background: #F2DEDE;
339
  padding: 5px;
340
  -webkit-border-radius: 3px;
341
+ -moz-border-radius: 3px;
342
+ border-radius: 3px;
343
  }
344
 
345
+ .qmn_btn,
346
+ .qmn_quiz_container .btn {
347
  display: relative;
348
  display: inline-block;
349
  color: #666 !important;
352
  padding: 10px 20px 10px 20px !important;
353
  text-decoration: none !important;
354
  -webkit-border-radius: 3px;
355
+ -moz-border-radius: 3px;
356
+ border-radius: 3px;
357
+ -webkit-box-shadow: 0px 0px 6px rgba(0, 0, 0, .05);
358
+ -moz-box-shadow: 0px 0px 6px rgba(0, 0, 0, .05);
359
+ box-shadow: 0px 0px 6px rgba(0, 0, 0, .05);
360
+ -webkit-transition: background .25s ease-out;
361
+ -moz-transition: background .25s ease-out;
362
+ transition: background .25s ease-out;
363
+ }
364
+
365
+ .qmn_btn:hover,
366
+ .qmn_quiz_container .btn:hover {
367
  color: #fff;
368
  background: #666;
369
  }
370
 
371
  .qmn_pagination {
372
+ position: relative;
373
+ display: flex;
374
+ align-items: stretch;
375
+ flex-direction: column;
376
+ padding: 15px 0 15px 0;
377
+ border-top: 1px solid #f3f3f3;
378
  }
379
 
380
  @media screen and (min-width: 500px) {
381
+ .qmn_pagination {
382
+ justify-content: space-between;
383
+ align-items: center;
384
+ flex-direction: row;
385
+ }
386
  }
387
 
388
  /* .qmn_page_counter_message {
405
  padding: 0 20px;
406
  background: #34495e;
407
  color: #fff;
408
+ -webkit-border-radius: 50px;
409
+ -moz-border-radius: 50px;
410
+ border-radius: 50px;
411
+ -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, .10);
412
+ -moz-box-shadow: 0 4px 8px rgba(0, 0, 0, .10);
413
+ box-shadow: 0 4px 8px rgba(0, 0, 0, .10);
414
  }
415
 
416
  .qmn_quiz_container select,
431
  .qmn_quiz_container textarea:focus,
432
  .qmn_quiz_container input[type="text"]:focus,
433
  .qmn_quiz_container input[type="email"]:focus,
434
+ .qmn_quiz_container input[type="number"]:focus {
435
  outline: 0;
436
  background: #fff;
437
  border: 1px solid #3498db;
438
  -webkit-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
439
+ -moz-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
440
+ box-shadow: 0 0 10px rgba(52, 152, 219, .35);
441
  }
442
 
443
+ .qmn_quiz_container .qmn_btn,
444
+ .qmn_quiz_container .btn {
445
  color: #fff !important;
446
  background: #3498db !important;
447
  }
448
 
449
+ .qmn_quiz_container .qmn_btn:hover,
450
+ .qmn_quiz_container .btn:hover {
451
+ background: #2980b9 !important;
452
+ }
453
 
454
  .quiz_section.quiz_end .qsm-submit-btn {
455
+ display: block;
456
+ margin: 10px 0;
457
  }
458
 
459
  /* Helper classes */
460
 
461
+ .border-none {
462
+ border: 0;
463
+ }
464
+
465
+ .margin-bottom {
466
+ margin-bottom: 20px;
467
+ }
468
 
469
 
470
  @media (max-width: 768px) {
478
  font-size: 18px;
479
  }
480
 
481
+ .quiz_section p.form-help {
482
+ font-size: 14px;
483
+ }
484
 
485
  .quiz_section select,
486
  .quiz_section textarea,
502
  right: 0;
503
  }
504
 
505
+ .mlw_qmn_timer {
506
+ top: 20px;
507
+ }
508
 
509
  }
510
 
511
  .quick-question-res-p {
512
+ border: 2px solid;
513
+ padding: 5px 10px;
514
+ margin: 0;
515
+ border-radius: 5px;
516
  }
517
 
518
+ .mlw_qmn_quiz_link {
519
+ cursor: pointer;
520
  }
521
 
522
+ .qsm-results-page .qmn_question_answer {
523
+ margin-bottom: 30px;
524
  }
525
 
526
+ .page-timer-wrapper {
527
+ display: flex;
528
+ max-width: 100%;
529
+ box-sizing: border-box;
530
+ text-align: center;
531
+ align-items: center;
532
+ justify-content: space-between;
533
+ margin-bottom: 10px;
534
  }
535
+
536
+ .page-timer-wrapper .qsm-pagetimer {
537
+ font-size: 18px;
538
+ font-weight: bold;
539
+ line-height: 24px;
540
+ color: #333;
541
+ padding: 5px 10px;
542
+ box-shadow: 0 0 10px 1px #eee;
543
+ border-radius: 5px;
544
+ }
545
+
546
+ .page-timer-wrapper .qsm-pagetimer-warning {
547
+ box-sizing: border-box;
548
+ color: red;
549
+ font-size: 18px;
550
+ line-height: 24px;
551
  }