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

Version Description

(Oct 24, 2019) = * Massive overhaule for being responsive in admin panel. * Checkbox limit ([Issue #743] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/743) * Logic addon bug ([Issue #760] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/760) * Add filter to results array ([Issue #785] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/785)

Download this release

Release Info

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

Code changes from version 6.3.3 to 6.3.4

Files changed (110) hide show
  1. css/qsm-admin-question.css +7 -0
  2. css/qsm-admin.css +341 -290
  3. css/quizzes-list.css +23 -0
  4. js/qsm-admin-question.js +50 -7
  5. js/qsm-quiz.js +17 -5
  6. mlw_quizmaster2.php +4 -4
  7. php/admin/admin-results-page.php +2 -1
  8. php/admin/options-page-questions-tab.php +6 -1
  9. php/classes/class-qmn-quiz-manager.php +2 -2
  10. php/classes/class-qsm-install.php +1 -0
  11. php/question-types.php +6 -3
  12. php/rest-api.php +3 -1
  13. php/shortcodes.php +60 -1
  14. readme.txt +7 -2
  15. trunk/CHANGELOG.md +0 -849
  16. trunk/CONTRIBUTING.md +0 -52
  17. trunk/ISSUE_TEMPLATE.md +0 -25
  18. trunk/LICENSE.md +0 -339
  19. trunk/README.md +0 -22
  20. trunk/addons.xml +0 -113
  21. trunk/assets/facebook.png +0 -0
  22. trunk/assets/icon-128x128.png +0 -0
  23. trunk/assets/index.php +0 -4
  24. trunk/assets/screenshot-1.png +0 -0
  25. trunk/assets/screenshot-2.png +0 -0
  26. trunk/assets/screenshot-3.png +0 -0
  27. trunk/assets/screenshot-4.png +0 -0
  28. trunk/assets/screenshot-5.png +0 -0
  29. trunk/assets/screenshot-6.png +0 -0
  30. trunk/assets/screenshot-7.png +0 -0
  31. trunk/assets/twitter.png +0 -0
  32. trunk/blocks/block.js +0 -42
  33. trunk/blocks/block.php +0 -44
  34. trunk/blocks/index.php +0 -3
  35. trunk/css/index.php +0 -4
  36. trunk/css/jquery-ui.css +0 -1177
  37. trunk/css/qmn_quiz.css +0 -15
  38. trunk/css/qsm-admin-contact.css +0 -39
  39. trunk/css/qsm-admin-question.css +0 -353
  40. trunk/css/qsm-admin.css +0 -686
  41. trunk/index.php +0 -4
  42. trunk/js/Chart.min.js +0 -11
  43. trunk/js/admin.js +0 -107
  44. trunk/js/index.php +0 -4
  45. trunk/js/micromodal.min.js +0 -30
  46. trunk/js/progressbar.min.js +0 -2
  47. trunk/js/qsm-admin-contact.js +0 -189
  48. trunk/js/qsm-admin-emails.js +0 -133
  49. trunk/js/qsm-admin-question.js +0 -564
  50. trunk/js/qsm-admin-results.js +0 -135
  51. trunk/js/qsm-admin.js +0 -134
  52. trunk/js/qsm-quiz.js +0 -798
  53. trunk/mlw_quizmaster2.php +0 -303
  54. trunk/php/admin/about-page.php +0 -94
  55. trunk/php/admin/addons-page.php +0 -189
  56. trunk/php/admin/admin-results-details-page.php +0 -172
  57. trunk/php/admin/admin-results-page.php +0 -394
  58. trunk/php/admin/dashboard-widgets.php +0 -280
  59. trunk/php/admin/functions.php +0 -13
  60. trunk/php/admin/help-page.php +0 -166
  61. trunk/php/admin/index.php +0 -4
  62. trunk/php/admin/options-page-contact-tab.php +0 -78
  63. trunk/php/admin/options-page-email-tab.php +0 -187
  64. trunk/php/admin/options-page-option-tab.php +0 -29
  65. trunk/php/admin/options-page-preview-tab.php +0 -36
  66. trunk/php/admin/options-page-questions-tab.php +0 -355
  67. trunk/php/admin/options-page-results-page-tab.php +0 -192
  68. trunk/php/admin/options-page-style-tab.php +0 -105
  69. trunk/php/admin/options-page-text-tab.php +0 -106
  70. trunk/php/admin/quiz-options-page.php +0 -185
  71. trunk/php/admin/quizzes-page.php +0 -394
  72. trunk/php/admin/settings-page.php +0 -292
  73. trunk/php/admin/stats-page.php +0 -199
  74. trunk/php/admin/tools-page.php +0 -199
  75. trunk/php/adverts-generate.php +0 -51
  76. trunk/php/classes/class-qmn-alert-manager.php +0 -48
  77. trunk/php/classes/class-qmn-log-manager.php +0 -177
  78. trunk/php/classes/class-qmn-plugin-helper.php +0 -638
  79. trunk/php/classes/class-qmn-quiz-creator.php +0 -648
  80. trunk/php/classes/class-qmn-quiz-manager.php +0 -1664
  81. trunk/php/classes/class-qmn-review-message.php +0 -131
  82. trunk/php/classes/class-qsm-audit.php +0 -59
  83. trunk/php/classes/class-qsm-changelog-generator.php +0 -155
  84. trunk/php/classes/class-qsm-contact-manager.php +0 -301
  85. trunk/php/classes/class-qsm-emails.php +0 -469
  86. trunk/php/classes/class-qsm-fields.php +0 -248
  87. trunk/php/classes/class-qsm-install.php +0 -1435
  88. trunk/php/classes/class-qsm-questions.php +0 -318
  89. trunk/php/classes/class-qsm-results-pages.php +0 -350
  90. trunk/php/classes/class-qsm-settings.php +0 -434
  91. trunk/php/classes/class-qsm-tracking.php +0 -232
  92. trunk/php/classes/index.php +0 -3
  93. trunk/php/default-templates.php +0 -11
  94. trunk/php/gdpr.php +0 -291
  95. trunk/php/images/green_triangle.png +0 -0
  96. trunk/php/images/index.php +0 -4
  97. trunk/php/images/red_triangle.png +0 -0
  98. trunk/php/index.php +0 -4
  99. trunk/php/question-types.php +0 -950
  100. trunk/php/rest-api.php +0 -350
  101. trunk/php/shortcodes.php +0 -37
  102. trunk/php/template-variables.php +0 -588
  103. trunk/readme.txt +0 -168
  104. trunk/templates/qmn_amethyst.css +0 -427
  105. trunk/templates/qmn_base.css +0 -574
  106. trunk/templates/qmn_emerald.css +0 -426
  107. trunk/templates/qmn_gray.css +0 -393
  108. trunk/templates/qmn_primary.css +0 -458
  109. trunk/templates/qmn_turquoise.css +0 -427
  110. trunk/uninstall.php +0 -38
css/qsm-admin-question.css CHANGED
@@ -350,4 +350,11 @@ a.import-button.button.disable_import::before {
350
  float: right;
351
  margin-bottom: 20px;
352
  margin-right: 10px;
 
 
 
 
 
 
 
353
  }
350
  float: right;
351
  margin-bottom: 20px;
352
  margin-right: 10px;
353
+ }
354
+
355
+ @media screen and (max-width: 575px){
356
+ .qsm-popup__container{
357
+ min-width: auto;
358
+ max-width: 100%;
359
+ }
360
  }
css/qsm-admin.css CHANGED
@@ -12,52 +12,52 @@ span.qsm-quiz-name {
12
  }
13
 
14
  .qsm-quizzes-page-content {
15
- display: flex;
16
- flex-direction: column;
17
- justify-content: space-between;
18
  }
19
 
20
  .qsm-quiz-page-wrapper {
21
- flex-grow: 1;
22
  }
23
 
24
  .qsm-quiz-page-wrapper-with-ads {
25
- flex-grow: 1;
26
  }
27
 
28
  .qsm-news-ads {
29
- background-color: #0d97d8;
30
  }
31
 
32
  .qsm-news-ads-title {
33
- text-align: center;
34
- border-bottom: 5px solid #1DD969;
35
- margin: 0;
36
- padding: 10px 0;
37
- background-color: #fff;
38
  }
39
 
40
  .qsm-edit-name {
41
- font-size: 12px !important;
42
  }
43
 
44
  .qsm-action-link {
45
- font-size: 14px !important;
46
  }
47
 
48
  .qsm-action-links:hover {
49
- background-color: black;
50
  }
51
 
52
  .qsm-action-link-delete {
53
- color: red !important;
54
  }
55
 
56
  .qsm-dialog-form label {
57
- display: inline-block;
58
- font-size: 16px;
59
- font-weight: bold;
60
- padding-right: 30px;
61
  }
62
 
63
  .qsm-quiz-page-addon{
@@ -71,17 +71,17 @@ span.qsm-quiz-name {
71
  }
72
 
73
  @media screen and (min-width: 1200px) {
74
- .qsm-quizzes-page-content {
75
- flex-direction: row;
76
- }
77
 
78
- .qsm-quiz-page-wrapper-with-ads {
79
- margin-right: 10px;
80
- }
81
 
82
- .qsm-news-ads {
83
- flex-basis: 15%;
84
- }
85
  }
86
 
87
  @media screen and (max-width: 767px) {
@@ -100,15 +100,15 @@ Options Page
100
  *********************/
101
 
102
  .template_list_holder {
103
- width: 100%;
104
  }
105
  .template_variable {
106
- width: 50%;
107
- float: left;
108
- font-size: 14px;
109
  }
110
  .template_name {
111
- font-weight: bold;
112
  }
113
 
114
  /********************
@@ -116,135 +116,135 @@ Results Pages & Emails Tab
116
  *********************/
117
  .results-page,
118
  .email {
119
- width: 100%;
120
- background-color: #0d97d8;
121
- margin: 20px 0;
122
- padding-bottom: 15px;
123
- box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.4)
124
  }
125
 
126
  .results-page-header,
127
  .email-header {
128
- display: flex;
129
- align-items: center;
130
- justify-content: flex-end;
131
- background-color: #fff;
132
- padding: 10px 35px;
133
- border-bottom: 5px solid #1DD969;
134
  }
135
 
136
  .delete-page-button,
137
  .delete-email-button {
138
- background: none;
139
- border: none;
140
- color: #1DD969;
141
- cursor: pointer;
142
- transition-duration: 200ms;
143
  }
144
 
145
  .delete-page-button:hover,
146
  .delete-email-button:hover {
147
- transform: scale(1.2);
148
  }
149
 
150
  .results-page-content,
151
  .email-content {
152
- display: flex;
153
- flex-direction: column;
154
  }
155
 
156
  .results-page-when,
157
  .results-page-show,
158
  .email-when,
159
  .email-show {
160
- padding: 10px;
161
- background-color: #fff;
162
- border: 5px solid #1DD969;
163
- margin: 15px 0;
164
- min-width: 60%;
165
  }
166
 
167
  .results-page-content-header,
168
  .email-content-header {
169
- margin-bottom: 10px;
170
  }
171
 
172
  .results-page-content-header h4,
173
  .results-page-content-header p,
174
  .email-content-header h4,
175
  .email-content-header p {
176
- margin: 0;
177
  }
178
 
179
  .results-page-condition,
180
  .email-condition {
181
- display: flex;
182
- flex-direction: column;
183
- margin-bottom: 15px;
184
- justify-content: space-around;
185
  }
186
 
187
  .results-page-condition > select,
188
  .results-page-condition > input,
189
  .email-condition > select,
190
  .email-condition > input {
191
- max-width: 100%;
192
  }
193
 
194
  .delete-condition-button {
195
- background: none;
196
- border: 1px solid #1DD969;
197
- color: #1DD969;
198
- cursor: pointer;
199
- transition-duration: 200ms;
200
- padding: 6px;
201
  }
202
 
203
  .delete-condition-button:hover {
204
- transform: scale(1.1);
205
  }
206
 
207
  .email-show .label {
208
- display: block;
209
  }
210
 
211
  .results-page-show textarea,
212
  .to-email,
213
  .subject,
214
  .email-template {
215
- width: 100%;
216
- margin-bottom: 10px;
217
  }
218
 
219
  @media screen and (min-width: 760px) {
220
- .results-page-content,
221
- .email-content {
222
- flex-direction: row;
223
- justify-content: space-around;
224
- }
225
-
226
- .results-page-when,
227
- .results-page-show,
228
- .email-when,
229
- .email-show {
230
- min-width: 35%;
231
- }
232
-
233
- .results-page-condition,
234
- .email-condition {
235
- align-items: center;
236
- flex-direction: row;
237
- }
238
- .results-page-condition > select,
239
- .results-page-condition > input,
240
- .email-condition > select,
241
- .email-condition > input {
242
- max-width: 30%;
243
- }
244
-
245
- .delete-condition-button {
246
- border: none;
247
- }
248
  }
249
 
250
  /********************
@@ -252,15 +252,15 @@ Quiz Styles Tab
252
  *********************/
253
 
254
  .qsm-styles {
255
- display: flex;
256
- flex-direction: column;
257
  }
258
 
259
  @media screen and (min-width:700px) {
260
- .qsm-styles {
261
- flex-direction: row;
262
- flex-wrap: wrap;
263
- }
264
  }
265
 
266
 
@@ -270,106 +270,106 @@ About/Credits Page
270
  *********************/
271
 
272
  div.qsm_icon_wrap {
273
- position: absolute;
274
- top: 0;
275
- right: 0;
276
- background-color: rgba(54, 58, 66, 1);
277
- color: #1DD969;
278
- background-position: center 24px;
279
- background-size: 85px 85px;
280
- font-size: 14px;
281
- text-align: center;
282
- font-weight: 600;
283
- margin: 5px 0 0;
284
- padding-top: 120px;
285
- height: 40px;
286
- display: inline-block;
287
- width: 150px;
288
- text-rendering: optimizeLegibility;
289
- border: 5px solid #106daa;
290
- -moz-border-radius: 20px;
291
- -webkit-border-radius: 20px;
292
- -khtml-border-radius: 20px;
293
- border-radius: 20px;
294
  }
295
 
296
  .qsm-tab-content .feature {
297
- margin-bottom: 20px;
298
  }
299
 
300
  .qsm-tab-content .feature .feature-headline {
301
- margin: 1.1em 0 .2em;
302
- font-size: 40px;
303
- font-weight: 300;
304
- line-height: 1.3;
305
- text-align: center;
306
  }
307
 
308
  .qsm-tab-content .feature .feature-text {
309
- text-align: center;
310
- font-size: 16px;
311
  }
312
 
313
  ul.changelog {
314
- background-color: #fff;
315
- padding: 10px 10px;
316
  }
317
 
318
  ul.changelog li {
319
- padding: 4px 0px;
320
  }
321
 
322
  ul.changelog li div.two{
323
- width: 70%;
324
- float: left;
325
- display: inline-block;
326
- height: 25px;
327
- margin-right: 20px;
328
- background: #D9E0E4;
329
- text-align: center;
330
- line-height: 25px;
331
  }
332
 
333
  ul.changelog li.fixed > div {
334
- background:#F0FFE1;
335
- color: #444;
336
- border-right:1px solid #5cb85c;
337
- width: 20%;
338
  }
339
 
340
  ul.changelog li.fixed div.two:before {
341
- content: "\f147";
342
- font-family: "dashicons";
343
- color:#5CB85C;
344
- margin-right: 5px;
345
  }
346
 
347
  ul.changelog li.add > div{
348
- background:#FFEED0;
349
- color: #444;
350
- border-right:1px solid #EFA537;
351
- width: 20%;
352
  }
353
 
354
  ul.changelog li.add div.two:before {
355
- content: "\f155";
356
- font-family: "dashicons";
357
- color:#EFA537;
358
- margin-right: 5px;
359
  }
360
 
361
  ul.changelog li.update > div{
362
- background:#bde7ff;
363
- color: #444;
364
- border-right:1px solid #106daa;
365
- width: 20%;
366
  }
367
 
368
  ul.changelog li.update div.two:before {
369
- content: "\f463";
370
- font-family: "dashicons";
371
- color:#106daa;
372
- margin-right: 5px;
373
  }
374
 
375
  /********************
@@ -377,15 +377,15 @@ Addons Page
377
  *********************/
378
 
379
  .qsm-addons {
380
- display: flex;
381
- flex-direction: column;
382
  }
383
 
384
  @media screen and (min-width:700px) {
385
- .qsm-addons {
386
- flex-direction: row;
387
- flex-wrap: wrap;
388
- }
389
  }
390
 
391
 
@@ -394,20 +394,20 @@ Help Page
394
  *********************/
395
 
396
  .quiz_email_support p#mlw_support_message {
397
- color: red;
398
- font-size: 20px;
399
  }
400
 
401
  .quiz_email_support input, .quiz_email_support textarea {
402
- width: 100% !important;
403
  }
404
 
405
  .quiz_email_support textarea {
406
- min-height: 200px;
407
  }
408
 
409
  .quiz_email_support label {
410
- font-weight: bold;
411
  }
412
 
413
 
@@ -417,206 +417,206 @@ Misc.
417
 
418
  /* Ads */
419
  .help-decide {
420
- display: block;
421
- text-align:center;
422
- background: #fff;
423
- border: 5px solid #1DD969;
424
- color: #000;
425
- font-weight: bold;
426
  }
427
  .help-decide p {
428
- font-size: 14px;
429
  }
430
 
431
  /* Info Bar */
432
  .qsm-info-box {
433
- display: block;
434
- text-align:center;
435
- background: #0d97d8;
436
- border: 5px solid #1DD969;
437
- color: #000;
438
- font-weight: bold;
439
- font-size: 14px;
440
  }
441
 
442
  .qsm-info-box p {
443
- font-size: 14px;
444
  }
445
 
446
  .qsm-info-box a {
447
- color: yellow;
448
  }
449
 
450
  /* Info Widget */
451
  .qsm-info-widget {
452
- text-align: center;
453
- border: 5px solid #1DD969;
454
- margin: 10px 5px;
455
- background: #fff;
456
- padding: 10px 5px;
457
- transition-duration: 0.5s;
458
- max-width: 330px;
459
  }
460
 
461
  .qsm-info-widget:hover {
462
- transform: scale(1.1);
463
  }
464
 
465
  /* Options tabs */
466
  .qsm_tab_content,
467
  .mlw_tab_content {
468
- padding: 10px 10px 10px 10px;
469
  }
470
 
471
  /* Popup */
472
 
473
  .qsm-popup {
474
- font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
475
  }
476
-
477
  .qsm-popup__overlay {
478
- position: fixed;
479
- top: 0;
480
- left: 0;
481
- right: 0;
482
- bottom: 0;
483
- background: rgba(0,0,0,0.6);
484
- display: flex;
485
- justify-content: center;
486
- align-items: center;
487
- z-index: 9999;
488
  }
489
 
490
  .qsm-popup__container {
491
- background-color: #fff;
492
- padding: 30px;
493
- min-width: 500px;
494
- max-width: 700px;
495
- max-height: 95vh;
496
- border-radius: 4px;
497
- overflow-y: auto;
498
- box-sizing: border-box;
499
  }
500
 
501
  .qsm-popup__header {
502
- display: flex;
503
- justify-content: space-between;
504
- align-items: center;
505
  }
506
 
507
  .qsm-popup__title {
508
- margin-top: 0;
509
- margin-bottom: 0;
510
- font-weight: 600;
511
- font-size: 1.25rem;
512
- line-height: 1.25;
513
- color: #00449e;
514
- box-sizing: border-box;
515
  }
516
 
517
  .qsm-popup__close {
518
- background: transparent;
519
- border: 0;
520
- color: #00449e;
521
  text-decoration: none;
522
  }
523
 
524
  .qsm-popup__header .qsm-popup__close:before {
525
- content: "\2715";
526
  }
527
 
528
  .qsm-popup__content {
529
- margin-top: 2rem;
530
- margin-bottom: 2rem;
531
- line-height: 1.5;
532
- color: rgba(0,0,0,.8);
533
  }
534
 
535
  .qsm-popup__btn {
536
- font-size: .875rem;
537
- padding-left: 1rem;
538
- padding-right: 1rem;
539
- padding-top: .5rem;
540
- padding-bottom: .5rem;
541
- background-color: #e6e6e6;
542
- color: rgba(0,0,0,.8);
543
- border-radius: .25rem;
544
- border-style: none;
545
- border-width: 0;
546
- cursor: pointer;
547
- -webkit-appearance: button;
548
- text-transform: none;
549
- overflow: visible;
550
- line-height: 1.15;
551
- margin: 0;
552
- will-change: transform;
553
- -moz-osx-font-smoothing: grayscale;
554
- -webkit-backface-visibility: hidden;
555
- backface-visibility: hidden;
556
- -webkit-transform: translateZ(0);
557
- transform: translateZ(0);
558
- transition: -webkit-transform .25s ease-out;
559
- transition: transform .25s ease-out;
560
- transition: transform .25s ease-out,-webkit-transform .25s ease-out;
561
  }
562
 
563
  .qsm-popup__btn:focus, .qsm-popup__btn:hover {
564
- -webkit-transform: scale(1.05);
565
- transform: scale(1.05);
566
  }
567
 
568
  .qsm-popup__btn-primary {
569
- background-color: #00449e;
570
- color: #fff;
571
  }
572
 
573
  @keyframes mmfadeIn {
574
- from { opacity: 0; }
575
- to { opacity: 1; }
576
  }
577
 
578
  @keyframes mmfadeOut {
579
- from { opacity: 1; }
580
- to { opacity: 0; }
581
  }
582
 
583
  @keyframes mmslideIn {
584
- from { transform: translateY(15%); }
585
- to { transform: translateY(0); }
586
  }
587
 
588
  @keyframes mmslideOut {
589
- from { transform: translateY(0); }
590
- to { transform: translateY(-10%); }
591
  }
592
 
593
  .qsm-popup-slide {
594
- display: none;
595
  }
596
 
597
  .qsm-popup-slide.is-open {
598
- display: block;
599
  }
600
 
601
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
602
- animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
603
  }
604
 
605
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
606
- animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
607
  }
608
 
609
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
610
- animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
611
  }
612
 
613
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
614
- animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
615
  }
616
 
617
  .qsm-popup-slide .qsm-popup__container,
618
  .qsm-popup-slide .qsm-popup__overlay {
619
- will-change: transform;
620
  }
621
 
622
  /**
@@ -683,4 +683,55 @@ h3.addon_category_name {
683
  width: 100%;
684
  background: #d7d1d1;
685
  padding: 15px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
686
  }
12
  }
13
 
14
  .qsm-quizzes-page-content {
15
+ display: flex;
16
+ flex-direction: column;
17
+ justify-content: space-between;
18
  }
19
 
20
  .qsm-quiz-page-wrapper {
21
+ flex-grow: 1;
22
  }
23
 
24
  .qsm-quiz-page-wrapper-with-ads {
25
+ flex-grow: 1;
26
  }
27
 
28
  .qsm-news-ads {
29
+ background-color: #0d97d8;
30
  }
31
 
32
  .qsm-news-ads-title {
33
+ text-align: center;
34
+ border-bottom: 5px solid #1DD969;
35
+ margin: 0;
36
+ padding: 10px 0;
37
+ background-color: #fff;
38
  }
39
 
40
  .qsm-edit-name {
41
+ font-size: 12px !important;
42
  }
43
 
44
  .qsm-action-link {
45
+ font-size: 14px !important;
46
  }
47
 
48
  .qsm-action-links:hover {
49
+ background-color: black;
50
  }
51
 
52
  .qsm-action-link-delete {
53
+ color: red !important;
54
  }
55
 
56
  .qsm-dialog-form label {
57
+ display: inline-block;
58
+ font-size: 16px;
59
+ font-weight: bold;
60
+ padding-right: 30px;
61
  }
62
 
63
  .qsm-quiz-page-addon{
71
  }
72
 
73
  @media screen and (min-width: 1200px) {
74
+ .qsm-quizzes-page-content {
75
+ flex-direction: row;
76
+ }
77
 
78
+ .qsm-quiz-page-wrapper-with-ads {
79
+ margin-right: 10px;
80
+ }
81
 
82
+ .qsm-news-ads {
83
+ flex-basis: 15%;
84
+ }
85
  }
86
 
87
  @media screen and (max-width: 767px) {
100
  *********************/
101
 
102
  .template_list_holder {
103
+ width: 100%;
104
  }
105
  .template_variable {
106
+ width: 50%;
107
+ float: left;
108
+ font-size: 14px;
109
  }
110
  .template_name {
111
+ font-weight: bold;
112
  }
113
 
114
  /********************
116
  *********************/
117
  .results-page,
118
  .email {
119
+ width: 100%;
120
+ background-color: #0d97d8;
121
+ margin: 20px 0;
122
+ padding-bottom: 15px;
123
+ box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.4)
124
  }
125
 
126
  .results-page-header,
127
  .email-header {
128
+ display: flex;
129
+ align-items: center;
130
+ justify-content: flex-end;
131
+ background-color: #fff;
132
+ padding: 10px 35px;
133
+ border-bottom: 5px solid #1DD969;
134
  }
135
 
136
  .delete-page-button,
137
  .delete-email-button {
138
+ background: none;
139
+ border: none;
140
+ color: #1DD969;
141
+ cursor: pointer;
142
+ transition-duration: 200ms;
143
  }
144
 
145
  .delete-page-button:hover,
146
  .delete-email-button:hover {
147
+ transform: scale(1.2);
148
  }
149
 
150
  .results-page-content,
151
  .email-content {
152
+ display: flex;
153
+ flex-direction: column;
154
  }
155
 
156
  .results-page-when,
157
  .results-page-show,
158
  .email-when,
159
  .email-show {
160
+ padding: 10px;
161
+ background-color: #fff;
162
+ border: 5px solid #1DD969;
163
+ margin: 15px 0;
164
+ min-width: 60%;
165
  }
166
 
167
  .results-page-content-header,
168
  .email-content-header {
169
+ margin-bottom: 10px;
170
  }
171
 
172
  .results-page-content-header h4,
173
  .results-page-content-header p,
174
  .email-content-header h4,
175
  .email-content-header p {
176
+ margin: 0;
177
  }
178
 
179
  .results-page-condition,
180
  .email-condition {
181
+ display: flex;
182
+ flex-direction: column;
183
+ margin-bottom: 15px;
184
+ justify-content: space-around;
185
  }
186
 
187
  .results-page-condition > select,
188
  .results-page-condition > input,
189
  .email-condition > select,
190
  .email-condition > input {
191
+ max-width: 100%;
192
  }
193
 
194
  .delete-condition-button {
195
+ background: none;
196
+ border: 1px solid #1DD969;
197
+ color: #1DD969;
198
+ cursor: pointer;
199
+ transition-duration: 200ms;
200
+ padding: 6px;
201
  }
202
 
203
  .delete-condition-button:hover {
204
+ transform: scale(1.1);
205
  }
206
 
207
  .email-show .label {
208
+ display: block;
209
  }
210
 
211
  .results-page-show textarea,
212
  .to-email,
213
  .subject,
214
  .email-template {
215
+ width: 100%;
216
+ margin-bottom: 10px;
217
  }
218
 
219
  @media screen and (min-width: 760px) {
220
+ .results-page-content,
221
+ .email-content {
222
+ flex-direction: row;
223
+ justify-content: space-around;
224
+ }
225
+
226
+ .results-page-when,
227
+ .results-page-show,
228
+ .email-when,
229
+ .email-show {
230
+ min-width: 35%;
231
+ }
232
+
233
+ .results-page-condition,
234
+ .email-condition {
235
+ align-items: center;
236
+ flex-direction: row;
237
+ }
238
+ .results-page-condition > select,
239
+ .results-page-condition > input,
240
+ .email-condition > select,
241
+ .email-condition > input {
242
+ max-width: 30%;
243
+ }
244
+
245
+ .delete-condition-button {
246
+ border: none;
247
+ }
248
  }
249
 
250
  /********************
252
  *********************/
253
 
254
  .qsm-styles {
255
+ display: flex;
256
+ flex-direction: column;
257
  }
258
 
259
  @media screen and (min-width:700px) {
260
+ .qsm-styles {
261
+ flex-direction: row;
262
+ flex-wrap: wrap;
263
+ }
264
  }
265
 
266
 
270
  *********************/
271
 
272
  div.qsm_icon_wrap {
273
+ position: absolute;
274
+ top: 0;
275
+ right: 0;
276
+ background-color: rgba(54, 58, 66, 1);
277
+ color: #1DD969;
278
+ background-position: center 24px;
279
+ background-size: 85px 85px;
280
+ font-size: 14px;
281
+ text-align: center;
282
+ font-weight: 600;
283
+ margin: 5px 0 0;
284
+ padding-top: 120px;
285
+ height: 40px;
286
+ display: inline-block;
287
+ width: 150px;
288
+ text-rendering: optimizeLegibility;
289
+ border: 5px solid #106daa;
290
+ -moz-border-radius: 20px;
291
+ -webkit-border-radius: 20px;
292
+ -khtml-border-radius: 20px;
293
+ border-radius: 20px;
294
  }
295
 
296
  .qsm-tab-content .feature {
297
+ margin-bottom: 20px;
298
  }
299
 
300
  .qsm-tab-content .feature .feature-headline {
301
+ margin: 1.1em 0 .2em;
302
+ font-size: 40px;
303
+ font-weight: 300;
304
+ line-height: 1.3;
305
+ text-align: center;
306
  }
307
 
308
  .qsm-tab-content .feature .feature-text {
309
+ text-align: center;
310
+ font-size: 16px;
311
  }
312
 
313
  ul.changelog {
314
+ background-color: #fff;
315
+ padding: 10px 10px;
316
  }
317
 
318
  ul.changelog li {
319
+ padding: 4px 0px;
320
  }
321
 
322
  ul.changelog li div.two{
323
+ width: 70%;
324
+ float: left;
325
+ display: inline-block;
326
+ height: 25px;
327
+ margin-right: 20px;
328
+ background: #D9E0E4;
329
+ text-align: center;
330
+ line-height: 25px;
331
  }
332
 
333
  ul.changelog li.fixed > div {
334
+ background:#F0FFE1;
335
+ color: #444;
336
+ border-right:1px solid #5cb85c;
337
+ width: 20%;
338
  }
339
 
340
  ul.changelog li.fixed div.two:before {
341
+ content: "\f147";
342
+ font-family: "dashicons";
343
+ color:#5CB85C;
344
+ margin-right: 5px;
345
  }
346
 
347
  ul.changelog li.add > div{
348
+ background:#FFEED0;
349
+ color: #444;
350
+ border-right:1px solid #EFA537;
351
+ width: 20%;
352
  }
353
 
354
  ul.changelog li.add div.two:before {
355
+ content: "\f155";
356
+ font-family: "dashicons";
357
+ color:#EFA537;
358
+ margin-right: 5px;
359
  }
360
 
361
  ul.changelog li.update > div{
362
+ background:#bde7ff;
363
+ color: #444;
364
+ border-right:1px solid #106daa;
365
+ width: 20%;
366
  }
367
 
368
  ul.changelog li.update div.two:before {
369
+ content: "\f463";
370
+ font-family: "dashicons";
371
+ color:#106daa;
372
+ margin-right: 5px;
373
  }
374
 
375
  /********************
377
  *********************/
378
 
379
  .qsm-addons {
380
+ display: flex;
381
+ flex-direction: column;
382
  }
383
 
384
  @media screen and (min-width:700px) {
385
+ .qsm-addons {
386
+ flex-direction: row;
387
+ flex-wrap: wrap;
388
+ }
389
  }
390
 
391
 
394
  *********************/
395
 
396
  .quiz_email_support p#mlw_support_message {
397
+ color: red;
398
+ font-size: 20px;
399
  }
400
 
401
  .quiz_email_support input, .quiz_email_support textarea {
402
+ width: 100% !important;
403
  }
404
 
405
  .quiz_email_support textarea {
406
+ min-height: 200px;
407
  }
408
 
409
  .quiz_email_support label {
410
+ font-weight: bold;
411
  }
412
 
413
 
417
 
418
  /* Ads */
419
  .help-decide {
420
+ display: block;
421
+ text-align:center;
422
+ background: #fff;
423
+ border: 5px solid #1DD969;
424
+ color: #000;
425
+ font-weight: bold;
426
  }
427
  .help-decide p {
428
+ font-size: 14px;
429
  }
430
 
431
  /* Info Bar */
432
  .qsm-info-box {
433
+ display: block;
434
+ text-align:center;
435
+ background: #0d97d8;
436
+ border: 5px solid #1DD969;
437
+ color: #000;
438
+ font-weight: bold;
439
+ font-size: 14px;
440
  }
441
 
442
  .qsm-info-box p {
443
+ font-size: 14px;
444
  }
445
 
446
  .qsm-info-box a {
447
+ color: yellow;
448
  }
449
 
450
  /* Info Widget */
451
  .qsm-info-widget {
452
+ text-align: center;
453
+ border: 5px solid #1DD969;
454
+ margin: 10px 5px;
455
+ background: #fff;
456
+ padding: 10px 5px;
457
+ transition-duration: 0.5s;
458
+ max-width: 330px;
459
  }
460
 
461
  .qsm-info-widget:hover {
462
+ transform: scale(1.1);
463
  }
464
 
465
  /* Options tabs */
466
  .qsm_tab_content,
467
  .mlw_tab_content {
468
+ padding: 10px 10px 10px 10px;
469
  }
470
 
471
  /* Popup */
472
 
473
  .qsm-popup {
474
+ font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
475
  }
476
+
477
  .qsm-popup__overlay {
478
+ position: fixed;
479
+ top: 0;
480
+ left: 0;
481
+ right: 0;
482
+ bottom: 0;
483
+ background: rgba(0,0,0,0.6);
484
+ display: flex;
485
+ justify-content: center;
486
+ align-items: center;
487
+ z-index: 9999;
488
  }
489
 
490
  .qsm-popup__container {
491
+ background-color: #fff;
492
+ padding: 30px;
493
+ min-width: 500px;
494
+ max-width: 700px;
495
+ max-height: 95vh;
496
+ border-radius: 4px;
497
+ overflow-y: auto;
498
+ box-sizing: border-box;
499
  }
500
 
501
  .qsm-popup__header {
502
+ display: flex;
503
+ justify-content: space-between;
504
+ align-items: center;
505
  }
506
 
507
  .qsm-popup__title {
508
+ margin-top: 0;
509
+ margin-bottom: 0;
510
+ font-weight: 600;
511
+ font-size: 1.25rem;
512
+ line-height: 1.25;
513
+ color: #00449e;
514
+ box-sizing: border-box;
515
  }
516
 
517
  .qsm-popup__close {
518
+ background: transparent;
519
+ border: 0;
520
+ color: #00449e;
521
  text-decoration: none;
522
  }
523
 
524
  .qsm-popup__header .qsm-popup__close:before {
525
+ content: "\2715";
526
  }
527
 
528
  .qsm-popup__content {
529
+ margin-top: 2rem;
530
+ margin-bottom: 2rem;
531
+ line-height: 1.5;
532
+ color: rgba(0,0,0,.8);
533
  }
534
 
535
  .qsm-popup__btn {
536
+ font-size: .875rem;
537
+ padding-left: 1rem;
538
+ padding-right: 1rem;
539
+ padding-top: .5rem;
540
+ padding-bottom: .5rem;
541
+ background-color: #e6e6e6;
542
+ color: rgba(0,0,0,.8);
543
+ border-radius: .25rem;
544
+ border-style: none;
545
+ border-width: 0;
546
+ cursor: pointer;
547
+ -webkit-appearance: button;
548
+ text-transform: none;
549
+ overflow: visible;
550
+ line-height: 1.15;
551
+ margin: 0;
552
+ will-change: transform;
553
+ -moz-osx-font-smoothing: grayscale;
554
+ -webkit-backface-visibility: hidden;
555
+ backface-visibility: hidden;
556
+ -webkit-transform: translateZ(0);
557
+ transform: translateZ(0);
558
+ transition: -webkit-transform .25s ease-out;
559
+ transition: transform .25s ease-out;
560
+ transition: transform .25s ease-out,-webkit-transform .25s ease-out;
561
  }
562
 
563
  .qsm-popup__btn:focus, .qsm-popup__btn:hover {
564
+ -webkit-transform: scale(1.05);
565
+ transform: scale(1.05);
566
  }
567
 
568
  .qsm-popup__btn-primary {
569
+ background-color: #00449e;
570
+ color: #fff;
571
  }
572
 
573
  @keyframes mmfadeIn {
574
+ from { opacity: 0; }
575
+ to { opacity: 1; }
576
  }
577
 
578
  @keyframes mmfadeOut {
579
+ from { opacity: 1; }
580
+ to { opacity: 0; }
581
  }
582
 
583
  @keyframes mmslideIn {
584
+ from { transform: translateY(15%); }
585
+ to { transform: translateY(0); }
586
  }
587
 
588
  @keyframes mmslideOut {
589
+ from { transform: translateY(0); }
590
+ to { transform: translateY(-10%); }
591
  }
592
 
593
  .qsm-popup-slide {
594
+ display: none;
595
  }
596
 
597
  .qsm-popup-slide.is-open {
598
+ display: block;
599
  }
600
 
601
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
602
+ animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
603
  }
604
 
605
  .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
606
+ animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
607
  }
608
 
609
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
610
+ animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
611
  }
612
 
613
  .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
614
+ animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
615
  }
616
 
617
  .qsm-popup-slide .qsm-popup__container,
618
  .qsm-popup-slide .qsm-popup__overlay {
619
+ will-change: transform;
620
  }
621
 
622
  /**
683
  width: 100%;
684
  background: #d7d1d1;
685
  padding: 15px;
686
+ }
687
+
688
+ @media screen and (max-width: 767px){
689
+ .qsm-quiz-row td:nth-of-type(2n){
690
+ display: none;
691
+ }
692
+ .qsm-quiz-page-wrapper thead th:nth-of-type(2n),
693
+ .qsm-quiz-page-wrapper tfoot th:nth-of-type(2n),
694
+ .qsm-quiz-page-wrapper-with-ads thead th:nth-of-type(2n),
695
+ .qsm-quiz-page-wrapper-with-ads tfoot th:nth-of-type(2n){
696
+ display: none;
697
+ }
698
+ .qsm-quiz-page-wrapper .row-actions{
699
+ display: inline-block !important;
700
+ }
701
+ .qsm-quiz-page-wrapper p.search-box {
702
+ bottom: -30px;
703
+ }
704
+ .qsm-popup__container{
705
+ min-width: auto;
706
+ max-width: 100%;
707
+ }
708
+ #show-advanced-option {
709
+ display: block;
710
+ width: 100%;
711
+ float: left;
712
+ }
713
+ .contact-form-label {
714
+ display: inline-block;
715
+ }
716
+ .template_variable{
717
+ width: 100%;
718
+ max-width: 100%;
719
+ margin-bottom: 10px;
720
+ word-break: break-word;
721
+ }
722
+ .qsm_tab_content .form-table input[type=radio]{
723
+ top: 6px;
724
+ margin-bottom: 8px;
725
+ }
726
+ .result-page-wrapper form{
727
+ overflow: scroll;
728
+ width: 100%;
729
+ }
730
+ p.search-box{
731
+ bottom: -30px;
732
+ }
733
+ .quizzes-surveys_page_qsm_quiz_help .hndle{
734
+ padding-left: 15px;
735
+ padding-bottom: 15px;
736
+ }
737
  }
css/quizzes-list.css ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ind-quiz
2
+ {
3
+ width: 100%;
4
+ border-bottom: 1px solid #ccc
5
+ }
6
+ .quiz-heading
7
+ {
8
+ width: 75%;
9
+ float: left;
10
+ padding: 15px 5px;
11
+ font-weight: bold;
12
+ font-size:20px;
13
+
14
+ }
15
+ .quiz-url
16
+ {
17
+ width: 20%;
18
+ float: left;
19
+ padding: 15px 5px;
20
+ }
21
+ .clear {
22
+ clear: both
23
+ }
js/qsm-admin-question.js CHANGED
@@ -254,6 +254,10 @@ var import_button;
254
  var model = QSMQuestion.questions.get( questionID );
255
  var hint = $( '#hint' ).val();
256
  var name = wp.editor.getContent( 'question-text' );
 
 
 
 
257
  var answerInfo = $( '#correct_answer_info' ).val();
258
  var type = $( "#question_type" ).val();
259
  var comments = $( "#comments" ).val();
@@ -261,6 +265,7 @@ var import_button;
261
  var category = $( ".category-radio:checked" ).val();
262
  var autofill = $( "#hide_autofill" ).val();
263
  var limit_text = $( "#limit_text" ).val();
 
264
  if ( 'new_category' == category ) {
265
  category = $( '#new_category' ).val();
266
  }
@@ -297,9 +302,10 @@ var import_button;
297
  category: category,
298
  required: required,
299
  answers: answers,
300
- answer_editor: answerType,
301
  autofill: autofill,
302
- limit_text: limit_text
 
303
  },
304
  {
305
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
@@ -318,9 +324,10 @@ var import_button;
318
  setTimeout( QSMQuestion.removeNew, 250 );
319
  },
320
  addNewAnswer: function( answer ) {
 
321
  var answerTemplate = wp.template( 'single-answer' );
322
- $( '#answers' ).append( answerTemplate( { answer: answer[0], points: answer[1], correct: answer[2], count: answer[3], question_id: answer[4], answerType: answer[5] } ) );
323
- if(answer[5] == 'rich'){
324
  var textarea_id = 'answer-' + answer[4] + '-' + answer[3];
325
  wp.editor.remove( textarea_id );
326
  var settings = {
@@ -341,9 +348,13 @@ var import_button;
341
  QSMQuestion.prepareCategories();
342
  QSMQuestion.processCategories();
343
  var question = QSMQuestion.questions.get( questionID );
 
344
  var questionText = QSMQuestion.prepareQuestionText( question.get( 'name' ) );
345
  $( '#edit_question_id' ).val( questionID );
346
- var question_editor = tinyMCE.get( 'question-text' );
 
 
 
347
  if ($('#wp-question-text-wrap').hasClass('html-active')) {
348
  jQuery( "#question-text" ).val( questionText );
349
  } else if ( question_editor ) {
@@ -359,7 +370,7 @@ var import_button;
359
  answerEditor = 'text';
360
  }
361
  //Check autofill setting
362
- var disableAutofill = question.get( 'autofill' );
363
  if( disableAutofill === null || typeof disableAutofill === "undefined" ){
364
  disableAutofill = '0';
365
  }
@@ -368,6 +379,11 @@ var import_button;
368
  if( get_limit_text === null || typeof get_limit_text === "undefined" ){
369
  get_limit_text = '0';
370
  }
 
 
 
 
 
371
  var al = 0;
372
  _.each( answers, function( answer ) {
373
  answer.push(al + 1);
@@ -383,6 +399,7 @@ var import_button;
383
  $( "#required" ).val( question.get( 'required' ) );
384
  $( "#hide_autofill" ).val( disableAutofill );
385
  $( "#limit_text" ).val( get_limit_text );
 
386
  $( "#change-answer-editor" ).val( answerEditor );
387
  $( ".category-radio" ).removeAttr( 'checked' );
388
  $( "#edit-question-id" ).text('').text(questionID);
@@ -530,7 +547,9 @@ var import_button;
530
  placeholder: "ui-state-highlight",
531
  connectWith: '.page'
532
  });
533
- QSMQuestion.prepareEditor();
 
 
534
  QSMQuestion.loadQuestions();
535
 
536
  /**
@@ -561,4 +580,28 @@ var import_button;
561
  }
562
  });
563
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  }(jQuery));
254
  var model = QSMQuestion.questions.get( questionID );
255
  var hint = $( '#hint' ).val();
256
  var name = wp.editor.getContent( 'question-text' );
257
+ if(name == ''){
258
+ alert('Enter question title');
259
+ return false;
260
+ }
261
  var answerInfo = $( '#correct_answer_info' ).val();
262
  var type = $( "#question_type" ).val();
263
  var comments = $( "#comments" ).val();
265
  var category = $( ".category-radio:checked" ).val();
266
  var autofill = $( "#hide_autofill" ).val();
267
  var limit_text = $( "#limit_text" ).val();
268
+ var limit_multiple_response = $( "#limit_multiple_response" ).val();
269
  if ( 'new_category' == category ) {
270
  category = $( '#new_category' ).val();
271
  }
302
  category: category,
303
  required: required,
304
  answers: answers,
305
+ answerEditor: answerType,
306
  autofill: autofill,
307
+ limit_text: limit_text,
308
+ limit_multiple_response: limit_multiple_response
309
  },
310
  {
311
  headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
324
  setTimeout( QSMQuestion.removeNew, 250 );
325
  },
326
  addNewAnswer: function( answer ) {
327
+
328
  var answerTemplate = wp.template( 'single-answer' );
329
+ $( '#answers' ).append( answerTemplate( { answer: decodeEntities( answer[0] ), points: answer[1], correct: answer[2], count: answer[3], question_id: answer[4], answerType: answer[5] } ) );
330
+ if(answer[5] == 'rich' && qsmQuestionSettings.qsm_user_ve === 'true'){
331
  var textarea_id = 'answer-' + answer[4] + '-' + answer[3];
332
  wp.editor.remove( textarea_id );
333
  var settings = {
348
  QSMQuestion.prepareCategories();
349
  QSMQuestion.processCategories();
350
  var question = QSMQuestion.questions.get( questionID );
351
+ console.log(question)
352
  var questionText = QSMQuestion.prepareQuestionText( question.get( 'name' ) );
353
  $( '#edit_question_id' ).val( questionID );
354
+ var question_editor = ''
355
+ if(qsmQuestionSettings.qsm_user_ve === 'true'){
356
+ question_editor = tinyMCE.get( 'question-text' );
357
+ }
358
  if ($('#wp-question-text-wrap').hasClass('html-active')) {
359
  jQuery( "#question-text" ).val( questionText );
360
  } else if ( question_editor ) {
370
  answerEditor = 'text';
371
  }
372
  //Check autofill setting
373
+ var disableAutofill = question.get( 'autofill' );
374
  if( disableAutofill === null || typeof disableAutofill === "undefined" ){
375
  disableAutofill = '0';
376
  }
379
  if( get_limit_text === null || typeof get_limit_text === "undefined" ){
380
  get_limit_text = '0';
381
  }
382
+ //Get limit multiple response value
383
+ var get_limit_mr = question.get( 'limit_multiple_response' );
384
+ if( get_limit_mr === null || typeof get_limit_mr === "undefined" ){
385
+ get_limit_mr = '0';
386
+ }
387
  var al = 0;
388
  _.each( answers, function( answer ) {
389
  answer.push(al + 1);
399
  $( "#required" ).val( question.get( 'required' ) );
400
  $( "#hide_autofill" ).val( disableAutofill );
401
  $( "#limit_text" ).val( get_limit_text );
402
+ $( "#limit_multiple_response" ).val( get_limit_mr );
403
  $( "#change-answer-editor" ).val( answerEditor );
404
  $( ".category-radio" ).removeAttr( 'checked' );
405
  $( "#edit-question-id" ).text('').text(questionID);
547
  placeholder: "ui-state-highlight",
548
  connectWith: '.page'
549
  });
550
+ if(qsmQuestionSettings.qsm_user_ve === 'true'){
551
+ QSMQuestion.prepareEditor();
552
+ }
553
  QSMQuestion.loadQuestions();
554
 
555
  /**
580
  }
581
  });
582
  });
583
+ var decodeEntities = (function () {
584
+ //create a new html document (doesn't execute script tags in child elements)
585
+ var doc = document.implementation.createHTMLDocument("");
586
+ var element = doc.createElement('div');
587
+
588
+ function getText(str) {
589
+ element.innerHTML = str;
590
+ str = element.textContent;
591
+ element.textContent = '';
592
+ return str;
593
+ }
594
+
595
+ function decodeHTMLEntities(str) {
596
+ if (str && typeof str === 'string') {
597
+ var x = getText(str);
598
+ while (str !== x) {
599
+ str = x;
600
+ x = getText(x);
601
+ }
602
+ return x;
603
+ }
604
+ }
605
+ return decodeHTMLEntities;
606
+ })();
607
  }(jQuery));
js/qsm-quiz.js CHANGED
@@ -330,7 +330,7 @@ var QSM;
330
  */
331
  getQuizForm: function( quizID ) {
332
  return $( '#quizForm' + quizID );
333
- }
334
  };
335
 
336
  // On load code
@@ -340,13 +340,25 @@ var QSM;
340
  qmnInit();
341
 
342
  // Call main initialization.
343
- QSM.init();
344
  });
 
345
  }(jQuery));
346
 
347
  // Global Variables
348
  var qsmTitleText = document.title;
349
 
 
 
 
 
 
 
 
 
 
 
 
350
  function qmnTimeTakenTimer() {
351
  var x = +jQuery( '#timer' ).val();
352
  if ( NaN === x ) {
@@ -443,7 +455,7 @@ function qmnValidation( element, quiz_form_id ) {
443
  //Google recaptcha validation
444
  if( jQuery( this ).attr( 'class' ).indexOf( 'g-recaptcha-response' ) > -1 ) {
445
  if(grecaptcha.getResponse() == "") {
446
- alert('ReCaptcha is missing');
447
  result = false;
448
  }
449
  }
@@ -782,7 +794,7 @@ jQuery(function() {
782
  }
783
  });
784
 
785
- jQuery('.qmn_radio_answers > .qmn_mc_answer_wrap').on('click',function(event){
786
  var radButton = jQuery(this).find('input[type=radio]');
787
  if(event.target.className == 'qmn_quiz_radio'){
788
  return true;
@@ -792,7 +804,7 @@ jQuery(function() {
792
  } else {
793
  jQuery(radButton).prop("checked", true);
794
  }
795
- });
796
  });
797
 
798
  var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
330
  */
331
  getQuizForm: function( quizID ) {
332
  return $( '#quizForm' + quizID );
333
+ }
334
  };
335
 
336
  // On load code
340
  qmnInit();
341
 
342
  // Call main initialization.
343
+ QSM.init();
344
  });
345
+
346
  }(jQuery));
347
 
348
  // Global Variables
349
  var qsmTitleText = document.title;
350
 
351
+ /**
352
+ * Limit multiple response based on question limit
353
+ * @returns {undefined}
354
+ */
355
+ function qsmCheckMR(event, limit){
356
+ var checked = jQuery(event).parents('.quiz_section').find(':checkbox:checked').length;
357
+ if (checked > limit) {
358
+ event.checked = false;
359
+ }
360
+ }
361
+
362
  function qmnTimeTakenTimer() {
363
  var x = +jQuery( '#timer' ).val();
364
  if ( NaN === x ) {
455
  //Google recaptcha validation
456
  if( jQuery( this ).attr( 'class' ).indexOf( 'g-recaptcha-response' ) > -1 ) {
457
  if(grecaptcha.getResponse() == "") {
458
+ alert('ReCaptcha is missing');
459
  result = false;
460
  }
461
  }
794
  }
795
  });
796
 
797
+ /*jQuery('.qmn_radio_answers > .qmn_mc_answer_wrap').on('click',function(event){
798
  var radButton = jQuery(this).find('input[type=radio]');
799
  if(event.target.className == 'qmn_quiz_radio'){
800
  return true;
804
  } else {
805
  jQuery(radButton).prop("checked", true);
806
  }
807
+ });*/
808
  });
809
 
810
  var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
mlw_quizmaster2.php CHANGED
@@ -2,14 +2,14 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 6.3.3
6
  * Author: QSM Team
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://quizandsurveymaster.com/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
- * @version 6.3.3
13
  * @package QSM
14
  */
15
 
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
18
  }
19
 
20
  define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
21
-
22
  /**
23
  * This class is the main class of the plugin
24
  *
@@ -34,7 +34,7 @@ class MLWQuizMasterNext {
34
  * @var string
35
  * @since 4.0.0
36
  */
37
- public $version = '6.3.3';
38
 
39
  /**
40
  * QSM Alert Manager Object
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 6.3.4
6
  * Author: QSM Team
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://quizandsurveymaster.com/
9
  * Text Domain: quiz-master-next
10
  *
11
  * @author QSM Team
12
+ * @version 6.3.4
13
  * @package QSM
14
  */
15
 
18
  }
19
 
20
  define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
21
+ define( 'QSM_SUBMENU', __FILE__);
22
  /**
23
  * This class is the main class of the plugin
24
  *
34
  * @var string
35
  * @since 4.0.0
36
  */
37
+ public $version = '6.3.4';
38
 
39
  /**
40
  * QSM Alert Manager Object
php/admin/admin-results-page.php CHANGED
@@ -41,7 +41,7 @@ function qsm_generate_admin_results_page() {
41
  }
42
  ?>
43
  </h2>
44
- <div>
45
  <?php
46
  // Locates the active tab and calls its content function.
47
  foreach ( $tab_array as $tab ) {
@@ -202,6 +202,7 @@ function qsm_results_overview_tab_content() {
202
  wp_enqueue_script( 'jquery-ui-button' );
203
  wp_enqueue_script( 'qmn_admin_js', plugins_url( '../../js/admin.js', __FILE__ ) );
204
  wp_enqueue_style( 'qmn_jquery_redmond_theme', plugins_url( '../../css/jquery-ui.css', __FILE__ ) );
 
205
  ?>
206
  <script type="text/javascript">
207
  var $j = jQuery.noConflict();
41
  }
42
  ?>
43
  </h2>
44
+ <div class="result-page-wrapper">
45
  <?php
46
  // Locates the active tab and calls its content function.
47
  foreach ( $tab_array as $tab ) {
202
  wp_enqueue_script( 'jquery-ui-button' );
203
  wp_enqueue_script( 'qmn_admin_js', plugins_url( '../../js/admin.js', __FILE__ ) );
204
  wp_enqueue_style( 'qmn_jquery_redmond_theme', plugins_url( '../../css/jquery-ui.css', __FILE__ ) );
205
+ wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array() );
206
  ?>
207
  <script type="text/javascript">
208
  var $j = jQuery.noConflict();
php/admin/options-page-questions-tab.php CHANGED
@@ -32,12 +32,13 @@ function qsm_options_questions_tab_content() {
32
  global $wpdb;
33
  global $mlwQuizMasterNext;
34
  $quiz_id = intval( $_GET['quiz_id'] );
35
-
36
  $json_data = array(
37
  'quizID' => $quiz_id,
38
  'answerText' => __( 'Answer', 'quiz-master-next' ),
39
  'nonce' => wp_create_nonce( 'wp_rest' ),
40
  'pages' => $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() ),
 
41
  );
42
 
43
  // Scripts and styles.
@@ -195,6 +196,10 @@ function qsm_options_questions_tab_content() {
195
  <label><?php _e( 'Limit Text( Works for text fields )', 'quiz-master-next' ); ?></label>
196
  <input type="number" name="limit_text" value="" id="limit_text"/>
197
  </div>
 
 
 
 
198
  </div>
199
  </main>
200
  <footer class="qsm-popup__footer">
32
  global $wpdb;
33
  global $mlwQuizMasterNext;
34
  $quiz_id = intval( $_GET['quiz_id'] );
35
+ $user_id = get_current_user_id();
36
  $json_data = array(
37
  'quizID' => $quiz_id,
38
  'answerText' => __( 'Answer', 'quiz-master-next' ),
39
  'nonce' => wp_create_nonce( 'wp_rest' ),
40
  'pages' => $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() ),
41
+ 'qsm_user_ve' => get_user_meta($user_id, 'rich_editing', true)
42
  );
43
 
44
  // Scripts and styles.
196
  <label><?php _e( 'Limit Text( Works for text fields )', 'quiz-master-next' ); ?></label>
197
  <input type="number" name="limit_text" value="" id="limit_text"/>
198
  </div>
199
+ <div id="required_area" class="qsm-row">
200
+ <label><?php _e( 'Limit Multiple choice( Works for Multiple Response )', 'quiz-master-next' ); ?></label>
201
+ <input type="number" name="limit_multiple_response" value="" id="limit_multiple_response"/>
202
+ </div>
203
  </div>
204
  </main>
205
  <footer class="qsm-popup__footer">
php/classes/class-qmn-quiz-manager.php CHANGED
@@ -899,7 +899,7 @@ class QMNQuizManager {
899
  $result_display .= $this->display_social($qmn_quiz_options, $qmn_array_for_variables);
900
  $result_display = apply_filters('qmn_after_social_media', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
901
  if ( is_plugin_active( 'qsm-save-resume/qsm-save-resume.php' ) != 1 && $qmn_quiz_options->enable_retake_quiz_button == 1 ) {
902
- $result_display .= '<a style="float: right;" class="button btn-reload-quiz" data-quiz_id="'. $qmn_array_for_variables['quiz_id'] .'" href="#" >'. __('Retake Quiz','quiz-master-next') .'</a>';
903
  }
904
  // If the store responses in database option is set to Yes.
905
  if (0 != $qmn_quiz_options->store_responses) {
@@ -1050,7 +1050,7 @@ class QMNQuizManager {
1050
  $answer_points = 0;
1051
 
1052
  // Send question to our grading function
1053
- $results_array = $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']);
1054
 
1055
  // If question was graded correctly.
1056
  if (!isset($results_array["null_review"])) {
899
  $result_display .= $this->display_social($qmn_quiz_options, $qmn_array_for_variables);
900
  $result_display = apply_filters('qmn_after_social_media', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
901
  if ( is_plugin_active( 'qsm-save-resume/qsm-save-resume.php' ) != 1 && $qmn_quiz_options->enable_retake_quiz_button == 1 ) {
902
+ $result_display .= '<a style="float: right;" class="button btn-reload-quiz" data-quiz_id="'. $qmn_array_for_variables['quiz_id'] .'" href="#" >'. apply_filters('qsm_retake_quiz_text', 'Retake Quiz') .'</a>';
903
  }
904
  // If the store responses in database option is set to Yes.
905
  if (0 != $qmn_quiz_options->store_responses) {
1050
  $answer_points = 0;
1051
 
1052
  // Send question to our grading function
1053
+ $results_array = apply_filters('qmn_results_array', $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']));
1054
 
1055
  // If question was graded correctly.
1056
  if (!isset($results_array["null_review"])) {
php/classes/class-qsm-install.php CHANGED
@@ -25,6 +25,7 @@ class QSM_Install {
25
  * @since 4.7.1
26
  */
27
  public function add_hooks() {
 
28
  add_action( 'admin_init', array( $this, 'update' ) );
29
  add_filter( 'plugin_action_links_' . QSM_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
30
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
25
  * @since 4.7.1
26
  */
27
  public function add_hooks() {
28
+ add_action( 'admin_init', array( $this, 'update' ) );
29
  add_action( 'admin_init', array( $this, 'update' ) );
30
  add_filter( 'plugin_action_links_' . QSM_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
31
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
php/question-types.php CHANGED
@@ -215,7 +215,7 @@ function qmn_drop_down_display($id, $question, $answers)
215
  }
216
  $question_display .= "<span class='mlw_qmn_question'>" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . "</span>";
217
  $question_display .= "<select class='qsm_select $require_class' name='question".$id."'>";
218
- $question_display .= "<option value='No Answer Provided' selected='selected'>&nbsp;</option>";
219
  if (is_array($answers))
220
  {
221
  $mlw_answer_total = 0;
@@ -374,9 +374,12 @@ function qmn_question_type_multiple_response()
374
  */
375
  function qmn_multiple_response_display($id, $question, $answers)
376
  {
377
- $question_display = '';
378
  global $mlwQuizMasterNext;
379
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
 
 
 
380
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
381
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
382
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
@@ -390,7 +393,7 @@ function qmn_multiple_response_display($id, $question, $answers)
390
  {
391
  $question_display .= '<div class="qsm_check_answer">';
392
  $question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
393
- $question_display .= "<input type='checkbox' name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label>";
394
  $question_display .= '</div>';
395
  }
396
  }
215
  }
216
  $question_display .= "<span class='mlw_qmn_question'>" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . "</span>";
217
  $question_display .= "<select class='qsm_select $require_class' name='question".$id."'>";
218
+ $question_display .= "<option value='' selected='selected'>" . __('Please select your answer','quiz-master-next') . "</option>";
219
  if (is_array($answers))
220
  {
221
  $mlw_answer_total = 0;
374
  */
375
  function qmn_multiple_response_display($id, $question, $answers)
376
  {
377
+ $question_display = $limit_mr_text = '';
378
  global $mlwQuizMasterNext;
379
  $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
380
+ $limit_multiple_response = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_multiple_response');
381
+ if($limit_multiple_response > 0)
382
+ $limit_mr_text = 'onchange="qsmCheckMR(this,'. $limit_multiple_response .')"';
383
  if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
384
  $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
385
  $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
393
  {
394
  $question_display .= '<div class="qsm_check_answer">';
395
  $question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
396
+ $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."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label>";
397
  $question_display .= '</div>';
398
  }
399
  }
php/rest-api.php CHANGED
@@ -229,6 +229,7 @@ function qsm_rest_get_questions( WP_REST_Request $request ) {
229
  'answerEditor' => isset($question['settings']['answerEditor']) ? $question['settings']['answerEditor'] : 'text',
230
  'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
231
  'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
 
232
  'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
233
  );
234
  }
@@ -321,9 +322,10 @@ function qsm_rest_save_question( WP_REST_Request $request ) {
321
  );
322
  $settings = array(
323
  'required' => $request['required'],
324
- 'answerEditor' => $request['answer_editor'],
325
  'autofill' => $request['autofill'],
326
  'limit_text' => $request['limit_text'],
 
327
  );
328
  $intial_answers = $request['answers'];
329
  $answers = array();
229
  'answerEditor' => isset($question['settings']['answerEditor']) ? $question['settings']['answerEditor'] : 'text',
230
  'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
231
  'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
232
+ 'limit_multiple_response' => isset($question['settings']['limit_multiple_response']) ? $question['settings']['limit_multiple_response'] : 0,
233
  'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
234
  );
235
  }
322
  );
323
  $settings = array(
324
  'required' => $request['required'],
325
+ 'answerEditor' => $request['answerEditor'],
326
  'autofill' => $request['autofill'],
327
  'limit_text' => $request['limit_text'],
328
+ 'limit_multiple_response' => $request['limit_multiple_response'],
329
  );
330
  $intial_answers = $request['answers'];
331
  $answers = array();
php/shortcodes.php CHANGED
@@ -34,4 +34,63 @@ function qsm_quiz_link_shortcode( $atts, $content = '' ) {
34
  return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "' $target_html>" . esc_html( $content ) . "</a>";
35
  }
36
  add_shortcode( 'qsm_link', 'qsm_quiz_link_shortcode' );
37
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "' $target_html>" . esc_html( $content ) . "</a>";
35
  }
36
  add_shortcode( 'qsm_link', 'qsm_quiz_link_shortcode' );
37
+
38
+ /**
39
+ * Displays a list of most recently created quizes [qsm_recent_quizzes]
40
+ * @param - attrs - array of shortcode attributes - no_of_quizzes, include_future_quizzes
41
+ * @param - no_of_quizzes - Number of most recent quizzes to be displayed (default 10)
42
+ * @param - include_future_quizzes - Whether to display future scheduled quizzes or not - yes/no (default yes)
43
+ * @since 5.1.0
44
+ * @return string - list of quizzes
45
+ * Shortcode call - [qsm_recent_quizzes no_of_quizzes=5 include_future_quizzes='no' ]
46
+ */
47
+
48
+ function qsm_display_recent_quizzes($attrs) {
49
+
50
+ $no_of_quizzes = isset($attrs['no_of_quizzes'])? $attrs['no_of_quizzes']:10;
51
+ $include_future_quizzes = isset($attrs['include_future_quizzes'])? $attrs['include_future_quizzes']: true;
52
+ global $wpdb;
53
+ wp_enqueue_style('quizzes-list', plugins_url('../css/quizzes-list.css', __FILE__));
54
+
55
+ $quiz_tbl = $wpdb->prefix.'mlw_quizzes';
56
+
57
+ $query = "SELECT quiz_id, quiz_name, quiz_settings FROM $quiz_tbl WHERE deleted=0 ORDER BY quiz_id DESC";
58
+ $quizzes = $wpdb->get_results($query);
59
+ $result = '<div class="outer-con">';
60
+ $i = 0;
61
+ foreach($quizzes as $quiz) {
62
+ if($i < $no_of_quizzes) {
63
+ $setting = unserialize($quiz->quiz_settings);
64
+ $options = unserialize($setting['quiz_options']);
65
+
66
+ $start_date = $options['scheduled_time_start'];
67
+ $end_date = $options['scheduled_time_end'];
68
+ $today = date('m/d/Y');
69
+ if($end_date!='' && $end_date < $today)
70
+ continue;
71
+ else if($include_future_quizzes == 'no' && $start_date > $today)
72
+ continue;
73
+ else {
74
+ $title = $quiz->quiz_name;
75
+ $id = $quiz->quiz_id;
76
+ $url = do_shortcode("[qsm_link id='$id'] Take Quiz [/qsm_link]");
77
+ $result .= "<div class='ind-quiz'>
78
+ <div class='quiz-heading'>
79
+ {$title}
80
+ </div>
81
+ <div class='quiz-url'>
82
+ {$url}
83
+ </div>
84
+ </div>";
85
+ $result .= "<div class='clear'></div>";
86
+ $i++;
87
+ }
88
+ }
89
+ }
90
+ if($i == 0)
91
+ $result .= "No quiz found";
92
+ $result .= "</div>";
93
+ return $result;
94
+
95
+ }
96
+ add_shortcode('qsm_recent_quizzes', 'qsm_display_recent_quizzes');
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question
4
  Requires at least: 4.9
5
  Tested up to: 5.2
6
  Requires PHP: 5.4
7
- Stable tag: 6.3.3
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -111,13 +111,18 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
 
114
  = 6.3.3 (Oct 04, 2019) =
115
  * Option to disable "retake" quiz option.
116
  * Mouse pointer over the FB / TW buttons
117
  * Translate for "Retake Quiz" ([Issue #773] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/773)
118
  * Radio buttons hard to select ([WP Issue] (https://wordpress.org/support/topic/radio-buttons-are-hard-to-select-on-mobile-devices/))
119
  * Results page enhancements
120
- * Skipped 6.3.2, by mistake.
121
 
122
  = 6.3.2 (July 06, 2019) =
123
  * UI Changes
4
  Requires at least: 4.9
5
  Tested up to: 5.2
6
  Requires PHP: 5.4
7
+ Stable tag: 6.3.4
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
111
 
112
  == Changelog ==
113
 
114
+ = 6.3.4 (Oct 24, 2019) =
115
+ * Massive overhaule for being responsive in admin panel.
116
+ * Checkbox limit ([Issue #743] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/743)
117
+ * Logic addon bug ([Issue #760] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/760)
118
+ * Add filter to results array ([Issue #785] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/785)
119
+
120
  = 6.3.3 (Oct 04, 2019) =
121
  * Option to disable "retake" quiz option.
122
  * Mouse pointer over the FB / TW buttons
123
  * Translate for "Retake Quiz" ([Issue #773] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/773)
124
  * Radio buttons hard to select ([WP Issue] (https://wordpress.org/support/topic/radio-buttons-are-hard-to-select-on-mobile-devices/))
125
  * Results page enhancements
 
126
 
127
  = 6.3.2 (July 06, 2019) =
128
  * UI Changes
trunk/CHANGELOG.md DELETED
@@ -1,849 +0,0 @@
1
- = 6.1.2 (January 7, 2019) =
2
- * Closed User Request: Add special character selector to question editor ([Issue #750](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/750))
3
- * Closed User Request: Add total questions and total pages to Questions tab ([Issue #749](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/749))
4
- * Updated getting started video
5
-
6
- = 6.1.1 (December 28, 2018) =
7
- * Fixes issue causing broken quizzes on sites using older versions of WordPress
8
-
9
- = 6.1.0 (December 26, 2018) =
10
- * Adds new Gutenberg blocks
11
- * Fixes undefined access at delete_question static function (Thanks [bpanatta](https://github.com/QuizandSurveyMaster/quiz_master_next/pull/746)!
12
-
13
- = 6.0.4 (October 2, 2018) =
14
- * Changes links from old documentation to newer documentation
15
-
16
- = 6.0.3 (August 20, 2018) =
17
- * Closed Bug: User gets 'trapped' if timer runs out on required question when questions are paginated ([Issue #583](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/583))
18
- * Closed Bug: If user refreshes quiz page when timer is at 0, cannot submit ([Issue #501](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/501))
19
- * Closed Bug: Saving quiz name when editing results in error if no changes are made ([Issue #391](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/391))
20
- * Adds deprecated notice to the quiz setting functions found in the quizCreator object
21
- * Adds hook after results are stored in the database
22
-
23
- = 6.0.2 (July 18, 2018) =
24
- * Closed Bug: PHP warning thrown on Help page ([Issue #711](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/711))
25
- * Closed Bug: Timer not working on certain sites when using questions per page option ([Issue #709](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/709))
26
- * Closed Bug: Blank page shown when contact fields and message fields are empty ([Issue #707](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/707))
27
-
28
- = 6.0.1 (July 11, 2018) =
29
- * Closed Bug: Quiz comment box shows HTML in label when using newer pagination system ([Issue #704](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/704))
30
-
31
- = 6.0.0 (June 20, 2018) =
32
- * Closed Enhancement: Remove Tools tab ([Issue #689](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/689))
33
- * Closed Enhancement: Bump Minimum PHP Version To 5.4 ([Issue #607](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/607))
34
- * Closed Enhancement: Move Leaderboards to free addon ([Issue #380](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/380))
35
-
36
- = 5.3.2 (June 7, 2018) =
37
- * Closed Plugin Compatibility: Conflict with Divi Builder ([Issue #686](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/686))
38
-
39
- = 5.3.1 (May 21, 2018) =
40
- * Closed Enhancement: Add user ID to admin results page table - ([Issue #682](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/682))
41
- * Closed Enhancement: Integrate with WordPress 4.9.6 GDPR features - ([Issue #681](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/681))
42
-
43
- = 5.3.0 (May 16, 2018) =
44
- * Closed Enhancement: Ability to disable IP address collection - ([Issue #670](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/670))
45
- * Closed User Request: Ability to customize name of QSM archive name - ([Issue #666](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/666))
46
- * Closed User Request: Progress Bar - ([Issue #412](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/412))
47
- * Closed User Request: Disable Results Being Stored In Database - ([Issue #215](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/215))
48
- * Closed Bug: Question ordering doesn't work when using older pagination option - ([Issue #657](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/657))
49
-
50
- = 5.2.4 (May 7, 2018) =
51
- * Closed Bug: %QUESTIONS_ANSWERS% variable is displaying questions in order of creation - ([Issue #660](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/660))
52
- * Closed Bug: Extra spacing is being added to questions when multiple lines are in question - ([Issue #659](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/659))
53
- * Closed Bug: Tabs pages stop working when translated - ([Issue #582](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/582))
54
-
55
- = 5.2.3 (April 3, 2018) =
56
- * Closed Bug: Cannot save question on certain servers - ([Issue #651](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/651))
57
- * Closed Bug: Questions/Answers Template Not Loaded In Admin Results Page - ([Issue #636](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/636))
58
-
59
- = 5.2.2 (April 1, 2018) =
60
- * Makes minor style adjustments
61
- * Adds additional hook to admin results details page
62
- * Modifies a few error messages
63
-
64
- = 5.2.1 (March 5, 2018) =
65
- * Fixes broken "Custom" styles
66
- * Fixes minor bugs in new question editor
67
- * Makes minor style adjustments
68
-
69
- = 5.2.0 (March 3, 2018) =
70
- * Closed Enhancement: Make Quiz Results Extendable/Filterable - ([Issue #622](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/622))
71
- * Closed Enhancement: New Question Editor - ([Issue #568](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/568))
72
- * Closed Bug: Pagination Bug - ([Issue #477](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/477))
73
- * Closed Bug: Questions shift - ([Issue #467](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/467))
74
- * Closed User Request: Remove duplicate question popup confirmation - ([Issue #396](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/396))
75
- * Closed User Request: Question Grouping - ([Issue #356](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/356))
76
- * Closed User Request: Ability To Move Submit Button To Last Question Page - ([Issue #321](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/321))
77
-
78
- = 5.1.7 (January 2, 2018) =
79
- * Closed Bug: Quizzes/Surveys table not working on certain installs - ([Issue #598](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/598))
80
-
81
- = 5.1.6 (December 25, 2017) =
82
- * Closed Bug: Timezone ID '' is invalid - ([Issue #606](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/606))
83
- * Closed Bug: Required contact fields not working correctly when the loggedin_user_contact option is set to no - ([Issue #603](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/603))
84
-
85
- = 5.1.5 (November 27, 2017) =
86
- * IMPORTANT FIX: 5.1.4 had a fatal error for sites using out of date PHP versions. Please update to this!
87
-
88
- = 5.1.4 (November 27, 2017) =
89
- * Closed Bug: Headers already sent message - ([Issue #596](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/596))
90
- * Closed Bug: Styling for hints is missing causing them to be hard to read - ([Issue #587](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/587))
91
-
92
- = 5.1.3 (November 18, 2017) =
93
- * Closed Bug: MathJax library not loading - ([Issue #590](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/590))
94
- * Closed Bug: Fatal error: Call to a member function register_question_type - ([Issue #509](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/509))
95
-
96
- = 5.1.2 (October 17, 2017) =
97
- * Closed Bug: Special characters fail the uppercase validation in open answer/fill in the blank questions - ([Issue #580](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/580))
98
-
99
- = 5.1.1 (October 4, 2017) =
100
- * Closed Bug: Variable function names break Certificate addon - ([Issue #578](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/578))
101
-
102
- = 5.1.0 (October 2, 2017) =
103
- * Closed Enhancement: Add all active quizzes function to API - ([Issue #552](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/552))
104
- * Closed User Request: Shortcode or variable for dynamic link to specific quiz/survey - ([Issue #524](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/524))
105
- * Closed Enhancement: Use locale's date to generate date strings - ([Issue #479](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/479))
106
- * Closed User Request: Allow users to change the date to European Date DD.MM.YYYY - ([Issue #439](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/439))
107
- * Closed User Request: More Space in the Correct Answer Info textbox - ([Issue #417](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/417))
108
-
109
- = 5.0.7 (September 18, 2017) =
110
- * Closed Bug: Answers of "0" disappear when adding or editing questions - ([Issue #531](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/531))
111
-
112
- = 5.0.6 (August 1, 2017) =
113
- * Closed Bug: HTML Entities causing incorrect answers and missing user answer - ([Issue #565](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/565))
114
-
115
- = 5.0.5 (July 8, 2017) =
116
- * Closed Enhancement: Add notice for leaderboard removal - ([Issue #562](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/562))
117
- * Closed Bug: Scheduled timeframe options are not working - ([Issue #558](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/558))
118
-
119
- = 5.0.4 (June 19, 2017) =
120
- * Closed Bug: Required fields are not checked 2nd time user takes quiz when timer is turned on ([Issue #528](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/528))
121
- * Closed Enhancement: Ensure compatibility with WordPress 4.8 ([Issue #554](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/554))
122
-
123
- = 5.0.3 (May 29, 2017) =
124
- * Minor code changes
125
-
126
- = 5.0.2 (May 7, 2017) =
127
- * Closed Bug: Social sharing text not updating when user changes the text ([Issue #541](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/541))
128
-
129
- = 5.0.1 (March 27, 2017) =
130
- * Closed Bug: The setting to hide contact fields from logged-in users is hiding fields from visitors too ([Issue #535](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/535))
131
-
132
- = 5.0.0 (March 25, 2017) =
133
- * Closed Bug: Fix delete custom post types during uninstall bug ([Issue #527](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/527))
134
- * Closed Enhancement: Change Shortcode To QSM ([Issue #515](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/515))
135
- * Closed Enhancement: Search function for quizzes/surveys ([Issue #492](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/492))
136
- * Closed Enhancement: Create new fields class to handle creation/post data of settings fields ([Issue #450](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/450))
137
- * Closed Enhancement: Create new settings class to handle the settings data ([Issue #449](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/449))
138
- * Closed Enhancement: Rewrite options system to allow for extendibility ([Issue #448](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/448))
139
- * Closed Enhancement: Enable tabs for the admin results page ([Issue #408](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/408))
140
- * Closed Enhancement: Create onboarding process ([Issue #397](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/397))
141
- * Closed Enhancement: Create new contact tab to allow form creation ([Issue #394](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/394))
142
- * Closed Enhancement: Move Certificate to free addon ([Issue #381](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/381))
143
- * Closed Enhancement: Ability to add check box for privacy statement with the contact fields ([Issue #372](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/372))
144
- * Closed Enhancement: Customize the "Please complete all required fields!" text ([Issue #371](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/371))
145
- * Closed Enhancement: Allow admins to customize the validation error messages ([Issue #346](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/346))
146
- * Closed Enhancement: Hint field cannot be customized ([Issue #262](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/262))
147
- * Closed Enhancement: Add custom fields to the contact form ([Issue #211](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/211))
148
- * Closed Enhancement: Scrollable List of Quizzes ([Issue #46](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/46))
149
-
150
- = 4.7.10 (January 1, 2017) =
151
- * Closed Bug: Edit question not working when visual editor is off - Issue #497
152
- * Closed Bug: Localization incomplete on Global Settings page - Issue #478
153
-
154
- = 4.7.9 (December 13, 2016) =
155
- * Closed Security: CSRF vulnerability on Questions tab
156
-
157
- = 4.7.8 (November 2, 2016) =
158
- * Closed Bug: Apostrophe in translation for tab name text causing errors - Issue #490
159
- * Closed Bug: Timer resets if user copies link, opens new tab, and pastes link - Issue #489
160
- * Closed Enhancement: Add Business, Email, And Phone To Quiz Results Search - Issue #485
161
- * Closed Bug: "You Deserve It" button in review message leads to 404 - Issue #476
162
- * Closed Bug: In the Hint dropdown text, the 'apostrophe' does not display properly - Issue #453
163
-
164
- = 4.7.7 (September 10, 2016) =
165
- * Closed Bug: From Email Bug Causing 500 Error On WP 4.6 - Issue #473
166
- * Closed Enhancement: Table Styles Don't Match Default WordPress Styles. - Issue #471
167
- * Closed Bug: Tracking manager causes admin server error when request error occurs. - Issue #470
168
-
169
- = 4.7.6 (July 11, 2016) =
170
- * Closed: Add language and error logs to usage tracking - Issue #457
171
-
172
- = 4.7.5 (June 15, 2016) =
173
- * Closed Enhancement: Change Text Block To Text/HTML - Issue #451
174
- * Closed Enhancement: Create alert warning about removal of certificate - Issue #382
175
-
176
- = 4.7.4 (June 3, 2016) =
177
- * Closed Bug: Results page will not load on some sites - Issue #445
178
-
179
- = 4.7.3 (May 31, 2016) =
180
- * Closed Enhancement: Create new question section id CSS class for each question - Issue #440
181
- * Closed Bug: Creating/Editing questions throw PHP notice of undefined index - Issue #436
182
-
183
- = 4.7.2 (May 23, 2016) =
184
- * Closed Bug: Multiple quizzes on page causes plugin to scroll to top quiz when submitting - Issue #428
185
-
186
- = 4.7.1 (May 10, 2016) =
187
- * Closed Enhancement: Create new audit trail class - Issue #425
188
- * Closed Enhancement: Raise minimum WordPress version to 4.1 - Issue #423
189
- * Closed Enhancement: WordPress Compatibility with 4.5.2 - Issue #422
190
- * Closed Enhancement: Move installation process into new QSM_Install class - Issue #416
191
- * Closed Enhancement: Update links for plugin on Plugins page - Issue #415
192
- * Closed Bug: Activating plugin on fresh install causes unexpected output warning - Issue #414
193
- * Closed User Request: Shortcode parameter to override amount of questions - Issue #345
194
- * Closed Enhancement: Limit per user - upgrade to include non-logged in users - Issue #301
195
-
196
- = 4.7.0 (April 4, 2016) =
197
- * Closed Bug: Slash Added Before Quotation Mark When Editing Quiz/Survey Name - Issue #401
198
- * Closed User Request: Add CSS Class To Container When Timer Runs Out - Issue #400
199
- * Closed Bug: Validation breaks on second time through quiz - Issue #398
200
- * Closed Bug: Validation not working when more than one question per page - Issue #395
201
- * Closed Enhancement: Add Spinner/De-activate Submit Button Once Submitted - Issue #387
202
- * Closed Enhancement: Pull changelog from GitHub API - Issue #377
203
- * Closed Bug: Theme Conflict With Button Class (btn) - Issue #370
204
- * Closed User Request: Add Average Points Per Category Variable - Issue #369
205
- * Closed Bug: Mixed content SSL error - Issue #367
206
- * Closed Enhancement: Default Option For Drop Down - Issue #334
207
- * Closed Bug: Disable Answer On Change Not Working - Issue #331
208
- * Closed User Request: Randomize Answers But Not Questions - Issue #330
209
- * Closed User Request: Add Date Taken Variable - Issue #310
210
- * Closed User Request: Copy Questions Between Quizzes - Issue #166
211
-
212
- = 4.6.7 (January 22, 2016) =
213
- * Fixes bug causing multiple response to be on a single line for some users
214
- * Fixes bug causing the incorrect/correct CSS class from being not added on results page correctly
215
- * Fixes bug causing unexpected output error when activating plugin
216
- * Changes comment section to default to off in newer quizzes
217
- * Adds link to online academy to help page
218
- * Cleans up installation function code
219
-
220
- = 4.6.6 (January 11, 2016) =
221
- * Fixes bug preventing some users to not be able to submit quiz
222
- * Fixes bug causing undefined titles for some users
223
-
224
- = 4.6.5 (January 9, 2016) =
225
- * Fixes timer bug that caused the timer to continue counting down after quiz has been submitted
226
- * Fixes theme conflict between QSM and some Bootstrap based themes
227
- * Fixes Quizzes/Surveys page table width issue
228
- * Fixes bug preventing editing of quiz post settings
229
- * Minor design changes
230
-
231
- = 4.6.4 (December 15, 2015) =
232
- * Fixes undefined results notice displayed on admin results for some users
233
- * Fixes bug that was causing the disable radio buttons option to not work in all browsers
234
- * Minor design changes
235
-
236
- = 4.6.3 (November 4, 2015) =
237
- * Fixes certificate bug that was preventing quiz/survey submissions
238
- * Fixes undefined quiz id bug that was affecting some addons
239
- * Fixes tooltip bug that was affecting required question validation on a few sites
240
-
241
- = 4.6.2 (October 21, 2015) =
242
- * Bug fix for browsers with JavaScript turned off
243
-
244
- = 4.6.1 (October 20, 2015) =
245
- * Bug fix for rare bug preventing IE usage on a small number of sites
246
-
247
- = 4.6.0 (October 20, 2015) =
248
- * Adds new dynamic form submission ([Github Issue #206](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/206))
249
- * Adds new From email address option ([Github Issue #312](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/312))
250
- * Adds new Reply-To admin email option
251
- * Fixed timer issue that started timer but prevent access to next page ([Github Issue #302](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/302))
252
- * Fixes redirect bug that prevented submissions from saving ([Github Issue #201](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/201))
253
- * Fixes required question bug that prevented multiple quizzes/surveys on one page ([Github Issue #304](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/304))
254
- * Re-wrote front-end JavaScript to fix a variety of smaller bugs
255
- * Renamed several file names and functions to align more with WordPress coding standards
256
-
257
- = 4.5.5 (October 1, 2015) =
258
- * Adds 4 new style templates to choose from
259
- * Fixes Dutch translation ([Github Issue #285](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/285))
260
- * Fixes quiz results losing search filters after first page ([Github Issue #293](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/293))
261
- * Fixes question drag and drop not working on certain installs ([Github Issue #295](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/295))
262
- * Fixes Required? question setting where the Yes or No value did not show when editing ([Github Issue #296](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/296))
263
-
264
- = 4.5.4 (September 3, 2015) =
265
- * Rebrand as Quiz And Survey Master
266
- * Fixes scroll to top pagination bug
267
- * Fixes leaderboard widget bug
268
-
269
- = 4.5.3 (August 21, 2015) =
270
- * Fixed an issue where Quiz Views and Quiz Taken stats in the Quizzes screen was reseting to 1 instead of 0. ([Github Issue #277](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/277))
271
-
272
- = 4.5.2 (August 14, 2015) =
273
- * Ensured compatibility with Wordpress version 4.3
274
- * Fixed an issue when Contact details are set to Required and the user leaves the fields blank the quiz is still allowed to gets submitted in IE. ([Github Issue #270](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/270))
275
-
276
- = 4.5.1 (August 12, 2015) =
277
- * Fixes parse error on hosts with older PHP versions
278
-
279
- = 4.5.0 (August 11, 2015) =
280
- * Added a brand new log system to track errors in the plugin. ([Github Issue #233](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/233))
281
- * Added the ability to drag and drop questions when creating your quiz. ([Github Issue #235](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/235))
282
- * Added new CSS template system for quizzes. ([Github Issue #234](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/234))
283
- * Added new classes for Correct/Incorrect Answers. ([Github Issue #228](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/228))
284
- * Added ability to sort the results. ([Github Issue #167](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/167))
285
- * Added the ability to search quiz results by quiz name, score, time taken, and completion time. ([Github Issue #70](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/70))
286
- * Added the ability for developers to show only relevant fields when adding/editing questions on different question types.
287
- * Added new register template functions to the API.
288
- * Added a new contributor tab to the credits page.
289
- * Added a checkbox to the quiz results page to delete results.
290
- * Added a brand new review message system.
291
- * Bug Fix: Fixed a bug where slashes where appearing with the category name.
292
- * Bug Fix: Fixed a timer bug that prevented the timer form working when using pagination.
293
-
294
- = 4.4.4 (July 19, 2015) =
295
- * Security Fix: Fixed possible sql injection from authenticated users on certificate, email, and leaderboard tabs
296
- * Security Fix: Fixed data validation bug on help page, leaderboard shortcode, and quiz shortcode
297
-
298
- = 4.4.3 (July 17, 2015) =
299
- * Security Fix: Fixed possible sql injection from authenticated users on text and tools tabs
300
-
301
- = 4.4.2 (June 26, 2015) =
302
- * Bug Fix: Fixed bug that caused issues with validation ([Github Issue #254](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/254))
303
- * Bug Fix: Fixed a rare permalink issue ([Github Issue #253](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/253))
304
-
305
- = 4.4.1 (June 21, 2015) =
306
- * Bug Fix: Fixes validation bug from missing first page
307
- * Bug Fix: Fixes timer bug that prevented timer when first page was missing
308
- * Bug Fix: Fixes bug that prevented re-editing of LaTex
309
- * Bug Fix: Fixes certificate site_url bug
310
-
311
- = 4.4.0 (June 11, 2015) =
312
- * Added new template variable %TIMER_MINUTES% ([GitHub Issue #209](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/209))
313
- * Eliminates first page if empty ([GitHub Issue #182](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/182))
314
- * Timer now begins counting down after starting quiz if using pagination ([GitHub Issue #181](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/181))
315
- * Amount Finished Compared To Amount In Quiz ([GitHub Issue #21](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/21))
316
- * Bug Fix: Required Answers And Timer Doesn't Work Well Together ([GitHub Issue #220](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/220))
317
- * Bug Fix: FPDF WriteHTML Path Not Being Created Correctly On Windows ([GitHub Issue #204](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/204))
318
- * Bug Fix: Long quiz URL mangles page layout ([GitHub Issue #202](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/202))
319
- * Bug Fix: Fixed Support Widget bug where the support widget was not always submitting correctly.
320
-
321
- = 4.2.4 (April 1, 2015) =
322
- * Minor Design Changes
323
- * Minor Bug Fixes
324
-
325
- = 4.2.3 (March 26, 2015) =
326
- * Minor Design Changes
327
- * Minor Bug Fixes
328
- * Added Italian Translation
329
-
330
- = 4.2.2 (March 23, 2015) =
331
- * Minor Design Update
332
-
333
- = 4.2.1 (March 19, 2015) =
334
- * Minor Design Changes
335
- * Moved Redirect URL Back To Beta
336
-
337
- = 4.2.0 (March 7, 2015) =
338
- * Added Fill In The Blank Questions ([GitHub Issue #132](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/132))
339
- * Created New Template Variables For Social Sharing ([GitHub Issue #121](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/121))
340
- * Added Ability To Redirect To Other Page Upon Completion ([GitHub Issue #35](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/35))
341
- * Added Several Translations: da_DK, es_ES, nl_NL, pt_BR, and th
342
- * Bug Fix: Duplicate Quizzes Not Having URL ([GitHub Issue #144](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/144))
343
- * Bug Fix: Message Sent Text ([GitHub Issue #142](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/142))
344
- * Bug Fix: Missing Footer Column ([GitHub Issue #145](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/145))
345
-
346
- = 4.1.0 (February 11, 2015) =
347
- * Added Ability To Restore Deleted Quizzes ([GitHub Issue #107](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/107))
348
- * Added Ability To Multi-Delete Results ([GitHub Issue #4](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/4))
349
- * Redesigned Admin Results Pages ([GitHub Issue #106](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/106))
350
- * Added Ability To Go To Next/Previous Results ([GitHub Issue #71](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/71))
351
- * Quizzes Now Have Direct URL And Archive ([GitHub Issue #104](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/104))
352
- * Added Ability To Use Own Facebook App ID ([GitHub Issue #137](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/137))
353
- * In Code: New Hook For Template Variable List
354
- * In Code: Certificate On Admin Results Now Hooked Into New Template Variable System
355
- * In Code: Converted Support Widget To Remote Post ([GitHub Issue #114](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/114))
356
- * In Code: Added Uninstall File Direct Access Check
357
- * Bug Fix: Fixed Dashboard Widget No Quiz Bug ([GitHub Issue #119](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/119))
358
- * Bug Fix: Fixed Shortcode No Quiz Bug ([GitHub Issue #120](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/120))
359
- * Bug Fix: Fixed Required Contact User Bug ([GitHub Issue #123](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/123))
360
- * Bug Fix: Fixed Text Template Bug ([GitHub Issue #117](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/117))
361
-
362
- = 4.0.1 (January 21, 2015) =
363
- * Results HTML Bug Fix
364
- * Question HTML Bug Fix
365
- * Multiple Response Points Bug Fix
366
-
367
- = 4.0.0 (January 14, 2015) =
368
- * Added Ability To Add Categories To Your Quizzes
369
- * Added Multiple Choice And Multiple Response To Required System
370
- * Added Wp Editor To Results Pages
371
- * Added Shortcode Capability To Results Pages
372
- * Added Translation Capabilities
373
- * Created New Addon Settings Page
374
- * Design Changes To Quiz Settings Page
375
- * In Code: Added 20 New Filters And Hooks
376
- * In Code: Turned Question Types Into Extendable Functions For Creating Own Question Types
377
- * In Code: Created New Plugin Helper Class For Extending Plugin
378
- * In Code: Rewrote 75% of quiz shortcode file. Now With New Quiz Manager Class
379
- * In Code: Re-organized File/Directory Structure
380
- * In Code: Separated Quiz Settings Functions Into Own Files
381
-
382
- = 3.9.0 (December 30, 2014) =
383
- * Added Wp Editor To Text Tab
384
- * Added Weekly Stats To Snapshot Widget
385
- * Moved Email Settings To Emails Tab
386
- * Default Question Order Auto-increments For New Questions
387
- * In Code: Separated CSS/JS From Core Quiz PHP File
388
-
389
- = 3.8.2 (December 21, 2014) =
390
- * Minor Design Changes
391
-
392
- = 3.8.1 (December 17, 2014) =
393
- * Added Ability To Send Different Admin Emails Based On Score
394
- * Added Ability To Customize Admin Email Subject
395
- * Added New Dashboard Widget For Quick Snapshot Of Status
396
- * Added New Help Page With Link To Documentation
397
- * Create New System Info Widget On Help Page
398
- * In Code: Added 4 New Hooks Throughout The Quiz Creator Class
399
- * In Code: Added 3 New Quiz Settings Helper Functions In Quiz Creator Class
400
-
401
- = 3.7.1 (December 10, 2014) =
402
- * Added Ability To Schedule A Timeframe That The Quiz Is Active In
403
- * Added Labels To Horizontal Radio Type For Better Use
404
- * In Code: Moved Alert Class Inside Main Class
405
- * In Code: Created New Quiz Creator Class
406
-
407
- = 3.6.1 (December 2, 2014) =
408
- * Add Separate Social Network Text Templates
409
- * Added Hours Field To Timer And Completion Time
410
- * Converted Quizzes Page To Use wpdb->update And wpdb->insert Instead Of query
411
- * Created New Filter For Creating New Variables For Quiz Page
412
- * Created New Filter For Creating New Variables For Results Page
413
-
414
- = 3.5.2 (November 26, 2014) =
415
- * Bug Fix For Some Bugs Resulting In Error Code 0008
416
-
417
- = 3.5.1 (November 25, 2014) =
418
- * Added The Ability To Require Users To Be Logged In To Access Quiz
419
- * Added Ability To Limit Total Amount Of Entries
420
- * Added Ability To Show Mathematic Formulas Using Tex Or LaTex
421
- * Set Up Parameters For Action 'mlw_qmn_load_results_page' To Pass Results Id And Quiz Settings
422
- * Minor Design Change To Quizzes Page
423
-
424
- = 3.4.1 (November 20, 2014) =
425
- * Added Preview Mode (Beta)
426
- * Several Design Changes To Quizzes Page
427
- * Minor Design Changes To Quiz Settings Page
428
- * Added Completion Time To Quiz Results Page
429
- * Added Time Taken To Quiz Result Details Page
430
- * Created New Hook On Quiz Settings Page
431
- * Broke Apart Quiz Settings Backend Into Smaller Functions That Hook Into New Hook
432
- * Created New Backend Alert Manager Class To Replace Archaic Old Error System
433
-
434
- = 3.3.3 (November 14, 2014) =
435
- * Minor Backend Change To Quiz Validation
436
- * Disabled Enter Key On Quiz
437
- * Minor Bug Fixes
438
-
439
- = 3.3.2 (October 26, 2014) =
440
- * Minor Design Change To Quiz Options
441
-
442
- = 3.3.1 (October 15, 2014) =
443
- * Added Horizontal Multiple Response Question Type
444
- * Added Ability To Duplicate Questions When Duplicate Quizzes
445
- * Added Last Modified Column To Table On Quizzes Page
446
- * Fixed Number Question Type Grading Bug
447
- * Fixed Missing theme_selected Column Installation Bug
448
- * Fixed Missing theme_selected Column Duplication Bug
449
- * Fixed Numerous Small Bugs
450
-
451
- = 3.2.2 (October 4, 2014) =
452
- * Minor Bug Fixes
453
-
454
- = 3.2.1 (October 2, 2014) =
455
- * Added New Captcha Question Type
456
- * Fixed Number Question Type Validation Bug
457
- * Fixed Validation Wrong Border Bug
458
-
459
- = 3.1.1 (September 15, 2014) =
460
- * Added Ability To Duplicate Individual Questions
461
- * Added Ability To Require Accept, Number, And Open Answer Question Types
462
- * Added Number Question Type
463
- * Added Accept Non-Question Type
464
-
465
- = 3.0.1 (August 28, 2014) =
466
- * Added New Style Manager
467
- * Added Ability For Non-Question Question Types
468
- * Added New Text Block Question Type
469
- * Added Question Type Column To Question List
470
- * Minor Design Changes To Quiz Questions Tab
471
- * Fixed Results Delete Link Not Working Bug
472
- * Fixed Quiz Name Showing Escaped Values Bug
473
-
474
- = 2.9.1 (August 11, 2014) =
475
- * Added Facebook Sharing
476
- * Added Ability To Edit Email Subject
477
- * Added Large Open Answer Question Type
478
- * Added Ability For Points To Have Decimal Values
479
- * Fixed Not All Questions Showing In Results Bug
480
- * Fixed Not Valid Email On Non-Required Email Bug
481
- * Fixed Special Character Not Grading Properly In Open Answer Bug
482
-
483
- = 2.8.5 (August 9, 2014) =
484
- * Minor Bug Fixes
485
- * Minor Design Tweaks To About Page
486
-
487
- = 2.8.4 (August 3, 2014) =
488
- * Minor Bug Fixes
489
-
490
- = 2.8.3 (June 8, 2014) =
491
- * Next/Previous Buttons Now Scroll Page To Top Of Quiz
492
- * Minor Bug Fixes
493
-
494
- = 2.8.2 (May 28, 2014) =
495
- * Minor Bug Fixes
496
-
497
- = 2.8.1 (May 26, 2014) =
498
- * Took Out Help Related Tool Tips
499
- * Design Changes To Quiz Text Tab For Easier Navigation
500
- * Deleted How-To Page, Please Use Documentation On Our Website
501
- * Renamed Quiz Options Page As Quiz Settings To Avoid Confusion With Quiz Options Tab
502
-
503
- = 2.7.3 (May 19, 2014) =
504
- * Fixed Open Answer Not Showing Correct Answer Bug
505
-
506
- = 2.7.2 (May 18, 2014) =
507
- * Fixed Timer Not Restarting Bug
508
- * Fixed Tooltip Affecting Whole Page Bug
509
-
510
- = 2.7.1 (May 16, 2014) =
511
- * Added Ability To Set Number Of Question Per Page
512
- * Fixed HTML Not Showing On Results Page Bug
513
- * Fixed Timer Not Disabling New Fields Bug
514
- * Fixed Timer Submitting Disabled Fields Bug
515
-
516
- = 2.6.4 (May 12, 2014) =
517
- * Bug Fixes
518
-
519
- = 2.6.3 (May 9, 2014) =
520
- * Bug Fixes
521
-
522
- = 2.6.2 (May 8, 2014) =
523
- * Bug Fixes
524
-
525
- = 2.6.1 (May 7, 2014) =
526
- * Added UTF-8 Support For Special Characters And Non-Latin Languages
527
- * Fixed Question Bank Showing All Answers Bug
528
-
529
- = 2.5.1 (May 3, 2014) =
530
- * Rebuilt Answer System
531
- * Added Ability To Have Unlimited Answers
532
- * Added Ability To Randomize Answers
533
- * Added New Question Type - Multiple Response (Checkboxes)
534
- * Added Ability To Send Admin Email To Multiple Users
535
- * Minor Design Changes To Quiz Options Page
536
-
537
- = 2.4.1 (April 20, 2014) =
538
- * Added New Quiz Emails Tab
539
- * Added Ability To Send Different Emails To Users Based On Score
540
- * Fixed Required Question Bug
541
- * Fixed Landing Page Bug
542
-
543
- = 2.3.1 (April 6, 2014) =
544
- * Added Ability To Have Graded Open Answer Questions
545
- * Minor Design Changes
546
-
547
- = 2.2.2 (March 30, 2014) =
548
- * Reverted To Previous Pagination Javascript
549
-
550
- = 2.2.1 (March 30, 2014) =
551
- * Added Ability To Show Question Numbers
552
- * Added More CSS Classes To Quiz Page For Better Styling Options
553
- * Changed Timer To Disable Fields Instead Of Submit Form When Time Is Up
554
- * Fixed Pagination Javascript Bug
555
- * Minor Design Change To Quiz
556
- * Minor Design Change To Quiz Options Page
557
-
558
- = 2.1.1 (March 26, 2014) =
559
- * Added Ability To Edit Style For Each Quiz
560
- * Fixed Tried Quiz Too Many Times Text Bug
561
- * Fixed Dashboard Quartely Widget Bug
562
- * Minor Design Changes To Quiz Options Page
563
-
564
- = 2.0.1 (March 22, 2014) =
565
- * Added Pagination On Quiz Results Page
566
- * Redesigned Results Detail Page
567
- * Fixed PHP Notice On Quizzes Page
568
- * Allow HTML/CSS in Landing Pages
569
-
570
- = 1.9.6 (March 19, 2014) =
571
- * Fixed Duplicate Quiz Bug
572
- * Fixed Uneditable Question Bug
573
- * Fixed Parse Bug
574
- * Made Email Now Send As HTML
575
-
576
- = 1.9.5 (March 18, 2014) =
577
- * Fixed Bug
578
-
579
- = 1.9.4 (March 18, 2014) =
580
- * Fixed Bug
581
-
582
- = 1.9.3 (March 17, 2014) =
583
- * Fixed Bug: Unexpected T_CONSTANT_ENCAPSED_STRING When Activating
584
-
585
- = 1.9.2 (March 17, 2014) =
586
- * Added Ability To Delete Landing Pages
587
- * Added Ability To Have HTML In Correct Answer Info Field
588
- * Added Previous Question Button To Paginated Quiz
589
- * Minor Design Changes To Quiz
590
- * Add Timer To Title Bar
591
- * Added %CURRENT_DATE% field
592
-
593
- = 1.9.1 (March 13, 2014) =
594
- * Added Ability To Show One Question At A Time Instead Of All At Once
595
- * Added Ability To Allow Users To Share Results On Twitter
596
- * Added Ability To Set Time Limits On Quiz
597
- * Minor Design Changes To Quiz
598
- * Minor Bug Fixes
599
-
600
- = 1.8.2 (March 11, 2014) =
601
- * Minor Bug Fixes
602
-
603
- = 1.8.1 (March 10, 2014) =
604
- * Added Customizable Text Section At End Of Quiz
605
- * Added Ability To Set Up Different Landing Pages Based On Score
606
- * Added Ability To Give Certificate After Quiz
607
- * Enhanced Quiz Total Stats Widget
608
- * Minor Design Changes To Quiz
609
- * Fixed Session_Start Bug
610
- * Fixed Division By Zero Bug
611
- * Fixed Total Stats Deleted Bug
612
- * Fixed Dashboard Rounding Bug
613
- * Fixed Notice Unknown Company Field Bug
614
-
615
- = 1.7.1 (March 6, 2014) =
616
- * Added Several New Widgets To Quiz Dashboard
617
- * Added A Timer Mechanism To Track How Long User Takes On Quiz
618
- * Added New About Update Page
619
- * Fixed Saving Results Bug
620
- * Fixed Random Number On Quiz Options Page Bug
621
-
622
- = 1.6.3 (March 5, 2014) =
623
- * Fixed Duplicated Shortcode Bug
624
- * Quiz Dashboard Design Changes
625
-
626
- = 1.6.2 (March 4, 2014) =
627
- * Minor Bug Fixes
628
- * Minor Design Changes
629
-
630
- = 1.6.1 (March 2, 2014) =
631
- * Added Ability To Limit Amount User Tries Certain Quizzes
632
- * Fixed Internet Explorer Quiz Adding Bug
633
- * Fixed Results Link On Quizzes Page Bug
634
- * Fixed Points Number Check Bug
635
- * Fixed Limited Question Grading Bug
636
- * Minor Design Changes To Admin Pages
637
-
638
- = 1.5.1 (February 26, 2014) =
639
- * Added Ability To Load Only Set Amount Of Questions From Total Questions
640
- * Fixed PHP Notices On Quizzes Page
641
- * Fixed PHP Notices On Quiz Options Page
642
- * Fixed PHP Notices On Quiz Results Page
643
- * Fixed PHP Notices On Quiz
644
- * Fixed Hidden Pop-Up Bug
645
-
646
- = 1.4.2 (February 22, 2014) =
647
- * Fixed Capability Bug
648
- * Minor Design Changes To Question Form
649
- * Hint Bubble Is Now Wider For Longer Hints
650
- * Minor Design Change To Quiz
651
-
652
- = 1.4.1 (February 20, 2014) =
653
- * Enhanced Plugins Compatibility With Other Plugins
654
- * Hints Are Now Hidden By Default
655
- * Minor Bug Fixes
656
-
657
- = 1.3.1 (February 18, 2014) =
658
- * Added Ability To Choose Whether Logged-in Users Can Enter Contact Info
659
- * Fixed Editing Hint Field Error
660
- * Added Ability To Have Media In Answers
661
- * Added Ability To Have HTML In Questions And Answers
662
-
663
- = 1.2.1 (February 11, 2014) =
664
- * Fixed Quiz Results Details Bug
665
- * Continued Working On New Error Code System
666
- * Added Pagination To Tools Page, Quizzes Page And List Of Questions On Quiz Options Page
667
- * Added Ability To Create A Duplicate Of A Quiz
668
-
669
- = 1.1.1 (February 6, 2014) =
670
- * Added %AVERAGE_POINT% Variable That Calculates Average Points Per Question
671
- * Added Field For Reason Why Answer Is Correct
672
- * Added %CORRECT_ANSWER_INFO% To Display Why Answer Is Correct
673
- * Begun Creating New Error Code System
674
- * Fixed Edit Quiz Name Bug
675
- * Fixed New Quiz Bug
676
-
677
- = 1.0.1 (February 4, 2014) =
678
- * Fixed Saving Results Bug
679
- * Fixed Leaderboard Bug
680
-
681
- = 1.0 (February 1, 2014) =
682
- * Added Ability To Customize From Name For User And Admin Emails
683
- * Changed Question Editor
684
- * Minor Change To Help System
685
-
686
- = 0.9.9 (January 30, 2014) =
687
- * Begun Creating New Advanced Help System
688
- * Added New Question Editor
689
- * Added Ability To Have Media In Questions
690
- * Minor Design Changes To Quiz Options
691
-
692
- = 0.9.8 (January 25, 2014) =
693
- * Added Leaderboard Widget
694
- * Added Ability To Reset Quiz Stats On Each Quiz
695
- * Added Ability To Delete Results
696
- * Minor Design Changes
697
- * Minor Bug Fixes
698
-
699
- = 0.9.7 (January 24, 2014) =
700
- * Started Setting Plugin Up For Translations
701
- * Relocated Widgets From Help Page To Quiz Dashboard Page
702
- * Updated Several Of The Help Sections Through Plugin
703
- * Minor Bug Fixes
704
-
705
- = 0.9.6 (January 21, 2014) =
706
- * Added Ability To Edit Question Order When Adding Questions
707
- * Added Ability To Choose Whether Contact Info Is Asked For At Beginning Or End Of Quiz
708
- * Defaulted Question Comment Field To None On New Questions
709
- * Fixed Double Quote Bug
710
- * Enhanced Monthly Stat Widget
711
- * Minor Design Change To Quiz Total Stats Widget
712
- * Minor Design Changes To Quiz Options Page
713
-
714
- = 0.9.5 (January 19, 2014) =
715
- * Added Ability To Edit %QUESTIONS_ANSWERS% Template
716
- * Changed Name Of Support Page To Help Page
717
- * Minor Design Changes On Quiz Options Page
718
-
719
- = 0.9.4 (January 16, 2014) =
720
- * Added Ability To Randomly Order Questions
721
- * Updated Monthly Stat Widget
722
-
723
- = 0.9.3 (January 14, 2014) =
724
- * Logged-In Users Now See Contact Information
725
- * Minor Bug Fixes
726
-
727
- = 0.9.2 (January 12, 2014) =
728
- * Updated Weekly Stat Widget
729
- * Begun Work On Monthly Stat Widget
730
- * Added Ability To Edit Leaderboard Template
731
- * Bug Fixes
732
-
733
- = 0.9.1 (January 8, 2014) =
734
- * Fixed Leaderboard Design Bug
735
- * Fixed Contact Information Design Bug
736
- * Added Ability To Not Need Contact Info For Logged In Users
737
-
738
- = 0.9 (January 5, 2014) =
739
- * Added Ability To Edit Quiz Name
740
- * Added Ability To Display Question As Drop Down
741
- * Added Quiz Name To Completion Email's Subject
742
- * Minor Design Changes To Quiz Options Page
743
- * Design Changes To Quiz
744
-
745
- = 0.8.6 (January 2, 2014) =
746
- * Bug Fixes
747
-
748
- = 0.8.5 (January 1, 2014) =
749
- * New Screenshots Added
750
- * Minor Design Changes
751
- * Bug Fixes
752
-
753
- = 0.8.4 (December 22, 2013) =
754
- * New Option To Change Size Of Comment Field
755
- * Enhanced Weekly Stat Chart
756
- * Bug Fixes
757
-
758
- = 0.8.3 (December 14, 2013) =
759
- * Fixed Leaderboard Bug
760
- * Started Work On Weekly Stat Widget
761
- * Tweaked Some Design Throughout Admin Side
762
- * Minor Bug Fixes
763
-
764
- = 0.8.2 (December 10, 2013) =
765
- * Fixed Disappearing Question Bug Completely
766
- * Updated Update Process
767
-
768
- = 0.8.1 (December 9, 2013) =
769
- * Fixed Disappearing Question Bug
770
-
771
- = 0.8 (December 1, 2013) =
772
- * Added Spam Prevention Techniques To Backend
773
- * Added Ability To Reorder Questions
774
- * Added New Section On How-To Page
775
- * Bug Fixes
776
-
777
- = 0.7.2 (November 24, 2013) =
778
- * Bug Fixes
779
- * Added New Section On How-To Page
780
-
781
- = 0.7.1 (November 19, 2013) =
782
- * Changed Design For How-To Page
783
- * Added New Section In How-To Page
784
- * Added New Widget On Plugin Dashboard For Daily Stats
785
-
786
- = 0.7 (November 15, 2013) =
787
- * Bug Fixes
788
- * Begun Work On New How-To Page
789
- * Continued Redesigning Plugin Dashboard
790
-
791
- = 0.6.2 (November 10, 2013) =
792
- * Bug Fixes
793
- * Added More Stats
794
- * Started Redesigning Plugin Dashboard
795
-
796
- = 0.6.1 (November 2, 2013) =
797
- * Bug Fixes
798
-
799
- = 0.6 (October 19, 2013) =
800
- * Started Developing Quiz Leaderboards
801
- * Added Ability To Save User Answers And Comments
802
- * Added More Statistics To Quiz Dashboard
803
- * Bug Fixes
804
-
805
- = 0.5.3 (October 11, 2013) =
806
- * Bug Fixes
807
- * Started Redesigning Quiz Look
808
-
809
- = 0.5.2 (September 29, 2013) =
810
- * Bug Fixes
811
-
812
- = 0.5.1 (September 22, 2013) =
813
- * Added More Statistics To Quiz Dashboard
814
- * Bug Fixes
815
-
816
- = 0.5 (September 18, 2013) =
817
- * Created New Tools Page And Moved Audit Trail To It
818
- * Added Ability For Comment Section At End Of Quiz
819
- * Added Ability To Have Hints
820
- * Added Option To Have Comment Boxes On Questions
821
- * Added More Statistics To Main Page
822
-
823
- = 0.4.1 (September 15, 2013) =
824
- * Bug Fixes
825
-
826
- = 0.4 (September 13, 2013) =
827
- * Add The Ability To Require Contact Information
828
- * Add Email Validating To Email Field
829
-
830
- = 0.3.1 (September 13, 2013) =
831
- * Bug Fixes
832
-
833
- = 0.3 (September 12, 2013) =
834
- * Increased Scoring Systems To Three: Correct, Points, Or Not Graded
835
- * Error Fixes
836
-
837
- = 0.2 (September 9, 2013) =
838
- * Added New Quiz Dashboard Page
839
- * Created Audit Trail
840
- * Added Ability to Add Questions/Answers to Templates
841
- * Minor Spelling/Grammer Fixes
842
-
843
- = 0.1 (September 1, 2013) =
844
- * Begun Development
845
- * Added ability to create/edit/delete quizzes
846
- * Added ability to create/edit/delete questions
847
- * Added quiz admin page
848
- * Added questions admin page
849
- * Added results page
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/CONTRIBUTING.md DELETED
@@ -1,52 +0,0 @@
1
- # Contribute To Quiz And Survey Master
2
-
3
- Community made feature requests, patches, localisations, bug reports and contributions are always welcome and are crucial to ensure Quiz and Survey Master continues to grow to become the #1 quiz and survey platform for on WordPress.
4
-
5
- When contributing please ensure you follow the guidelines below so that we can keep on top of things.
6
-
7
- __Please Note:__ GitHub is not intended for support based questions. For those, please use [Our Contact Form](http://quizandsurveymaster.com/contact-us/)
8
-
9
- ## Getting Started
10
- * Make sure you have a free [GitHub Account](https://github.com/signup/free)
11
-
12
- ## Creating Issues
13
- * If you have a bug report or feature request, please [create an issue](https://github.com/QuizandSurveyMaster/quiz_master_next/issues).
14
- * For bug reports:
15
- * Please follow the debug guidlines below and report findings
16
- * Include what version of WordPress and what version of Quiz And Survey Master you are using
17
- * Include what operating system and browser you are using if applicable
18
- * If possible include link to quiz url or screenshot of issue
19
- * Clearly describe the bug/issue and include steps on how to reproduce it
20
- * For feature requests:
21
- * Please clearly describe what you would like and how it would be used
22
- * If possible, include a link or screenshot of an example
23
-
24
- ## Debug Guidelines
25
-
26
- If you are reporting a bug, please follow these guidlines first to see if any of these resolves the issue.
27
- * Switch to the default theme such as Twenty Fifteen, does your problem still persist?
28
- * De-activate all other plugins, does your problem still persist?
29
- * If that solves the problem, re-activate your plugins one at a time and test if the problem re-appears. If so, let us know which plugin caused it.
30
- * Try switching to another browser. Does your problem still persist?
31
-
32
- ## Making Changes
33
-
34
- * Fork the repository on GitHub
35
- * Make the changes to your forked repository
36
- * Ensure you stick to the [WordPress Coding Standards](https://codex.wordpress.org/WordPress_Coding_Standards)
37
- * When committing, reference your issue (if present) and include a note about the fix
38
- * Push the changes to your fork and submit a pull request to the 'master' branch of the QSM repository
39
-
40
- ## Code Documentation
41
-
42
- * We are trying to ensure that every QSM function is documented well and follows the standards set by phpDoc going forward
43
- * An example function can be found [here](https://gist.github.com/sunnyratilal/5308969)
44
- * Please make sure that every function is documented so that when we update our API Documentation things don't go awry!
45
- * If you're adding/editing a function in a class, make sure to add `@access {private|public|protected}`
46
- * Finally, please use tabs and not spaces. The tab indent size should be 4 for all QSM code.
47
-
48
- At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
49
-
50
- # Additional Resources
51
- * [General GitHub Documentation](http://help.github.com/)
52
- * [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/ISSUE_TEMPLATE.md DELETED
@@ -1,25 +0,0 @@
1
- **IF YOU DO NOT FOLLOW THIS TEMPLATE, YOUR ISSUE MAY BE CLOSED!!**
2
-
3
- Please provide the following information when creating your issues:
4
-
5
- ## Site Info
6
- WordPress Version:
7
- QSM Version:
8
- Browser:
9
-
10
- ## General description
11
- If this is a bug, give a general description of what you are experiencing. If this is a feature request, include what the feature is that you are requesting.
12
-
13
- Link to quiz or screenshot (if relevant):
14
-
15
- ## Expected behavior
16
- If you are reporting a bug, please describe what you are expecting the plugin to do. If this is a feature request, delete this section.
17
-
18
- ## Actual behavior
19
- If you are reporting a bug, please describe what you are experiencing. If this is a feature request, delete this section.
20
-
21
- ## Steps to reproduce the behavior
22
- If you are reporting a bug, describe the exact steps you are taking that results in the behavior described above. If this is a feature request, delete this section.
23
-
24
- ## Feature request
25
- If you are reporting a bug, delete this section. If you are requesting a feature, please explain what you would like to have in the plugin. Please include examples of other systems/software that may have similar features as well as the exact way you would use this feature.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/LICENSE.md DELETED
@@ -1,339 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
3
-
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
- Preamble
10
-
11
- The licenses for most software are designed to take away your
12
- freedom to share and change it. By contrast, the GNU General Public
13
- License is intended to guarantee your freedom to share and change free
14
- software--to make sure the software is free for all its users. This
15
- General Public License applies to most of the Free Software
16
- Foundation's software and to any other program whose authors commit to
17
- using it. (Some other Free Software Foundation software is covered by
18
- the GNU Lesser General Public License instead.) You can apply it to
19
- your programs, too.
20
-
21
- When we speak of free software, we are referring to freedom, not
22
- price. Our General Public Licenses are designed to make sure that you
23
- have the freedom to distribute copies of free software (and charge for
24
- this service if you wish), that you receive source code or can get it
25
- if you want it, that you can change the software or use pieces of it
26
- in new free programs; and that you know you can do these things.
27
-
28
- To protect your rights, we need to make restrictions that forbid
29
- anyone to deny you these rights or to ask you to surrender the rights.
30
- These restrictions translate to certain responsibilities for you if you
31
- distribute copies of the software, or if you modify it.
32
-
33
- For example, if you distribute copies of such a program, whether
34
- gratis or for a fee, you must give the recipients all the rights that
35
- you have. You must make sure that they, too, receive or can get the
36
- source code. And you must show them these terms so they know their
37
- rights.
38
-
39
- We protect your rights with two steps: (1) copyright the software, and
40
- (2) offer you this license which gives you legal permission to copy,
41
- distribute and/or modify the software.
42
-
43
- Also, for each author's protection and ours, we want to make certain
44
- that everyone understands that there is no warranty for this free
45
- software. If the software is modified by someone else and passed on, we
46
- want its recipients to know that what they have is not the original, so
47
- that any problems introduced by others will not reflect on the original
48
- authors' reputations.
49
-
50
- Finally, any free program is threatened constantly by software
51
- patents. We wish to avoid the danger that redistributors of a free
52
- program will individually obtain patent licenses, in effect making the
53
- program proprietary. To prevent this, we have made it clear that any
54
- patent must be licensed for everyone's free use or not licensed at all.
55
-
56
- The precise terms and conditions for copying, distribution and
57
- modification follow.
58
-
59
- GNU GENERAL PUBLIC LICENSE
60
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
-
62
- 0. This License applies to any program or other work which contains
63
- a notice placed by the copyright holder saying it may be distributed
64
- under the terms of this General Public License. The "Program", below,
65
- refers to any such program or work, and a "work based on the Program"
66
- means either the Program or any derivative work under copyright law:
67
- that is to say, a work containing the Program or a portion of it,
68
- either verbatim or with modifications and/or translated into another
69
- language. (Hereinafter, translation is included without limitation in
70
- the term "modification".) Each licensee is addressed as "you".
71
-
72
- Activities other than copying, distribution and modification are not
73
- covered by this License; they are outside its scope. The act of
74
- running the Program is not restricted, and the output from the Program
75
- is covered only if its contents constitute a work based on the
76
- Program (independent of having been made by running the Program).
77
- Whether that is true depends on what the Program does.
78
-
79
- 1. You may copy and distribute verbatim copies of the Program's
80
- source code as you receive it, in any medium, provided that you
81
- conspicuously and appropriately publish on each copy an appropriate
82
- copyright notice and disclaimer of warranty; keep intact all the
83
- notices that refer to this License and to the absence of any warranty;
84
- and give any other recipients of the Program a copy of this License
85
- along with the Program.
86
-
87
- You may charge a fee for the physical act of transferring a copy, and
88
- you may at your option offer warranty protection in exchange for a fee.
89
-
90
- 2. You may modify your copy or copies of the Program or any portion
91
- of it, thus forming a work based on the Program, and copy and
92
- distribute such modifications or work under the terms of Section 1
93
- above, provided that you also meet all of these conditions:
94
-
95
- a) You must cause the modified files to carry prominent notices
96
- stating that you changed the files and the date of any change.
97
-
98
- b) You must cause any work that you distribute or publish, that in
99
- whole or in part contains or is derived from the Program or any
100
- part thereof, to be licensed as a whole at no charge to all third
101
- parties under the terms of this License.
102
-
103
- c) If the modified program normally reads commands interactively
104
- when run, you must cause it, when started running for such
105
- interactive use in the most ordinary way, to print or display an
106
- announcement including an appropriate copyright notice and a
107
- notice that there is no warranty (or else, saying that you provide
108
- a warranty) and that users may redistribute the program under
109
- these conditions, and telling the user how to view a copy of this
110
- License. (Exception: if the Program itself is interactive but
111
- does not normally print such an announcement, your work based on
112
- the Program is not required to print an announcement.)
113
-
114
- These requirements apply to the modified work as a whole. If
115
- identifiable sections of that work are not derived from the Program,
116
- and can be reasonably considered independent and separate works in
117
- themselves, then this License, and its terms, do not apply to those
118
- sections when you distribute them as separate works. But when you
119
- distribute the same sections as part of a whole which is a work based
120
- on the Program, the distribution of the whole must be on the terms of
121
- this License, whose permissions for other licensees extend to the
122
- entire whole, and thus to each and every part regardless of who wrote it.
123
-
124
- Thus, it is not the intent of this section to claim rights or contest
125
- your rights to work written entirely by you; rather, the intent is to
126
- exercise the right to control the distribution of derivative or
127
- collective works based on the Program.
128
-
129
- In addition, mere aggregation of another work not based on the Program
130
- with the Program (or with a work based on the Program) on a volume of
131
- a storage or distribution medium does not bring the other work under
132
- the scope of this License.
133
-
134
- 3. You may copy and distribute the Program (or a work based on it,
135
- under Section 2) in object code or executable form under the terms of
136
- Sections 1 and 2 above provided that you also do one of the following:
137
-
138
- a) Accompany it with the complete corresponding machine-readable
139
- source code, which must be distributed under the terms of Sections
140
- 1 and 2 above on a medium customarily used for software interchange; or,
141
-
142
- b) Accompany it with a written offer, valid for at least three
143
- years, to give any third party, for a charge no more than your
144
- cost of physically performing source distribution, a complete
145
- machine-readable copy of the corresponding source code, to be
146
- distributed under the terms of Sections 1 and 2 above on a medium
147
- customarily used for software interchange; or,
148
-
149
- c) Accompany it with the information you received as to the offer
150
- to distribute corresponding source code. (This alternative is
151
- allowed only for noncommercial distribution and only if you
152
- received the program in object code or executable form with such
153
- an offer, in accord with Subsection b above.)
154
-
155
- The source code for a work means the preferred form of the work for
156
- making modifications to it. For an executable work, complete source
157
- code means all the source code for all modules it contains, plus any
158
- associated interface definition files, plus the scripts used to
159
- control compilation and installation of the executable. However, as a
160
- special exception, the source code distributed need not include
161
- anything that is normally distributed (in either source or binary
162
- form) with the major components (compiler, kernel, and so on) of the
163
- operating system on which the executable runs, unless that component
164
- itself accompanies the executable.
165
-
166
- If distribution of executable or object code is made by offering
167
- access to copy from a designated place, then offering equivalent
168
- access to copy the source code from the same place counts as
169
- distribution of the source code, even though third parties are not
170
- compelled to copy the source along with the object code.
171
-
172
- 4. You may not copy, modify, sublicense, or distribute the Program
173
- except as expressly provided under this License. Any attempt
174
- otherwise to copy, modify, sublicense or distribute the Program is
175
- void, and will automatically terminate your rights under this License.
176
- However, parties who have received copies, or rights, from you under
177
- this License will not have their licenses terminated so long as such
178
- parties remain in full compliance.
179
-
180
- 5. You are not required to accept this License, since you have not
181
- signed it. However, nothing else grants you permission to modify or
182
- distribute the Program or its derivative works. These actions are
183
- prohibited by law if you do not accept this License. Therefore, by
184
- modifying or distributing the Program (or any work based on the
185
- Program), you indicate your acceptance of this License to do so, and
186
- all its terms and conditions for copying, distributing or modifying
187
- the Program or works based on it.
188
-
189
- 6. Each time you redistribute the Program (or any work based on the
190
- Program), the recipient automatically receives a license from the
191
- original licensor to copy, distribute or modify the Program subject to
192
- these terms and conditions. You may not impose any further
193
- restrictions on the recipients' exercise of the rights granted herein.
194
- You are not responsible for enforcing compliance by third parties to
195
- this License.
196
-
197
- 7. If, as a consequence of a court judgment or allegation of patent
198
- infringement or for any other reason (not limited to patent issues),
199
- conditions are imposed on you (whether by court order, agreement or
200
- otherwise) that contradict the conditions of this License, they do not
201
- excuse you from the conditions of this License. If you cannot
202
- distribute so as to satisfy simultaneously your obligations under this
203
- License and any other pertinent obligations, then as a consequence you
204
- may not distribute the Program at all. For example, if a patent
205
- license would not permit royalty-free redistribution of the Program by
206
- all those who receive copies directly or indirectly through you, then
207
- the only way you could satisfy both it and this License would be to
208
- refrain entirely from distribution of the Program.
209
-
210
- If any portion of this section is held invalid or unenforceable under
211
- any particular circumstance, the balance of the section is intended to
212
- apply and the section as a whole is intended to apply in other
213
- circumstances.
214
-
215
- It is not the purpose of this section to induce you to infringe any
216
- patents or other property right claims or to contest validity of any
217
- such claims; this section has the sole purpose of protecting the
218
- integrity of the free software distribution system, which is
219
- implemented by public license practices. Many people have made
220
- generous contributions to the wide range of software distributed
221
- through that system in reliance on consistent application of that
222
- system; it is up to the author/donor to decide if he or she is willing
223
- to distribute software through any other system and a licensee cannot
224
- impose that choice.
225
-
226
- This section is intended to make thoroughly clear what is believed to
227
- be a consequence of the rest of this License.
228
-
229
- 8. If the distribution and/or use of the Program is restricted in
230
- certain countries either by patents or by copyrighted interfaces, the
231
- original copyright holder who places the Program under this License
232
- may add an explicit geographical distribution limitation excluding
233
- those countries, so that distribution is permitted only in or among
234
- countries not thus excluded. In such case, this License incorporates
235
- the limitation as if written in the body of this License.
236
-
237
- 9. The Free Software Foundation may publish revised and/or new versions
238
- of the General Public License from time to time. Such new versions will
239
- be similar in spirit to the present version, but may differ in detail to
240
- address new problems or concerns.
241
-
242
- Each version is given a distinguishing version number. If the Program
243
- specifies a version number of this License which applies to it and "any
244
- later version", you have the option of following the terms and conditions
245
- either of that version or of any later version published by the Free
246
- Software Foundation. If the Program does not specify a version number of
247
- this License, you may choose any version ever published by the Free Software
248
- Foundation.
249
-
250
- 10. If you wish to incorporate parts of the Program into other free
251
- programs whose distribution conditions are different, write to the author
252
- to ask for permission. For software which is copyrighted by the Free
253
- Software Foundation, write to the Free Software Foundation; we sometimes
254
- make exceptions for this. Our decision will be guided by the two goals
255
- of preserving the free status of all derivatives of our free software and
256
- of promoting the sharing and reuse of software generally.
257
-
258
- NO WARRANTY
259
-
260
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
- REPAIR OR CORRECTION.
269
-
270
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
- POSSIBILITY OF SUCH DAMAGES.
279
-
280
- END OF TERMS AND CONDITIONS
281
-
282
- How to Apply These Terms to Your New Programs
283
-
284
- If you develop a new program, and you want it to be of the greatest
285
- possible use to the public, the best way to achieve this is to make it
286
- free software which everyone can redistribute and change under these terms.
287
-
288
- To do so, attach the following notices to the program. It is safest
289
- to attach them to the start of each source file to most effectively
290
- convey the exclusion of warranty; and each file should have at least
291
- the "copyright" line and a pointer to where the full notice is found.
292
-
293
- {description}
294
- Copyright (C) {year} {fullname}
295
-
296
- This program is free software; you can redistribute it and/or modify
297
- it under the terms of the GNU General Public License as published by
298
- the Free Software Foundation; either version 2 of the License, or
299
- (at your option) any later version.
300
-
301
- This program is distributed in the hope that it will be useful,
302
- but WITHOUT ANY WARRANTY; without even the implied warranty of
303
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
- GNU General Public License for more details.
305
-
306
- You should have received a copy of the GNU General Public License along
307
- with this program; if not, write to the Free Software Foundation, Inc.,
308
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
-
310
- Also add information on how to contact you by electronic and paper mail.
311
-
312
- If the program is interactive, make it output a short notice like this
313
- when it starts in an interactive mode:
314
-
315
- Gnomovision version 69, Copyright (C) year name of author
316
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
- This is free software, and you are welcome to redistribute it
318
- under certain conditions; type `show c' for details.
319
-
320
- The hypothetical commands `show w' and `show c' should show the appropriate
321
- parts of the General Public License. Of course, the commands you use may
322
- be called something other than `show w' and `show c'; they could even be
323
- mouse-clicks or menu items--whatever suits your program.
324
-
325
- You should also get your employer (if you work as a programmer) or your
326
- school, if any, to sign a "copyright disclaimer" for the program, if
327
- necessary. Here is a sample; alter the names:
328
-
329
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
-
332
- {signature of Ty Coon}, 1 April 1989
333
- Ty Coon, President of Vice
334
-
335
- This General Public License does not permit incorporating your program into
336
- proprietary programs. If your program is a subroutine library, you may
337
- consider it more useful to permit linking proprietary applications with the
338
- library. If this is what you want to do, use the GNU Lesser General
339
- Public License instead of this License.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/README.md DELETED
@@ -1,22 +0,0 @@
1
- # Quiz And Survey Master (Formerly Quiz Master Next)
2
-
3
- Easily and quickly add quizzes, tests, and surveys to your WordPress site.
4
-
5
- ## Getting Started
6
-
7
- This repo is for the core plugin for Quiz And Survey Master. This can be downloaded as a zip and installed as-is with no build script needing to be run.
8
-
9
- ## Contributing
10
- Please read [CONTRIBUTING.md](https://github.com/QuizandSurveyMaster/quiz_master_next/blob/master/CONTRIBUTING.md) for the process for submitting pull requests or issues to us.
11
-
12
- ## Versioning
13
- We use [SemVer](http://semver.org/) for versioning. For the versions available, see [the releases in this repository](https://github.com/QuizandSurveyMaster/quiz_master_next/releases).
14
-
15
- ## Developers
16
- See [the list of contributors](https://github.com/QuizandSurveyMaster/quiz_master_next/graphs/contributors) who participated in this project.
17
-
18
- ## License
19
- This project is licensed under the GPLv2 License - see the [LICENSE.md file](https://github.com/QuizandSurveyMaster/quiz_master_next/blob/master/LICENSE.md) for details.
20
-
21
- ## Support ##
22
- This is a developer's portal for Quiz And Survey Master and should _not_ be used for support. Please create a support ticket [here](http://quizandsurveymaster.com/contact-us/).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/addons.xml DELETED
@@ -1,113 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
-
3
- <addon-list>
4
- <item>
5
- <name>Landing Page</name>
6
- <desc>Display your quizzes and surveys in their own standalone page without distracting menus, themes, or other content from your site.</desc>
7
- <img></img>
8
- <link>https://quizandsurveymaster.com/downloads/landing-page/?utm_source=qsm-addons-page</link>
9
- <category>Frontend</category>
10
- <price>25</price>
11
- <slug>landing-page</slug>
12
- </item>
13
- <item>
14
- <name>Reporting and Analysis</name>
15
- <desc>Analyze your quiz's or survey's results to see the percentage of users who chose each answer displayed on useful charts. You can then filter that data or export it.</desc>
16
- <img></img>
17
- <link>http://quizandsurveymaster.com/downloads/results-analysis/?utm_source=qsm-addons-page</link>
18
- <category>Analytics</category>
19
- <price>35</price>
20
- <slug>reporting-and-analysis</slug>
21
- </item>
22
- <item>
23
- <name>Export Results</name>
24
- <desc>This addon gives you the ability to export your quiz results as a CSV file.</desc>
25
- <img></img>
26
- <link>http://quizandsurveymaster.com/downloads/export-results/?utm_source=qsm-addons-page</link>
27
- <category>Utility</category>
28
- <price>25</price>
29
- <slug>export-results</slug>
30
- </item>
31
- <item>
32
- <name>Advertisement Be Gone</name>
33
- <desc>This addon will remove all services/addon advertisements throughout the plugin.</desc>
34
- <img></img>
35
- <link>http://quizandsurveymaster.com/downloads/advertisement-gone/?utm_source=qsm-addons-page</link>
36
- <category>Utility</category>
37
- <price>10</price>
38
- <slug>advertisement-be-gone</slug>
39
- </item>
40
- <item>
41
- <name>MailChimp Integration</name>
42
- <desc>Grow your list of subscribers in MailChimp by using this addon to add users who take your quizzes and surveys!</desc>
43
- <img></img>
44
- <link>http://quizandsurveymaster.com/downloads/mailchimp-integration/?utm_source=qsm-addons-page</link>
45
- <category>Integrations</category>
46
- <price>25</price>
47
- <slug>mailchimp-integration</slug>
48
- </item>
49
- <item>
50
- <name>User Dashboard</name>
51
- <desc>This addon gives you the ability to set up a page where users can review their results from all the quizzes they have taken.</desc>
52
- <img></img>
53
- <link>http://quizandsurveymaster.com/downloads/user-dashboard/?utm_source=qsm-addons-page</link>
54
- <category>Frontend</category>
55
- <price>25</price>
56
- <slug>user-dashboard</slug>
57
- </item>
58
- <item>
59
- <name>Aweber Integration</name>
60
- <desc>Grow your list of subscribers in AWeber by using this addon to add users who take your quizzes!</desc>
61
- <img></img>
62
- <link>http://quizandsurveymaster.com/downloads/aweber-integration/?utm_source=qsm-addons-page</link>
63
- <category>Integrations</category>
64
- <price>25 </price>
65
- <slug>aweber-integration</slug>
66
- </item>
67
- <item>
68
- <name>Extra Template Variables</name>
69
- <desc>This addon gives you several more template variables to use in your emails and results pages.</desc>
70
- <img></img>
71
- <link>http://quizandsurveymaster.com/downloads/extra-template-variables/?utm_source=qsm-addons-page</link>
72
- <category>Developer</category>
73
- <price>8</price>
74
- <slug>extra-template-variables</slug>
75
- </item>
76
- <qsm_bundle>
77
- <starter_bundle>
78
- <name>Starter Bundle</name>
79
- <desc>Get a bundle of 10 addons together which would cost over $225. With the Starter Plan, you get to use all the included addons on one site for only $49 per year. That is over 70% off compared to purchasing the addons individually.</desc>
80
- <price>69</price>
81
- <link>https://quizandsurveymaster.com/downloads/starter-plan/</link>
82
- </starter_bundle>
83
- <premium_bundle>
84
- <name>Premium Bundle</name>
85
- <desc>Buy our Premium Bundle and save over 95% on addon costs. You will get all 30+ plugins included in the Premium Bundle which is worth over $1500. View our pricing page for more details.!</desc>
86
- <price>99</price>
87
- <link>https://quizandsurveymaster.com/downloads/starter-plan/</link>
88
- <slug>all-addons-top</slug>
89
- </premium_bundle>
90
- </qsm_bundle>
91
- <qsm_news>
92
- <title>Subscribe to our newsletter!</title>
93
- <desc>Join our mailing list to learn about our newest features, receive email-only promotions, receive tips and guides, and more!</desc>
94
- <link>http://quizandsurveymaster.com/subscribe-to-our-newsletter/</link>
95
- </qsm_news>
96
- <qsm_ads>
97
- <ads>
98
- <text>Are you finding this plugin very beneficial? Please consider checking out our premium addons which help support continued development of this plugin. Visit our [link] for details!</text>
99
- <link>http://quizandsurveymaster.com/addons/?utm_source=qsm-plugin-ads#38utm_medium=plugin#38utm_content=#38utm_campaign=qsm_plugin</link>
100
- <link_text>Addon Store</link_text>
101
- </ads>
102
- <ads>
103
- <text>Are you receiving a lot of responses to your quizzes and surveys? Consider our Reporting and Anaylsis addon which analyzes the data for you and allows you to filter the data as well as export it! [link]</text>
104
- <link>http://quizandsurveymaster.com/downloads/results-analysis/?utm_source=qsm-plugin-ads#38utm_medium=plugin#38utm_content=reporting-analysis-1#38utm_campaign=qsm_plugin</link>
105
- <link_text>Click here for more details!</link_text>
106
- </ads>
107
- <ads>
108
- <text>Want to grow your email list? Check out our addons for adding your quiz or survey takers to your email lists! [link].</text>
109
- <link>http://bit.ly/2Bsw0Je</link>
110
- <link_text>View our addon store</link_text>
111
- </ads>
112
- </qsm_ads>
113
- </addon-list>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/facebook.png DELETED
Binary file
trunk/assets/icon-128x128.png DELETED
Binary file
trunk/assets/index.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- die("Error: Unauthorized Access");
4
- ?>
 
 
 
 
trunk/assets/screenshot-1.png DELETED
Binary file
trunk/assets/screenshot-2.png DELETED
Binary file
trunk/assets/screenshot-3.png DELETED
Binary file
trunk/assets/screenshot-4.png DELETED
Binary file
trunk/assets/screenshot-5.png DELETED
Binary file
trunk/assets/screenshot-6.png DELETED
Binary file
trunk/assets/screenshot-7.png DELETED
Binary file
trunk/assets/twitter.png DELETED
Binary file
trunk/blocks/block.js DELETED
@@ -1,42 +0,0 @@
1
-
2
- var el = wp.element.createElement,
3
- registerBlockType = wp.blocks.registerBlockType,
4
- ServerSideRender = wp.components.ServerSideRender,
5
- TextControl = wp.components.TextControl,
6
- InspectorControls = wp.editor.InspectorControls;
7
-
8
- /*
9
- * Registers the main QSM block
10
- */
11
- registerBlockType( 'qsm/main-block', {
12
- title: 'QSM Block',
13
- icon: 'feedback',
14
- category: 'widgets',
15
-
16
- edit: function( props ) {
17
- return [
18
- /*
19
- * The ServerSideRender element uses the REST API to automatically call
20
- * php_block_render() in your PHP code whenever it needs to get an updated
21
- * view of the block.
22
- */
23
- el( ServerSideRender, {
24
- block: 'qsm/main-block',
25
- attributes: props.attributes,
26
- } ),
27
-
28
- el( InspectorControls, {},
29
- el( TextControl, {
30
- label: 'Quiz/Survey ID',
31
- value: props.attributes.quiz,
32
- onChange: ( value ) => { props.setAttributes( { quiz: value } ); },
33
- } )
34
- ),
35
- ];
36
- },
37
-
38
- // We're going to be rendering in PHP, so save() can just return null.
39
- save: function() {
40
- return null;
41
- },
42
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/blocks/block.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- /**
3
- * Converts our main shortcode to a simple Gutenberg block.
4
- * Uses ServerSideRender for now. Need to create a better block soon.
5
- *
6
- * Heavily built upon the GPL demo block: https://gist.github.com/pento/cf38fd73ce0f13fcf0f0ae7d6c4b685d
7
- *
8
- * @package QSM
9
- */
10
-
11
- /**
12
- * Register our block.
13
- */
14
- function qsm_block_init() {
15
- // Register our block editor script.
16
- wp_register_script(
17
- 'qsm-quiz-block',
18
- plugins_url( 'block.js', __FILE__ ),
19
- array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' )
20
- );
21
- // Register our block, and explicitly define the attributes we accept.
22
- register_block_type( 'qsm/main-block', array(
23
- 'attributes' => array(
24
- 'quiz' => array(
25
- 'type' => 'string',
26
- ),
27
- ),
28
- 'editor_script' => 'qsm-quiz-block',
29
- 'render_callback' => 'qsm_block_render',
30
- ) );
31
- }
32
- add_action( 'init', 'qsm_block_init' );
33
-
34
- /**
35
- * The block renderer.
36
- *
37
- * This simply calls our main shortcode renderer.
38
- *
39
- * @param array $attributes The attributes that were set on the block.
40
- */
41
- function qsm_block_render( $attributes ) {
42
- global $qmnQuizManager;
43
- return $qmnQuizManager->display_shortcode( $attributes );
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/blocks/index.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- // Silence is golden...
3
- ?>
 
 
 
trunk/css/index.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- die("Error: Unauthorized Access");
4
- ?>
 
 
 
 
trunk/css/jquery-ui.css DELETED
@@ -1,1177 +0,0 @@
1
- /*! jQuery UI - v1.10.3 - 2013-05-03
2
- * http://jqueryui.com
3
- * Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
4
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande%2CLucida%20Sans%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=gloss_wave&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=inset_hard&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=glass&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=inset_hard&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=flat&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
5
- * Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
6
-
7
- /* Layout helpers
8
- ----------------------------------*/
9
- .ui-helper-hidden {
10
- display: none;
11
- }
12
- .ui-helper-hidden-accessible {
13
- border: 0;
14
- clip: rect(0 0 0 0);
15
- height: 1px;
16
- margin: -1px;
17
- overflow: hidden;
18
- padding: 0;
19
- position: absolute;
20
- width: 1px;
21
- }
22
- .ui-helper-reset {
23
- margin: 0;
24
- padding: 0;
25
- border: 0;
26
- outline: 0;
27
- line-height: 1.3;
28
- text-decoration: none;
29
- font-size: 100%;
30
- list-style: none;
31
- }
32
- .ui-helper-clearfix:before,
33
- .ui-helper-clearfix:after {
34
- content: "";
35
- display: table;
36
- border-collapse: collapse;
37
- }
38
- .ui-helper-clearfix:after {
39
- clear: both;
40
- }
41
- .ui-helper-clearfix {
42
- min-height: 0; /* support: IE7 */
43
- }
44
- .ui-helper-zfix {
45
- width: 100%;
46
- height: 100%;
47
- top: 0;
48
- left: 0;
49
- position: absolute;
50
- opacity: 0;
51
- filter:Alpha(Opacity=0);
52
- }
53
-
54
- .ui-front {
55
- z-index: 100;
56
- }
57
-
58
-
59
- /* Interaction Cues
60
- ----------------------------------*/
61
- .ui-state-disabled {
62
- cursor: default !important;
63
- }
64
-
65
-
66
- /* Icons
67
- ----------------------------------*/
68
-
69
- /* states and images */
70
- .ui-icon {
71
- display: block;
72
- text-indent: -99999px;
73
- overflow: hidden;
74
- background-repeat: no-repeat;
75
- }
76
-
77
-
78
- /* Misc visuals
79
- ----------------------------------*/
80
-
81
- /* Overlays */
82
- .ui-widget-overlay {
83
- position: fixed;
84
- top: 0;
85
- left: 0;
86
- width: 100%;
87
- height: 100%;
88
- }
89
- .ui-accordion .ui-accordion-header {
90
- display: block;
91
- cursor: pointer;
92
- position: relative;
93
- margin-top: 2px;
94
- padding: .5em .5em .5em .7em;
95
- min-height: 0; /* support: IE7 */
96
- }
97
- .ui-accordion .ui-accordion-icons {
98
- padding-left: 2.2em;
99
- }
100
- .ui-accordion .ui-accordion-noicons {
101
- padding-left: .7em;
102
- }
103
- .ui-accordion .ui-accordion-icons .ui-accordion-icons {
104
- padding-left: 2.2em;
105
- }
106
- .ui-accordion .ui-accordion-header .ui-accordion-header-icon {
107
- position: absolute;
108
- left: .5em;
109
- top: 50%;
110
- margin-top: -8px;
111
- }
112
- .ui-accordion .ui-accordion-content {
113
- padding: 1em 2.2em;
114
- border-top: 0;
115
- overflow: auto;
116
- }
117
- .ui-autocomplete {
118
- position: absolute;
119
- top: 0;
120
- left: 0;
121
- cursor: default;
122
- }
123
- .ui-button {
124
- display: inline-block;
125
- position: relative;
126
- padding: 0;
127
- line-height: normal;
128
- margin-right: .1em;
129
- cursor: pointer;
130
- vertical-align: middle;
131
- text-align: center;
132
- overflow: visible; /* removes extra width in IE */
133
- }
134
- .ui-button,
135
- .ui-button:link,
136
- .ui-button:visited,
137
- .ui-button:hover,
138
- .ui-button:active {
139
- text-decoration: none;
140
- }
141
- /* to make room for the icon, a width needs to be set here */
142
- .ui-button-icon-only {
143
- width: 2.2em;
144
- }
145
- /* button elements seem to need a little more width */
146
- button.ui-button-icon-only {
147
- width: 2.4em;
148
- }
149
- .ui-button-icons-only {
150
- width: 3.4em;
151
- }
152
- button.ui-button-icons-only {
153
- width: 3.7em;
154
- }
155
-
156
- /* button text element */
157
- .ui-button .ui-button-text {
158
- display: block;
159
- line-height: normal;
160
- }
161
- .ui-button-text-only .ui-button-text {
162
- padding: .4em 1em;
163
- }
164
- .ui-button-icon-only .ui-button-text,
165
- .ui-button-icons-only .ui-button-text {
166
- padding: .4em;
167
- text-indent: -9999999px;
168
- }
169
- .ui-button-text-icon-primary .ui-button-text,
170
- .ui-button-text-icons .ui-button-text {
171
- padding: .4em 1em .4em 2.1em;
172
- }
173
- .ui-button-text-icon-secondary .ui-button-text,
174
- .ui-button-text-icons .ui-button-text {
175
- padding: .4em 2.1em .4em 1em;
176
- }
177
- .ui-button-text-icons .ui-button-text {
178
- padding-left: 2.1em;
179
- padding-right: 2.1em;
180
- }
181
- /* no icon support for input elements, provide padding by default */
182
- input.ui-button {
183
- padding: .4em 1em;
184
- }
185
-
186
- /* button icon element(s) */
187
- .ui-button-icon-only .ui-icon,
188
- .ui-button-text-icon-primary .ui-icon,
189
- .ui-button-text-icon-secondary .ui-icon,
190
- .ui-button-text-icons .ui-icon,
191
- .ui-button-icons-only .ui-icon {
192
- position: absolute;
193
- top: 50%;
194
- margin-top: -8px;
195
- }
196
- .ui-button-icon-only .ui-icon {
197
- left: 50%;
198
- margin-left: -8px;
199
- }
200
- .ui-button-text-icon-primary .ui-button-icon-primary,
201
- .ui-button-text-icons .ui-button-icon-primary,
202
- .ui-button-icons-only .ui-button-icon-primary {
203
- left: .5em;
204
- }
205
- .ui-button-text-icon-secondary .ui-button-icon-secondary,
206
- .ui-button-text-icons .ui-button-icon-secondary,
207
- .ui-button-icons-only .ui-button-icon-secondary {
208
- right: .5em;
209
- }
210
-
211
- /* button sets */
212
- .ui-buttonset {
213
- margin-right: 7px;
214
- }
215
- .ui-buttonset .ui-button {
216
- margin-left: 0;
217
- margin-right: -.3em;
218
- }
219
-
220
- /* workarounds */
221
- /* reset extra padding in Firefox, see h5bp.com/l */
222
- input.ui-button::-moz-focus-inner,
223
- button.ui-button::-moz-focus-inner {
224
- border: 0;
225
- padding: 0;
226
- }
227
- .ui-datepicker {
228
- width: 17em;
229
- padding: .2em .2em 0;
230
- display: none;
231
- }
232
- .ui-datepicker .ui-datepicker-header {
233
- position: relative;
234
- padding: .2em 0;
235
- }
236
- .ui-datepicker .ui-datepicker-prev,
237
- .ui-datepicker .ui-datepicker-next {
238
- position: absolute;
239
- top: 2px;
240
- width: 1.8em;
241
- height: 1.8em;
242
- }
243
- .ui-datepicker .ui-datepicker-prev-hover,
244
- .ui-datepicker .ui-datepicker-next-hover {
245
- top: 1px;
246
- }
247
- .ui-datepicker .ui-datepicker-prev {
248
- left: 2px;
249
- }
250
- .ui-datepicker .ui-datepicker-next {
251
- right: 2px;
252
- }
253
- .ui-datepicker .ui-datepicker-prev-hover {
254
- left: 1px;
255
- }
256
- .ui-datepicker .ui-datepicker-next-hover {
257
- right: 1px;
258
- }
259
- .ui-datepicker .ui-datepicker-prev span,
260
- .ui-datepicker .ui-datepicker-next span {
261
- display: block;
262
- position: absolute;
263
- left: 50%;
264
- margin-left: -8px;
265
- top: 50%;
266
- margin-top: -8px;
267
- }
268
- .ui-datepicker .ui-datepicker-title {
269
- margin: 0 2.3em;
270
- line-height: 1.8em;
271
- text-align: center;
272
- }
273
- .ui-datepicker .ui-datepicker-title select {
274
- font-size: 1em;
275
- margin: 1px 0;
276
- }
277
- .ui-datepicker select.ui-datepicker-month-year {
278
- width: 100%;
279
- }
280
- .ui-datepicker select.ui-datepicker-month,
281
- .ui-datepicker select.ui-datepicker-year {
282
- width: 49%;
283
- }
284
- .ui-datepicker table {
285
- width: 100%;
286
- font-size: .9em;
287
- border-collapse: collapse;
288
- margin: 0 0 .4em;
289
- }
290
- .ui-datepicker th {
291
- padding: .7em .3em;
292
- text-align: center;
293
- font-weight: bold;
294
- border: 0;
295
- }
296
- .ui-datepicker td {
297
- border: 0;
298
- padding: 1px;
299
- }
300
- .ui-datepicker td span,
301
- .ui-datepicker td a {
302
- display: block;
303
- padding: .2em;
304
- text-align: right;
305
- text-decoration: none;
306
- }
307
- .ui-datepicker .ui-datepicker-buttonpane {
308
- background-image: none;
309
- margin: .7em 0 0 0;
310
- padding: 0 .2em;
311
- border-left: 0;
312
- border-right: 0;
313
- border-bottom: 0;
314
- }
315
- .ui-datepicker .ui-datepicker-buttonpane button {
316
- float: right;
317
- margin: .5em .2em .4em;
318
- cursor: pointer;
319
- padding: .2em .6em .3em .6em;
320
- width: auto;
321
- overflow: visible;
322
- }
323
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
324
- float: left;
325
- }
326
-
327
- /* with multiple calendars */
328
- .ui-datepicker.ui-datepicker-multi {
329
- width: auto;
330
- }
331
- .ui-datepicker-multi .ui-datepicker-group {
332
- float: left;
333
- }
334
- .ui-datepicker-multi .ui-datepicker-group table {
335
- width: 95%;
336
- margin: 0 auto .4em;
337
- }
338
- .ui-datepicker-multi-2 .ui-datepicker-group {
339
- width: 50%;
340
- }
341
- .ui-datepicker-multi-3 .ui-datepicker-group {
342
- width: 33.3%;
343
- }
344
- .ui-datepicker-multi-4 .ui-datepicker-group {
345
- width: 25%;
346
- }
347
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
348
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
349
- border-left-width: 0;
350
- }
351
- .ui-datepicker-multi .ui-datepicker-buttonpane {
352
- clear: left;
353
- }
354
- .ui-datepicker-row-break {
355
- clear: both;
356
- width: 100%;
357
- font-size: 0;
358
- }
359
-
360
- /* RTL support */
361
- .ui-datepicker-rtl {
362
- direction: rtl;
363
- }
364
- .ui-datepicker-rtl .ui-datepicker-prev {
365
- right: 2px;
366
- left: auto;
367
- }
368
- .ui-datepicker-rtl .ui-datepicker-next {
369
- left: 2px;
370
- right: auto;
371
- }
372
- .ui-datepicker-rtl .ui-datepicker-prev:hover {
373
- right: 1px;
374
- left: auto;
375
- }
376
- .ui-datepicker-rtl .ui-datepicker-next:hover {
377
- left: 1px;
378
- right: auto;
379
- }
380
- .ui-datepicker-rtl .ui-datepicker-buttonpane {
381
- clear: right;
382
- }
383
- .ui-datepicker-rtl .ui-datepicker-buttonpane button {
384
- float: left;
385
- }
386
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
387
- .ui-datepicker-rtl .ui-datepicker-group {
388
- float: right;
389
- }
390
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
391
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
392
- border-right-width: 0;
393
- border-left-width: 1px;
394
- }
395
- .ui-dialog {
396
- position: absolute;
397
- top: 0;
398
- left: 0;
399
- padding: .2em;
400
- outline: 0;
401
- }
402
- .ui-dialog .ui-dialog-titlebar {
403
- padding: .4em 1em;
404
- position: relative;
405
- }
406
- .ui-dialog .ui-dialog-title {
407
- float: left;
408
- margin: .1em 0;
409
- white-space: nowrap;
410
- width: 90%;
411
- overflow: hidden;
412
- text-overflow: ellipsis;
413
- }
414
- .ui-dialog .ui-dialog-titlebar-close {
415
- position: absolute;
416
- right: .3em;
417
- top: 50%;
418
- width: 21px;
419
- margin: -10px 0 0 0;
420
- padding: 1px;
421
- height: 20px;
422
- }
423
- .ui-dialog .ui-dialog-content {
424
- position: relative;
425
- border: 0;
426
- padding: .5em 1em;
427
- background: none;
428
- overflow: auto;
429
- }
430
- .ui-dialog .ui-dialog-buttonpane {
431
- text-align: left;
432
- border-width: 1px 0 0 0;
433
- background-image: none;
434
- margin-top: .5em;
435
- padding: .3em 1em .5em .4em;
436
- }
437
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
438
- float: right;
439
- }
440
- .ui-dialog .ui-dialog-buttonpane button {
441
- margin: .5em .4em .5em 0;
442
- cursor: pointer;
443
- }
444
- .ui-dialog .ui-resizable-se {
445
- width: 12px;
446
- height: 12px;
447
- right: -5px;
448
- bottom: -5px;
449
- background-position: 16px 16px;
450
- }
451
- .ui-draggable .ui-dialog-titlebar {
452
- cursor: move;
453
- }
454
- .ui-menu {
455
- list-style: none;
456
- padding: 2px;
457
- margin: 0;
458
- display: block;
459
- outline: none;
460
- }
461
- .ui-menu .ui-menu {
462
- margin-top: -3px;
463
- position: absolute;
464
- }
465
- .ui-menu .ui-menu-item {
466
- margin: 0;
467
- padding: 0;
468
- width: 100%;
469
- /* support: IE10, see #8844 */
470
- list-style-image: url(data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==);
471
- }
472
- .ui-menu .ui-menu-divider {
473
- margin: 5px -2px 5px -2px;
474
- height: 0;
475
- font-size: 0;
476
- line-height: 0;
477
- border-width: 1px 0 0 0;
478
- }
479
- .ui-menu .ui-menu-item a {
480
- text-decoration: none;
481
- display: block;
482
- padding: 2px .4em;
483
- line-height: 1.5;
484
- min-height: 0; /* support: IE7 */
485
- font-weight: normal;
486
- }
487
- .ui-menu .ui-menu-item a.ui-state-focus,
488
- .ui-menu .ui-menu-item a.ui-state-active {
489
- font-weight: normal;
490
- margin: -1px;
491
- }
492
-
493
- .ui-menu .ui-state-disabled {
494
- font-weight: normal;
495
- margin: .4em 0 .2em;
496
- line-height: 1.5;
497
- }
498
- .ui-menu .ui-state-disabled a {
499
- cursor: default;
500
- }
501
-
502
- /* icon support */
503
- .ui-menu-icons {
504
- position: relative;
505
- }
506
- .ui-menu-icons .ui-menu-item a {
507
- position: relative;
508
- padding-left: 2em;
509
- }
510
-
511
- /* left-aligned */
512
- .ui-menu .ui-icon {
513
- position: absolute;
514
- top: .2em;
515
- left: .2em;
516
- }
517
-
518
- /* right-aligned */
519
- .ui-menu .ui-menu-icon {
520
- position: static;
521
- float: right;
522
- }
523
- .ui-progressbar {
524
- height: 2em;
525
- text-align: left;
526
- overflow: hidden;
527
- }
528
- .ui-progressbar .ui-progressbar-value {
529
- margin: -1px;
530
- height: 100%;
531
- }
532
- .ui-progressbar .ui-progressbar-overlay {
533
- background: url("images/animated-overlay.gif");
534
- height: 100%;
535
- filter: alpha(opacity=25);
536
- opacity: 0.25;
537
- }
538
- .ui-progressbar-indeterminate .ui-progressbar-value {
539
- background-image: none;
540
- }
541
- .ui-resizable {
542
- position: relative;
543
- }
544
- .ui-resizable-handle {
545
- position: absolute;
546
- font-size: 0.1px;
547
- display: block;
548
- }
549
- .ui-resizable-disabled .ui-resizable-handle,
550
- .ui-resizable-autohide .ui-resizable-handle {
551
- display: none;
552
- }
553
- .ui-resizable-n {
554
- cursor: n-resize;
555
- height: 7px;
556
- width: 100%;
557
- top: -5px;
558
- left: 0;
559
- }
560
- .ui-resizable-s {
561
- cursor: s-resize;
562
- height: 7px;
563
- width: 100%;
564
- bottom: -5px;
565
- left: 0;
566
- }
567
- .ui-resizable-e {
568
- cursor: e-resize;
569
- width: 7px;
570
- right: -5px;
571
- top: 0;
572
- height: 100%;
573
- }
574
- .ui-resizable-w {
575
- cursor: w-resize;
576
- width: 7px;
577
- left: -5px;
578
- top: 0;
579
- height: 100%;
580
- }
581
- .ui-resizable-se {
582
- cursor: se-resize;
583
- width: 12px;
584
- height: 12px;
585
- right: 1px;
586
- bottom: 1px;
587
- }
588
- .ui-resizable-sw {
589
- cursor: sw-resize;
590
- width: 9px;
591
- height: 9px;
592
- left: -5px;
593
- bottom: -5px;
594
- }
595
- .ui-resizable-nw {
596
- cursor: nw-resize;
597
- width: 9px;
598
- height: 9px;
599
- left: -5px;
600
- top: -5px;
601
- }
602
- .ui-resizable-ne {
603
- cursor: ne-resize;
604
- width: 9px;
605
- height: 9px;
606
- right: -5px;
607
- top: -5px;
608
- }
609
- .ui-selectable-helper {
610
- position: absolute;
611
- z-index: 100;
612
- border: 1px dotted black;
613
- }
614
- .ui-slider {
615
- position: relative;
616
- text-align: left;
617
- }
618
- .ui-slider .ui-slider-handle {
619
- position: absolute;
620
- z-index: 2;
621
- width: 1.2em;
622
- height: 1.2em;
623
- cursor: default;
624
- }
625
- .ui-slider .ui-slider-range {
626
- position: absolute;
627
- z-index: 1;
628
- font-size: .7em;
629
- display: block;
630
- border: 0;
631
- background-position: 0 0;
632
- }
633
-
634
- /* For IE8 - See #6727 */
635
- .ui-slider.ui-state-disabled .ui-slider-handle,
636
- .ui-slider.ui-state-disabled .ui-slider-range {
637
- filter: inherit;
638
- }
639
-
640
- .ui-slider-horizontal {
641
- height: .8em;
642
- }
643
- .ui-slider-horizontal .ui-slider-handle {
644
- top: -.3em;
645
- margin-left: -.6em;
646
- }
647
- .ui-slider-horizontal .ui-slider-range {
648
- top: 0;
649
- height: 100%;
650
- }
651
- .ui-slider-horizontal .ui-slider-range-min {
652
- left: 0;
653
- }
654
- .ui-slider-horizontal .ui-slider-range-max {
655
- right: 0;
656
- }
657
-
658
- .ui-slider-vertical {
659
- width: .8em;
660
- height: 100px;
661
- }
662
- .ui-slider-vertical .ui-slider-handle {
663
- left: -.3em;
664
- margin-left: 0;
665
- margin-bottom: -.6em;
666
- }
667
- .ui-slider-vertical .ui-slider-range {
668
- left: 0;
669
- width: 100%;
670
- }
671
- .ui-slider-vertical .ui-slider-range-min {
672
- bottom: 0;
673
- }
674
- .ui-slider-vertical .ui-slider-range-max {
675
- top: 0;
676
- }
677
- .ui-spinner {
678
- position: relative;
679
- display: inline-block;
680
- overflow: hidden;
681
- padding: 0;
682
- vertical-align: middle;
683
- }
684
- .ui-spinner-input {
685
- border: none;
686
- background: none;
687
- color: inherit;
688
- padding: 0;
689
- margin: .2em 0;
690
- vertical-align: middle;
691
- margin-left: .4em;
692
- margin-right: 22px;
693
- }
694
- .ui-spinner-button {
695
- width: 16px;
696
- height: 50%;
697
- font-size: .5em;
698
- padding: 0;
699
- margin: 0;
700
- text-align: center;
701
- position: absolute;
702
- cursor: default;
703
- display: block;
704
- overflow: hidden;
705
- right: 0;
706
- }
707
- /* more specificity required here to overide default borders */
708
- .ui-spinner a.ui-spinner-button {
709
- border-top: none;
710
- border-bottom: none;
711
- border-right: none;
712
- }
713
- /* vertical centre icon */
714
- .ui-spinner .ui-icon {
715
- position: absolute;
716
- margin-top: -8px;
717
- top: 50%;
718
- left: 0;
719
- }
720
- .ui-spinner-up {
721
- top: 0;
722
- }
723
- .ui-spinner-down {
724
- bottom: 0;
725
- }
726
-
727
- /* TR overrides */
728
- .ui-spinner .ui-icon-triangle-1-s {
729
- /* need to fix icons sprite */
730
- background-position: -65px -16px;
731
- }
732
- .ui-tabs {
733
- position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
734
- padding: .2em;
735
- }
736
- .ui-tabs .ui-tabs-nav {
737
- margin: 0;
738
- padding: .2em .2em 0;
739
- }
740
- .ui-tabs .ui-tabs-nav li {
741
- list-style: none;
742
- float: left;
743
- position: relative;
744
- top: 0;
745
- margin: 1px .2em 0 0;
746
- border-bottom-width: 0;
747
- padding: 0;
748
- white-space: nowrap;
749
- }
750
- .ui-tabs .ui-tabs-nav li a {
751
- float: left;
752
- padding: .5em 1em;
753
- text-decoration: none;
754
- }
755
- .ui-tabs .ui-tabs-nav li.ui-tabs-active {
756
- margin-bottom: -1px;
757
- padding-bottom: 1px;
758
- }
759
- .ui-tabs .ui-tabs-nav li.ui-tabs-active a,
760
- .ui-tabs .ui-tabs-nav li.ui-state-disabled a,
761
- .ui-tabs .ui-tabs-nav li.ui-tabs-loading a {
762
- cursor: text;
763
- }
764
- .ui-tabs .ui-tabs-nav li a, /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
765
- .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a {
766
- cursor: pointer;
767
- }
768
- .ui-tabs .ui-tabs-panel {
769
- display: block;
770
- border-width: 0;
771
- padding: 1em 1.4em;
772
- background: none;
773
- }
774
- .ui-tooltip {
775
- padding: 8px;
776
- position: absolute;
777
- z-index: 9999;
778
- max-width: 300px;
779
- -webkit-box-shadow: 0 0 5px #aaa;
780
- box-shadow: 0 0 5px #aaa;
781
- }
782
- body .ui-tooltip {
783
- border-width: 2px;
784
- }
785
-
786
- /* Component containers
787
- ----------------------------------*/
788
- .ui-widget {
789
- font-family: Lucida Grande,Lucida Sans,Arial,sans-serif;
790
- font-size: 1.1em;
791
- }
792
- .ui-widget .ui-widget {
793
- font-size: 1em;
794
- }
795
- .ui-widget input,
796
- .ui-widget select,
797
- .ui-widget textarea,
798
- .ui-widget button {
799
- font-family: Lucida Grande,Lucida Sans,Arial,sans-serif;
800
- font-size: 1em;
801
- }
802
- .ui-widget-content {
803
- border: 1px solid #a6c9e2;
804
- background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x;
805
- color: #222222;
806
- }
807
- .ui-widget-content a {
808
- color: #222222;
809
- }
810
- .ui-widget-header {
811
- border: 1px solid #4297d7;
812
- background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x;
813
- color: #ffffff;
814
- font-weight: bold;
815
- }
816
- .ui-widget-header a {
817
- color: #ffffff;
818
- }
819
-
820
- /* Interaction states
821
- ----------------------------------*/
822
- .ui-state-default,
823
- .ui-widget-content .ui-state-default,
824
- .ui-widget-header .ui-state-default {
825
- border: 1px solid #c5dbec;
826
- background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x;
827
- font-weight: bold;
828
- color: #2e6e9e;
829
- }
830
- .ui-state-default a,
831
- .ui-state-default a:link,
832
- .ui-state-default a:visited {
833
- color: #2e6e9e;
834
- text-decoration: none;
835
- }
836
- .ui-state-hover,
837
- .ui-widget-content .ui-state-hover,
838
- .ui-widget-header .ui-state-hover,
839
- .ui-state-focus,
840
- .ui-widget-content .ui-state-focus,
841
- .ui-widget-header .ui-state-focus {
842
- border: 1px solid #79b7e7;
843
- background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x;
844
- font-weight: bold;
845
- color: #1d5987;
846
- }
847
- .ui-state-hover a,
848
- .ui-state-hover a:hover,
849
- .ui-state-hover a:link,
850
- .ui-state-hover a:visited {
851
- color: #1d5987;
852
- text-decoration: none;
853
- }
854
- .ui-state-active,
855
- .ui-widget-content .ui-state-active,
856
- .ui-widget-header .ui-state-active {
857
- border: 1px solid #79b7e7;
858
- background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x;
859
- font-weight: bold;
860
- color: #e17009;
861
- }
862
- .ui-state-active a,
863
- .ui-state-active a:link,
864
- .ui-state-active a:visited {
865
- color: #e17009;
866
- text-decoration: none;
867
- }
868
-
869
- /* Interaction Cues
870
- ----------------------------------*/
871
- .ui-state-highlight,
872
- .ui-widget-content .ui-state-highlight,
873
- .ui-widget-header .ui-state-highlight {
874
- border: 1px solid #fad42e;
875
- background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x;
876
- color: #363636;
877
- }
878
- .ui-state-highlight a,
879
- .ui-widget-content .ui-state-highlight a,
880
- .ui-widget-header .ui-state-highlight a {
881
- color: #363636;
882
- }
883
- .ui-state-error,
884
- .ui-widget-content .ui-state-error,
885
- .ui-widget-header .ui-state-error {
886
- border: 1px solid #cd0a0a;
887
- background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;
888
- color: #cd0a0a;
889
- }
890
- .ui-state-error a,
891
- .ui-widget-content .ui-state-error a,
892
- .ui-widget-header .ui-state-error a {
893
- color: #cd0a0a;
894
- }
895
- .ui-state-error-text,
896
- .ui-widget-content .ui-state-error-text,
897
- .ui-widget-header .ui-state-error-text {
898
- color: #cd0a0a;
899
- }
900
- .ui-priority-primary,
901
- .ui-widget-content .ui-priority-primary,
902
- .ui-widget-header .ui-priority-primary {
903
- font-weight: bold;
904
- }
905
- .ui-priority-secondary,
906
- .ui-widget-content .ui-priority-secondary,
907
- .ui-widget-header .ui-priority-secondary {
908
- opacity: .7;
909
- filter:Alpha(Opacity=70);
910
- font-weight: normal;
911
- }
912
- .ui-state-disabled,
913
- .ui-widget-content .ui-state-disabled,
914
- .ui-widget-header .ui-state-disabled {
915
- opacity: .35;
916
- filter:Alpha(Opacity=35);
917
- background-image: none;
918
- }
919
- .ui-state-disabled .ui-icon {
920
- filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
921
- }
922
-
923
- /* Icons
924
- ----------------------------------*/
925
-
926
- /* states and images */
927
- .ui-icon {
928
- width: 16px;
929
- height: 16px;
930
- }
931
- .ui-icon,
932
- .ui-widget-content .ui-icon {
933
- background-image: url(images/ui-icons_469bdd_256x240.png);
934
- }
935
- .ui-widget-header .ui-icon {
936
- background-image: url(images/ui-icons_d8e7f3_256x240.png);
937
- }
938
- .ui-state-default .ui-icon {
939
- background-image: url(images/ui-icons_6da8d5_256x240.png);
940
- }
941
- .ui-state-hover .ui-icon,
942
- .ui-state-focus .ui-icon {
943
- background-image: url(images/ui-icons_217bc0_256x240.png);
944
- }
945
- .ui-state-active .ui-icon {
946
- background-image: url(images/ui-icons_f9bd01_256x240.png);
947
- }
948
- .ui-state-highlight .ui-icon {
949
- background-image: url(images/ui-icons_2e83ff_256x240.png);
950
- }
951
- .ui-state-error .ui-icon,
952
- .ui-state-error-text .ui-icon {
953
- background-image: url(images/ui-icons_cd0a0a_256x240.png);
954
- }
955
-
956
- /* positioning */
957
- .ui-icon-blank { background-position: 16px 16px; }
958
- .ui-icon-carat-1-n { background-position: 0 0; }
959
- .ui-icon-carat-1-ne { background-position: -16px 0; }
960
- .ui-icon-carat-1-e { background-position: -32px 0; }
961
- .ui-icon-carat-1-se { background-position: -48px 0; }
962
- .ui-icon-carat-1-s { background-position: -64px 0; }
963
- .ui-icon-carat-1-sw { background-position: -80px 0; }
964
- .ui-icon-carat-1-w { background-position: -96px 0; }
965
- .ui-icon-carat-1-nw { background-position: -112px 0; }
966
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
967
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
968
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
969
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
970
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
971
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
972
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
973
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
974
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
975
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
976
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
977
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
978
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
979
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
980
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
981
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
982
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
983
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
984
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
985
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
986
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
987
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
988
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
989
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
990
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
991
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
992
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
993
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
994
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
995
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
996
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
997
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
998
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
999
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
1000
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
1001
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
1002
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
1003
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
1004
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
1005
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
1006
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
1007
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
1008
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
1009
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
1010
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
1011
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
1012
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
1013
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
1014
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
1015
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
1016
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
1017
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
1018
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
1019
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
1020
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
1021
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
1022
- .ui-icon-arrow-4 { background-position: 0 -80px; }
1023
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
1024
- .ui-icon-extlink { background-position: -32px -80px; }
1025
- .ui-icon-newwin { background-position: -48px -80px; }
1026
- .ui-icon-refresh { background-position: -64px -80px; }
1027
- .ui-icon-shuffle { background-position: -80px -80px; }
1028
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
1029
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
1030
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
1031
- .ui-icon-folder-open { background-position: -16px -96px; }
1032
- .ui-icon-document { background-position: -32px -96px; }
1033
- .ui-icon-document-b { background-position: -48px -96px; }
1034
- .ui-icon-note { background-position: -64px -96px; }
1035
- .ui-icon-mail-closed { background-position: -80px -96px; }
1036
- .ui-icon-mail-open { background-position: -96px -96px; }
1037
- .ui-icon-suitcase { background-position: -112px -96px; }
1038
- .ui-icon-comment { background-position: -128px -96px; }
1039
- .ui-icon-person { background-position: -144px -96px; }
1040
- .ui-icon-print { background-position: -160px -96px; }
1041
- .ui-icon-trash { background-position: -176px -96px; }
1042
- .ui-icon-locked { background-position: -192px -96px; }
1043
- .ui-icon-unlocked { background-position: -208px -96px; }
1044
- .ui-icon-bookmark { background-position: -224px -96px; }
1045
- .ui-icon-tag { background-position: -240px -96px; }
1046
- .ui-icon-home { background-position: 0 -112px; }
1047
- .ui-icon-flag { background-position: -16px -112px; }
1048
- .ui-icon-calendar { background-position: -32px -112px; }
1049
- .ui-icon-cart { background-position: -48px -112px; }
1050
- .ui-icon-pencil { background-position: -64px -112px; }
1051
- .ui-icon-clock { background-position: -80px -112px; }
1052
- .ui-icon-disk { background-position: -96px -112px; }
1053
- .ui-icon-calculator { background-position: -112px -112px; }
1054
- .ui-icon-zoomin { background-position: -128px -112px; }
1055
- .ui-icon-zoomout { background-position: -144px -112px; }
1056
- .ui-icon-search { background-position: -160px -112px; }
1057
- .ui-icon-wrench { background-position: -176px -112px; }
1058
- .ui-icon-gear { background-position: -192px -112px; }
1059
- .ui-icon-heart { background-position: -208px -112px; }
1060
- .ui-icon-star { background-position: -224px -112px; }
1061
- .ui-icon-link { background-position: -240px -112px; }
1062
- .ui-icon-cancel { background-position: 0 -128px; }
1063
- .ui-icon-plus { background-position: -16px -128px; }
1064
- .ui-icon-plusthick { background-position: -32px -128px; }
1065
- .ui-icon-minus { background-position: -48px -128px; }
1066
- .ui-icon-minusthick { background-position: -64px -128px; }
1067
- .ui-icon-close { background-position: -80px -128px; }
1068
- .ui-icon-closethick { background-position: -96px -128px; }
1069
- .ui-icon-key { background-position: -112px -128px; }
1070
- .ui-icon-lightbulb { background-position: -128px -128px; }
1071
- .ui-icon-scissors { background-position: -144px -128px; }
1072
- .ui-icon-clipboard { background-position: -160px -128px; }
1073
- .ui-icon-copy { background-position: -176px -128px; }
1074
- .ui-icon-contact { background-position: -192px -128px; }
1075
- .ui-icon-image { background-position: -208px -128px; }
1076
- .ui-icon-video { background-position: -224px -128px; }
1077
- .ui-icon-script { background-position: -240px -128px; }
1078
- .ui-icon-alert { background-position: 0 -144px; }
1079
- .ui-icon-info { background-position: -16px -144px; }
1080
- .ui-icon-notice { background-position: -32px -144px; }
1081
- .ui-icon-help { background-position: -48px -144px; }
1082
- .ui-icon-check { background-position: -64px -144px; }
1083
- .ui-icon-bullet { background-position: -80px -144px; }
1084
- .ui-icon-radio-on { background-position: -96px -144px; }
1085
- .ui-icon-radio-off { background-position: -112px -144px; }
1086
- .ui-icon-pin-w { background-position: -128px -144px; }
1087
- .ui-icon-pin-s { background-position: -144px -144px; }
1088
- .ui-icon-play { background-position: 0 -160px; }
1089
- .ui-icon-pause { background-position: -16px -160px; }
1090
- .ui-icon-seek-next { background-position: -32px -160px; }
1091
- .ui-icon-seek-prev { background-position: -48px -160px; }
1092
- .ui-icon-seek-end { background-position: -64px -160px; }
1093
- .ui-icon-seek-start { background-position: -80px -160px; }
1094
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
1095
- .ui-icon-seek-first { background-position: -80px -160px; }
1096
- .ui-icon-stop { background-position: -96px -160px; }
1097
- .ui-icon-eject { background-position: -112px -160px; }
1098
- .ui-icon-volume-off { background-position: -128px -160px; }
1099
- .ui-icon-volume-on { background-position: -144px -160px; }
1100
- .ui-icon-power { background-position: 0 -176px; }
1101
- .ui-icon-signal-diag { background-position: -16px -176px; }
1102
- .ui-icon-signal { background-position: -32px -176px; }
1103
- .ui-icon-battery-0 { background-position: -48px -176px; }
1104
- .ui-icon-battery-1 { background-position: -64px -176px; }
1105
- .ui-icon-battery-2 { background-position: -80px -176px; }
1106
- .ui-icon-battery-3 { background-position: -96px -176px; }
1107
- .ui-icon-circle-plus { background-position: 0 -192px; }
1108
- .ui-icon-circle-minus { background-position: -16px -192px; }
1109
- .ui-icon-circle-close { background-position: -32px -192px; }
1110
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
1111
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
1112
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
1113
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
1114
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
1115
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
1116
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
1117
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
1118
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
1119
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
1120
- .ui-icon-circle-check { background-position: -208px -192px; }
1121
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
1122
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
1123
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
1124
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
1125
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
1126
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
1127
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
1128
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
1129
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
1130
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
1131
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
1132
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
1133
-
1134
-
1135
- /* Misc visuals
1136
- ----------------------------------*/
1137
-
1138
- /* Corner radius */
1139
- .ui-corner-all,
1140
- .ui-corner-top,
1141
- .ui-corner-left,
1142
- .ui-corner-tl {
1143
- border-top-left-radius: 5px;
1144
- }
1145
- .ui-corner-all,
1146
- .ui-corner-top,
1147
- .ui-corner-right,
1148
- .ui-corner-tr {
1149
- border-top-right-radius: 5px;
1150
- }
1151
- .ui-corner-all,
1152
- .ui-corner-bottom,
1153
- .ui-corner-left,
1154
- .ui-corner-bl {
1155
- border-bottom-left-radius: 5px;
1156
- }
1157
- .ui-corner-all,
1158
- .ui-corner-bottom,
1159
- .ui-corner-right,
1160
- .ui-corner-br {
1161
- border-bottom-right-radius: 5px;
1162
- }
1163
-
1164
- /* Overlays */
1165
- .ui-widget-overlay {
1166
- background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
1167
- opacity: .3;
1168
- filter: Alpha(Opacity=30);
1169
- }
1170
- .ui-widget-shadow {
1171
- margin: -8px 0 0 -8px;
1172
- padding: 8px;
1173
- background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
1174
- opacity: .3;
1175
- filter: Alpha(Opacity=30);
1176
- border-radius: 8px;
1177
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/css/qmn_quiz.css DELETED
@@ -1,15 +0,0 @@
1
- .ui-tooltip {
2
- max-width: 500px !important;
3
- }
4
- .ui-tooltip-content {
5
- max-width: 500px !important;
6
- }
7
- .mlw_qmn_hint_link {
8
- text-decoration:underline;
9
- color:rgb(0,0,255);
10
- }
11
- .mlw_qmn_quiz_link {
12
- display: inline;
13
- vertical-align:top !important;
14
- text-decoration: none;
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/css/qsm-admin-contact.css DELETED
@@ -1,39 +0,0 @@
1
- .contact-form {
2
- background-color: #0d97d8;
3
- box-sizing: border-box;
4
- margin: 20px 0;
5
- overflow: hidden;
6
- }
7
-
8
- .contact-form-field {
9
- padding: 25px 10px 10px;
10
- margin: 15px 10px;
11
- background: #fff;
12
- border: 5px solid #1DD969;
13
- }
14
-
15
- .contact-form-field.new {
16
- background: #ffff66;
17
- }
18
-
19
- .contact-form-field.deleting {
20
- background: #ff6666;
21
- }
22
-
23
- .contact-form-group {
24
- margin: 0px 0px 15px;
25
- }
26
-
27
- .contact-form-label {
28
- font-weight: bold;
29
- margin-right: 10px;
30
- display: block;
31
- }
32
-
33
- .contact-form-control {
34
- height: 35px;
35
- padding: 6px 12px;
36
- font-size: 14px;
37
- line-height: 1.4;
38
- width: 100%;
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/css/qsm-admin-question.css DELETED
@@ -1,353 +0,0 @@
1
- .question-controls {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: space-between;
5
- align-items: center;
6
- }
7
-
8
- @media screen and (min-width:700px) {
9
- .question-controls {
10
- flex-direction: row;
11
- }
12
- }
13
-
14
- .page {
15
- width: 100%;
16
- background-color: #0d97d8;
17
- margin: 20px 0;
18
- padding-bottom: 15px;
19
- box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.4)
20
- }
21
-
22
- .page-header {
23
- display: flex;
24
- align-items: center;
25
- justify-content: space-between;
26
- background-color: #fff;
27
- padding: 10px 35px;
28
- border-bottom: 5px solid #1DD969;
29
- }
30
-
31
- .page-header a {
32
- text-decoration: none;
33
- }
34
-
35
- .page-header-buttons {
36
- text-align: center;
37
- }
38
-
39
- .question, .question-bank-question {
40
- padding: 10px;
41
- background-color: #fff;
42
- border: 5px solid #1DD969;
43
- margin: 15px 10px 0;
44
- }
45
-
46
- .question a {
47
- text-decoration: none;
48
- }
49
-
50
- .question-content {
51
- display: flex;
52
- align-items: center;
53
- justify-content: space-between;
54
- }
55
-
56
- .question-content > div {
57
- margin: 0 10px;
58
- }
59
-
60
- .question-content-text {
61
- flex-grow: 1;
62
- }
63
-
64
- .question-bank-question {
65
- display: flex;
66
- align-items: center;
67
- justify-content: space-between;
68
- clear: both;
69
- }
70
-
71
- .question-bank-question div {
72
- margin: 0 10px;
73
- }
74
-
75
- .page-new, .question-new {
76
- background-color: yellow !important;
77
- }
78
-
79
- .correct-header {
80
- text-align: right;
81
- }
82
-
83
- .answers-single {
84
- display: flex;
85
- justify-content: space-between;
86
- margin-bottom: 5px;
87
- }
88
-
89
- .answers-single > div {
90
- margin-left: 5px;
91
- }
92
-
93
- .answer-text-div {
94
- width: 100%;
95
- }
96
-
97
- .qsm-row {
98
- display: block;
99
- width: 100%;
100
- margin-bottom: 10px;
101
- font-size: 16px;
102
- }
103
-
104
- .qsm-row > label {
105
- font-weight: bold;
106
- display: block;
107
- }
108
-
109
- .qsm-row select, .qsm-row input[type=text], .qsm-row textarea {
110
- width: 100%;
111
- }
112
-
113
- .qsm-popup {
114
- font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
115
- }
116
-
117
- .qsm-popup__overlay {
118
- position: fixed;
119
- top: 0;
120
- left: 0;
121
- right: 0;
122
- bottom: 0;
123
- background: rgba(0,0,0,0.6);
124
- display: flex;
125
- justify-content: center;
126
- align-items: center;
127
- z-index: 9999;
128
- }
129
-
130
- .qsm-popup__container {
131
- background-color: #fff;
132
- padding: 30px;
133
- min-width: 500px;
134
- max-width: 700px;
135
- max-height: 95vh;
136
- border-radius: 4px;
137
- overflow-y: auto;
138
- box-sizing: border-box;
139
- }
140
-
141
- .qsm-popup__header {
142
- display: flex;
143
- justify-content: space-between;
144
- align-items: center;
145
- }
146
-
147
- .qsm-popup__title {
148
- margin-top: 0;
149
- margin-bottom: 0;
150
- font-weight: 600;
151
- font-size: 1.25rem;
152
- line-height: 1.25;
153
- color: #00449e;
154
- box-sizing: border-box;
155
- }
156
-
157
- .qsm-popup__close {
158
- background: transparent;
159
- border: 0;
160
- color: #00449e;
161
- text-decoration: none;
162
- }
163
-
164
- .qsm-popup__header .qsm-popup__close:before {
165
- content: "\2715";
166
- }
167
-
168
- .qsm-popup__content {
169
- margin-top: 2rem;
170
- margin-bottom: 2rem;
171
- line-height: 1.5;
172
- color: rgba(0,0,0,.8);
173
- }
174
-
175
- .qsm-popup__btn {
176
- font-size: .875rem;
177
- padding-left: 1rem;
178
- padding-right: 1rem;
179
- padding-top: .5rem;
180
- padding-bottom: .5rem;
181
- background-color: #e6e6e6;
182
- color: rgba(0,0,0,.8);
183
- border-radius: .25rem;
184
- border-style: none;
185
- border-width: 0;
186
- cursor: pointer;
187
- -webkit-appearance: button;
188
- text-transform: none;
189
- overflow: visible;
190
- line-height: 1.15;
191
- margin: 0;
192
- will-change: transform;
193
- -moz-osx-font-smoothing: grayscale;
194
- -webkit-backface-visibility: hidden;
195
- backface-visibility: hidden;
196
- -webkit-transform: translateZ(0);
197
- transform: translateZ(0);
198
- transition: -webkit-transform .25s ease-out;
199
- transition: transform .25s ease-out;
200
- transition: transform .25s ease-out,-webkit-transform .25s ease-out;
201
- }
202
-
203
- .qsm-popup__btn:focus, .qsm-popup__btn:hover {
204
- -webkit-transform: scale(1.05);
205
- transform: scale(1.05);
206
- }
207
-
208
- .qsm-popup__btn-primary {
209
- background-color: #00449e;
210
- color: #fff;
211
- }
212
-
213
- @keyframes mmfadeIn {
214
- from { opacity: 0; }
215
- to { opacity: 1; }
216
- }
217
-
218
- @keyframes mmfadeOut {
219
- from { opacity: 1; }
220
- to { opacity: 0; }
221
- }
222
-
223
- @keyframes mmslideIn {
224
- from { transform: translateY(15%); }
225
- to { transform: translateY(0); }
226
- }
227
-
228
- @keyframes mmslideOut {
229
- from { transform: translateY(0); }
230
- to { transform: translateY(-10%); }
231
- }
232
-
233
- .qsm-popup-slide {
234
- display: none;
235
- }
236
-
237
- .qsm-popup-slide.is-open {
238
- display: block;
239
- }
240
-
241
- .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
242
- animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
243
- }
244
-
245
- .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
246
- animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
247
- }
248
-
249
- .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
250
- animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
251
- }
252
-
253
- .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
254
- animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
255
- }
256
-
257
- .qsm-popup-slide .qsm-popup__container,
258
- .qsm-popup-slide .qsm-popup__overlay {
259
- will-change: transform;
260
- }
261
-
262
- @-moz-keyframes qsm-spinner-loader {
263
- 0% {
264
- -moz-transform: rotate(0deg);
265
- transform: rotate(0deg);
266
- }
267
- 100% {
268
- -moz-transform: rotate(360deg);
269
- transform: rotate(360deg);
270
- }
271
- }
272
- @-webkit-keyframes qsm-spinner-loader {
273
- 0% {
274
- -webkit-transform: rotate(0deg);
275
- transform: rotate(0deg);
276
- }
277
- 100% {
278
- -webkit-transform: rotate(360deg);
279
- transform: rotate(360deg);
280
- }
281
- }
282
-
283
- @keyframes qsm-spinner-loader {
284
- 0% {
285
- -moz-transform: rotate(0deg);
286
- -ms-transform: rotate(0deg);
287
- -webkit-transform: rotate(0deg);
288
- transform: rotate(0deg);
289
- }
290
- 100% {
291
- -moz-transform: rotate(360deg);
292
- -ms-transform: rotate(360deg);
293
- -webkit-transform: rotate(360deg);
294
- transform: rotate(360deg);
295
- }
296
- }
297
-
298
- /* :not(:required) hides this rule from IE9 and below */
299
- .qsm-spinner-loader:not(:required) {
300
- -moz-animation: qsm-spinner-loader 1500ms infinite linear;
301
- -webkit-animation: qsm-spinner-loader 1500ms infinite linear;
302
- animation: qsm-spinner-loader 1500ms infinite linear;
303
- -moz-border-radius: 0.5em;
304
- -webkit-border-radius: 0.5em;
305
- border-radius: 0.5em;
306
- -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;
307
- -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;
308
- 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;
309
- display: inline-block;
310
- font-size: 10px;
311
- width: 1em;
312
- height: 1em;
313
- margin: 1.5em;
314
- overflow: hidden;
315
- text-indent: 100%;
316
- }
317
-
318
- /**
319
- * Css for change-answer-editor-label
320
- */
321
- .change-answer-editor-label{
322
- display: inline-block;
323
- float: right;
324
- font-size: 14px;
325
- font-weight: normal !important;
326
- }
327
- .change-answer-editor-label > #change-answer-editor{
328
- width: auto;
329
- }
330
-
331
- a.import-button.button.disable_import{
332
- position: relative;
333
- z-index: 0;
334
- }
335
-
336
- a.import-button.button.disable_import::before {
337
- content: '';
338
- background: rgba(255,255,255,0.5);
339
- width: 100%;
340
- height: 100%;
341
- left: 0;
342
- right: 0;
343
- top: 0;
344
- bottom: 0;
345
- position: absolute;
346
- z-index: 5;
347
- }
348
-
349
- #question-bank-cat{
350
- float: right;
351
- margin-bottom: 20px;
352
- margin-right: 10px;
353
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/css/qsm-admin.css DELETED
@@ -1,686 +0,0 @@
1
- /********************
2
- Quizzes/Surveys Page
3
- *********************/
4
-
5
- /*.qsm-quizes-page .widefat td {
6
- font-size: 16px !important;
7
- }*/
8
-
9
- span.qsm-quiz-name {
10
- font-size: 14px;
11
- font-weight: 600;
12
- }
13
-
14
- .qsm-quizzes-page-content {
15
- display: flex;
16
- flex-direction: column;
17
- justify-content: space-between;
18
- }
19
-
20
- .qsm-quiz-page-wrapper {
21
- flex-grow: 1;
22
- }
23
-
24
- .qsm-quiz-page-wrapper-with-ads {
25
- flex-grow: 1;
26
- }
27
-
28
- .qsm-news-ads {
29
- background-color: #0d97d8;
30
- }
31
-
32
- .qsm-news-ads-title {
33
- text-align: center;
34
- border-bottom: 5px solid #1DD969;
35
- margin: 0;
36
- padding: 10px 0;
37
- background-color: #fff;
38
- }
39
-
40
- .qsm-edit-name {
41
- font-size: 12px !important;
42
- }
43
-
44
- .qsm-action-link {
45
- font-size: 14px !important;
46
- }
47
-
48
- .qsm-action-links:hover {
49
- background-color: black;
50
- }
51
-
52
- .qsm-action-link-delete {
53
- color: red !important;
54
- }
55
-
56
- .qsm-dialog-form label {
57
- display: inline-block;
58
- font-size: 16px;
59
- font-weight: bold;
60
- padding-right: 30px;
61
- }
62
-
63
- .qsm-quiz-page-addon{
64
- width: 83%;
65
- float: left;
66
- }
67
-
68
- .quizzes-surveys_page_qmn_addons .qsm-news-ads{
69
- width: 15%;
70
- float: right;
71
- }
72
-
73
- @media screen and (min-width: 1200px) {
74
- .qsm-quizzes-page-content {
75
- flex-direction: row;
76
- }
77
-
78
- .qsm-quiz-page-wrapper-with-ads {
79
- margin-right: 10px;
80
- }
81
-
82
- .qsm-news-ads {
83
- flex-basis: 15%;
84
- }
85
- }
86
-
87
- @media screen and (max-width: 767px) {
88
- .qsm-quiz-page-addon{
89
- width: 100%;
90
- }
91
-
92
- .quizzes-surveys_page_qmn_addons .qsm-news-ads{
93
- width: 100%;
94
- }
95
- }
96
-
97
-
98
- /********************
99
- Options Page
100
- *********************/
101
-
102
- .template_list_holder {
103
- width: 100%;
104
- }
105
- .template_variable {
106
- width: 50%;
107
- float: left;
108
- font-size: 14px;
109
- }
110
- .template_name {
111
- font-weight: bold;
112
- }
113
-
114
- /********************
115
- Results Pages & Emails Tab
116
- *********************/
117
- .results-page,
118
- .email {
119
- width: 100%;
120
- background-color: #0d97d8;
121
- margin: 20px 0;
122
- padding-bottom: 15px;
123
- box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.4)
124
- }
125
-
126
- .results-page-header,
127
- .email-header {
128
- display: flex;
129
- align-items: center;
130
- justify-content: flex-end;
131
- background-color: #fff;
132
- padding: 10px 35px;
133
- border-bottom: 5px solid #1DD969;
134
- }
135
-
136
- .delete-page-button,
137
- .delete-email-button {
138
- background: none;
139
- border: none;
140
- color: #1DD969;
141
- cursor: pointer;
142
- transition-duration: 200ms;
143
- }
144
-
145
- .delete-page-button:hover,
146
- .delete-email-button:hover {
147
- transform: scale(1.2);
148
- }
149
-
150
- .results-page-content,
151
- .email-content {
152
- display: flex;
153
- flex-direction: column;
154
- }
155
-
156
- .results-page-when,
157
- .results-page-show,
158
- .email-when,
159
- .email-show {
160
- padding: 10px;
161
- background-color: #fff;
162
- border: 5px solid #1DD969;
163
- margin: 15px 0;
164
- min-width: 60%;
165
- }
166
-
167
- .results-page-content-header,
168
- .email-content-header {
169
- margin-bottom: 10px;
170
- }
171
-
172
- .results-page-content-header h4,
173
- .results-page-content-header p,
174
- .email-content-header h4,
175
- .email-content-header p {
176
- margin: 0;
177
- }
178
-
179
- .results-page-condition,
180
- .email-condition {
181
- display: flex;
182
- flex-direction: column;
183
- margin-bottom: 15px;
184
- justify-content: space-around;
185
- }
186
-
187
- .results-page-condition > select,
188
- .results-page-condition > input,
189
- .email-condition > select,
190
- .email-condition > input {
191
- max-width: 100%;
192
- }
193
-
194
- .delete-condition-button {
195
- background: none;
196
- border: 1px solid #1DD969;
197
- color: #1DD969;
198
- cursor: pointer;
199
- transition-duration: 200ms;
200
- padding: 6px;
201
- }
202
-
203
- .delete-condition-button:hover {
204
- transform: scale(1.1);
205
- }
206
-
207
- .email-show .label {
208
- display: block;
209
- }
210
-
211
- .results-page-show textarea,
212
- .to-email,
213
- .subject,
214
- .email-template {
215
- width: 100%;
216
- margin-bottom: 10px;
217
- }
218
-
219
- @media screen and (min-width: 760px) {
220
- .results-page-content,
221
- .email-content {
222
- flex-direction: row;
223
- justify-content: space-around;
224
- }
225
-
226
- .results-page-when,
227
- .results-page-show,
228
- .email-when,
229
- .email-show {
230
- min-width: 35%;
231
- }
232
-
233
- .results-page-condition,
234
- .email-condition {
235
- align-items: center;
236
- flex-direction: row;
237
- }
238
- .results-page-condition > select,
239
- .results-page-condition > input,
240
- .email-condition > select,
241
- .email-condition > input {
242
- max-width: 30%;
243
- }
244
-
245
- .delete-condition-button {
246
- border: none;
247
- }
248
- }
249
-
250
- /********************
251
- Quiz Styles Tab
252
- *********************/
253
-
254
- .qsm-styles {
255
- display: flex;
256
- flex-direction: column;
257
- }
258
-
259
- @media screen and (min-width:700px) {
260
- .qsm-styles {
261
- flex-direction: row;
262
- flex-wrap: wrap;
263
- }
264
- }
265
-
266
-
267
-
268
- /********************
269
- About/Credits Page
270
- *********************/
271
-
272
- div.qsm_icon_wrap {
273
- position: absolute;
274
- top: 0;
275
- right: 0;
276
- background-color: rgba(54, 58, 66, 1);
277
- color: #1DD969;
278
- background-position: center 24px;
279
- background-size: 85px 85px;
280
- font-size: 14px;
281
- text-align: center;
282
- font-weight: 600;
283
- margin: 5px 0 0;
284
- padding-top: 120px;
285
- height: 40px;
286
- display: inline-block;
287
- width: 150px;
288
- text-rendering: optimizeLegibility;
289
- border: 5px solid #106daa;
290
- -moz-border-radius: 20px;
291
- -webkit-border-radius: 20px;
292
- -khtml-border-radius: 20px;
293
- border-radius: 20px;
294
- }
295
-
296
- .qsm-tab-content .feature {
297
- margin-bottom: 20px;
298
- }
299
-
300
- .qsm-tab-content .feature .feature-headline {
301
- margin: 1.1em 0 .2em;
302
- font-size: 40px;
303
- font-weight: 300;
304
- line-height: 1.3;
305
- text-align: center;
306
- }
307
-
308
- .qsm-tab-content .feature .feature-text {
309
- text-align: center;
310
- font-size: 16px;
311
- }
312
-
313
- ul.changelog {
314
- background-color: #fff;
315
- padding: 10px 10px;
316
- }
317
-
318
- ul.changelog li {
319
- padding: 4px 0px;
320
- }
321
-
322
- ul.changelog li div.two{
323
- width: 70%;
324
- float: left;
325
- display: inline-block;
326
- height: 25px;
327
- margin-right: 20px;
328
- background: #D9E0E4;
329
- text-align: center;
330
- line-height: 25px;
331
- }
332
-
333
- ul.changelog li.fixed > div {
334
- background:#F0FFE1;
335
- color: #444;
336
- border-right:1px solid #5cb85c;
337
- width: 20%;
338
- }
339
-
340
- ul.changelog li.fixed div.two:before {
341
- content: "\f147";
342
- font-family: "dashicons";
343
- color:#5CB85C;
344
- margin-right: 5px;
345
- }
346
-
347
- ul.changelog li.add > div{
348
- background:#FFEED0;
349
- color: #444;
350
- border-right:1px solid #EFA537;
351
- width: 20%;
352
- }
353
-
354
- ul.changelog li.add div.two:before {
355
- content: "\f155";
356
- font-family: "dashicons";
357
- color:#EFA537;
358
- margin-right: 5px;
359
- }
360
-
361
- ul.changelog li.update > div{
362
- background:#bde7ff;
363
- color: #444;
364
- border-right:1px solid #106daa;
365
- width: 20%;
366
- }
367
-
368
- ul.changelog li.update div.two:before {
369
- content: "\f463";
370
- font-family: "dashicons";
371
- color:#106daa;
372
- margin-right: 5px;
373
- }
374
-
375
- /********************
376
- Addons Page
377
- *********************/
378
-
379
- .qsm-addons {
380
- display: flex;
381
- flex-direction: column;
382
- }
383
-
384
- @media screen and (min-width:700px) {
385
- .qsm-addons {
386
- flex-direction: row;
387
- flex-wrap: wrap;
388
- }
389
- }
390
-
391
-
392
- /********************
393
- Help Page
394
- *********************/
395
-
396
- .quiz_email_support p#mlw_support_message {
397
- color: red;
398
- font-size: 20px;
399
- }
400
-
401
- .quiz_email_support input, .quiz_email_support textarea {
402
- width: 100% !important;
403
- }
404
-
405
- .quiz_email_support textarea {
406
- min-height: 200px;
407
- }
408
-
409
- .quiz_email_support label {
410
- font-weight: bold;
411
- }
412
-
413
-
414
- /********************
415
- Misc.
416
- *********************/
417
-
418
- /* Ads */
419
- .help-decide {
420
- display: block;
421
- text-align:center;
422
- background: #fff;
423
- border: 5px solid #1DD969;
424
- color: #000;
425
- font-weight: bold;
426
- }
427
- .help-decide p {
428
- font-size: 14px;
429
- }
430
-
431
- /* Info Bar */
432
- .qsm-info-box {
433
- display: block;
434
- text-align:center;
435
- background: #0d97d8;
436
- border: 5px solid #1DD969;
437
- color: #000;
438
- font-weight: bold;
439
- font-size: 14px;
440
- }
441
-
442
- .qsm-info-box p {
443
- font-size: 14px;
444
- }
445
-
446
- .qsm-info-box a {
447
- color: yellow;
448
- }
449
-
450
- /* Info Widget */
451
- .qsm-info-widget {
452
- text-align: center;
453
- border: 5px solid #1DD969;
454
- margin: 10px 5px;
455
- background: #fff;
456
- padding: 10px 5px;
457
- transition-duration: 0.5s;
458
- max-width: 330px;
459
- }
460
-
461
- .qsm-info-widget:hover {
462
- transform: scale(1.1);
463
- }
464
-
465
- /* Options tabs */
466
- .qsm_tab_content,
467
- .mlw_tab_content {
468
- padding: 10px 10px 10px 10px;
469
- }
470
-
471
- /* Popup */
472
-
473
- .qsm-popup {
474
- font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
475
- }
476
-
477
- .qsm-popup__overlay {
478
- position: fixed;
479
- top: 0;
480
- left: 0;
481
- right: 0;
482
- bottom: 0;
483
- background: rgba(0,0,0,0.6);
484
- display: flex;
485
- justify-content: center;
486
- align-items: center;
487
- z-index: 9999;
488
- }
489
-
490
- .qsm-popup__container {
491
- background-color: #fff;
492
- padding: 30px;
493
- min-width: 500px;
494
- max-width: 700px;
495
- max-height: 95vh;
496
- border-radius: 4px;
497
- overflow-y: auto;
498
- box-sizing: border-box;
499
- }
500
-
501
- .qsm-popup__header {
502
- display: flex;
503
- justify-content: space-between;
504
- align-items: center;
505
- }
506
-
507
- .qsm-popup__title {
508
- margin-top: 0;
509
- margin-bottom: 0;
510
- font-weight: 600;
511
- font-size: 1.25rem;
512
- line-height: 1.25;
513
- color: #00449e;
514
- box-sizing: border-box;
515
- }
516
-
517
- .qsm-popup__close {
518
- background: transparent;
519
- border: 0;
520
- color: #00449e;
521
- text-decoration: none;
522
- }
523
-
524
- .qsm-popup__header .qsm-popup__close:before {
525
- content: "\2715";
526
- }
527
-
528
- .qsm-popup__content {
529
- margin-top: 2rem;
530
- margin-bottom: 2rem;
531
- line-height: 1.5;
532
- color: rgba(0,0,0,.8);
533
- }
534
-
535
- .qsm-popup__btn {
536
- font-size: .875rem;
537
- padding-left: 1rem;
538
- padding-right: 1rem;
539
- padding-top: .5rem;
540
- padding-bottom: .5rem;
541
- background-color: #e6e6e6;
542
- color: rgba(0,0,0,.8);
543
- border-radius: .25rem;
544
- border-style: none;
545
- border-width: 0;
546
- cursor: pointer;
547
- -webkit-appearance: button;
548
- text-transform: none;
549
- overflow: visible;
550
- line-height: 1.15;
551
- margin: 0;
552
- will-change: transform;
553
- -moz-osx-font-smoothing: grayscale;
554
- -webkit-backface-visibility: hidden;
555
- backface-visibility: hidden;
556
- -webkit-transform: translateZ(0);
557
- transform: translateZ(0);
558
- transition: -webkit-transform .25s ease-out;
559
- transition: transform .25s ease-out;
560
- transition: transform .25s ease-out,-webkit-transform .25s ease-out;
561
- }
562
-
563
- .qsm-popup__btn:focus, .qsm-popup__btn:hover {
564
- -webkit-transform: scale(1.05);
565
- transform: scale(1.05);
566
- }
567
-
568
- .qsm-popup__btn-primary {
569
- background-color: #00449e;
570
- color: #fff;
571
- }
572
-
573
- @keyframes mmfadeIn {
574
- from { opacity: 0; }
575
- to { opacity: 1; }
576
- }
577
-
578
- @keyframes mmfadeOut {
579
- from { opacity: 1; }
580
- to { opacity: 0; }
581
- }
582
-
583
- @keyframes mmslideIn {
584
- from { transform: translateY(15%); }
585
- to { transform: translateY(0); }
586
- }
587
-
588
- @keyframes mmslideOut {
589
- from { transform: translateY(0); }
590
- to { transform: translateY(-10%); }
591
- }
592
-
593
- .qsm-popup-slide {
594
- display: none;
595
- }
596
-
597
- .qsm-popup-slide.is-open {
598
- display: block;
599
- }
600
-
601
- .qsm-popup-slide[aria-hidden="false"] .qsm-popup__overlay {
602
- animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
603
- }
604
-
605
- .qsm-popup-slide[aria-hidden="false"] .qsm-popup__container {
606
- animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
607
- }
608
-
609
- .qsm-popup-slide[aria-hidden="true"] .qsm-popup__overlay {
610
- animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
611
- }
612
-
613
- .qsm-popup-slide[aria-hidden="true"] .qsm-popup__container {
614
- animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
615
- }
616
-
617
- .qsm-popup-slide .qsm-popup__container,
618
- .qsm-popup-slide .qsm-popup__overlay {
619
- will-change: transform;
620
- }
621
-
622
- /**
623
- * Shortcode accordion
624
- */
625
- .sc-opener{
626
- position: relative;
627
- font-size: 14px !important;
628
- margin-bottom: 10px;
629
- cursor: pointer;
630
- }
631
- .sc-opener span.dashicons{
632
- position: relative;
633
- top: 2px;
634
- margin-right: 5px;
635
- }
636
- .sc-content{
637
- display: none;
638
- }
639
- .quiz-preview-link{
640
- margin-left: 10px;
641
- position: relative;
642
- top: 3px;
643
- }
644
-
645
- #show-advanced-option{
646
- font-size: 16px;
647
- cursor: pointer;
648
- color: #0073aa;
649
- margin-bottom: 15px;
650
- }
651
-
652
- .remove-ads-adv-link{
653
- text-align: center;
654
- }
655
-
656
- .remove-ads-adv-link a{
657
- background: #1DD969;
658
- text-align: center;
659
- color: #fff;
660
- padding: 3px 10px;
661
- border-radius: 5px;
662
- display: inline-block;
663
- text-decoration: none;
664
- font-size: 13px;
665
- font-weight: bold;
666
- margin-bottom: 10px;
667
- }
668
-
669
- .help-decide a.remove-adv-button{
670
- background: #1DD969;
671
- text-align: center;
672
- color: #fff;
673
- padding: 3px 10px;
674
- border-radius: 5px;
675
- display: inline-block;
676
- text-decoration: none;
677
- font-size: 13px;
678
- font-weight: bold;
679
- margin-left: 10px;
680
- }
681
-
682
- h3.addon_category_name {
683
- width: 100%;
684
- background: #d7d1d1;
685
- padding: 15px;
686
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/index.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- die("Error: Unauthorized Access.");
4
- ?>
 
 
 
 
trunk/js/Chart.min.js DELETED
@@ -1,11 +0,0 @@
1
- /*!
2
- * Chart.js
3
- * http://chartjs.org/
4
- * Version: 1.0.1
5
- *
6
- * Copyright 2015 Nick Downie
7
- * Released under the MIT license
8
- * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
9
- */
10
- (function(){"use strict";var t=this,i=t.Chart,e=function(t){this.canvas=t.canvas,this.ctx=t;this.width=t.canvas.width,this.height=t.canvas.height;return this.aspectRatio=this.width/this.height,s.retinaScale(this),this};e.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,customTooltips:!1,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",onAnimationProgress:function(){},onAnimationComplete:function(){}}},e.types={};var s=e.helpers={},n=s.each=function(t,i,e){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var n;for(n=0;n<t.length;n++)i.apply(e,[t[n],n].concat(s))}else for(var o in t)i.apply(e,[t[o],o].concat(s))},o=s.clone=function(t){var i={};return n(t,function(e,s){t.hasOwnProperty(s)&&(i[s]=e)}),i},a=s.extend=function(t){return n(Array.prototype.slice.call(arguments,1),function(i){n(i,function(e,s){i.hasOwnProperty(s)&&(t[s]=e)})}),t},h=s.merge=function(){var t=Array.prototype.slice.call(arguments,0);return t.unshift({}),a.apply(null,t)},l=s.indexOf=function(t,i){if(Array.prototype.indexOf)return t.indexOf(i);for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1},r=(s.where=function(t,i){var e=[];return s.each(t,function(t){i(t)&&e.push(t)}),e},s.findNextWhere=function(t,i,e){e||(e=-1);for(var s=e+1;s<t.length;s++){var n=t[s];if(i(n))return n}},s.findPreviousWhere=function(t,i,e){e||(e=t.length);for(var s=e-1;s>=0;s--){var n=t[s];if(i(n))return n}},s.inherits=function(t){var i=this,e=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},s=function(){this.constructor=e};return s.prototype=i.prototype,e.prototype=new s,e.extend=r,t&&a(e.prototype,t),e.__super__=i.prototype,e}),c=s.noop=function(){},u=s.uid=function(){var t=0;return function(){return"chart-"+t++}}(),d=s.warn=function(t){window.console&&"function"==typeof window.console.warn&&console.warn(t)},p=s.amd="function"==typeof define&&define.amd,f=s.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},g=s.max=function(t){return Math.max.apply(Math,t)},m=s.min=function(t){return Math.min.apply(Math,t)},v=(s.cap=function(t,i,e){if(f(i)){if(t>i)return i}else if(f(e)&&e>t)return e;return t},s.getDecimalPlaces=function(t){return t%1!==0&&f(t)?t.toString().split(".")[1].length:0}),S=s.radians=function(t){return t*(Math.PI/180)},x=(s.getAngleFromPoint=function(t,i){var e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s),o=2*Math.PI+Math.atan2(s,e);return 0>e&&0>s&&(o+=2*Math.PI),{angle:o,distance:n}},s.aliasPixel=function(t){return t%2===0?0:.5}),y=(s.splineCurve=function(t,i,e,s){var n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=s*n/(n+o),h=s*o/(n+o);return{inner:{x:i.x-a*(e.x-t.x),y:i.y-a*(e.y-t.y)},outer:{x:i.x+h*(e.x-t.x),y:i.y+h*(e.y-t.y)}}},s.calculateOrderOfMagnitude=function(t){return Math.floor(Math.log(t)/Math.LN10)}),C=(s.calculateScaleRange=function(t,i,e,s,n){var o=2,a=Math.floor(i/(1.5*e)),h=o>=a,l=g(t),r=m(t);l===r&&(l+=.5,r>=.5&&!s?r-=.5:l+=.5);for(var c=Math.abs(l-r),u=y(c),d=Math.ceil(l/(1*Math.pow(10,u)))*Math.pow(10,u),p=s?0:Math.floor(r/(1*Math.pow(10,u)))*Math.pow(10,u),f=d-p,v=Math.pow(10,u),S=Math.round(f/v);(S>a||a>2*S)&&!h;)if(S>a)v*=2,S=Math.round(f/v),S%1!==0&&(h=!0);else if(n&&u>=0){if(v/2%1!==0)break;v/=2,S=Math.round(f/v)}else v/=2,S=Math.round(f/v);return h&&(S=o,v=f/S),{steps:S,stepValue:v,min:p,max:p+S*v}},s.template=function(t,i){function e(t,i){var e=/\W/.test(t)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+t.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):s[t]=s[t];return i?e(i):e}if(t instanceof Function)return t(i);var s={};return e(t,i)}),w=(s.generateLabels=function(t,i,e,s){var o=new Array(i);return labelTemplateString&&n(o,function(i,n){o[n]=C(t,{value:e+s*(n+1)})}),o},s.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-0.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-0.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),-(s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)))},easeOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),s*Math.pow(2,-10*t)*Math.sin(2*(1*t-i)*Math.PI/e)+1)},easeInOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:2==(t/=.5)?1:(e||(e=.3*1.5),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),1>t?-.5*s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e):s*Math.pow(2,-10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)*.5+1)},easeInBack:function(t){var i=1.70158;return 1*(t/=1)*t*((i+1)*t-i)},easeOutBack:function(t){var i=1.70158;return 1*((t=t/1-1)*t*((i+1)*t+i)+1)},easeInOutBack:function(t){var i=1.70158;return(t/=.5)<1?.5*t*t*(((i*=1.525)+1)*t-i):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},easeInBounce:function(t){return 1-w.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?7.5625*t*t:2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*w.easeInBounce(2*t):.5*w.easeOutBounce(2*t-1)+.5}}),b=s.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),P=(s.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),s.animationLoop=function(t,i,e,s,n,o){var a=0,h=w[e]||w.linear,l=function(){a++;var e=a/i,r=h(e);t.call(o,r,e,a),s.call(o,r,e),i>a?o.animationFrame=b(l):n.apply(o)};b(l)},s.getRelativePosition=function(t){var i,e,s=t.originalEvent||t,n=t.currentTarget||t.srcElement,o=n.getBoundingClientRect();return s.touches?(i=s.touches[0].clientX-o.left,e=s.touches[0].clientY-o.top):(i=s.clientX-o.left,e=s.clientY-o.top),{x:i,y:e}},s.addEvent=function(t,i,e){t.addEventListener?t.addEventListener(i,e):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e}),L=s.removeEvent=function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=c},k=(s.bindEvents=function(t,i,e){t.events||(t.events={}),n(i,function(i){t.events[i]=function(){e.apply(t,arguments)},P(t.chart.canvas,i,t.events[i])})},s.unbindEvents=function(t,i){n(i,function(i,e){L(t.chart.canvas,e,i)})}),F=s.getMaximumWidth=function(t){var i=t.parentNode;return i.clientWidth},R=s.getMaximumHeight=function(t){var i=t.parentNode;return i.clientHeight},T=(s.getMaximumSize=s.getMaximumWidth,s.retinaScale=function(t){var i=t.ctx,e=t.canvas.width,s=t.canvas.height;window.devicePixelRatio&&(i.canvas.style.width=e+"px",i.canvas.style.height=s+"px",i.canvas.height=s*window.devicePixelRatio,i.canvas.width=e*window.devicePixelRatio,i.scale(window.devicePixelRatio,window.devicePixelRatio))}),A=s.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},M=s.fontString=function(t,i,e){return i+" "+t+"px "+e},W=s.longestText=function(t,i,e){t.font=i;var s=0;return n(e,function(i){var e=t.measureText(i).width;s=e>s?e:s}),s},z=s.drawRoundedRectangle=function(t,i,e,s,n,o){t.beginPath(),t.moveTo(i+o,e),t.lineTo(i+s-o,e),t.quadraticCurveTo(i+s,e,i+s,e+o),t.lineTo(i+s,e+n-o),t.quadraticCurveTo(i+s,e+n,i+s-o,e+n),t.lineTo(i+o,e+n),t.quadraticCurveTo(i,e+n,i,e+n-o),t.lineTo(i,e+o),t.quadraticCurveTo(i,e,i+o,e),t.closePath()};e.instances={},e.Type=function(t,i,s){this.options=i,this.chart=s,this.id=u(),e.instances[this.id]=this,i.responsive&&this.resize(),this.initialize.call(this,t)},a(e.Type.prototype,{initialize:function(){return this},clear:function(){return A(this.chart),this},stop:function(){return s.cancelAnimFrame.call(t,this.animationFrame),this},resize:function(t){this.stop();var i=this.chart.canvas,e=F(this.chart.canvas),s=this.options.maintainAspectRatio?e/this.chart.aspectRatio:R(this.chart.canvas);return i.width=this.chart.width=e,i.height=this.chart.height=s,T(this.chart),"function"==typeof t&&t.apply(this,Array.prototype.slice.call(arguments,1)),this},reflow:c,render:function(t){return t&&this.reflow(),this.options.animation&&!t?s.animationLoop(this.draw,this.options.animationSteps,this.options.animationEasing,this.options.onAnimationProgress,this.options.onAnimationComplete,this):(this.draw(),this.options.onAnimationComplete.call(this)),this},generateLegend:function(){return C(this.options.legendTemplate,this)},destroy:function(){this.clear(),k(this,this.events);var t=this.chart.canvas;t.width=this.chart.width,t.height=this.chart.height,t.style.removeProperty?(t.style.removeProperty("width"),t.style.removeProperty("height")):(t.style.removeAttribute("width"),t.style.removeAttribute("height")),delete e.instances[this.id]},showTooltip:function(t,i){"undefined"==typeof this.activeElements&&(this.activeElements=[]);var o=function(t){var i=!1;return t.length!==this.activeElements.length?i=!0:(n(t,function(t,e){t!==this.activeElements[e]&&(i=!0)},this),i)}.call(this,t);if(o||i){if(this.activeElements=t,this.draw(),this.options.customTooltips&&this.options.customTooltips(!1),t.length>0)if(this.datasets&&this.datasets.length>1){for(var a,h,r=this.datasets.length-1;r>=0&&(a=this.datasets[r].points||this.datasets[r].bars||this.datasets[r].segments,h=l(a,t[0]),-1===h);r--);var c=[],u=[],d=function(){var t,i,e,n,o,a=[],l=[],r=[];return s.each(this.datasets,function(i){t=i.points||i.bars||i.segments,t[h]&&t[h].hasValue()&&a.push(t[h])}),s.each(a,function(t){l.push(t.x),r.push(t.y),c.push(s.template(this.options.multiTooltipTemplate,t)),u.push({fill:t._saved.fillColor||t.fillColor,stroke:t._saved.strokeColor||t.strokeColor})},this),o=m(r),e=g(r),n=m(l),i=g(l),{x:n>this.chart.width/2?n:i,y:(o+e)/2}}.call(this,h);new e.MultiTooltip({x:d.x,y:d.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:c,legendColors:u,legendColorBackground:this.options.multiTooltipKeyBackground,title:t[0].label,chart:this.chart,ctx:this.chart.ctx,custom:this.options.customTooltips}).draw()}else n(t,function(t){var i=t.tooltipPosition();new e.Tooltip({x:Math.round(i.x),y:Math.round(i.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,text:C(this.options.tooltipTemplate,t),chart:this.chart,custom:this.options.customTooltips}).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}}),e.Type.extend=function(t){var i=this,s=function(){return i.apply(this,arguments)};if(s.prototype=o(i.prototype),a(s.prototype,t),s.extend=e.Type.extend,t.name||i.prototype.name){var n=t.name||i.prototype.name,l=e.defaults[i.prototype.name]?o(e.defaults[i.prototype.name]):{};e.defaults[n]=a(l,t.defaults),e.types[n]=s,e.prototype[n]=function(t,i){var o=h(e.defaults.global,e.defaults[n],i||{});return new s(t,o,this)}}else d("Name not provided for this chart, so it hasn't been registered");return i},e.Element=function(t){a(this,t),this.initialize.apply(this,arguments),this.save()},a(e.Element.prototype,{initialize:function(){},restore:function(t){return t?n(t,function(t){this[t]=this._saved[t]},this):a(this,this._saved),this},save:function(){return this._saved=o(this),delete this._saved._saved,this},update:function(t){return n(t,function(t,i){this._saved[i]=this[i],this[i]=t},this),this},transition:function(t,i){return n(t,function(t,e){this[e]=(t-this._saved[e])*i+this._saved[e]},this),this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return f(this.value)}}),e.Element.extend=r,e.Point=e.Element.extend({display:!0,inRange:function(t,i){var e=this.hitDetectionRadius+this.radius;return Math.pow(t-this.x,2)+Math.pow(i-this.y,2)<Math.pow(e,2)},draw:function(){if(this.display){var t=this.ctx;t.beginPath(),t.arc(this.x,this.y,this.radius,0,2*Math.PI),t.closePath(),t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.fillStyle=this.fillColor,t.fill(),t.stroke()}}}),e.Arc=e.Element.extend({inRange:function(t,i){var e=s.getAngleFromPoint(this,{x:t,y:i}),n=e.angle>=this.startAngle&&e.angle<=this.endAngle,o=e.distance>=this.innerRadius&&e.distance<=this.outerRadius;return n&&o},tooltipPosition:function(){var t=this.startAngle+(this.endAngle-this.startAngle)/2,i=(this.outerRadius-this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(t)*i,y:this.y+Math.sin(t)*i}},draw:function(t){var i=this.ctx;i.beginPath(),i.arc(this.x,this.y,this.outerRadius,this.startAngle,this.endAngle),i.arc(this.x,this.y,this.innerRadius,this.endAngle,this.startAngle,!0),i.closePath(),i.strokeStyle=this.strokeColor,i.lineWidth=this.strokeWidth,i.fillStyle=this.fillColor,i.fill(),i.lineJoin="bevel",this.showStroke&&i.stroke()}}),e.Rectangle=e.Element.extend({draw:function(){var t=this.ctx,i=this.width/2,e=this.x-i,s=this.x+i,n=this.base-(this.base-this.y),o=this.strokeWidth/2;this.showStroke&&(e+=o,s-=o,n+=o),t.beginPath(),t.fillStyle=this.fillColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.moveTo(e,this.base),t.lineTo(e,n),t.lineTo(s,n),t.lineTo(s,this.base),t.fill(),this.showStroke&&t.stroke()},height:function(){return this.base-this.y},inRange:function(t,i){return t>=this.x-this.width/2&&t<=this.x+this.width/2&&i>=this.y&&i<=this.base}}),e.Tooltip=e.Element.extend({draw:function(){var t=this.chart.ctx;t.font=M(this.fontSize,this.fontStyle,this.fontFamily),this.xAlign="center",this.yAlign="above";var i=this.caretPadding=2,e=t.measureText(this.text).width+2*this.xPadding,s=this.fontSize+2*this.yPadding,n=s+this.caretHeight+i;this.x+e/2>this.chart.width?this.xAlign="left":this.x-e/2<0&&(this.xAlign="right"),this.y-n<0&&(this.yAlign="below");var o=this.x-e/2,a=this.y-n;if(t.fillStyle=this.fillColor,this.custom)this.custom(this);else{switch(this.yAlign){case"above":t.beginPath(),t.moveTo(this.x,this.y-i),t.lineTo(this.x+this.caretHeight,this.y-(i+this.caretHeight)),t.lineTo(this.x-this.caretHeight,this.y-(i+this.caretHeight)),t.closePath(),t.fill();break;case"below":a=this.y+i+this.caretHeight,t.beginPath(),t.moveTo(this.x,this.y+i),t.lineTo(this.x+this.caretHeight,this.y+i+this.caretHeight),t.lineTo(this.x-this.caretHeight,this.y+i+this.caretHeight),t.closePath(),t.fill()}switch(this.xAlign){case"left":o=this.x-e+(this.cornerRadius+this.caretHeight);break;case"right":o=this.x-(this.cornerRadius+this.caretHeight)}z(t,o,a,e,s,this.cornerRadius),t.fill(),t.fillStyle=this.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,o+e/2,a+s/2)}}}),e.MultiTooltip=e.Element.extend({initialize:function(){this.font=M(this.fontSize,this.fontStyle,this.fontFamily),this.titleFont=M(this.titleFontSize,this.titleFontStyle,this.titleFontFamily),this.height=this.labels.length*this.fontSize+(this.labels.length-1)*(this.fontSize/2)+2*this.yPadding+1.5*this.titleFontSize,this.ctx.font=this.titleFont;var t=this.ctx.measureText(this.title).width,i=W(this.ctx,this.font,this.labels)+this.fontSize+3,e=g([i,t]);this.width=e+2*this.xPadding;var s=this.height/2;this.y-s<0?this.y=s:this.y+s>this.chart.height&&(this.y=this.chart.height-s),this.x>this.chart.width/2?this.x-=this.xOffset+this.width:this.x+=this.xOffset},getLineHeight:function(t){var i=this.y-this.height/2+this.yPadding,e=t-1;return 0===t?i+this.titleFontSize/2:i+(1.5*this.fontSize*e+this.fontSize/2)+1.5*this.titleFontSize},draw:function(){if(this.custom)this.custom(this);else{z(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius);var t=this.ctx;t.fillStyle=this.fillColor,t.fill(),t.closePath(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=this.titleTextColor,t.font=this.titleFont,t.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0)),t.font=this.font,s.each(this.labels,function(i,e){t.fillStyle=this.textColor,t.fillText(i,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(e+1)),t.fillStyle=this.legendColorBackground,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize),t.fillStyle=this.legendColors[e].fill,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize)},this)}}}),e.Scale=e.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}));this.yLabelWidth=this.display&&this.showLabels?W(this.ctx,this.font,this.yLabels):0},addXLabel:function(t){this.xLabels.push(t),this.valuesCount++,this.fit()},removeXLabel:function(){this.xLabels.shift(),this.valuesCount--,this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var t,i=this.endPoint-this.startPoint;for(this.calculateYRange(i),this.buildYLabels(),this.calculateXLabelRotation();i>this.endPoint-this.startPoint;)i=this.endPoint-this.startPoint,t=this.yLabelWidth,this.calculateYRange(i),this.buildYLabels(),t<this.yLabelWidth&&this.calculateXLabelRotation()},calculateXLabelRotation:function(){this.ctx.font=this.font;var t,i,e=this.ctx.measureText(this.xLabels[0]).width,s=this.ctx.measureText(this.xLabels[this.xLabels.length-1]).width;if(this.xScalePaddingRight=s/2+3,this.xScalePaddingLeft=e/2>this.yLabelWidth+10?e/2:this.yLabelWidth+10,this.xLabelRotation=0,this.display){var n,o=W(this.ctx,this.font,this.xLabels);this.xLabelWidth=o;for(var a=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>a&&0===this.xLabelRotation||this.xLabelWidth>a&&this.xLabelRotation<=90&&this.xLabelRotation>0;)n=Math.cos(S(this.xLabelRotation)),t=n*e,i=n*s,t+this.fontSize/2>this.yLabelWidth+8&&(this.xScalePaddingLeft=t+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=n*o;this.xLabelRotation>0&&(this.endPoint-=Math.sin(S(this.xLabelRotation))*o+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding},calculateYRange:c,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(t){var i=this.drawingArea()/(this.min-this.max);return this.endPoint-i*(t-this.min)},calculateX:function(t){var i=(this.xLabelRotation>0,this.width-(this.xScalePaddingLeft+this.xScalePaddingRight)),e=i/(this.valuesCount-(this.offsetGridLines?0:1)),s=e*t+this.xScalePaddingLeft;return this.offsetGridLines&&(s+=e/2),Math.round(s)},update:function(t){s.extend(this,t),this.fit()},draw:function(){var t=this.ctx,i=(this.endPoint-this.startPoint)/this.steps,e=Math.round(this.xScalePaddingLeft);this.display&&(t.fillStyle=this.textColor,t.font=this.font,n(this.yLabels,function(n,o){var a=this.endPoint-i*o,h=Math.round(a),l=this.showHorizontalLines;t.textAlign="right",t.textBaseline="middle",this.showLabels&&t.fillText(n,e-10,a),0!==o||l||(l=!0),l&&t.beginPath(),o>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),h+=s.aliasPixel(t.lineWidth),l&&(t.moveTo(e,h),t.lineTo(this.width,h),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(e-5,h),t.lineTo(e,h),t.stroke(),t.closePath()},this),n(this.xLabels,function(i,e){var s=this.calculateX(e)+x(this.lineWidth),n=this.calculateX(e-(this.offsetGridLines?.5:0))+x(this.lineWidth),o=this.xLabelRotation>0,a=this.showVerticalLines;0!==e||a||(a=!0),a&&t.beginPath(),e>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),a&&(t.moveTo(n,this.endPoint),t.lineTo(n,this.startPoint-3),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(n,this.endPoint),t.lineTo(n,this.endPoint+5),t.stroke(),t.closePath(),t.save(),t.translate(s,o?this.endPoint+12:this.endPoint+8),t.rotate(-1*S(this.xLabelRotation)),t.font=this.font,t.textAlign=o?"right":"center",t.textBaseline=o?"middle":"top",t.fillText(i,0,0),t.restore()},this))}}),e.RadialScale=e.Element.extend({initialize:function(){this.size=m([this.height,this.width]),this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(t){var i=this.drawingArea/(this.max-this.min);return(t-this.min)*i},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize(),this.buildYLabels()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var t,i,e,s,n,o,a,h,l,r,c,u,d=m([this.height/2-this.pointLabelFontSize-5,this.width/2]),p=this.width,g=0;for(this.ctx.font=M(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),i=0;i<this.valuesCount;i++)t=this.getPointPosition(i,d),e=this.ctx.measureText(C(this.templateString,{value:this.labels[i]})).width+5,0===i||i===this.valuesCount/2?(s=e/2,t.x+s>p&&(p=t.x+s,n=i),t.x-s<g&&(g=t.x-s,a=i)):i<this.valuesCount/2?t.x+e>p&&(p=t.x+e,n=i):i>this.valuesCount/2&&t.x-e<g&&(g=t.x-e,a=i);l=g,r=Math.ceil(p-this.width),o=this.getIndexAngle(n),h=this.getIndexAngle(a),c=r/Math.sin(o+Math.PI/2),u=l/Math.sin(h+Math.PI/2),c=f(c)?c:0,u=f(u)?u:0,this.drawingArea=d-(u+c)/2,this.setCenterPoint(u,c)},setCenterPoint:function(t,i){var e=this.width-i-this.drawingArea,s=t+this.drawingArea;this.xCenter=(s+e)/2,this.yCenter=this.height/2},getIndexAngle:function(t){var i=2*Math.PI/this.valuesCount;return t*i-Math.PI/2},getPointPosition:function(t,i){var e=this.getIndexAngle(t);return{x:Math.cos(e)*i+this.xCenter,y:Math.sin(e)*i+this.yCenter}},draw:function(){if(this.display){var t=this.ctx;if(n(this.yLabels,function(i,e){if(e>0){var s,n=e*(this.drawingArea/this.steps),o=this.yCenter-n;if(this.lineWidth>0)if(t.strokeStyle=this.lineColor,t.lineWidth=this.lineWidth,this.lineArc)t.beginPath(),t.arc(this.xCenter,this.yCenter,n,0,2*Math.PI),t.closePath(),t.stroke();else{t.beginPath();for(var a=0;a<this.valuesCount;a++)s=this.getPointPosition(a,this.calculateCenterOffset(this.min+e*this.stepValue)),0===a?t.moveTo(s.x,s.y):t.lineTo(s.x,s.y);t.closePath(),t.stroke()}if(this.showLabels){if(t.font=M(this.fontSize,this.fontStyle,this.fontFamily),this.showLabelBackdrop){var h=t.measureText(i).width;t.fillStyle=this.backdropColor,t.fillRect(this.xCenter-h/2-this.backdropPaddingX,o-this.fontSize/2-this.backdropPaddingY,h+2*this.backdropPaddingX,this.fontSize+2*this.backdropPaddingY)}t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.fontColor,t.fillText(i,this.xCenter,o)}}},this),!this.lineArc){t.lineWidth=this.angleLineWidth,t.strokeStyle=this.angleLineColor;for(var i=this.valuesCount-1;i>=0;i--){if(this.angleLineWidth>0){var e=this.getPointPosition(i,this.calculateCenterOffset(this.max));t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(e.x,e.y),t.stroke(),t.closePath()}var s=this.getPointPosition(i,this.calculateCenterOffset(this.max)+5);t.font=M(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),t.fillStyle=this.pointLabelFontColor;var o=this.labels.length,a=this.labels.length/2,h=a/2,l=h>i||i>o-h,r=i===h||i===o-h;t.textAlign=0===i?"center":i===a?"center":a>i?"left":"right",t.textBaseline=r?"middle":l?"bottom":"top",t.fillText(this.labels[i],s.x,s.y)}}}}}),s.addEvent(window,"resize",function(){var t;return function(){clearTimeout(t),t=setTimeout(function(){n(e.instances,function(t){t.options.responsive&&t.resize(t.render,!0)})},50)}}()),p?define(function(){return e}):"object"==typeof module&&module.exports&&(module.exports=e),t.Chart=e,e.noConflict=function(){return t.Chart=i,e}}).call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Bar",defaults:s,initialize:function(t){var s=this.options;this.ScaleClass=i.Scale.extend({offsetGridLines:!0,calculateBarX:function(t,i,e){var n=this.calculateBaseWidth(),o=this.calculateX(e)-n/2,a=this.calculateBarWidth(t);return o+a*i+i*s.barDatasetSpacing+a/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*s.barValueSpacing},calculateBarWidth:function(t){var i=this.calculateBaseWidth()-(t-1)*s.barDatasetSpacing;return i/t}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getBarsAtEvent(t):[];this.eachBars(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),this.BarClass=i.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,bars:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.bars.push(new this.BarClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.strokeColor,fillColor:i.fillColor,highlightFill:i.highlightFill||i.fillColor,highlightStroke:i.highlightStroke||i.strokeColor}))},this)},this),this.buildScale(t.labels),this.BarClass.prototype.base=this.scale.endPoint,this.eachBars(function(t,i,s){e.extend(t,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,s,i),y:this.scale.endPoint}),t.save()},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachBars(function(t){t.save()}),this.render()},eachBars:function(t){e.each(this.datasets,function(i,s){e.each(i.bars,t,this,s)},this)},getBarsAtEvent:function(t){for(var i,s=[],n=e.getRelativePosition(t),o=function(t){s.push(t.bars[i])},a=0;a<this.datasets.length;a++)for(i=0;i<this.datasets[a].bars.length;i++)if(this.datasets[a].bars[i].inRange(n.x,n.y))return e.each(this.datasets,o),s;return s},buildScale:function(t){var i=this,s=function(){var t=[];return i.eachBars(function(i){t.push(i.value)}),t},n={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(s(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(n,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new this.ScaleClass(n)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].bars.push(new this.BarClass({value:t,label:i,x:this.scale.calculateBarX(this.datasets.length,e,this.scale.valuesCount+1),y:this.scale.endPoint,width:this.scale.calculateBarWidth(this.datasets.length),base:this.scale.endPoint,strokeColor:this.datasets[e].strokeColor,fillColor:this.datasets[e].fillColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.bars.shift()},this),this.update()},reflow:function(){e.extend(this.BarClass.prototype,{y:this.scale.endPoint,base:this.scale.endPoint});
11
- var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();this.chart.ctx;this.scale.draw(i),e.each(this.datasets,function(t,s){e.each(t.bars,function(t,e){t.hasValue()&&(t.base=this.scale.endPoint,t.transition({x:this.scale.calculateBarX(this.datasets.length,s,e),y:this.scale.calculateY(t.value),width:this.scale.calculateBarWidth(this.datasets.length)},i).draw())},this)},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Doughnut",defaults:s,initialize:function(t){this.segments=[],this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=i.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.calculateTotal(t),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({value:t.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:t.color,highlightColor:t.highlight||t.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(t.value),label:t.label})),e||(this.reflow(),this.update())},calculateCircumference:function(t){return 2*Math.PI*(t/this.total)},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this)},update:function(){this.calculateTotal(this.segments),e.each(this.activeElements,function(t){t.restore(["fillColor"])}),e.each(this.segments,function(t){t.save()}),this.render()},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,e.each(this.segments,function(t){t.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(t){var i=t?t:1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.calculateCircumference(t.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},i),t.endAngle=t.startAngle+t.circumference,t.draw(),0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle)},this)}}),i.types.Doughnut.extend({name:"Pie",defaults:e.merge(s,{percentageInnerCutout:0})})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,bezierCurve:!0,bezierCurveTension:.4,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Line",defaults:s,initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(t){return Math.pow(t-this.x,2)<Math.pow(this.radius+this.hitDetectionRadius,2)}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this),this.buildScale(t.labels),this.eachPoints(function(t,i){e.extend(t,{x:this.scale.calculateX(i),y:this.scale.endPoint}),t.save()},this)},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachPoints(function(t){t.save()}),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.datasets,function(t){e.each(t.points,function(t){t.inRange(s.x,s.y)&&i.push(t)})},this),i},buildScale:function(t){var s=this,n=function(){var t=[];return s.eachPoints(function(i){t.push(i.value)}),t},o={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(n(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.pointDotRadius+this.options.pointDotStrokeWidth,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(o,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new i.Scale(o)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:this.scale.calculateX(this.scale.valuesCount+1),y:this.scale.endPoint,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.points.shift()},this),this.update()},reflow:function(){var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();var s=this.chart.ctx,n=function(t){return null!==t.value},o=function(t,i,s){return e.findNextWhere(i,n,s)||t},a=function(t,i,s){return e.findPreviousWhere(i,n,s)||t};this.scale.draw(i),e.each(this.datasets,function(t){var h=e.where(t.points,n);e.each(t.points,function(t,e){t.hasValue()&&t.transition({y:this.scale.calculateY(t.value),x:this.scale.calculateX(e)},i)},this),this.options.bezierCurve&&e.each(h,function(t,i){var s=i>0&&i<h.length-1?this.options.bezierCurveTension:0;t.controlPoints=e.splineCurve(a(t,h,i),t,o(t,h,i),s),t.controlPoints.outer.y>this.scale.endPoint?t.controlPoints.outer.y=this.scale.endPoint:t.controlPoints.outer.y<this.scale.startPoint&&(t.controlPoints.outer.y=this.scale.startPoint),t.controlPoints.inner.y>this.scale.endPoint?t.controlPoints.inner.y=this.scale.endPoint:t.controlPoints.inner.y<this.scale.startPoint&&(t.controlPoints.inner.y=this.scale.startPoint)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(h,function(t,i){if(0===i)s.moveTo(t.x,t.y);else if(this.options.bezierCurve){var e=a(t,h,i);s.bezierCurveTo(e.controlPoints.outer.x,e.controlPoints.outer.y,t.controlPoints.inner.x,t.controlPoints.inner.y,t.x,t.y)}else s.lineTo(t.x,t.y)},this),s.stroke(),this.options.datasetFill&&h.length>0&&(s.lineTo(h[h.length-1].x,this.scale.endPoint),s.lineTo(h[0].x,this.scale.endPoint),s.fillStyle=t.fillColor,s.closePath(),s.fill()),e.each(h,function(t){t.draw()})},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"PolarArea",defaults:s,initialize:function(t){this.segments=[],this.SegmentArc=i.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:t.length}),this.updateScaleRange(t),this.scale.update(),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({fillColor:t.color,highlightColor:t.highlight||t.color,label:t.label,value:t.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(t.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),e||(this.reflow(),this.update())},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(t){var i=[];e.each(t,function(t){i.push(t.value)});var s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s,{size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),e.each(this.segments,function(t){t.save()}),this.render()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),e.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),e.each(this.segments,function(t){t.update({outerRadius:this.scale.calculateCenterOffset(t.value)})},this)},draw:function(t){var i=t||1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(t.value)},i),t.endAngle=t.startAngle+t.circumference,0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle),t.draw()},this),this.scale.draw()}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers;i.Type.extend({name:"Radar",defaults:{scaleShowLine:!0,angleShowLineOut:!0,scaleShowLabels:!1,scaleBeginAtZero:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:10,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(t),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){var o;this.scale.animation||(o=this.scale.getPointPosition(n,this.scale.calculateCenterOffset(e))),s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,x:this.options.animation?this.scale.xCenter:o.x,y:this.options.animation?this.scale.yCenter:o.y,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=e.getRelativePosition(t),s=e.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),n=2*Math.PI/this.scale.valuesCount,o=Math.round((s.angle-1.5*Math.PI)/n),a=[];return(o>=this.scale.valuesCount||0>o)&&(o=0),s.distance<=this.scale.drawingArea&&e.each(this.datasets,function(t){a.push(t.points[o])}),a},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i=function(){var i=[];return e.each(t,function(t){t.data?i=i.concat(t.data):e.each(t.points,function(t){i.push(t.value)})}),i}(),s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s)},addData:function(t,i){this.scale.valuesCount++,e.each(t,function(t,e){var s=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:s.x,y:s.y,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.labels.push(i),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),e.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var i=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),e.each(this.datasets,function(t){e.each(t.points,function(t,e){t.hasValue()&&t.transition(this.scale.getPointPosition(e,this.scale.calculateCenterOffset(t.value)),i)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,s.fill(),e.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this);
 
 
 
 
 
 
 
 
 
 
 
trunk/js/admin.js DELETED
@@ -1,107 +0,0 @@
1
- /**
2
- * Main admin file for functions to be used across many QSM admin pages.
3
- */
4
- var QSMAdmin;
5
- (function ($) {
6
-
7
- QSMAdmin = {
8
- /**
9
- * Catches an error from a jQuery function (i.e. $.ajax())
10
- */
11
- displayjQueryError: function (jqXHR, textStatus, errorThrown) {
12
- QSMAdmin.displayAlert('Error: ' + errorThrown + '! Please try again.', 'error');
13
- },
14
- /**
15
- * Catches an error from a BackBone function (i.e. model.save())
16
- */
17
- displayError: function (jqXHR, textStatus, errorThrown) {
18
- QSMAdmin.displayAlert('Error: ' + errorThrown.errorThrown + '! Please try again.', 'error');
19
- },
20
- /**
21
- * Displays an alert within the "Quiz Settings" page
22
- *
23
- * @param string message The message of the alert
24
- * @param string type The type of alert. Choose from 'error', 'info', 'success', and 'warning'
25
- */
26
- displayAlert: function (message, type) {
27
- QSMAdmin.clearAlerts();
28
- var template = wp.template('notice');
29
- var data = {
30
- message: message,
31
- type: type
32
- };
33
- $('.qsm-alerts').append(template(data));
34
- },
35
- clearAlerts: function () {
36
- $('.qsm-alerts').empty();
37
- },
38
- selectTab: function (tab) {
39
- $('.qsm-tab').removeClass('nav-tab-active');
40
- $('.qsm-tab-content').hide();
41
- tab.addClass('nav-tab-active');
42
- tabID = tab.data('tab');
43
- $('.tab-' + tabID).show();
44
- }
45
- };
46
- $(function () {
47
- $('.qsm-tab').on('click', function (event) {
48
- event.preventDefault();
49
- QSMAdmin.selectTab($(this));
50
- });
51
-
52
- $('#qmn_check_all').change(function () {
53
- $('.qmn_delete_checkbox').prop('checked', jQuery('#qmn_check_all').prop('checked'));
54
- });
55
-
56
- $('.edit-quiz-name').click(function (e) {
57
- e.preventDefault();
58
- MicroModal.show('modal-3');
59
- });
60
- $('#edit-name-button').on('click', function (event) {
61
- event.preventDefault();
62
- $('#edit-name-form').submit();
63
- });
64
- $('#sendySignupForm').submit(function (e) {
65
-
66
- e.preventDefault();
67
- var $form = $(this),
68
- name = $form.find('input[name="name"]').val(),
69
- email = $form.find('input[name="email"]').val(),
70
- action = 'qsm_send_data_sendy';
71
- $form.find('#submit').attr('disabled', true);
72
- $.post(ajaxurl, {name: name, email: email, action: action},
73
- function (data) {
74
- if (data)
75
- {
76
- $("#status").text('');
77
- if (data == "Some fields are missing.")
78
- {
79
- $("#status").text("Please fill in your name and email.");
80
- $("#status").css("color", "red");
81
- } else if (data == "Invalid email address.")
82
- {
83
- $("#status").text("Your email address is invalid.");
84
- $("#status").css("color", "red");
85
- } else if (data == "Invalid list ID.")
86
- {
87
- $("#status").text("Your list ID is invalid.");
88
- $("#status").css("color", "red");
89
- } else if (data == "Already subscribed.")
90
- {
91
- $("#status").text("You're already subscribed!");
92
- $("#status").css("color", "red");
93
- } else
94
- {
95
- $("#status").text("Thanks, you are now subscribed to our mailing list!");
96
- $("#status").css("color", "green");
97
- }
98
- $form.find('#submit').attr('disabled', false);
99
- } else
100
- {
101
- alert("Sorry, unable to subscribe. Please try again later!");
102
- }
103
- }
104
- );
105
- });
106
- });
107
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/js/index.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- die("Error: Unauthorized Access");
4
- ?>
 
 
 
 
trunk/js/micromodal.min.js DELETED
@@ -1,30 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.MicroModal=t()}(this,function(){"use strict"
2
- var e=(function(){function e(e){this.value=e}function t(t){function o(e,t){return new Promise(function(o,i){var l={key:e,arg:t,resolve:o,reject:i,next:null}
3
- a?a=a.next=l:(r=a=l,n(e,t))})}function n(o,r){try{var a=t[o](r),l=a.value
4
- l instanceof e?Promise.resolve(l.value).then(function(e){n("next",e)},function(e){n("throw",e)}):i(a.done?"return":"normal",a.value)}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":r.resolve({value:t,done:!0})
5
- break
6
- case"throw":r.reject(t)
7
- break
8
- default:r.resolve({value:t,done:!1})}r=r.next,r?n(r.key,r.arg):a=null}var r,a
9
- this._invoke=o,"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}),t=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o]
10
- n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),o=function(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t]
11
- return o}return Array.from(e)}
12
- return function(){var n=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],i=function(){function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.targetModal,r=t.triggers,a=void 0===r?[]:r,l=t.disableScroll,s=void 0!==l&&l,c=(t.debugMode,t.onShow),u=void 0===c?function(){}:c,d=t.onClose,f=void 0===d?function(){}:d
13
- e(this,i),this.modal=document.getElementById(n),a.length>0&&this.registerTriggers.apply(this,o(a)),this.disableScroll=s,this.callbacks={onShow:u,onClose:f},this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}return t(i,[{key:"registerTriggers",value:function(){for(var e=this,t=arguments.length,o=Array(t),n=0;n<t;n++)o[n]=arguments[n]
14
- o.forEach(function(t){t.addEventListener("click",function(){return e.showModal()})})}},{key:"showModal",value:function(){var e=this
15
- this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),window.requestAnimationFrame(function(){e.modal.classList.add("is-open"),e.setFocusToFirstNode()}),this.scrollBehaviour("disable"),this.addEventListeners(),this.callbacks.onShow(this.modal)}},{key:"closeModal",value:function(){var e=this.modal
16
- this.modal.addEventListener("animationend",function t(){window.requestAnimationFrame(function(){return e.classList.remove("is-open")}),e.removeEventListener("animationend",t,!1)},!1),this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement.focus(),this.callbacks.onClose(this.modal)}},{key:"scrollBehaviour",value:function(e){if(!1!==this.disableScroll){var t=document.querySelector("body")
17
- switch(e){case"enable":Object.assign(t.style,{overflow:"initial",height:"initial"})
18
- break
19
- case"disable":Object.assign(t.style,{overflow:"hidden",height:"100vh"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){e.target.hasAttribute("data-micromodal-close")&&(this.closeModal(),e.preventDefault())}},{key:"onKeydown",value:function(e){27===e.keyCode&&this.closeModal(e),9===e.keyCode&&this.maintainFocus(e)}},{key:"getFocusableNodes",value:function(){var e=this.modal.querySelectorAll(n)
20
- return Object.keys(e).map(function(t){return e[t]})}},{key:"setFocusToFirstNode",value:function(){var e=this.getFocusableNodes()
21
- e.length&&e[0].focus()}},{key:"maintainFocus",value:function(e){var t=this.getFocusableNodes(),o=t.indexOf(document.activeElement)
22
- e.shiftKey&&0===o&&(t[t.length-1].focus(),e.preventDefault()),e.shiftKey||o!==t.length-1||(t[0].focus(),e.preventDefault())}}]),i}(),r=function(e){var t=[]
23
- return e.forEach(function(e){var o=e.dataset.micromodalTrigger
24
- void 0===t[o]&&(t[o]=[]),t[o].push(e)}),t},a=function(e){if(!document.getElementById(e))return console.warn("MicroModal v0.2.0: ❗Seems like you have missed %c'"+e+"'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<div class="modal" id="'+e+'"></div>'),!1},l=function(e){if(e.length<=0)return console.warn("MicroModal v0.2.0: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>'),!1},s=function(e,t){if(l(e),!t)return!0
25
- for(var o in t)a(o)
26
- return!0},c=function(e){var t=e||{},n=[].concat(o(document.querySelectorAll("[data-micromodal-trigger]"))),a=r(n)
27
- if(!0!==t.debugMode||!1!==s(n,a))for(var l in a){var c=a[l]
28
- t.targetModal=l,t.triggers=[].concat(o(c)),new i(t)}},u=null
29
- return{init:c,show:function(e,t){var o=t||{}
30
- o.targetModal=e,!0===o.debugMode&&!1===a(e)||(u=new i(o),u.showModal())},close:function(){u.closeModal()}}}()})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/js/progressbar.min.js DELETED
@@ -1,2 +0,0 @@
1
- !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.ProgressBar=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(b,c,d){(function(){var b=this||Function("return this")(),e=function(){"use strict";function e(){}function f(a,b){var c;for(c in a)Object.hasOwnProperty.call(a,c)&&b(c)}function g(a,b){return f(b,function(c){a[c]=b[c]}),a}function h(a,b){f(b,function(c){"undefined"==typeof a[c]&&(a[c]=b[c])})}function i(a,b,c,d,e,f,g){var h,i,k,l=a<f?0:(a-f)/e;for(h in b)b.hasOwnProperty(h)&&(i=g[h],k="function"==typeof i?i:o[i],b[h]=j(c[h],d[h],k,l));return b}function j(a,b,c,d){return a+(b-a)*c(d)}function k(a,b){var c=n.prototype.filter,d=a._filterArgs;f(c,function(e){"undefined"!=typeof c[e][b]&&c[e][b].apply(a,d)})}function l(a,b,c,d,e,f,g,h,j,l,m){v=b+c+d,w=Math.min(m||u(),v),x=w>=v,y=d-(v-w),a.isPlaying()&&(x?(j(g,a._attachment,y),a.stop(!0)):(a._scheduleId=l(a._timeoutHandler,s),k(a,"beforeTween"),w<b+c?i(1,e,f,g,1,1,h):i(w,e,f,g,d,b+c,h),k(a,"afterTween"),j(e,a._attachment,y)))}function m(a,b){var c={},d=typeof b;return"string"===d||"function"===d?f(a,function(a){c[a]=b}):f(a,function(a){c[a]||(c[a]=b[a]||q)}),c}function n(a,b){this._currentState=a||{},this._configured=!1,this._scheduleFunction=p,"undefined"!=typeof b&&this.setConfig(b)}var o,p,q="linear",r=500,s=1e3/60,t=Date.now?Date.now:function(){return+new Date},u="undefined"!=typeof SHIFTY_DEBUG_NOW?SHIFTY_DEBUG_NOW:t;p="undefined"!=typeof window?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||window.mozCancelRequestAnimationFrame&&window.mozRequestAnimationFrame||setTimeout:setTimeout;var v,w,x,y;return n.prototype.tween=function(a){return this._isTweening?this:(void 0===a&&this._configured||this.setConfig(a),this._timestamp=u(),this._start(this.get(),this._attachment),this.resume())},n.prototype.setConfig=function(a){a=a||{},this._configured=!0,this._attachment=a.attachment,this._pausedAtTime=null,this._scheduleId=null,this._delay=a.delay||0,this._start=a.start||e,this._step=a.step||e,this._finish=a.finish||e,this._duration=a.duration||r,this._currentState=g({},a.from||this.get()),this._originalState=this.get(),this._targetState=g({},a.to||this.get());var b=this;this._timeoutHandler=function(){l(b,b._timestamp,b._delay,b._duration,b._currentState,b._originalState,b._targetState,b._easing,b._step,b._scheduleFunction)};var c=this._currentState,d=this._targetState;return h(d,c),this._easing=m(c,a.easing||q),this._filterArgs=[c,this._originalState,d,this._easing],k(this,"tweenCreated"),this},n.prototype.get=function(){return g({},this._currentState)},n.prototype.set=function(a){this._currentState=a},n.prototype.pause=function(){return this._pausedAtTime=u(),this._isPaused=!0,this},n.prototype.resume=function(){return this._isPaused&&(this._timestamp+=u()-this._pausedAtTime),this._isPaused=!1,this._isTweening=!0,this._timeoutHandler(),this},n.prototype.seek=function(a){a=Math.max(a,0);var b=u();return this._timestamp+a===0?this:(this._timestamp=b-a,this.isPlaying()||(this._isTweening=!0,this._isPaused=!1,l(this,this._timestamp,this._delay,this._duration,this._currentState,this._originalState,this._targetState,this._easing,this._step,this._scheduleFunction,b),this.pause()),this)},n.prototype.stop=function(a){return this._isTweening=!1,this._isPaused=!1,this._timeoutHandler=e,(b.cancelAnimationFrame||b.webkitCancelAnimationFrame||b.oCancelAnimationFrame||b.msCancelAnimationFrame||b.mozCancelRequestAnimationFrame||b.clearTimeout)(this._scheduleId),a&&(k(this,"beforeTween"),i(1,this._currentState,this._originalState,this._targetState,1,0,this._easing),k(this,"afterTween"),k(this,"afterTweenEnd"),this._finish.call(this,this._currentState,this._attachment)),this},n.prototype.isPlaying=function(){return this._isTweening&&!this._isPaused},n.prototype.setScheduleFunction=function(a){this._scheduleFunction=a},n.prototype.dispose=function(){var a;for(a in this)this.hasOwnProperty(a)&&delete this[a]},n.prototype.filter={},n.prototype.formula={linear:function(a){return a}},o=n.prototype.formula,g(n,{now:u,each:f,tweenProps:i,tweenProp:j,applyFilter:k,shallowCopy:g,defaults:h,composeEasingObject:m}),"function"==typeof SHIFTY_DEBUG_NOW&&(b.timeoutHandler=l),"object"==typeof d?c.exports=n:"function"==typeof a&&a.amd?a(function(){return n}):"undefined"==typeof b.Tweenable&&(b.Tweenable=n),n}();!function(){e.shallowCopy(e.prototype.formula,{easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return-(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){return(a/=.5)<1?.5*Math.pow(a,2):-.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){return(a/=.5)<1?.5*Math.pow(a,3):.5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return-(Math.pow(a-1,4)-1)},easeInOutQuart:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-.5*((a-=2)*Math.pow(a,3)-2)},easeInQuint:function(a){return Math.pow(a,5)},easeOutQuint:function(a){return Math.pow(a-1,5)+1},easeInOutQuint:function(a){return(a/=.5)<1?.5*Math.pow(a,5):.5*(Math.pow(a-2,5)+2)},easeInSine:function(a){return-Math.cos(a*(Math.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(Math.PI/2))},easeInOutSine:function(a){return-.5*(Math.cos(Math.PI*a)-1)},easeInExpo:function(a){return 0===a?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return 1===a?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){return 0===a?0:1===a?1:(a/=.5)<1?.5*Math.pow(2,10*(a-1)):.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return-(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){return(a/=.5)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)},easeOutBounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},easeInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},easeInOutBack:function(a){var b=1.70158;return(a/=.5)<1?.5*(a*a*(((b*=1.525)+1)*a-b)):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},elastic:function(a){return-1*Math.pow(4,-8*a)*Math.sin((6*a-1)*(2*Math.PI)/2)+1},swingFromTo:function(a){var b=1.70158;return(a/=.5)<1?.5*(a*a*(((b*=1.525)+1)*a-b)):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},swingFrom:function(a){var b=1.70158;return a*a*((b+1)*a-b)},swingTo:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},bounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},bouncePast:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?2-(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?2-(7.5625*(a-=2.25/2.75)*a+.9375):2-(7.5625*(a-=2.625/2.75)*a+.984375)},easeFromTo:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-.5*((a-=2)*Math.pow(a,3)-2)},easeFrom:function(a){return Math.pow(a,4)},easeTo:function(a){return Math.pow(a,.25)}})}(),function(){function a(a,b,c,d,e,f){function g(a){return((n*a+o)*a+p)*a}function h(a){return((q*a+r)*a+s)*a}function i(a){return(3*n*a+2*o)*a+p}function j(a){return 1/(200*a)}function k(a,b){return h(m(a,b))}function l(a){return a>=0?a:0-a}function m(a,b){var c,d,e,f,h,j;for(e=a,j=0;j<8;j++){if(f=g(e)-a,l(f)<b)return e;if(h=i(e),l(h)<1e-6)break;e-=f/h}if(c=0,d=1,e=a,e<c)return c;if(e>d)return d;for(;c<d;){if(f=g(e),l(f-a)<b)return e;a>f?c=e:d=e,e=.5*(d-c)+c}return e}var n=0,o=0,p=0,q=0,r=0,s=0;return p=3*b,o=3*(d-b)-p,n=1-p-o,s=3*c,r=3*(e-c)-s,q=1-s-r,k(a,j(f))}function b(b,c,d,e){return function(f){return a(f,b,c,d,e,1)}}e.setBezierFunction=function(a,c,d,f,g){var h=b(c,d,f,g);return h.displayName=a,h.x1=c,h.y1=d,h.x2=f,h.y2=g,e.prototype.formula[a]=h},e.unsetBezierFunction=function(a){delete e.prototype.formula[a]}}(),function(){function a(a,b,c,d,f,g){return e.tweenProps(d,b,a,c,1,g,f)}var b=new e;b._filterArgs=[],e.interpolate=function(c,d,f,g,h){var i=e.shallowCopy({},c),j=h||0,k=e.composeEasingObject(c,g||"linear");b.set({});var l=b._filterArgs;l.length=0,l[0]=i,l[1]=c,l[2]=d,l[3]=k,e.applyFilter(b,"tweenCreated"),e.applyFilter(b,"beforeTween");var m=a(c,i,d,f,k,j);return e.applyFilter(b,"afterTween"),m}}(),function(a){function b(a,b){var c,d=[],e=a.length;for(c=0;c<e;c++)d.push("_"+b+"_"+c);return d}function c(a){var b=a.match(v);return b?(1===b.length||a.charAt(0).match(u))&&b.unshift(""):b=["",""],b.join(A)}function d(b){a.each(b,function(a){var c=b[a];"string"==typeof c&&c.match(z)&&(b[a]=e(c))})}function e(a){return i(z,a,f)}function f(a){var b=g(a);return"rgb("+b[0]+","+b[1]+","+b[2]+")"}function g(a){return a=a.replace(/#/,""),3===a.length&&(a=a.split(""),a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),B[0]=h(a.substr(0,2)),B[1]=h(a.substr(2,2)),B[2]=h(a.substr(4,2)),B}function h(a){return parseInt(a,16)}function i(a,b,c){var d=b.match(a),e=b.replace(a,A);if(d)for(var f,g=d.length,h=0;h<g;h++)f=d.shift(),e=e.replace(A,c(f));return e}function j(a){return i(x,a,k)}function k(a){for(var b=a.match(w),c=b.length,d=a.match(y)[0],e=0;e<c;e++)d+=parseInt(b[e],10)+",";return d=d.slice(0,-1)+")"}function l(d){var e={};return a.each(d,function(a){var f=d[a];if("string"==typeof f){var g=r(f);e[a]={formatString:c(f),chunkNames:b(g,a)}}}),e}function m(b,c){a.each(c,function(a){for(var d=b[a],e=r(d),f=e.length,g=0;g<f;g++)b[c[a].chunkNames[g]]=+e[g];delete b[a]})}function n(b,c){a.each(c,function(a){var d=b[a],e=o(b,c[a].chunkNames),f=p(e,c[a].chunkNames);d=q(c[a].formatString,f),b[a]=j(d)})}function o(a,b){for(var c,d={},e=b.length,f=0;f<e;f++)c=b[f],d[c]=a[c],delete a[c];return d}function p(a,b){C.length=0;for(var c=b.length,d=0;d<c;d++)C.push(a[b[d]]);return C}function q(a,b){for(var c=a,d=b.length,e=0;e<d;e++)c=c.replace(A,+b[e].toFixed(4));return c}function r(a){return a.match(w)}function s(b,c){a.each(c,function(a){var d,e=c[a],f=e.chunkNames,g=f.length,h=b[a];if("string"==typeof h){var i=h.split(" "),j=i[i.length-1];for(d=0;d<g;d++)b[f[d]]=i[d]||j}else for(d=0;d<g;d++)b[f[d]]=h;delete b[a]})}function t(b,c){a.each(c,function(a){var d=c[a],e=d.chunkNames,f=e.length,g=b[e[0]],h=typeof g;if("string"===h){for(var i="",j=0;j<f;j++)i+=" "+b[e[j]],delete b[e[j]];b[a]=i.substr(1)}else b[a]=g})}var u=/(\d|\-|\.)/,v=/([^\-0-9\.]+)/g,w=/[0-9.\-]+/g,x=new RegExp("rgb\\("+w.source+/,\s*/.source+w.source+/,\s*/.source+w.source+"\\)","g"),y=/^.*\(/,z=/#([0-9]|[a-f]){3,6}/gi,A="VAL",B=[],C=[];a.prototype.filter.token={tweenCreated:function(a,b,c,e){d(a),d(b),d(c),this._tokenData=l(a)},beforeTween:function(a,b,c,d){s(d,this._tokenData),m(a,this._tokenData),m(b,this._tokenData),m(c,this._tokenData)},afterTween:function(a,b,c,d){n(a,this._tokenData),n(b,this._tokenData),n(c,this._tokenData),t(d,this._tokenData)}}}(e)}).call(null)},{}],2:[function(a,b,c){var d=a("./shape"),e=a("./utils"),f=function(a,b){this._pathTemplate="M 50,50 m 0,-{radius} a {radius},{radius} 0 1 1 0,{2radius} a {radius},{radius} 0 1 1 0,-{2radius}",this.containerAspectRatio=1,d.apply(this,arguments)};f.prototype=new d,f.prototype.constructor=f,f.prototype._pathString=function(a){var b=a.strokeWidth;a.trailWidth&&a.trailWidth>a.strokeWidth&&(b=a.trailWidth);var c=50-b/2;return e.render(this._pathTemplate,{radius:c,"2radius":2*c})},f.prototype._trailString=function(a){return this._pathString(a)},b.exports=f},{"./shape":7,"./utils":9}],3:[function(a,b,c){var d=a("./shape"),e=a("./utils"),f=function(a,b){this._pathTemplate="M 0,{center} L 100,{center}",d.apply(this,arguments)};f.prototype=new d,f.prototype.constructor=f,f.prototype._initializeSvg=function(a,b){a.setAttribute("viewBox","0 0 100 "+b.strokeWidth),a.setAttribute("preserveAspectRatio","none")},f.prototype._pathString=function(a){return e.render(this._pathTemplate,{center:a.strokeWidth/2})},f.prototype._trailString=function(a){return this._pathString(a)},b.exports=f},{"./shape":7,"./utils":9}],4:[function(a,b,c){b.exports={Line:a("./line"),Circle:a("./circle"),SemiCircle:a("./semicircle"),Square:a("./square"),Path:a("./path"),Shape:a("./shape"),utils:a("./utils")}},{"./circle":2,"./line":3,"./path":5,"./semicircle":6,"./shape":7,"./square":8,"./utils":9}],5:[function(a,b,c){var d=a("shifty"),e=a("./utils"),f={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},g=function a(b,c){if(!(this instanceof a))throw new Error("Constructor was called without new keyword");c=e.extend({duration:800,easing:"linear",from:{},to:{},step:function(){}},c);var d;d=e.isString(b)?document.querySelector(b):b,this.path=d,this._opts=c,this._tweenable=null;var f=this.path.getTotalLength();this.path.style.strokeDasharray=f+" "+f,this.set(0)};g.prototype.value=function(){var a=this._getComputedDashOffset(),b=this.path.getTotalLength(),c=1-a/b;return parseFloat(c.toFixed(6),10)},g.prototype.set=function(a){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(a);var b=this._opts.step;if(e.isFunction(b)){var c=this._easing(this._opts.easing),d=this._calculateTo(a,c),f=this._opts.shape||this;b(d,f,this._opts.attachment)}},g.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},g.prototype.animate=function(a,b,c){b=b||{},e.isFunction(b)&&(c=b,b={});var f=e.extend({},b),g=e.extend({},this._opts);b=e.extend(g,b);var h=this._easing(b.easing),i=this._resolveFromAndTo(a,h,f);this.stop(),this.path.getBoundingClientRect();var j=this._getComputedDashOffset(),k=this._progressToOffset(a),l=this;this._tweenable=new d,this._tweenable.tween({from:e.extend({offset:j},i.from),to:e.extend({offset:k},i.to),duration:b.duration,easing:h,step:function(a){l.path.style.strokeDashoffset=a.offset;var c=b.shape||l;b.step(a,c,b.attachment)},finish:function(a){e.isFunction(c)&&c()}})},g.prototype._getComputedDashOffset=function(){var a=window.getComputedStyle(this.path,null);return parseFloat(a.getPropertyValue("stroke-dashoffset"),10)},g.prototype._progressToOffset=function(a){var b=this.path.getTotalLength();return b-a*b},g.prototype._resolveFromAndTo=function(a,b,c){return c.from&&c.to?{from:c.from,to:c.to}:{from:this._calculateFrom(b),to:this._calculateTo(a,b)}},g.prototype._calculateFrom=function(a){return d.interpolate(this._opts.from,this._opts.to,this.value(),a)},g.prototype._calculateTo=function(a,b){return d.interpolate(this._opts.from,this._opts.to,a,b)},g.prototype._stopTween=function(){null!==this._tweenable&&(this._tweenable.stop(),this._tweenable=null)},g.prototype._easing=function(a){return f.hasOwnProperty(a)?f[a]:a},b.exports=g},{"./utils":9,shifty:1}],6:[function(a,b,c){var d=a("./shape"),e=a("./circle"),f=a("./utils"),g=function(a,b){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius} 0 1 1 {2radius},0",this.containerAspectRatio=2,d.apply(this,arguments)};g.prototype=new d,g.prototype.constructor=g,g.prototype._initializeSvg=function(a,b){a.setAttribute("viewBox","0 0 100 50")},g.prototype._initializeTextContainer=function(a,b,c){a.text.style&&(c.style.top="auto",c.style.bottom="0",a.text.alignToBottom?f.setStyle(c,"transform","translate(-50%, 0)"):f.setStyle(c,"transform","translate(-50%, 50%)"))},g.prototype._pathString=e.prototype._pathString,g.prototype._trailString=e.prototype._trailString,b.exports=g},{"./circle":2,"./shape":7,"./utils":9}],7:[function(a,b,c){var d=a("./path"),e=a("./utils"),f="Object is destroyed",g=function a(b,c){if(!(this instanceof a))throw new Error("Constructor was called without new keyword");if(0!==arguments.length){this._opts=e.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},c,!0),e.isObject(c)&&void 0!==c.svgStyle&&(this._opts.svgStyle=c.svgStyle),e.isObject(c)&&e.isObject(c.text)&&void 0!==c.text.style&&(this._opts.text.style=c.text.style);var f,g=this._createSvgView(this._opts);if(f=e.isString(b)?document.querySelector(b):b,!f)throw new Error("Container does not exist: "+b);this._container=f,this._container.appendChild(g.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&e.setStyles(g.svg,this._opts.svgStyle),this.svg=g.svg,this.path=g.path,this.trail=g.trail,this.text=null;var h=e.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new d(g.path,h),e.isObject(this._opts.text)&&null!==this._opts.text.value&&this.setText(this._opts.text.value)}};g.prototype.animate=function(a,b,c){if(null===this._progressPath)throw new Error(f);this._progressPath.animate(a,b,c)},g.prototype.stop=function(){if(null===this._progressPath)throw new Error(f);void 0!==this._progressPath&&this._progressPath.stop()},g.prototype.destroy=function(){if(null===this._progressPath)throw new Error(f);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,this._progressPath=null,null!==this.text&&(this.text.parentNode.removeChild(this.text),this.text=null)},g.prototype.set=function(a){if(null===this._progressPath)throw new Error(f);this._progressPath.set(a)},g.prototype.value=function(){if(null===this._progressPath)throw new Error(f);return void 0===this._progressPath?0:this._progressPath.value()},g.prototype.setText=function(a){if(null===this._progressPath)throw new Error(f);null===this.text&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),e.isObject(a)?(e.removeChildren(this.text),this.text.appendChild(a)):this.text.innerHTML=a},g.prototype._createSvgView=function(a){var b=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(b,a);var c=null;(a.trailColor||a.trailWidth)&&(c=this._createTrail(a),b.appendChild(c));var d=this._createPath(a);return b.appendChild(d),{svg:b,path:d,trail:c}},g.prototype._initializeSvg=function(a,b){a.setAttribute("viewBox","0 0 100 100")},g.prototype._createPath=function(a){var b=this._pathString(a);return this._createPathElement(b,a)},g.prototype._createTrail=function(a){var b=this._trailString(a),c=e.extend({},a);return c.trailColor||(c.trailColor="#eee"),c.trailWidth||(c.trailWidth=c.strokeWidth),c.color=c.trailColor,c.strokeWidth=c.trailWidth,c.fill=null,this._createPathElement(b,c)},g.prototype._createPathElement=function(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",a),c.setAttribute("stroke",b.color),c.setAttribute("stroke-width",b.strokeWidth),b.fill?c.setAttribute("fill",b.fill):c.setAttribute("fill-opacity","0"),c},g.prototype._createTextContainer=function(a,b){var c=document.createElement("div");c.className=a.text.className;var d=a.text.style;return d&&(a.text.autoStyleContainer&&(b.style.position="relative"),e.setStyles(c,d),d.color||(c.style.color=a.color)),this._initializeTextContainer(a,b,c),c},g.prototype._initializeTextContainer=function(a,b,c){},g.prototype._pathString=function(a){throw new Error("Override this function for each progress bar")},g.prototype._trailString=function(a){throw new Error("Override this function for each progress bar")},g.prototype._warnContainerAspectRatio=function(a){if(this.containerAspectRatio){var b=window.getComputedStyle(a,null),c=parseFloat(b.getPropertyValue("width"),10),d=parseFloat(b.getPropertyValue("height"),10);e.floatEquals(this.containerAspectRatio,c/d)||(console.warn("Incorrect aspect ratio of container","#"+a.id,"detected:",b.getPropertyValue("width")+"(width)","/",b.getPropertyValue("height")+"(height)","=",c/d),console.warn("Aspect ratio of should be",this.containerAspectRatio))}},b.exports=g},{"./path":5,"./utils":9}],8:[function(a,b,c){var d=a("./shape"),e=a("./utils"),f=function(a,b){this._pathTemplate="M 0,{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{strokeWidth}",this._trailTemplate="M {startMargin},{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{halfOfStrokeWidth}",d.apply(this,arguments)};f.prototype=new d,f.prototype.constructor=f,f.prototype._pathString=function(a){var b=100-a.strokeWidth/2;return e.render(this._pathTemplate,{width:b,strokeWidth:a.strokeWidth,halfOfStrokeWidth:a.strokeWidth/2})},f.prototype._trailString=function(a){var b=100-a.strokeWidth/2;return e.render(this._trailTemplate,{width:b,strokeWidth:a.strokeWidth,halfOfStrokeWidth:a.strokeWidth/2,startMargin:a.strokeWidth/2-a.trailWidth/2})},b.exports=f},{"./shape":7,"./utils":9}],9:[function(a,b,c){function d(a,b,c){a=a||{},b=b||{},c=c||!1;for(var e in b)if(b.hasOwnProperty(e)){var f=a[e],g=b[e];c&&l(f)&&l(g)?a[e]=d(f,g,c):a[e]=g}return a}function e(a,b){var c=a;for(var d in b)if(b.hasOwnProperty(d)){var e=b[d],f="\\{"+d+"\\}",g=new RegExp(f,"g");c=c.replace(g,e)}return c}function f(a,b,c){for(var d=a.style,e=0;e<p.length;++e){var f=p[e];d[f+h(b)]=c}d[b]=c}function g(a,b){m(b,function(b,c){null!==b&&void 0!==b&&(l(b)&&b.prefix===!0?f(a,c,b.value):a.style[c]=b)})}function h(a){return a.charAt(0).toUpperCase()+a.slice(1)}function i(a){return"string"==typeof a||a instanceof String}function j(a){return"function"==typeof a}function k(a){return"[object Array]"===Object.prototype.toString.call(a)}function l(a){if(k(a))return!1;var b=typeof a;return"object"===b&&!!a}function m(a,b){for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];b(d,c)}}function n(a,b){return Math.abs(a-b)<q}function o(a){for(;a.firstChild;)a.removeChild(a.firstChild)}var p="Webkit Moz O ms".split(" "),q=.001;b.exports={extend:d,render:e,setStyle:f,setStyles:g,capitalize:h,isString:i,isFunction:j,isObject:l,forEachObject:m,floatEquals:n,removeChildren:o}},{}]},{},[4])(4)});
2
- //# sourceMappingURL=progressbar.min.js.map
 
 
trunk/js/qsm-admin-contact.js DELETED
@@ -1,189 +0,0 @@
1
- /**
2
- * QSM - Contact Form
3
- */
4
-
5
- var QSMContact;
6
- (function ($) {
7
- QSMContact = {
8
- load : function() {
9
- if($.isArray(qsmContactObject.contactForm) && qsmContactObject.contactForm.length > 0){
10
- $.each( qsmContactObject.contactForm, function( i, val ) {
11
- QSMContact.addField( val );
12
- });
13
- }
14
- },
15
- addField : function( fieldArray ) {
16
- var contactField = $( '<div class="contact-form-field new">' +
17
- '<div class="contact-form-group">' +
18
- '<label class="contact-form-label">Field Type</label>' +
19
- '<select class="contact-form-control wide type-control">' +
20
- '<option value="none">Select a type...</option>' +
21
- '<option value="text">Small Open Answer</option>' +
22
- '<option value="email">Email</option>' +
23
- '<option value="checkbox">Checkbox</option>' +
24
- '</select>' +
25
- '</div>' +
26
- '<div class="contact-form-group">' +
27
- '<label class="contact-form-label">Label</label>' +
28
- '<input type="text" class="contact-form-control label-control" value="' + fieldArray.label + '">' +
29
- '</div>' +
30
- '<div class="contact-form-group">' +
31
- '<label class="contact-form-label">Used For</label>' +
32
- '<select class="contact-form-control use-control">' +
33
- '<option value="none"></option>' +
34
- '<option value="name">Name</option>' +
35
- '<option value="email">Email</option>' +
36
- '<option value="comp">Business</option>' +
37
- '<option value="phone">Phone</option>' +
38
- '</select>' +
39
- '</div>' +
40
- '<div class="contact-form-group">' +
41
- '<label class="contact-form-label">Required?</label>' +
42
- '<input type="checkbox" class="required-control">' +
43
- '</div>' +
44
- '<div class="contact-form-group">' +
45
- '<a href="#" class="delete-field">Delete</a> | ' +
46
- '<a href="#" class="copy-field">Duplicate</a>' +
47
- '</div>' +
48
- '</div>'
49
- );
50
- if ( true === fieldArray.required || "true" === fieldArray.required ) {
51
- contactField.find( '.required-control' ).prop( 'checked', true );
52
- }
53
- switch ( fieldArray.type ) {
54
- case 'text':
55
- contactField.find( '.type-control option[value="text"]').prop( 'selected', true );
56
- break;
57
- case 'email':
58
- contactField.find( '.type-control option[value="email"]').prop( 'selected', true );
59
- break;
60
- case 'checkbox':
61
- contactField.find( '.type-control option[value="checkbox"]').prop( 'selected', true );
62
- break;
63
- default:
64
-
65
- }
66
- switch ( fieldArray.use ) {
67
- case 'name':
68
- contactField.find( '.use-control option[value="name"]').prop( 'selected', true );
69
- break;
70
- case 'email':
71
- contactField.find( '.use-control option[value="email"]').prop( 'selected', true );
72
- break;
73
- case 'comp':
74
- contactField.find( '.use-control option[value="comp"]').prop( 'selected', true );
75
- break;
76
- case 'phone':
77
- contactField.find( '.use-control option[value="phone"]').prop( 'selected', true );
78
- break;
79
- default:
80
-
81
- }
82
- $( '.contact-form' ).append( contactField );
83
- setTimeout( QSMContact.removeNew, 250 );
84
- },
85
- removeNew: function() {
86
- $( '.contact-form-field' ).removeClass( 'new' );
87
- },
88
- duplicateField: function( linkClicked ) {
89
- var field = linkClicked.parents( '.contact-form-field' );
90
- var fieldArray = {
91
- label: field.find( '.label-control' ).val(),
92
- type: field.find( '.type-control' ).val(),
93
- required: field.find( '.required-control' ).prop( 'checked' ),
94
- use: field.find( '.use-control' ).val()
95
- };
96
- QSMContact.addField( fieldArray );
97
- },
98
- deleteField: function( field ) {
99
- var parent = field.parents( '.contact-form-field' );
100
- parent.addClass( 'deleting' );
101
- setTimeout( function() {
102
- parent.remove();
103
- }, 250 );
104
- },
105
- newField : function() {
106
- var fieldArray = {
107
- label : '',
108
- type : 'text',
109
- answers : [],
110
- required : false,
111
- use: ''
112
- };
113
- QSMContact.addField( fieldArray );
114
- },
115
- save : function() {
116
- QSMContact.displayAlert( 'Saving contact fields...', 'info' );
117
- var contactFields = $( '.contact-form-field' );
118
- var contactForm = [];
119
- var contactEach;
120
- $.each( contactFields, function( i, val ) {
121
- contactEach = {
122
- label: $( this ).find( '.label-control' ).val(),
123
- type: $( this ).find( '.type-control' ).val(),
124
- required: $( this ).find( '.required-control' ).prop( 'checked' ),
125
- use: $( this ).find( '.use-control' ).val()
126
- };
127
- contactForm.push( contactEach );
128
- });
129
- var data = {
130
- action: 'qsm_save_contact',
131
- contact_form: contactForm,
132
- quiz_id : qsmContactObject.quizID
133
- };
134
-
135
- jQuery.post( ajaxurl, data, function( response ) {
136
- QSMContact.saved( JSON.parse( response ) );
137
- });
138
- },
139
- saved : function( response ) {
140
- if ( response.status ) {
141
- QSMContact.displayAlert( '<strong>Success</strong> Your contact fields have been saved!', 'success' );
142
- } else {
143
- QSMContact.displayAlert( '<strong>Error</strong> There was an error encountered when saving your contact fields. Please try again.', 'error' );
144
- }
145
- },
146
- displayAlert: function( message, type ) {
147
- QSMContact.clearAlerts();
148
- $( '.contact-message' ).addClass( 'notice' );
149
- switch ( type ) {
150
- case 'info':
151
- $( '.contact-message' ).addClass( 'notice-info' );
152
- break;
153
- case 'error':
154
- $( '.contact-message' ).addClass( 'notice-error' );
155
- break;
156
- case 'success':
157
- $( '.contact-message' ).addClass( 'notice-success' );
158
- break;
159
- default:
160
- }
161
- $( '.contact-message' ).append( '<p>' + message + '</p>' );
162
- },
163
- clearAlerts: function() {
164
- $( '.contact-message' ).empty().removeClass().addClass( 'contact-message' );
165
- }
166
- };
167
- $(function() {
168
- QSMContact.load();
169
- $( '.add-contact-field' ).on( 'click', function() {
170
- QSMContact.newField();
171
- });
172
- $( '.save-contact' ).on( 'click', function() {
173
- QSMContact.save();
174
- });
175
- $( '.contact-form' ).on( 'click', '.delete-field', function( event ) {
176
- event.preventDefault();
177
- QSMContact.deleteField( $( this ) );
178
- });
179
- $( '.contact-form' ).on( 'click', '.copy-field', function( event ) {
180
- event.preventDefault();
181
- QSMContact.duplicateField( $( this ) );
182
- });
183
- $( '.contact-form' ).sortable({
184
- cursor: 'move',
185
- opacity: 60,
186
- placeholder: "ui-state-highlight"
187
- });
188
- });
189
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/js/qsm-admin-emails.js DELETED
@@ -1,133 +0,0 @@
1
- /**
2
- * QSM - Admin emails
3
- */
4
-
5
- var QSMAdminEmails;
6
- (function ($) {
7
- QSMAdminEmails = {
8
- total: 0,
9
- saveEmails: function() {
10
- QSMAdmin.displayAlert( 'Saving emails...', 'info' );
11
- var emails = [];
12
- var email = {};
13
- $( '.email' ).each( function() {
14
- email = {
15
- 'conditions': [],
16
- 'to': $( this ).find( '.to-email' ).val(),
17
- 'subject': $( this ).find( '.subject' ).val(),
18
- 'content': wp.editor.getContent( $( this ).find( '.email-template' ).attr( 'id' ) ),
19
- 'replyTo': $( this ).find( '.reply-to' ).prop( 'checked' ),
20
- };
21
- $( this ).find( '.email-condition' ).each( function() {
22
- email.conditions.push({
23
- 'criteria': $( this ).children( '.email-condition-criteria' ).val(),
24
- 'operator': $( this ).children( '.email-condition-operator' ).val(),
25
- 'value': $( this ).children( '.email-condition-value' ).val()
26
- });
27
- });
28
- emails.push( email );
29
- });
30
- var data = {
31
- 'emails': emails
32
- }
33
- $.ajax({
34
- url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmEmailsObject.quizID + '/emails',
35
- method: 'POST',
36
- data: data,
37
- headers: { 'X-WP-Nonce': qsmEmailsObject.nonce },
38
- })
39
- .done(function( results ) {
40
- if ( results.status ) {
41
- QSMAdmin.displayAlert( 'Emails were saved!', 'success' );
42
- } else {
43
- QSMAdmin.displayAlert( 'There was an error when saving the emails. Please try again.', 'error' );
44
- }
45
- })
46
- .fail(QSMAdmin.displayjQueryError);
47
- },
48
- loadEmails: function() {
49
- QSMAdmin.displayAlert( 'Loading emails...', 'info' );
50
- $.ajax({
51
- url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmEmailsObject.quizID + '/emails',
52
- headers: { 'X-WP-Nonce': qsmEmailsObject.nonce },
53
- })
54
- .done(function( emails ) {
55
- emails.forEach( function( email, i, emails ) {
56
- QSMAdminEmails.addEmail( email.conditions, email.to, email.subject, email.content, email.replyTo );
57
- });
58
- QSMAdmin.clearAlerts();
59
- })
60
- .fail(QSMAdmin.displayjQueryError);
61
- },
62
- addCondition: function( $email, criteria, operator, value ) {
63
- var template = wp.template( 'email-condition' );
64
- $email.find( '.email-when-conditions' ).append( template({
65
- 'criteria': criteria,
66
- 'operator': operator,
67
- 'value': value
68
- }));
69
- },
70
- newCondition: function( $email ) {
71
- QSMAdminEmails.addCondition( $email, 'score', 'equal', 0 );
72
- },
73
- addEmail: function( conditions, to, subject, content, replyTo ) {
74
- QSMAdminEmails.total += 1;
75
- var template = wp.template( 'email' );
76
- $( '#emails' ).append( template( { id: QSMAdminEmails.total, to: to, subject: subject, content: content, replyTo: replyTo } ) );
77
- conditions.forEach( function( condition, i, conditions) {
78
- QSMAdminEmails.addCondition(
79
- $( '.email:last-child' ),
80
- condition.criteria,
81
- condition.operator,
82
- condition.value
83
- );
84
- });
85
- var settings = {
86
- mediaButtons: true,
87
- tinymce: {
88
- forced_root_block : '',
89
- toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo'
90
- },
91
- quicktags: true,
92
- };
93
- wp.editor.initialize( 'email-template-' + QSMAdminEmails.total, settings );
94
- },
95
- newEmail: function() {
96
- var conditions = [{
97
- 'criteria': 'score',
98
- 'operator': 'greater',
99
- 'value': '0'
100
- }];
101
- var to = '%USER_EMAIL%';
102
- var subject = 'Quiz Results For %QUIZ_NAME%';
103
- var content = '%QUESTIONS_ANSWERS%';
104
- var replyTo = false;
105
- QSMAdminEmails.addEmail( conditions, to, subject, content, replyTo );
106
- }
107
- };
108
- $(function() {
109
- QSMAdminEmails.loadEmails();
110
-
111
- $( '.add-new-email' ).on( 'click', function( event ) {
112
- event.preventDefault();
113
- QSMAdminEmails.newEmail();
114
- });
115
- $( '.save-emails' ).on( 'click', function( event ) {
116
- event.preventDefault();
117
- QSMAdminEmails.saveEmails();
118
- });
119
- $( '#emails' ).on( 'click', '.new-condition', function( event ) {
120
- event.preventDefault();
121
- $page = $( this ).closest( '.email' );
122
- QSMAdminEmails.newCondition( $page );
123
- });
124
- $( '#emails' ).on( 'click', '.delete-email-button', function( event ) {
125
- event.preventDefault();
126
- $( this ).closest( '.email' ).remove();
127
- });
128
- $( '#emails' ).on( 'click', '.delete-condition-button', function( event ) {
129
- event.preventDefault();
130
- $( this ).closest( '.email-condition' ).remove();
131
- });
132
- });
133
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/js/qsm-admin-question.js DELETED
@@ -1,564 +0,0 @@
1
- /**
2
- * QSM Question Tab
3
- */
4
-
5
- var QSMQuestion;
6
- var import_button;
7
- (function ($) {
8
- QSMQuestion = {
9
- question: Backbone.Model.extend({
10
- defaults: {
11
- id: null,
12
- quizID: 1,
13
- type: '0',
14
- name: 'Your new question!',
15
- answerInfo: '',
16
- comments: '1',
17
- hint: '',
18
- category: '',
19
- required: 1,
20
- answers: [],
21
- page: 0
22
- }
23
- }),
24
- questions: null,
25
- questionCollection: null,
26
- categories: [],
27
- /**
28
- * Counts the total number of questions and then updates #total-questions span.
29
- */
30
- countTotal: function() {
31
- var total = 0;
32
-
33
- // Cycles through each page.
34
- _.each( jQuery( '.page' ), function( page ) {
35
-
36
- // If page is empty, continue to the next.
37
- if( 0 == jQuery( page ).children( '.question' ).length ) {
38
- return;
39
- }
40
- // Cycle through each question and add to our total.
41
- _.each( jQuery( page ).children( '.question' ), function( question ){
42
- total += 1;
43
- });
44
- });
45
- $( '#total-questions' ).text( total );
46
- },
47
- openQuestionBank: function( pageID ) {
48
- QSMQuestion.loadQuestionBank();
49
- $( '#add-question-bank-page' ).val( pageID );
50
- MicroModal.show( 'modal-2' );
51
- },
52
- loadQuestionBank: function() {
53
- $( '#question-bank' ).empty();
54
- $( '#question-bank' ).append( '<div class="qsm-spinner-loader"></div>' );
55
- $.ajax( {
56
- url: wpApiSettings.root + 'quiz-survey-master/v1/questions',
57
- method: 'GET',
58
- beforeSend: function ( xhr ) {
59
- xhr.setRequestHeader( 'X-WP-Nonce', qsmQuestionSettings.nonce );
60
- },
61
- data: {
62
- 'quizID' : 0
63
- },
64
- success: QSMQuestion.questionBankLoadSuccess
65
- });
66
- },
67
- questionBankLoadSuccess: function( questions ) {
68
- $( '#question-bank' ).empty();
69
- var category_arr = [];
70
- for ( var i = 0; i < questions.length; i++) {
71
- QSMQuestion.addQuestionToQuestionBank( questions[i] );
72
- if(category_arr.indexOf(questions[i].category) == -1 && questions[i].category != ''){
73
- category_arr.push(questions[i].category);
74
- }
75
- }
76
- if(category_arr.length > 0){
77
- $cat_html = '<select name="question-bank-cat" id="question-bank-cat">';
78
- $cat_html += '<option value="">All Questions</option>';
79
- $.each(category_arr, function(index, value){
80
- $cat_html += '<option value="'+ value +'">'+ value +' Questions</option>';
81
- });
82
- $cat_html += '</select>';
83
- $( '#question-bank' ).prepend($cat_html);
84
- }
85
- },
86
- addQuestionToQuestionBank: function( question ) {
87
- var questionText = QSMQuestion.prepareQuestionText( question.name );
88
- var template = wp.template( 'single-question-bank-question' );
89
- $( '#question-bank' ).append( template( { id: question.id, question: questionText, category: question.category, quiz_name: question.quiz_name } ) );
90
- },
91
- addQuestionFromQuestionBank: function( questionID ) {
92
- //MicroModal.close( 'modal-2' );
93
- //QSMAdmin.displayAlert( 'Adding question...', 'info' );
94
- var model = new QSMQuestion.question( { id: questionID } );
95
- model.fetch({
96
- headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
97
- url: wpApiSettings.root + 'quiz-survey-master/v1/questions/' + questionID,
98
- success: QSMQuestion.questionBankSuccess,
99
- error: QSMAdmin.displayError
100
- });
101
- },
102
- questionBankSuccess: function( model ) {
103
- var page = parseInt( $( '#add-question-bank-page' ).val(), 10 );
104
- model.set( 'page', page );
105
- //QSMAdmin.displayAlert( 'Question added!', 'success' );
106
- QSMQuestion.questions.add( model );
107
- QSMQuestion.addQuestionToPage( model );
108
- $('.import-button').removeClass('disable_import');
109
- import_button.html('').html('Add Question');
110
- },
111
- prepareCategories: function() {
112
- QSMQuestion.categories = [];
113
- QSMQuestion.questions.each(function( question ) {
114
- var category = question.get( 'category' );
115
- if ( 0 !== category.length && ! _.contains( QSMQuestion.categories, category ) ) {
116
- QSMQuestion.categories.push( category );
117
- }
118
- });
119
- },
120
- processCategories: function() {
121
- $( '.category' ).remove();
122
- _.each( QSMQuestion.categories, function( category ) {
123
- QSMQuestion.addCategory( category );
124
- });
125
- },
126
- addCategory: function( category ) {
127
- var template = wp.template( 'single-category' );
128
- $( '#categories' ).prepend( template( { category: category } ) );
129
- },
130
- loadQuestions: function() {
131
- QSMAdmin.displayAlert( 'Loading questions...', 'info' );
132
- QSMQuestion.questions.fetch({
133
- headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
134
- data: { quizID: qsmQuestionSettings.quizID },
135
- success: QSMQuestion.loadSuccess,
136
- error: QSMAdmin.displayError
137
- });
138
- },
139
- loadSuccess: function() {
140
- QSMAdmin.clearAlerts();
141
- var question;
142
- if ( qsmQuestionSettings.pages.length > 0 ) {
143
- for ( var i = 0; i < qsmQuestionSettings.pages.length; i++ ) {
144
- for ( var j = 0; j < qsmQuestionSettings.pages[ i ].length; j++ ) {
145
- question = QSMQuestion.questions.get( qsmQuestionSettings.pages[ i ][ j ] );
146
- QSMQuestion.addQuestionToPage( question );
147
- }
148
- }
149
- } else {
150
- QSMQuestion.questions.each( QSMQuestion.addQuestionToPage );
151
- }
152
- QSMQuestion.countTotal();
153
- },
154
- savePages: function() {
155
- QSMAdmin.displayAlert( 'Saving pages and questions...', 'info' );
156
- var pages = [];
157
-
158
- // Cycles through each page and add page + questions to pages variable
159
- _.each( jQuery( '.page' ), function( page ) {
160
-
161
- // If page is empty, do not add it.
162
- if( 0 == jQuery( page ).children( '.question' ).length ) {
163
- return;
164
- }
165
- var singlePage = [];
166
- // Cycle through each question and add to the page.
167
- _.each( jQuery( page ).children( '.question' ), function( question ){
168
- singlePage.push( jQuery( question ).data( 'question-id' ) )
169
- });
170
- pages.push( singlePage );
171
- });
172
- var data = {
173
- action: 'qsm_save_pages',
174
- pages: pages,
175
- quiz_id : qsmQuestionSettings.quizID
176
- };
177
-
178
- jQuery.ajax( ajaxurl, {
179
- data: data,
180
- method: 'POST',
181
- success: QSMQuestion.savePagesSuccess,
182
- error: QSMAdmin.displayjQueryError
183
- });
184
- },
185
- savePagesSuccess: function() {
186
- QSMAdmin.displayAlert( 'Questions and pages were saved!', 'success' );
187
- },
188
- addNewPage: function() {
189
- var template = wp.template( 'page' );
190
- $( '.questions' ).append( template() );
191
- $( '.page' ).sortable({
192
- items: '.question',
193
- opacity: 70,
194
- cursor: 'move',
195
- placeholder: "ui-state-highlight",
196
- connectWith: '.page'
197
- });
198
- setTimeout( QSMQuestion.removeNew, 250 );
199
- },
200
- addNewQuestion: function( model ) {
201
- QSMAdmin.displayAlert( 'Question created!', 'success' );
202
- QSMQuestion.addQuestionToPage( model );
203
- QSMQuestion.openEditPopup( model.id );
204
- QSMQuestion.countTotal();
205
- },
206
- addQuestionToPage: function( model ) {
207
- var page = model.get( 'page' ) + 1;
208
- var template = wp.template( 'question' );
209
- var page_exists = $( '.page:nth-child(' + page + ')' ).length;
210
- var count = 0;
211
- while ( ! page_exists ) {
212
- QSMQuestion.addNewPage();
213
- page_exists = $( '.page:nth-child(' + page + ')' ).length;
214
- count++;
215
- if ( count > 5 ) {
216
- page_exists = true;
217
- console.log( 'count reached' );
218
- }
219
- }
220
- var questionName = QSMQuestion.prepareQuestionText( model.get( 'name' ) );
221
- $( '.page:nth-child(' + page + ')' ).append( template( { id: model.id, category : model.get('category'), question: questionName } ) );
222
- setTimeout( QSMQuestion.removeNew, 250 );
223
- },
224
- createQuestion: function( page ) {
225
- QSMAdmin.displayAlert( 'Creating question...', 'info' );
226
- QSMQuestion.questions.create(
227
- {
228
- quizID: qsmQuestionSettings.quizID,
229
- page: page
230
- },
231
- {
232
- headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
233
- success: QSMQuestion.addNewQuestion,
234
- error: QSMAdmin.displayError
235
- }
236
- );
237
- },
238
- duplicateQuestion: function( questionID ) {
239
- QSMAdmin.displayAlert( 'Duplicating question...', 'info' );
240
- var model = QSMQuestion.questions.get( questionID );
241
- var newModel = _.clone(model.attributes);
242
- newModel.id = null;
243
- QSMQuestion.questions.create(
244
- newModel,
245
- {
246
- headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
247
- success: QSMQuestion.addNewQuestion,
248
- error: QSMAdmin.displayError
249
- }
250
- );
251
- },
252
- saveQuestion: function( questionID ) {
253
- QSMAdmin.displayAlert( 'Saving question...', 'info' );
254
- var model = QSMQuestion.questions.get( questionID );
255
- var hint = $( '#hint' ).val();
256
- var name = wp.editor.getContent( 'question-text' );
257
- var answerInfo = $( '#correct_answer_info' ).val();
258
- var type = $( "#question_type" ).val();
259
- var comments = $( "#comments" ).val();
260
- var required = $( "#required" ).val();
261
- var category = $( ".category-radio:checked" ).val();
262
- var autofill = $( "#hide_autofill" ).val();
263
- var limit_text = $( "#limit_text" ).val();
264
- if ( 'new_category' == category ) {
265
- category = $( '#new_category' ).val();
266
- }
267
- if ( ! category ) {
268
- category = '';
269
- }
270
- var answerType = $('#change-answer-editor').val();
271
- var answers = [];
272
- var $answers = jQuery( '.answers-single');
273
- _.each( $answers, function( answer ) {
274
- var $answer = jQuery( answer );
275
- var answer = '';
276
- if(answerType == 'rich'){
277
- var ta_id = $answer.find('textarea').attr('id')
278
- answer = wp.editor.getContent( ta_id );
279
- }else{
280
- answer = $answer.find( '.answer-text' ).val();
281
- }
282
-
283
- var points = $answer.find( '.answer-points' ).val();
284
- var correct = 0;
285
- if ( $answer.find( '.answer-correct' ).prop( 'checked' ) ) {
286
- correct = 1;
287
- }
288
- answers.push( [ answer, points, correct ] );
289
- });
290
- model.save(
291
- {
292
- type: type,
293
- name: name,
294
- answerInfo: answerInfo,
295
- comments: comments,
296
- hint: hint,
297
- category: category,
298
- required: required,
299
- answers: answers,
300
- answer_editor: answerType,
301
- autofill: autofill,
302
- limit_text: limit_text
303
- },
304
- {
305
- headers: { 'X-WP-Nonce': qsmQuestionSettings.nonce },
306
- success: QSMQuestion.saveSuccess,
307
- error: QSMAdmin.displayError,
308
- type: 'POST'
309
- }
310
- );
311
- MicroModal.close('modal-1');
312
- },
313
- saveSuccess: function( model ) {
314
- QSMAdmin.displayAlert( 'Question was saved!', 'success' );
315
- var template = wp.template( 'question' );
316
- var page = model.get( 'page' ) + 1;
317
- $( '.question[data-question-id=' + model.id + ']' ).replaceWith( template( { id: model.id, type : model.get('type'), category : model.get('category'), question: model.get('name') } ) );
318
- setTimeout( QSMQuestion.removeNew, 250 );
319
- },
320
- addNewAnswer: function( answer ) {
321
- var answerTemplate = wp.template( 'single-answer' );
322
- $( '#answers' ).append( answerTemplate( { answer: answer[0], points: answer[1], correct: answer[2], count: answer[3], question_id: answer[4], answerType: answer[5] } ) );
323
- if(answer[5] == 'rich'){
324
- var textarea_id = 'answer-' + answer[4] + '-' + answer[3];
325
- wp.editor.remove( textarea_id );
326
- var settings = {
327
- mediaButtons: true,
328
- tinymce: {
329
- forced_root_block : '',
330
- toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo'
331
- },
332
- quicktags: true,
333
- };
334
- wp.editor.initialize( textarea_id, settings );
335
- var anser = QSMQuestion.prepareQuestionText(answer[0]);
336
- $( textarea_id ).val(anser);
337
- tinyMCE.get( textarea_id ).setContent( anser );
338
- }
339
- },
340
- openEditPopup: function( questionID ) {
341
- QSMQuestion.prepareCategories();
342
- QSMQuestion.processCategories();
343
- var question = QSMQuestion.questions.get( questionID );
344
- var questionText = QSMQuestion.prepareQuestionText( question.get( 'name' ) );
345
- $( '#edit_question_id' ).val( questionID );
346
- var question_editor = tinyMCE.get( 'question-text' );
347
- if ($('#wp-question-text-wrap').hasClass('html-active')) {
348
- jQuery( "#question-text" ).val( questionText );
349
- } else if ( question_editor ) {
350
- tinyMCE.get( 'question-text' ).setContent( questionText );
351
- } else {
352
- jQuery( "#question-text" ).val( questionText );
353
- }
354
-
355
- $( '#answers' ).empty();
356
- var answers = question.get( 'answers' );
357
- var answerEditor = question.get( 'answerEditor' );
358
- if( answerEditor === null || typeof answerEditor === "undefined" ){
359
- answerEditor = 'text';
360
- }
361
- //Check autofill setting
362
- var disableAutofill = question.get( 'autofill' );
363
- if( disableAutofill === null || typeof disableAutofill === "undefined" ){
364
- disableAutofill = '0';
365
- }
366
- //Get text limit value
367
- var get_limit_text = question.get( 'limit_text' );
368
- if( get_limit_text === null || typeof get_limit_text === "undefined" ){
369
- get_limit_text = '0';
370
- }
371
- var al = 0;
372
- _.each( answers, function( answer ) {
373
- answer.push(al + 1);
374
- answer.push(questionID);
375
- answer.push(answerEditor);
376
- QSMQuestion.addNewAnswer( answer );
377
- al++;
378
- });
379
- $( '#hint' ).val( question.get( 'hint' ) );
380
- $( '#correct_answer_info' ).val( question.get( 'answerInfo' ) );
381
- $( "#question_type" ).val( question.get( 'type' ) );
382
- $( "#comments" ).val( question.get( 'comments' ) );
383
- $( "#required" ).val( question.get( 'required' ) );
384
- $( "#hide_autofill" ).val( disableAutofill );
385
- $( "#limit_text" ).val( get_limit_text );
386
- $( "#change-answer-editor" ).val( answerEditor );
387
- $( ".category-radio" ).removeAttr( 'checked' );
388
- $( "#edit-question-id" ).text('').text(questionID);
389
- if ( 0 !== question.get( 'category' ).length ) {
390
- $( ".category-radio" ).val( [question.get( 'category' )] );
391
- }
392
- MicroModal.show( 'modal-1' );
393
- },
394
- removeNew: function() {
395
- $( '.page-new' ).removeClass( 'page-new' );
396
- $( '.question-new' ).removeClass( 'question-new' );
397
- },
398
- prepareQuestionText: function( question ) {
399
- return jQuery('<textarea />').html( question ).text();
400
- },
401
- prepareEditor: function() {
402
- var settings = {
403
- mediaButtons: true,
404
- tinymce: {
405
- forced_root_block : '',
406
- toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo'
407
- },
408
- quicktags: true,
409
- };
410
- wp.editor.initialize( 'question-text', settings );
411
- }
412
- };
413
-
414
- $(function() {
415
- QSMQuestion.questionCollection = Backbone.Collection.extend({
416
- url: wpApiSettings.root + 'quiz-survey-master/v1/questions',
417
- model: QSMQuestion.question
418
- });
419
- QSMQuestion.questions = new QSMQuestion.questionCollection();
420
- $( '.new-page-button' ).on( 'click', function( event ) {
421
- event.preventDefault();
422
- QSMQuestion.addNewPage();
423
- });
424
-
425
- $( '.questions' ).on( 'click', '.new-question-button', function( event ) {
426
- event.preventDefault();
427
- QSMQuestion.createQuestion( $( this ).parents( '.page' ).index() );
428
- });
429
-
430
- $( '.questions' ).on( 'click', '.add-question-bank-button', function( event ) {
431
- event.preventDefault();
432
- QSMQuestion.openQuestionBank( $( this ).parents( '.page' ).index() );
433
- });
434
-
435
- $( '.questions' ).on( 'click', '.edit-question-button', function( event ) {
436
- event.preventDefault();
437
- QSMQuestion.openEditPopup( $( this ).parents( '.question' ).data( 'question-id' ) );
438
- });
439
-
440
- $( '.questions' ).on( 'click', '.duplicate-question-button', function( event ) {
441
- event.preventDefault();
442
- QSMQuestion.duplicateQuestion( $( this ).parents( '.question' ).data( 'question-id' ) );
443
- });
444
- $( '.questions' ).on( 'click', '.delete-question-button', function( event ) {
445
- event.preventDefault();
446
- $( this ).parents( '.question' ).remove();
447
- QSMQuestion.countTotal();
448
- $('.save-page-button').trigger('click');
449
- });
450
- $( '.questions' ).on( 'click', '.delete-page-button', function( event ) {
451
- event.preventDefault();
452
- $( this ).parents( '.page' ).remove();
453
- });
454
- $( '#answers' ).on( 'click', '.delete-answer-button', function( event ) {
455
- event.preventDefault();
456
- $( this ).parents( '.answers-single' ).remove();
457
- });
458
- $( '#save-popup-button' ).on( 'click', function( event ) {
459
- event.preventDefault();
460
- QSMQuestion.saveQuestion( $( this ).parent().siblings( 'main' ).children( '#edit_question_id' ).val() );
461
- $('.save-page-button').trigger('click');
462
- });
463
- $( '#new-answer-button' ).on( 'click', function( event ) {
464
- event.preventDefault();
465
- var answer_length = $( '#answers' ).find('.answers-single').length;
466
- var question_id = $('#edit_question_id').val();
467
- var answerType = $('#change-answer-editor').val();
468
- var answer = [ '', '', 0, answer_length + 1, question_id, answerType];
469
- QSMQuestion.addNewAnswer( answer );
470
- });
471
-
472
- $( '.qsm-popup-bank' ).on( 'click', '.import-button', function( event) {
473
- event.preventDefault();
474
- $(this).text('').text('Adding Question');
475
- import_button = $(this);
476
- QSMQuestion.addQuestionFromQuestionBank( $( this ).parents( '.question-bank-question' ).data( 'question-id' ) );
477
- $('.import-button').addClass('disable_import');
478
- });
479
-
480
- $( '.save-page-button' ).on( 'click', function( event ) {
481
- event.preventDefault();
482
- QSMQuestion.savePages();
483
- });
484
-
485
- $( document ).on( 'change', '#change-answer-editor', function( event ) {
486
- var newVal = $(this).val();
487
- if(confirm('All answer will be reset, Do you want to still continue?')){
488
- $('#answers').find( '.answers-single' ).remove();
489
- }else{
490
- if(newVal == 'rich'){
491
- $(this).val('text');
492
- }else{
493
- $(this).val('rich');
494
- }
495
- return false;
496
- }
497
- });
498
-
499
- // Adds event handlers for searching questions
500
- $( '#question_search' ).on( 'keyup', function() {
501
- $( '.question' ).each(function() {
502
- if ( $(this).text().toLowerCase().indexOf( $( '#question_search' ).val().toLowerCase()) === -1 ) {
503
- $(this).hide();
504
- } else {
505
- $(this).show();
506
- }
507
- });
508
- $( '.page' ).each(function() {
509
- if ( 0 === $(this).children( '.question:visible' ).length ) {
510
- $(this).hide();
511
- } else {
512
- $(this).show();
513
- }
514
- });
515
- if ( 0 === $( '#question_search' ).val().length ) {
516
- $( '.page' ).show();
517
- $( '.question' ).show();
518
- }
519
- });
520
-
521
- $( '.questions' ).sortable({
522
- opacity: 70,
523
- cursor: 'move',
524
- placeholder: "ui-state-highlight"
525
- });
526
- $( '.page' ).sortable({
527
- items: '.question',
528
- opacity: 70,
529
- cursor: 'move',
530
- placeholder: "ui-state-highlight",
531
- connectWith: '.page'
532
- });
533
- QSMQuestion.prepareEditor();
534
- QSMQuestion.loadQuestions();
535
-
536
- /**
537
- * Hide/show advanced option
538
- */
539
- $(document).on('click','#show-advanced-option',function(){
540
- var $this = $(this);
541
- $(this).next('div.advanced-content').slideToggle('slow',function(){
542
- if ($(this).is(':visible')) {
543
- $this.text('').html('Hide advance options &laquo;');
544
- } else {
545
- $this.text('').html('Show advance options &raquo;');
546
- }
547
- });
548
- });
549
- $(document).on('change','#question-bank-cat', function(){
550
- var val = $(this).val();
551
- if(val == ''){
552
- $('.question-bank-question').show();
553
- }else{
554
- $('.question-bank-question').each(function (){
555
- if($(this).attr("data-category-name") == val){
556
- $(this).show();
557
- }else{
558
- $(this).hide();
559
- }
560
- });
561
- }
562
- });
563
- });
564
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/js/qsm-admin-results.js DELETED
@@ -1,135 +0,0 @@
1
- /**
2
- * QSM - Admin results pages
3
- */
4
-
5
- var QSMAdminResults;
6
- (function ($) {
7
- QSMAdminResults = {
8
- total: 0,
9
- saveResults: function() {
10
- QSMAdmin.displayAlert( 'Saving results pages...', 'info' );
11
- var pages = [];
12
- var page = {};
13
- var redirect_value = '';
14
- $( '.results-page' ).each( function() {
15
- page = {
16
- 'conditions': [],
17
- 'page': wp.editor.getContent( $( this ).find( '.results-page-template' ).attr( 'id' ) ),
18
- 'redirect': false,
19
- };
20
- redirect_value = $( this ).find( '.results-page-redirect' ).val();
21
- if ( '' != redirect_value ) {
22
- page.redirect = redirect_value;
23
- }
24
- $( this ).find( '.results-page-condition' ).each( function() {
25
- page.conditions.push({
26
- 'criteria': $( this ).children( '.results-page-condition-criteria' ).val(),
27
- 'operator': $( this ).children( '.results-page-condition-operator' ).val(),
28
- 'value': $( this ).children( '.results-page-condition-value' ).val()
29
- });
30
- });
31
- pages.push( page );
32
- });
33
- var data = {
34
- 'pages': pages
35
- }
36
- $.ajax({
37
- url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmResultsObject.quizID + '/results',
38
- method: 'POST',
39
- data: data,
40
- headers: { 'X-WP-Nonce': qsmResultsObject.nonce },
41
- })
42
- .done(function( results ) {
43
- if ( results.status ) {
44
- QSMAdmin.displayAlert( 'Results pages were saved!', 'success' );
45
- } else {
46
- QSMAdmin.displayAlert( 'There was an error when saving the results pages. Please try again.', 'error' );
47
- }
48
- $('.save-pages').next('.spinner').removeClass('is-active');
49
- })
50
- .fail(QSMAdmin.displayjQueryError);
51
- },
52
- loadResults: function() {
53
- QSMAdmin.displayAlert( 'Loading results pages...', 'info' );
54
- $.ajax({
55
- url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmResultsObject.quizID + '/results',
56
- headers: { 'X-WP-Nonce': qsmResultsObject.nonce },
57
- })
58
- .done(function( pages ) {
59
- pages.forEach( function( page, i, pages ) {
60
- QSMAdminResults.addResultsPage( page.conditions, page.page, page.redirect );
61
- });
62
- QSMAdmin.clearAlerts();
63
- })
64
- .fail(QSMAdmin.displayjQueryError);
65
- },
66
- addCondition: function( $page, criteria, operator, value ) {
67
- var template = wp.template( 'results-page-condition' );
68
- $page.find( '.results-page-when-conditions' ).append( template({
69
- 'criteria': criteria,
70
- 'operator': operator,
71
- 'value': value
72
- }));
73
- },
74
- newCondition: function( $page ) {
75
- QSMAdminResults.addCondition( $page, 'score', 'equal', 0 );
76
- },
77
- addResultsPage: function( conditions, page, redirect ) {
78
- QSMAdminResults.total += 1;
79
- var template = wp.template( 'results-page' );
80
- $( '#results-pages' ).append( template( { id: QSMAdminResults.total, page: page, redirect: redirect } ) );
81
- conditions.forEach( function( condition, i, conditions) {
82
- QSMAdminResults.addCondition(
83
- $( '.results-page:last-child' ),
84
- condition.criteria,
85
- condition.operator,
86
- condition.value
87
- );
88
- });
89
- var settings = {
90
- mediaButtons: true,
91
- tinymce: {
92
- forced_root_block : '',
93
- toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo'
94
- },
95
- quicktags: true,
96
- };
97
- wp.editor.initialize( 'results-page-' + QSMAdminResults.total, settings );
98
- },
99
- newResultsPage: function() {
100
- var conditions = [{
101
- 'criteria': 'score',
102
- 'operator': 'greater',
103
- 'value': '0'
104
- }];
105
- var page = '%QUESTIONS_ANSWERS%';
106
- QSMAdminResults.addResultsPage( conditions, page );
107
- }
108
- };
109
- $(function() {
110
- QSMAdminResults.loadResults();
111
-
112
- $( '.add-new-page' ).on( 'click', function( event ) {
113
- event.preventDefault();
114
- QSMAdminResults.newResultsPage();
115
- });
116
- $( '.save-pages' ).on( 'click', function( event ) {
117
- event.preventDefault();
118
- $(this).next('.spinner').addClass('is-active');
119
- QSMAdminResults.saveResults();
120
- });
121
- $( '#results-pages' ).on( 'click', '.new-condition', function( event ) {
122
- event.preventDefault();
123
- $page = $( this ).closest( '.results-page' );
124
- QSMAdminResults.newCondition( $page );
125
- });
126
- $( '#results-pages' ).on( 'click', '.delete-page-button', function( event ) {
127
- event.preventDefault();
128
- $( this ).closest( '.results-page' ).remove();
129
- });
130
- $( '#results-pages' ).on( 'click', '.delete-condition-button', function( event ) {
131
- event.preventDefault();
132
- $( this ).closest( '.results-page-condition' ).remove();
133
- });
134
- });
135
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/js/qsm-admin.js DELETED
@@ -1,134 +0,0 @@
1
- /**
2
- * QSM - Quizzes/Surveys Page
3
- */
4
-
5
- var QSMQuizzesSurveys;
6
- (function ($) {
7
- QSMQuizzesSurveys = {
8
- load: function() {
9
- if ( 0 !== qsmQuizObject.length ) {
10
- $.each( qsmQuizObject, function( i, val ) {
11
- QSMQuizzesSurveys.addQuizRow( val );
12
- });
13
- $( '#the-list tr' ).filter( ':even' ).addClass( 'alternate' );
14
- } else {
15
- var template = wp.template( 'no-quiz' );
16
- $( '.qsm-quizzes-page-content' ).hide();
17
- $( '#new_quiz_button' ).parent().after( template() );
18
- }
19
- },
20
- addQuizRow: function( quizData ) {
21
- var template = wp.template( 'quiz-row' );
22
- var values = {
23
- 'id': quizData.id,
24
- 'name': quizData.name,
25
- 'link': quizData.link,
26
- 'postID': quizData.postID,
27
- 'views': quizData.views,
28
- 'taken': quizData.taken,
29
- 'lastActivity': quizData.lastActivity,
30
- 'lastActivityDateTime': quizData.lastActivityDateTime
31
- };
32
- var row = $( template( values ) );
33
- $( '#the-list' ).append( row );
34
- },
35
- searchQuizzes: function( query ) {
36
- $( ".qsm-quiz-row" ).each(function() {
37
- if ( -1 === $( this ).find( '.qsm-quiz-name' ).text().toLowerCase().indexOf( query.toLowerCase() ) ) {
38
- $( this ).hide();
39
- } else {
40
- $( this ).show();
41
- }
42
- });
43
- },
44
- deleteQuiz: function( quiz_id ) {
45
- $( '#delete_quiz_id' ).val( quiz_id );
46
- $.each( qsmQuizObject, function( i, val ) {
47
- if ( val.id == quiz_id ) {
48
- $( '#delete_quiz_name' ).val( val.name );
49
- }
50
- });
51
- MicroModal.show( 'modal-5' );
52
- },
53
- editQuizName: function( quiz_id ) {
54
- $( '#edit_quiz_id' ).val( quiz_id );
55
- $.each( qsmQuizObject, function( i, val ) {
56
- if ( val.id == quiz_id ) {
57
- $( '#edit_quiz_name' ).val( val.name );
58
- }
59
- });
60
- MicroModal.show( 'modal-3' );
61
- },
62
- duplicateQuiz: function( quiz_id ) {
63
- $( '#duplicate_quiz_id' ).val( quiz_id );
64
- MicroModal.show( 'modal-4' );
65
- },
66
- /**
67
- * Opens the popup to reset quiz stats
68
- *
69
- * @param int The ID of the quiz
70
- */
71
- openResetPopup: function( quiz_id ) {
72
- quiz_id = parseInt( quiz_id );
73
- $( '#reset_quiz_id' ).val( quiz_id );
74
- MicroModal.show( 'modal-1' );
75
- },
76
- };
77
- $(function() {
78
- $( '#new_quiz_button, #new_quiz_button_two' ).on( 'click', function( event ) {
79
- event.preventDefault();
80
- MicroModal.show( 'modal-2' );
81
- });
82
- $( '#quiz_search' ).keyup( function() {
83
- QSMQuizzesSurveys.searchQuizzes( $( this ).val() );
84
- });
85
- $( '#the-list' ).on( 'click', '.qsm-action-link-delete', function( event ) {
86
- event.preventDefault();
87
- QSMQuizzesSurveys.deleteQuiz( $( this ).parents( '.qsm-quiz-row' ).data( 'id' ) );
88
- });
89
- $( '#the-list' ).on( 'click', '.qsm-action-link-duplicate', function( event ) {
90
- event.preventDefault();
91
- QSMQuizzesSurveys.duplicateQuiz( $( this ).parents( '.qsm-quiz-row' ).data( 'id' ) );
92
- });
93
- $( '#the-list' ).on( 'click', '.qsm-edit-name', function( event ) {
94
- event.preventDefault();
95
- QSMQuizzesSurveys.editQuizName( $( this ).parents( '.qsm-quiz-row' ).data( 'id' ) );
96
- });
97
- $( '#the-list' ).on( 'click', '.qsm-action-link-reset', function( event ) {
98
- event.preventDefault();
99
- QSMQuizzesSurveys.openResetPopup( $( this ).parents( '.qsm-quiz-row' ).data( 'id' ) );
100
- });
101
- $( '#reset-stats-button' ).on( 'click', function( event ) {
102
- event.preventDefault();
103
- $( '#reset_quiz_form' ).submit();
104
- });
105
- $( '#create-quiz-button' ).on( 'click', function( event ) {
106
- event.preventDefault();
107
- $( '#new-quiz-form' ).submit();
108
- });
109
- $( '#duplicate-quiz-button' ).on( 'click', function( event ) {
110
- event.preventDefault();
111
- $( '#duplicate-quiz-form' ).submit();
112
- });
113
- $( '#delete-quiz-button' ).on( 'click', function( event ) {
114
- event.preventDefault();
115
- $( '#delete-quiz-form' ).submit();
116
- });
117
- QSMQuizzesSurveys.load();
118
- $(document).on('click','.sc-opener',function(){
119
- var $this = $(this);
120
- var shortcode_text = $this.next('.sc-content').text();
121
- $('#sc-shortcode-model-text').val(shortcode_text);
122
- MicroModal.show( 'modal-6' );
123
- });
124
- $(document).on('click','#sc-copy-shortcode', function(){
125
-
126
- var copyText = document.getElementById("sc-shortcode-model-text");
127
-
128
- copyText.select();
129
- /* Copy the text inside the text field */
130
- document.execCommand("copy");
131
-
132
- });
133
- });
134
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/js/qsm-quiz.js DELETED
@@ -1,798 +0,0 @@
1
- /**************************
2
- * Quiz And Survey Master
3
- *************************/
4
-
5
- /**************************
6
- * This object contains the newer functions. All global functions under are slowly
7
- * being deprecated and replaced with rewritten newer functions
8
- **************************/
9
- var QSM;
10
- (function ($) {
11
- QSM = {
12
- /**
13
- * Initializes all quizzes or surveys on the page
14
- */
15
- init: function() {
16
- // Makes sure we have quizzes on this page
17
- if ( typeof qmn_quiz_data != 'undefined' && qmn_quiz_data) {
18
- // Cycle through all quizzes
19
- _.each( qmn_quiz_data, function( quiz ) {
20
- quizID = parseInt( quiz.quiz_id );
21
- QSM.initPagination( quizID );
22
- if ( quiz.hasOwnProperty( 'timer_limit' ) && 0 != quiz.timer_limit ) {
23
- QSM.initTimer( quizID );
24
- }
25
- });
26
- }
27
- },
28
-
29
- /**
30
- * Sets up timer for a quiz
31
- *
32
- * @param int quizID The ID of the quiz
33
- */
34
- initTimer: function( quizID ) {
35
-
36
- // Gets our form
37
- var $quizForm = QSM.getQuizForm( quizID );
38
-
39
- // Creates timer status key.
40
- qmn_quiz_data[ quizID ].timerStatus = false;
41
-
42
- // If we are using the newer pagination system...
43
- if ( 0 < $quizForm.children( '.qsm-page' ).length ) {
44
- // If there is a first page...
45
- if ( qmn_quiz_data[quizID].hasOwnProperty('first_page') && qmn_quiz_data[quizID].first_page ) {
46
- // ... attach an event handler to the click event to activate the timer.
47
- $( '#quizForm' + quizID ).closest( '.qmn_quiz_container' ).find( '.mlw_next' ).on( 'click', function(event) {
48
- event.preventDefault();
49
- if ( ! qmn_quiz_data[ quizID ].timerStatus && qmnValidatePage( 'quizForm' + quizID ) ) {
50
- QSM.activateTimer( quizID );
51
- }
52
- });
53
- // ...else, activate the timer on page load.
54
- } else {
55
- QSM.activateTimer( quizID );
56
- }
57
- // ...else, we must be using the questions per page option.
58
- } else {
59
- if ( qmn_quiz_data[quizID].hasOwnProperty('pagination') && qmn_quiz_data[quizID].first_page ) {
60
- $( '#quizForm' + quizID ).closest( '.qmn_quiz_container' ).find( '.mlw_next' ).on( 'click', function(event) {
61
- event.preventDefault();
62
- if ( ! qmn_quiz_data[ quizID ].timerStatus && ( 0 == $( '.quiz_begin:visible' ).length || ( 1 == $( '.quiz_begin:visible' ).length && qmnValidatePage( 'quizForm' + quizID ) ) ) ) {
63
- QSM.activateTimer( quizID );
64
- }
65
- });
66
- } else {
67
- QSM.activateTimer( quizID );
68
- }
69
- }
70
- },
71
- /**
72
- * Starts the timer for the quiz.
73
- *
74
- * @param int quizID The ID of the quiz.
75
- */
76
- activateTimer: function( quizID ) {
77
-
78
- // Gets our form.
79
- var $timer = QSM.getTimer( quizID );
80
-
81
- // Sets up our variables.
82
- qmn_quiz_data[ quizID ].timerStatus = true;
83
- var seconds = 0;
84
-
85
- // Calculates starting time.
86
- var timerStarted = localStorage.getItem( 'mlw_started_quiz' + quizID );
87
- var timerRemaning = localStorage.getItem( 'mlw_time_quiz' + quizID );
88
- if ( 'yes' == timerStarted && 0 < timerRemaning ) {
89
- seconds = parseInt( timerRemaning );
90
- } else {
91
- seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
92
- }
93
- qmn_quiz_data[ quizID ].timerRemaning = seconds;
94
-
95
- // Makes the timer appear.
96
- $timer.show();
97
- $timer.text( QSM.secondsToTimer( seconds ) );
98
-
99
- // Sets up timer interval.
100
- qmn_quiz_data[ quizID ].timerInterval = setInterval( QSM.timer, 1000, quizID );
101
- },
102
- /**
103
- * Reduces the timer by one second and checks if timer is 0
104
- *
105
- * @param int quizID The ID of the quiz.
106
- */
107
- timer: function( quizID ) {
108
- qmn_quiz_data[ quizID ].timerRemaning -= 1;
109
- if ( 0 > qmn_quiz_data[ quizID ].timerRemaning ) {
110
- qmn_quiz_data[ quizID ].timerRemaning = 0;
111
- }
112
- var secondsRemaining = qmn_quiz_data[ quizID ].timerRemaning;
113
- var display = QSM.secondsToTimer( secondsRemaining );
114
-
115
- // Sets our local storage values for the timer being started and current timer value.
116
- localStorage.setItem( 'mlw_time_quiz' + quizID, secondsRemaining );
117
- localStorage.setItem( 'mlw_started_quiz' + quizID, "yes" );
118
-
119
- // Updates timer element and title on browser tab.
120
- var $timer = QSM.getTimer( quizID );
121
- $timer.text( display );
122
- document.title = display + ' ' + qsmTitleText;
123
-
124
- // If timer is run out, disable fields.
125
- if ( 0 >= secondsRemaining ) {
126
- clearInterval( qmn_quiz_data[ quizID ].timerInterval );
127
- $( ".mlw_qmn_quiz input:radio" ).attr( 'disabled', true );
128
- $( ".mlw_qmn_quiz input:checkbox" ).attr( 'disabled', true );
129
- $( ".mlw_qmn_quiz select" ).attr( 'disabled', true );
130
- $( ".mlw_qmn_question_comment" ).attr( 'disabled', true );
131
- $( ".mlw_answer_open_text" ).attr( 'disabled', true );
132
- $( ".mlw_answer_number" ).attr( 'disabled', true );
133
-
134
- var $quizForm = QSM.getQuizForm( quizID );
135
- $quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
136
- $quizForm.closest( '.qmn_quiz_container' ).prepend('<p style="color: red;">Quiz time is over</p>');
137
- //$( ".qsm-submit-btn" ).remove();
138
- if(qmn_ajax_object.enable_result_after_timer_end == 1){
139
- $quizForm.closest( '.qmn_quiz_container' ).find('form').submit();
140
- }else{
141
- alert('You are not able to attemp remaining part of quiz but you can submit the quiz!')
142
- }
143
- //document.quizForm.submit();
144
- return;
145
- }
146
- },
147
- /**
148
- * Clears timer interval
149
- *
150
- * @param int quizID The ID of the quiz
151
- */
152
- endTimer: function( quizID ) {
153
- localStorage.setItem( 'mlw_time_quiz' + quizID, 'completed' );
154
- localStorage.setItem( 'mlw_started_quiz' + quizID, 'no' );
155
- document.title = qsmTitleText;
156
- if ( typeof qmn_quiz_data[ quizID ].timerInterval != 'undefined' ) {
157
- clearInterval( qmn_quiz_data[ quizID ].timerInterval );
158
- }
159
- },
160
- /**
161
- * Converts seconds to 00:00:00 format
162
- *
163
- * @param int seconds The number of seconds
164
- * @return string A string in H:M:S format
165
- */
166
- secondsToTimer: function( seconds ) {
167
- var formattedTime = '';
168
- seconds = parseInt( seconds );
169
-
170
- // Prepares the hours part.
171
- var hours = Math.floor( seconds / 3600 );
172
- if ( 0 === hours) {
173
- formattedTime = '00:';
174
- } else if ( 10 > hours ) {
175
- formattedTime = '0' + hours + ':';
176
- } else {
177
- formattedTime = hours + ':';
178
- }
179
-
180
- // Prepares the minutes part.
181
- var minutes = Math.floor( ( seconds % 3600 ) / 60 );
182
- if ( 0 === minutes) {
183
- formattedTime = formattedTime + '00:';
184
- } else if ( 10 > minutes ) {
185
- formattedTime = formattedTime + '0' + minutes + ':';
186
- } else {
187
- formattedTime = formattedTime + minutes + ':';
188
- }
189
-
190
- // Prepares the seconds part.
191
- var remainder = Math.floor( ( seconds % 60 ) );
192
- if ( 0 === remainder) {
193
- formattedTime = formattedTime + '00';
194
- } else if ( 10 > remainder ) {
195
- formattedTime = formattedTime + '0' + remainder;
196
- } else {
197
- formattedTime = formattedTime + remainder;
198
- }
199
- return formattedTime;
200
- },
201
- /**
202
- * Gets the jQuery object for the timer
203
- */
204
- getTimer: function( quizID ) {
205
- var $quizForm = QSM.getQuizForm( quizID );
206
- return $quizForm.children( '.mlw_qmn_timer' );
207
- },
208
- /**
209
- * Sets up pagination for a quiz
210
- *
211
- * @param int quizID The ID of the quiz.
212
- */
213
- initPagination: function( quizID ) {
214
- var $quizForm = QSM.getQuizForm( quizID );
215
- if ( 0 < $quizForm.children( '.qsm-page' ).length ) {
216
- $quizForm.children( '.qsm-page' ).hide();
217
- template = wp.template( 'qsm-pagination' );
218
- $quizForm.append( template() );
219
- if ( '1' == qmn_quiz_data[ quizID ].progress_bar ) {
220
- $( '#qsm-progress-bar' ).show();
221
- qmn_quiz_data[ quizID ].bar = new ProgressBar.Line('#qsm-progress-bar', {
222
- strokeWidth: 2,
223
- easing: 'easeInOut',
224
- duration: 1400,
225
- color: '#3498db',
226
- trailColor: '#eee',
227
- trailWidth: 1,
228
- svgStyle: {width: '100%', height: '100%'},
229
- text: {
230
- style: {
231
- // color: '#999',
232
- position: 'absolute',
233
- padding: 0,
234
- margin: 0,
235
- top: 0,
236
- right: '10px',
237
- 'font-size': '13px',
238
- 'font-weight': 'bold',
239
- transform: null
240
- },
241
- autoStyleContainer: false
242
- },
243
- from: {color: '#3498db'},
244
- to: {color: '#ED6A5A'},
245
- step: function(state, bar) {
246
- bar.setText(Math.round(bar.value() * 100) + ' %');
247
- }
248
- });
249
- }
250
- QSM.goToPage( quizID, 1 );
251
- $quizForm.find( '.qsm-pagination .qsm-next' ).on( 'click', function( event ) {
252
- event.preventDefault();
253
- QSM.nextPage( quizID );
254
- });
255
- $quizForm.find( '.qsm-pagination .qsm-previous' ).on( 'click', function( event ) {
256
- event.preventDefault();
257
- QSM.prevPage( quizID );
258
- });
259
- }
260
- },
261
- /**
262
- * Navigates quiz to specific page
263
- *
264
- * @param int pageNumber The number of the page
265
- */
266
- goToPage: function( quizID, pageNumber ) {
267
- var $quizForm = QSM.getQuizForm( quizID );
268
- var $pages = $quizForm.children( '.qsm-page' );
269
- $pages.hide();
270
- $quizForm.children( '.qsm-page:nth-of-type(' + pageNumber + ')' ).show();
271
- $quizForm.find( '.qsm-previous' ).hide();
272
- $quizForm.find( '.qsm-next' ).hide();
273
- $quizForm.find( '.qsm-submit-btn' ).hide();
274
- if ( pageNumber < $pages.length ) {
275
- $quizForm.find( '.qsm-next' ).show();
276
- } else {
277
- $quizForm.find( '.qsm-submit-btn' ).show();
278
- }
279
- if ( 1 < pageNumber ) {
280
- $quizForm.find( '.qsm-previous' ).show();
281
- }
282
- if ( '1' == qmn_quiz_data[ quizID ].progress_bar ) {
283
- qmn_quiz_data[ quizID ].bar.animate( pageNumber / $pages.length );
284
- }
285
- QSM.savePage( quizID, pageNumber );
286
- },
287
- /**
288
- * Moves forward or backwards through the pages
289
- *
290
- * @param int quizID The ID of the quiz
291
- * @param int difference The number of pages to forward or back
292
- */
293
- changePage: function( quizID, difference ) {
294
- var page = QSM.getPage( quizID );
295
- page += difference;
296
- QSM.goToPage( quizID, page );
297
- },
298
- nextPage: function( quizID ) {
299
- if ( qmnValidatePage( 'quizForm' + quizID ) ) {
300
- QSM.changePage( quizID, 1 );
301
- }
302
- },
303
- prevPage: function( quizID ) {
304
- QSM.changePage( quizID, -1 );
305
- },
306
- savePage: function( quizID, pageNumber ) {
307
- sessionStorage.setItem( 'quiz' + quizID + 'page', pageNumber );
308
- },
309
- getPage: function( quizID ) {
310
- pageNumber = parseInt( sessionStorage.getItem( 'quiz' + quizID + 'page' ) );
311
- if ( isNaN( pageNumber ) || null == pageNumber ) {
312
- pageNumber = 1;
313
- }
314
- return pageNumber;
315
- },
316
- /**
317
- * Scrolls to the top of supplied element
318
- *
319
- * @param jQueryObject The jQuery version of an element. i.e. $('#quizForm3')
320
- */
321
- scrollTo: function( $element ) {
322
- jQuery( 'html, body' ).animate(
323
- {
324
- scrollTop: $element.offset().top - 150
325
- },
326
- 1000 );
327
- },
328
- /**
329
- * Gets the jQuery object of the quiz form
330
- */
331
- getQuizForm: function( quizID ) {
332
- return $( '#quizForm' + quizID );
333
- }
334
- };
335
-
336
- // On load code
337
- $(function() {
338
-
339
- // Legacy init.
340
- qmnInit();
341
-
342
- // Call main initialization.
343
- QSM.init();
344
- });
345
- }(jQuery));
346
-
347
- // Global Variables
348
- var qsmTitleText = document.title;
349
-
350
- function qmnTimeTakenTimer() {
351
- var x = +jQuery( '#timer' ).val();
352
- if ( NaN === x ) {
353
- x = 0;
354
- }
355
- x = x + 1;
356
- jQuery( '#timer' ).val( x );
357
- }
358
-
359
- function qsmEndTimeTakenTimer() {
360
- clearInterval( qsmTimerInterval );
361
- }
362
-
363
- function qmnClearField( field ) {
364
- if ( field.defaultValue == field.value ) field.value = '';
365
- }
366
-
367
- function qsmScrollTo( $element ) {
368
- if($element.length > 0){
369
- jQuery( 'html, body' ).animate( { scrollTop: $element.offset().top - 150 }, 1000 );
370
- }
371
- }
372
-
373
- function qmnDisplayError( message, field, quiz_form_id ) {
374
- jQuery( '#' + quiz_form_id + ' .qmn_error_message_section' ).addClass( 'qmn_error_message' );
375
- jQuery( '#' + quiz_form_id + ' .qmn_error_message' ).text( message );
376
- field.closest( '.quiz_section' ).addClass( 'qmn_error' );
377
- }
378
-
379
- function qmnResetError( quiz_form_id ) {
380
- jQuery( '#' + quiz_form_id + ' .qmn_error_message' ).text( '' );
381
- jQuery( '#' + quiz_form_id + ' .qmn_error_message_section' ).removeClass( 'qmn_error_message' );
382
- jQuery( '#' + quiz_form_id + ' .quiz_section' ).removeClass( 'qmn_error' );
383
- }
384
-
385
- function qmnValidation( element, quiz_form_id ) {
386
- var result = true;
387
- var quiz_id = +jQuery( '#' + quiz_form_id ).find( '.qmn_quiz_id' ).val();
388
- var email_error = qmn_quiz_data[ quiz_id ].error_messages.email;
389
- var number_error = qmn_quiz_data[ quiz_id ].error_messages.number;
390
- var empty_error = qmn_quiz_data[ quiz_id ].error_messages.empty;
391
- var incorrect_error = qmn_quiz_data[ quiz_id ].error_messages.incorrect;
392
- qmnResetError( quiz_form_id );
393
- jQuery( element ).each(function(){
394
- if ( jQuery( this ).attr( 'class' )) {
395
- if( jQuery( this ).attr( 'class' ).indexOf( 'mlwEmail' ) > -1 && this.value !== "" ) {
396
- var x = this.value;
397
- var atpos = x.indexOf('@');
398
- var dotpos = x.lastIndexOf( '.' );
399
- if ( atpos < 1 || dotpos < atpos + 2 || dotpos + 2>= x.length ) {
400
- qmnDisplayError( email_error, jQuery( this ), quiz_form_id );
401
- result = false;
402
- }
403
- }
404
- if ( localStorage.getItem( 'mlw_time_quiz' + quiz_id ) === null || localStorage.getItem( 'mlw_time_quiz'+quiz_id ) > 0.08 ) {
405
-
406
- if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredNumber' ) > -1 && this.value === "" && +this.value != NaN ) {
407
- qmnDisplayError( number_error, jQuery( this ), quiz_form_id );
408
- result = false;
409
- }
410
-
411
- if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredText' ) > -1 && this.value === "" ) {
412
- qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
413
- result = false;
414
- }
415
- if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredCaptcha' ) > -1 && this.value != mlw_code ) {
416
- qmnDisplayError( incorrect_error, jQuery( this ), quiz_form_id );
417
- result = false;
418
- }
419
- if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredAccept' ) > -1 && ! jQuery( this ).prop( 'checked' ) ) {
420
- qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
421
- result = false;
422
- }
423
- if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredRadio' ) > -1 ) {
424
- check_val = jQuery( this ).find( 'input:checked' ).val();
425
- if ( check_val == "No Answer Provided" ) {
426
- qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
427
- result = false;
428
- }
429
- }
430
- if( jQuery( this ).attr( 'class' ).indexOf( 'qsmRequiredSelect' ) > -1 ) {
431
- check_val = jQuery( this ).val();
432
- if ( check_val == "No Answer Provided" ) {
433
- qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
434
- result = false;
435
- }
436
- }
437
- if( jQuery( this ).attr( 'class' ).indexOf( 'mlwRequiredCheck' ) > -1 ) {
438
- if ( ! jQuery( this ).find( 'input:checked' ).length ) {
439
- qmnDisplayError( empty_error, jQuery( this ), quiz_form_id );
440
- result = false;
441
- }
442
- }
443
- //Google recaptcha validation
444
- if( jQuery( this ).attr( 'class' ).indexOf( 'g-recaptcha-response' ) > -1 ) {
445
- if(grecaptcha.getResponse() == "") {
446
- alert('ReCaptcha is missing');
447
- result = false;
448
- }
449
- }
450
- }
451
- }
452
- });
453
- return result;
454
- }
455
-
456
- function qmnFormSubmit( quiz_form_id ) {
457
- var quiz_id = +jQuery( '#' + quiz_form_id ).find( '.qmn_quiz_id' ).val();
458
- var $container = jQuery( '#' + quiz_form_id ).closest( '.qmn_quiz_container' );
459
- var result = qmnValidation( '#' + quiz_form_id + ' *', quiz_form_id );
460
-
461
- if ( ! result ) { return result; }
462
-
463
- jQuery( '.mlw_qmn_quiz input:radio' ).attr( 'disabled', false );
464
- jQuery( '.mlw_qmn_quiz input:checkbox' ).attr( 'disabled', false );
465
- jQuery( '.mlw_qmn_quiz select' ).attr( 'disabled', false );
466
- jQuery( '.mlw_qmn_question_comment' ).attr( 'disabled', false );
467
- jQuery( '.mlw_answer_open_text' ).attr( 'disabled', false );
468
-
469
- var data = {
470
- action: 'qmn_process_quiz',
471
- quizData: jQuery( '#' + quiz_form_id ).serialize()
472
- };
473
-
474
- qsmEndTimeTakenTimer();
475
-
476
- if ( qmn_quiz_data[quiz_id].hasOwnProperty( 'timer_limit' ) ) {
477
- QSM.endTimer( quiz_id );
478
- }
479
-
480
- jQuery( '#' + quiz_form_id + ' input[type=submit]' ).attr( 'disabled', 'disabled' );
481
- qsmDisplayLoading( $container );
482
-
483
- jQuery.post( qmn_ajax_object.ajaxurl, data, function( response ) {
484
- qmnDisplayResults( JSON.parse( response ), quiz_form_id, $container );
485
- });
486
-
487
- return false;
488
- }
489
-
490
- function qsmDisplayLoading( $container ) {
491
- $container.empty();
492
- $container.append( '<div class="qsm-spinner-loader"></div>' );
493
- qsmScrollTo( $container );
494
- }
495
-
496
- function qmnDisplayResults( results, quiz_form_id, $container ) {
497
- $container.empty();
498
- if ( results.redirect ) {
499
- window.location.replace( results.redirect );
500
- } else {
501
- $container.append( '<div class="qmn_results_page"></div>' );
502
- $container.find( '.qmn_results_page' ).html( results.display );
503
- qsmScrollTo( $container );
504
- }
505
- }
506
-
507
- function qmnInit() {
508
- if ( typeof qmn_quiz_data != 'undefined' && qmn_quiz_data ) {
509
- for ( var key in qmn_quiz_data ) {
510
- if ( qmn_quiz_data[key].ajax_show_correct === '1' ) {
511
- jQuery( '#quizForm' + qmn_quiz_data[key].quiz_id + ' .qmn_quiz_radio').change(function() {
512
- var chosen_answer = jQuery(this).val();
513
- var question_id = jQuery(this).attr('name').replace(/question/i,'');
514
- var chosen_id = jQuery(this).attr('id');
515
- jQuery.each( qmn_quiz_data[key].question_list, function( i, value ) {
516
- if ( question_id == value.question_id ) {
517
- jQuery.each( value.answers, function(j, answer ) {
518
- if ( answer[0] === chosen_answer ) {
519
- if ( answer[2] !== 1) {
520
- jQuery( '#'+chosen_id ).parent().addClass( "qmn_incorrect_answer" );
521
- }
522
- }
523
- if ( answer[2] === 1) {
524
- jQuery( ':radio[name=question'+question_id+'][value="'+answer[0]+'"]' ).parent().addClass( "qmn_correct_answer" );
525
- }
526
- });
527
- }
528
- });
529
- });
530
- }
531
-
532
- if ( qmn_quiz_data[key].disable_answer === '1' ) {
533
- jQuery( '#quizForm' + qmn_quiz_data[key].quiz_id + ' .qmn_quiz_radio').change(function() {
534
- var radio_group = jQuery(this).attr('name');
535
- jQuery('input[type=radio][name='+radio_group+']').prop('disabled',true);
536
- });
537
- }
538
-
539
- if ( qmn_quiz_data[key].hasOwnProperty('pagination') ) {
540
- qmnInitPagination( qmn_quiz_data[key].quiz_id );
541
- }
542
- }
543
- }
544
- }
545
-
546
- //Function to validate the answers provided in quiz
547
- function qmnValidatePage( quiz_form_id ) {
548
- var result = qmnValidation( '#' + quiz_form_id + ' .quiz_section:visible *', quiz_form_id );
549
- return result;
550
- }
551
-
552
- //Function to advance quiz to next page
553
- function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
554
- var quiz_id = +jQuery( quiz_form_id ).find( '.qmn_quiz_id' ).val();
555
- var $container = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' );
556
- var slide_number = +$container.find( '.slide_number_hidden' ).val();
557
- var previous = +$container.find( '.previous_amount_hidden' ).val();
558
- var section_totals = +$container.find( '.total_sections_hidden' ).val();
559
-
560
- jQuery( quiz_form_id + " .quiz_section" ).hide();
561
- for ( var i = 0; i < pagination; i++ ) {
562
- if (i === 0 && previous === 1 && slide_number > 1) {
563
- slide_number = slide_number + pagination;
564
- } else {
565
- slide_number++;
566
- }
567
- if (slide_number < 1) {
568
- slide_number = 1;
569
- }
570
- $container.find( ".mlw_qmn_quiz_link.mlw_previous" ).hide();
571
-
572
- if ( qmn_quiz_data[ quiz_id ].first_page ) {
573
- if (slide_number > 1) {
574
- $container.find( ".mlw_qmn_quiz_link.mlw_previous" ).show();
575
- }
576
- } else {
577
- if (slide_number > pagination) {
578
- $container.find( ".mlw_qmn_quiz_link.mlw_previous" ).show();
579
- }
580
- }
581
- if (slide_number == section_totals) {
582
- $container.find( ".mlw_qmn_quiz_link.mlw_next" ).hide();
583
- }
584
- if (slide_number < section_totals) {
585
- $container.find( ".mlw_qmn_quiz_link.mlw_next" ).show();
586
- }
587
- jQuery( quiz_form_id + " .quiz_section.slide" + slide_number ).show();
588
- }
589
-
590
- jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.slide_number_hidden' ).val( slide_number );
591
- jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.previous_amount_hidden' ).val( 0 );
592
-
593
- qmnUpdatePageNumber( 1, quiz_form_id );
594
-
595
- if (go_to_top == 1) {
596
- qsmScrollTo( $container );
597
- }
598
- }
599
-
600
- function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
601
- var quiz_id = +jQuery( quiz_form_id ).find( '.qmn_quiz_id' ).val();
602
- var $container = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' );
603
- var slide_number = +$container.find( '.slide_number_hidden' ).val();
604
- var previous = +$container.find( '.previous_amount_hidden' ).val();
605
- var section_totals = +$container.find( '.total_sections_hidden' ).val();
606
-
607
- jQuery( quiz_form_id + " .quiz_section" ).hide();
608
- for (var i = 0; i < pagination; i++) {
609
- if (i === 0 && previous === 0) {
610
- slide_number = slide_number - pagination;
611
- } else {
612
- slide_number--;
613
- }
614
- if (slide_number < 1) {
615
- slide_number = 1;
616
- }
617
-
618
- $container.find( ".mlw_qmn_quiz_link.mlw_previous" ).hide();
619
-
620
- if ( qmn_quiz_data[ quiz_id ].first_page ) {
621
- if (slide_number > 1) {
622
- $container.find( ".mlw_qmn_quiz_link.mlw_previous" ).show();
623
- }
624
- } else {
625
- if (slide_number > pagination) {
626
- $container.find( ".mlw_qmn_quiz_link.mlw_previous" ).show();
627
- }
628
- }
629
- if (slide_number == section_totals) {
630
- $container.find( ".mlw_qmn_quiz_link.mlw_next" ).hide();
631
- }
632
- if (slide_number < section_totals) {
633
- $container.find( ".mlw_qmn_quiz_link.mlw_next" ).show();
634
- }
635
- jQuery( quiz_form_id + " .quiz_section.slide" + slide_number ).show();
636
- }
637
-
638
- qmnUpdatePageNumber( -1, quiz_form_id );
639
-
640
- jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.slide_number_hidden' ).val( slide_number );
641
- jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.previous_amount_hidden' ).val( 0 );
642
-
643
- if (go_to_top == 1) {
644
- qsmScrollTo( $container );
645
- }
646
- }
647
-
648
- function qmnUpdatePageNumber( amount, quiz_form_id ) {
649
- var current_page = +jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.current_page_hidden' ).val();
650
- var total_pages = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find( '.total_pages_hidden' ).val();
651
- current_page += amount;
652
- //jQuery( quiz_form_id ).siblings( '.qmn_pagination' ).find( " .qmn_page_counter_message" ).text( current_page + "/" + total_pages );
653
- }
654
-
655
- function qmnInitPagination( quiz_id ) {
656
-
657
- var qmn_section_total = +qmn_quiz_data[quiz_id].pagination.total_questions + 1;
658
- if ( qmn_quiz_data[quiz_id].pagination.section_comments === '0' ) {
659
- qmn_section_total += 1;
660
- }
661
- var qmn_total_pages = Math.ceil( qmn_section_total / +qmn_quiz_data[quiz_id].pagination.amount );
662
- if ( qmn_quiz_data[quiz_id].first_page ) {
663
- qmn_total_pages += 1;
664
- qmn_section_total += 1;
665
- }
666
-
667
- jQuery( '#quizForm' + quiz_id + ' .quiz_section' ).hide();
668
- jQuery( '#quizForm' + quiz_id + ' .quiz_section' ).append( "<br />" );
669
- jQuery( '#quizForm' + quiz_id ).closest( '.qmn_quiz_container' ).append( '<div class="qmn_pagination border margin-bottom"></div>' );
670
- jQuery( '#quizForm' + quiz_id ).closest( '.qmn_quiz_container' ).find( '.qmn_pagination' ).append( '<input type="hidden" value="0" name="slide_number" class="slide_number_hidden" />')
671
- .append( '<input type="hidden" value="0" name="current_page" class="current_page_hidden" />')
672
- .append( '<input type="hidden" value="' + qmn_total_pages + '" name="total_pages" class="total_pages_hidden" />')
673
- .append( '<input type="hidden" value="' + qmn_section_total + '" name="total_sections" class="total_sections_hidden" />')
674
- .append( '<input type="hidden" value="0" name="previous_amount" class="previous_amount_hidden" />')
675
- .append( '<a class="qmn_btn mlw_qmn_quiz_link mlw_previous" href="#">' + qmn_quiz_data[quiz_id].pagination.previous_text + '</a>' )
676
- .append( '<span class="qmn_page_message"></span>' )
677
- .append( '<div class="qmn_page_counter_message"></div>' )
678
- .append( '<a class="qmn_btn mlw_qmn_quiz_link mlw_next" href="#">' + qmn_quiz_data[quiz_id].pagination.next_text + '</a>' );
679
-
680
- jQuery(".mlw_next").click(function(event) {
681
- event.preventDefault();
682
- var quiz_id = +jQuery( this ).closest( '.qmn_quiz_container' ).find( '.qmn_quiz_id' ).val();
683
- if ( qmnValidatePage( 'quizForm' + quiz_id ) ) {
684
- qmnNextSlide( qmn_quiz_data[quiz_id].pagination.amount, 1, '#quizForm' + quiz_id );
685
- }
686
- });
687
-
688
- jQuery(".mlw_previous").click(function(event) {
689
- event.preventDefault();
690
- var quiz_id = +jQuery( this ).closest( '.qmn_quiz_container' ).find( '.qmn_quiz_id' ).val();
691
- qmnPrevSlide( qmn_quiz_data[quiz_id].pagination.amount, 1, '#quizForm' + quiz_id );
692
- });
693
-
694
- if ( qmn_quiz_data[quiz_id].first_page ) {
695
- qmnNextSlide( 1, 0, '#quizForm' + quiz_id );
696
- } else {
697
- qmnNextSlide( qmn_quiz_data[quiz_id].pagination.amount, 0, '#quizForm' + quiz_id );
698
- }
699
- }
700
-
701
- function qmnSocialShare( network, mlw_qmn_social_text, mlw_qmn_title, facebook_id ) {
702
- var sTop = window.screen.height / 2 - ( 218 );
703
- var sLeft = window.screen.width / 2 - ( 313 );
704
- var sqShareOptions = "height=400,width=580,toolbar=0,status=0,location=0,menubar=0,directories=0,scrollbars=0,top=" + sTop + ",left=" + sLeft;
705
- var pageUrl = window.location.href;
706
- var pageUrlEncoded = encodeURIComponent( pageUrl );
707
- var url = '';
708
- if ( network == 'facebook' ) {
709
- url = "https://www.facebook.com/dialog/feed?" + "display=popup&" + "app_id="+facebook_id +
710
- "&" + "link=" + pageUrlEncoded + "&" + "name=" + encodeURIComponent(mlw_qmn_social_text) +
711
- "&" + "description=";
712
- }
713
- if ( network == 'twitter' ) {
714
- url = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(mlw_qmn_social_text);
715
- }
716
- window.open( url, "Share", sqShareOptions );
717
- return false;
718
- }
719
-
720
- jQuery(function() {
721
- jQuery( '.qmn_quiz_container' ).tooltip();
722
-
723
- jQuery( '.qmn_quiz_container input' ).on( 'keypress', function ( e ) {
724
- if ( e.which === 13 ) {
725
- e.preventDefault();
726
- }
727
- });
728
-
729
- jQuery( '.qmn_quiz_form' ).on( "submit", function( event ) {
730
- event.preventDefault();
731
- qmnFormSubmit( this.id );
732
- });
733
-
734
- jQuery(document).on('click','.btn-reload-quiz',function(e){
735
- e.preventDefault();
736
- var quiz_id = jQuery(this).data('quiz_id');
737
- var parent_div = jQuery(this).parents('.qsm-quiz-container');
738
- qsmDisplayLoading( parent_div );
739
- jQuery.ajax({
740
- type: 'POST',
741
- url: qmn_ajax_object.ajaxurl,
742
- data: {
743
- action: "qsm_get_quiz_to_reload",
744
- quiz_id: quiz_id,
745
- },
746
- success: function (response) {
747
- parent_div.replaceWith(response);
748
- QSM.initPagination( quiz_id );
749
- },
750
- error: function (errorThrown) {
751
- alert(errorThrown);
752
- }
753
- });
754
- });
755
-
756
- jQuery(document).on('change','.qmn_radio_answers input',function(e){
757
- if(qmn_ajax_object.enable_quick_result_mc == 1){
758
- var question_id = jQuery(this).attr('name').split('question')[1],
759
- value = jQuery(this).val(),
760
- $this = jQuery(this).parents('.quiz_section');
761
-
762
- jQuery.ajax({
763
- type: 'POST',
764
- url: qmn_ajax_object.ajaxurl,
765
- data: {
766
- action: "qsm_get_question_quick_result",
767
- question_id: question_id,
768
- answer: value,
769
- },
770
- success: function (response) {
771
- $this.find('.quick-question-res-p').remove();
772
- if(response == 'correct'){
773
- $this.append('<p style="color: green" class="quick-question-res-p"><b>Correct!</b> You have selected correct answer.</p>')
774
- }else if(response == 'incorrect'){
775
- $this.append('<p style="color: red" class="quick-question-res-p"><b>Wrong!</b> You have selected wrong answer.</p>')
776
- }
777
- },
778
- error: function (errorThrown) {
779
- alert(errorThrown);
780
- }
781
- });
782
- }
783
- });
784
-
785
- jQuery('.qmn_radio_answers > .qmn_mc_answer_wrap').on('click',function(event){
786
- var radButton = jQuery(this).find('input[type=radio]');
787
- if(event.target.className == 'qmn_quiz_radio'){
788
- return true;
789
- }
790
- if(radButton.is(':checked')){
791
- jQuery(radButton).prop("checked", false);
792
- } else {
793
- jQuery(radButton).prop("checked", true);
794
- }
795
- });
796
- });
797
-
798
- var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/mlw_quizmaster2.php DELETED
@@ -1,303 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin Name: Quiz And Survey Master
4
- * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 6.3.3
6
- * Author: QSM Team
7
- * Author URI: https://quizandsurveymaster.com/
8
- * Plugin URI: https://quizandsurveymaster.com/
9
- * Text Domain: quiz-master-next
10
- *
11
- * @author QSM Team
12
- * @version 6.3.3
13
- * @package QSM
14
- */
15
-
16
- if ( ! defined( 'ABSPATH' ) ) {
17
- exit;
18
- }
19
-
20
- define( 'QSM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
21
-
22
- /**
23
- * This class is the main class of the plugin
24
- *
25
- * When loaded, it loads the included plugin files and add functions to hooks or filters. The class also handles the admin menu
26
- *
27
- * @since 3.6.1
28
- */
29
- class MLWQuizMasterNext {
30
-
31
- /**
32
- * QSM Version Number
33
- *
34
- * @var string
35
- * @since 4.0.0
36
- */
37
- public $version = '6.3.3';
38
-
39
- /**
40
- * QSM Alert Manager Object
41
- *
42
- * @var object
43
- * @since 3.7.1
44
- */
45
- public $alertManager;
46
-
47
- /**
48
- * QSM Plugin Helper Object
49
- *
50
- * @var object
51
- * @since 4.0.0
52
- */
53
- public $pluginHelper;
54
-
55
- /**
56
- * QSM Quiz Creator Object
57
- *
58
- * @var object
59
- * @since 3.7.1
60
- */
61
- public $quizCreator;
62
-
63
- /**
64
- * QSM Log Manager Object
65
- *
66
- * @var object
67
- * @since 4.5.0
68
- */
69
- public $log_manager;
70
-
71
- /**
72
- * QSM Audit Manager Object
73
- *
74
- * @var object
75
- * @since 4.7.1
76
- */
77
- public $audit_manager;
78
-
79
- /**
80
- * QSM Settings Object
81
- *
82
- * @var object
83
- * @since 5.0.0
84
- */
85
- public $quiz_settings;
86
-
87
- /**
88
- * Main Construct Function
89
- *
90
- * Call functions within class
91
- *
92
- * @since 3.6.1
93
- * @uses MLWQuizMasterNext::load_dependencies() Loads required filed
94
- * @uses MLWQuizMasterNext::add_hooks() Adds actions to hooks and filters
95
- * @return void
96
- */
97
- public function __construct() {
98
- $this->load_dependencies();
99
- $this->add_hooks();
100
- }
101
-
102
- /**
103
- * Load File Dependencies
104
- *
105
- * @since 3.6.1
106
- * @return void
107
- */
108
- private function load_dependencies() {
109
-
110
- include 'php/classes/class-qsm-install.php';
111
- include 'php/classes/class-qsm-fields.php';
112
-
113
- include 'php/classes/class-qmn-log-manager.php';
114
- $this->log_manager = new QMN_Log_Manager();
115
-
116
- include 'php/classes/class-qsm-audit.php';
117
- $this->audit_manager = new QSM_Audit();
118
-
119
- if ( is_admin() ) {
120
- include 'php/admin/functions.php';
121
- include 'php/admin/stats-page.php';
122
- include 'php/admin/quizzes-page.php';
123
- include 'php/admin/quiz-options-page.php';
124
- include 'php/admin/admin-results-page.php';
125
- include 'php/admin/admin-results-details-page.php';
126
- include 'php/admin/tools-page.php';
127
- include 'php/classes/class-qsm-changelog-generator.php';
128
- include 'php/admin/about-page.php';
129
- include 'php/admin/help-page.php';
130
- include 'php/admin/dashboard-widgets.php';
131
- include 'php/admin/options-page-questions-tab.php';
132
- include 'php/admin/options-page-contact-tab.php';
133
- include 'php/admin/options-page-text-tab.php';
134
- include 'php/admin/options-page-option-tab.php';
135
- include 'php/admin/options-page-email-tab.php';
136
- include 'php/admin/options-page-results-page-tab.php';
137
- include 'php/admin/options-page-style-tab.php';
138
- include 'php/admin/options-page-preview-tab.php';
139
- include 'php/admin/addons-page.php';
140
- include 'php/admin/settings-page.php';
141
- include 'php/classes/class-qsm-tracking.php';
142
- include 'php/classes/class-qmn-review-message.php';
143
- include 'php/gdpr.php';
144
- }
145
- include 'php/classes/class-qsm-questions.php';
146
- include 'php/classes/class-qsm-contact-manager.php';
147
- include 'php/classes/class-qsm-results-pages.php';
148
- include 'php/classes/class-qsm-emails.php';
149
- include 'php/classes/class-qmn-quiz-manager.php';
150
-
151
- include 'php/template-variables.php';
152
- include 'php/adverts-generate.php';
153
- include 'php/question-types.php';
154
- include 'php/default-templates.php';
155
- include 'php/shortcodes.php';
156
-
157
- if ( function_exists( 'register_block_type' ) ) {
158
- include 'blocks/block.php';
159
- }
160
-
161
- include 'php/classes/class-qmn-alert-manager.php';
162
- $this->alertManager = new MlwQmnAlertManager();
163
-
164
- include 'php/classes/class-qmn-quiz-creator.php';
165
- $this->quizCreator = new QMNQuizCreator();
166
-
167
- include 'php/classes/class-qmn-plugin-helper.php';
168
- $this->pluginHelper = new QMNPluginHelper();
169
-
170
- include 'php/classes/class-qsm-settings.php';
171
- $this->quiz_settings = new QSM_Quiz_Settings();
172
-
173
- include 'php/rest-api.php';
174
- }
175
-
176
- /**
177
- * Add Hooks
178
- *
179
- * Adds functions to relavent hooks and filters
180
- *
181
- * @since 3.6.1
182
- * @return void
183
- */
184
- private function add_hooks() {
185
- add_action( 'admin_menu', array( $this, 'setup_admin_menu' ) );
186
- add_action( 'admin_head', array( $this, 'admin_head' ), 900 );
187
- add_action( 'init', array( $this, 'register_quiz_post_types' ) );
188
- }
189
-
190
- /**
191
- * Creates Custom Quiz Post Type
192
- *
193
- * @since 4.1.0
194
- * @return void
195
- */
196
- public function register_quiz_post_types() {
197
-
198
- // Checks settings to see if we need to alter the defaults.
199
- $has_archive = true;
200
- $exclude_search = false;
201
- $cpt_slug = 'quiz';
202
- $settings = (array) get_option( 'qmn-settings' );
203
- $plural_name = __( 'Quizzes & Surveys', 'quiz-master-next' );
204
-
205
- // Checks if admin turned off archive.
206
- if ( isset( $settings['cpt_archive'] ) && '1' == $settings['cpt_archive'] ) {
207
- $has_archive = false;
208
- }
209
-
210
- // Checks if admin turned off search.
211
- if ( isset( $settings['cpt_search'] ) && '1' == $settings['cpt_search'] ) {
212
- $exclude_search = true;
213
- }
214
-
215
- // Checks if admin changed slug.
216
- if ( isset( $settings['cpt_slug'] ) ) {
217
- $cpt_slug = trim( strtolower( str_replace( ' ', '-', $settings['cpt_slug'] ) ) );
218
- }
219
-
220
- // Checks if admin changed plural name.
221
- if ( isset( $settings['plural_name'] ) ) {
222
- $plural_name = trim( $settings['plural_name'] );
223
- }
224
-
225
- // Prepares labels.
226
- $quiz_labels = array(
227
- 'name' => $plural_name,
228
- 'singular_name' => __( 'Quiz', 'quiz-master-next' ),
229
- 'menu_name' => __( 'Quiz', 'quiz-master-next' ),
230
- 'name_admin_bar' => __( 'Quiz', 'quiz-master-next' ),
231
- 'add_new' => __( 'Add New', 'quiz-master-next' ),
232
- 'add_new_item' => __( 'Add New Quiz', 'quiz-master-next' ),
233
- 'new_item' => __( 'New Quiz', 'quiz-master-next' ),
234
- 'edit_item' => __( 'Edit Quiz', 'quiz-master-next' ),
235
- 'view_item' => __( 'View Quiz', 'quiz-master-next' ),
236
- 'all_items' => __( 'All Quizzes', 'quiz-master-next' ),
237
- 'search_items' => __( 'Search Quizzes', 'quiz-master-next' ),
238
- 'parent_item_colon' => __( 'Parent Quiz:', 'quiz-master-next' ),
239
- 'not_found' => __( 'No Quiz Found', 'quiz-master-next' ),
240
- 'not_found_in_trash' => __( 'No Quiz Found In Trash', 'quiz-master-next' ),
241
- );
242
-
243
- // Prepares post type array.
244
- $quiz_args = array(
245
- 'public' => true,
246
- 'show_ui' => true,
247
- 'show_in_menu' => false,
248
- 'show_in_nav_menus' => true,
249
- 'labels' => $quiz_labels,
250
- 'publicly_queryable' => true,
251
- 'exclude_from_search' => $exclude_search,
252
- 'label' => $plural_name,
253
- 'rewrite' => array( 'slug' => $cpt_slug ),
254
- 'has_archive' => $has_archive,
255
- 'supports' => array( 'title', 'author', 'comments', 'thumbnail' )
256
- );
257
-
258
- // Registers post type.
259
- register_post_type( 'quiz', $quiz_args );
260
- }
261
-
262
- /**
263
- * Setup Admin Menu
264
- *
265
- * Creates the admin menu and pages for the plugin and attaches functions to them
266
- *
267
- * @since 3.6.1
268
- * @return void
269
- */
270
- public function setup_admin_menu() {
271
- if ( function_exists( 'add_menu_page' ) ) {
272
- add_menu_page( 'Quiz And Survey Master', __( 'Quizzes/Surveys', 'quiz-master-next' ), 'moderate_comments', __FILE__, 'qsm_generate_quizzes_surveys_page', 'dashicons-feedback' );
273
- add_submenu_page( NULL, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_options', 'qsm_generate_quiz_options' );
274
- add_submenu_page( __FILE__, __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );
275
- add_submenu_page( NULL, __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_result_details', 'qsm_generate_result_details' );
276
- add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
277
- add_submenu_page( __FILE__, __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'qsm_quiz_tools', 'qsm_generate_quiz_tools' );
278
- add_submenu_page( __FILE__, __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
279
- add_submenu_page( __FILE__, __( 'Addon Settings', 'quiz-master-next' ), '<span style="color:#f39c12;">' . __( 'Addon Settings', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qmn_addons', 'qmn_addons_page' );
280
- add_submenu_page( __FILE__, __( 'Get a Free Addon', 'quiz-master-next' ), '<span style="color:#f39c12;">' . esc_html__( 'Get a Free Addon!', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qsm-free-addon', 'qsm_display_optin_page' );
281
- add_submenu_page( __FILE__, __( 'QSM About', 'quiz-master-next' ), __( 'QSM About', 'quiz-master-next' ), 'moderate_comments', 'qsm_about_page', 'qsm_generate_about_page' );
282
- add_submenu_page( __FILE__, __( 'Help', 'quiz-master-next' ), __( 'Help', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_help', 'qsm_generate_help_page' );
283
- }
284
- }
285
-
286
- /**
287
- * Removes Unnecessary Admin Page
288
- *
289
- * Removes the update, quiz settings, and quiz results pages from the Quiz Menu
290
- *
291
- * @since 4.1.0
292
- * @return void
293
- */
294
- public function admin_head() {
295
- remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'mlw_quiz_options' );
296
- remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'qsm_quiz_result_details' );
297
- }
298
- }
299
-
300
- global $mlwQuizMasterNext;
301
- $mlwQuizMasterNext = new MLWQuizMasterNext();
302
- register_activation_hook( __FILE__, array( 'QSM_Install', 'install' ) );
303
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/about-page.php DELETED
@@ -1,94 +0,0 @@
1
- <?php
2
- /**
3
- * Generates the content for the about page.
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
- /**
11
- * This function shows the about page. It also shows the changelog information.
12
- *
13
- * @return void
14
- * @since 6.2.0
15
- */
16
- function qsm_generate_about_page() {
17
-
18
- global $mlwQuizMasterNext;
19
- $version = $mlwQuizMasterNext->version;
20
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $version );
21
- wp_enqueue_script( 'qsm_admin_js', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $version );
22
- ?>
23
- <style>
24
- div.qsm_icon_wrap {
25
- background: <?php echo 'url("' . plugins_url( '../../assets/icon-128x128.png', __FILE__ ) . '" )'; ?> no-repeat;
26
- }
27
- </style>
28
- <div class="wrap about-wrap">
29
- <h1><?php esc_html_e( 'Welcome To Quiz And Survey Master (Formerly Quiz Master Next)', 'quiz-master-next' ); ?></h1>
30
- <div class="about-text"><?php esc_html_e( 'Thank you for updating!', 'quiz-master-next' ); ?></div>
31
- <div class="qsm_icon_wrap"><?php echo esc_html( $version ); ?></div>
32
- <h2 class="nav-tab-wrapper">
33
- <a href="#" data-tab='1' class="nav-tab nav-tab-active qsm-tab">
34
- <?php esc_html_e( "What's New!", 'quiz-master-next' ); ?></a>
35
- <a href="#" data-tab='2' class="nav-tab qsm-tab">
36
- <?php esc_html_e( 'Changelog', 'quiz-master-next' ); ?></a>
37
- <a href="#" data-tab='3' class="nav-tab qsm-tab">
38
- <?php esc_html_e( 'People Who Make QSM Possible', 'quiz-master-next' ); ?></a>
39
- </h2>
40
- <div class="qsm-tab-content tab-1">
41
- <div class="feature">
42
- <h2 class="feature-headline">Welcome to QSM 6.2!</h2>
43
- </div>
44
- <div class="feature">
45
- <h2 class="feature-headline">New Email System</h2>
46
- <p class="feature-text">All of the email system has been entirely re-written. The newer system is much more intuitive and allows for more granular conditions allowing us to add in more conditions types in future versions.</p>
47
- </div>
48
- <div class="feature">
49
- <h2 class="feature-headline">New Results Page System</h2>
50
- <p class="feature-text">All of the results page has been entirely re-written. The newer system is much more intuitive and allows for more granular conditions allowing us to add in more conditions types in future versions.</p>
51
- </div>
52
- </div>
53
- <div class="qsm-tab-content tab-2" style="display: none;">
54
- <h2>Changelog</h2>
55
- <?php QSM_Changelog_Generator::get_changelog_list( 'QuizandSurveyMaster/quiz_master_next', 56 ); ?>
56
- </div>
57
- <div class="qsm-tab-content tab-3" style="display:none;">
58
- <h2>GitHub Contributors</h2>
59
- <?php
60
- $contributors = get_transient( 'qmn_contributors' );
61
- if ( false === $contributors ) {
62
- $response = wp_remote_get( 'https://api.github.com/repos/QuizandSurveyMaster/quiz_master_next/contributors', array( 'sslverify' => false ) );
63
- if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
64
- $contributors = array();
65
- } else {
66
- $contributors = json_decode( wp_remote_retrieve_body( $response ) );
67
- }
68
- }
69
- if ( is_array( $contributors ) & ! empty( $contributors ) ) {
70
- set_transient( 'qmn_contributors', $contributors, 3600 );
71
- $contributor_list = '<ul class="wp-people-group">';
72
- foreach ( $contributors as $contributor ) {
73
- $contributor_list .= '<li class="wp-person">';
74
- $contributor_list .= sprintf( '<a href="%s" title="%s">',
75
- esc_url( 'https://github.com/' . $contributor->login ),
76
- // translators: This is the 'title' attribute for GitHub contributors. This would add the GitHub user such as 'View fpcorso'.
77
- esc_html( sprintf( __( 'View %s', 'quiz-master-next' ), $contributor->login ) )
78
- );
79
- $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
80
- $contributor_list .= '</a>';
81
- $contributor_list .= sprintf( '<a class="web" href="%s" target="_blank">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
82
- $contributor_list .= '</a>';
83
- $contributor_list .= '</li>';
84
- }
85
- $contributor_list .= '</ul>';
86
- echo $contributor_list;
87
- }
88
- ?>
89
- <a href="https://github.com/QuizandSurveyMaster/quiz_master_next" target="_blank" class="button-primary">View GitHub Repo</a>
90
- </div>
91
- </div>
92
- <?php
93
- }
94
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/addons-page.php DELETED
@@ -1,189 +0,0 @@
1
- <?php
2
- if (!defined('ABSPATH')) {
3
- exit;
4
- }
5
-
6
- /**
7
- * Creates the add on page that is displayed in the add on settings page
8
- *
9
- * @return void
10
- * @since 4.4.0
11
- */
12
- function qmn_addons_page() {
13
- if (!current_user_can('moderate_comments')) {
14
- return;
15
- }
16
-
17
- global $mlwQuizMasterNext;
18
- $active_tab = strtolower(str_replace(" ", "-", isset($_GET['tab']) ? $_GET['tab'] : __('Featured Addons', 'quiz-master-next')));
19
- $tab_array = $mlwQuizMasterNext->pluginHelper->get_addon_tabs();
20
- ?>
21
- <div class="wrap">
22
- <h2>Quiz And Survey Master Addon Settings</h2>
23
- <h2 class="nav-tab-wrapper">
24
- <?php
25
- foreach ($tab_array as $tab) {
26
- $active_class = '';
27
- if ($active_tab == $tab['slug']) {
28
- $active_class = 'nav-tab-active';
29
- }
30
- echo "<a href=\"?page=qmn_addons&tab={$tab['slug']}\" class=\"nav-tab $active_class\">{$tab['title']}</a>";
31
- }
32
- ?>
33
- </h2>
34
- <div>
35
- <?php
36
- foreach ($tab_array as $tab) {
37
- if ($active_tab == $tab['slug']) {
38
- call_user_func($tab['function']);
39
- }
40
- }
41
- ?>
42
- </div>
43
- </div>
44
- <?php
45
- }
46
-
47
- /**
48
- * Displays the contents of the featured add ons page.
49
- *
50
- * @return void
51
- * @since 4.4.0
52
- */
53
- function qsm_generate_featured_addons() {
54
- wp_enqueue_style('qsm_addons_style', plugins_url('../../css/qsm-admin.css', __FILE__));
55
- ?>
56
- <p><?php esc_html_e('These addons extend the functionality of Quiz And Survey Master', 'quiz-master-next'); ?></p>
57
- <div class="qsm-quiz-page-addon">
58
- <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
59
- <div class="qsm-addons">
60
- <?php
61
- $xml = qsm_fetch_data_from_xml();
62
- $cateory_arr = array();
63
- if (isset($xml->item) && $xml->item) {
64
- foreach ($xml->item as $key => $value) {
65
- $category_addon = trim($value->category);
66
- if (!array_key_exists($category_addon, $cateory_arr)) {
67
- $cateory_arr[$category_addon] = array();
68
- }
69
- $cateory_arr[$category_addon][] = $value;
70
- }
71
- }
72
- if ($cateory_arr) {
73
- foreach ($cateory_arr as $cat_name => $cat_value) {
74
- ?>
75
- <h3 class="addon_category_name"><?php echo $cat_name; ?></h3>
76
- <?php foreach ($cat_value as $value) { ?>
77
- <div class="qsm-info-widget">
78
- <h3><?php echo $value->name; ?></h3>
79
- <p><?php echo $value->desc; ?></p>
80
- <button class="button button-default"><?php echo '$' . $value->price; ?></button>
81
- <a href="<?php echo $value->link . '&utm_medium=plugin&utm_content=' . $value->slug . '&utm_campaign=qsm_plugin' ?>" target="_blank" class="button button-primary">Get This Addon</a>
82
- </div>
83
- <?php } ?>
84
- <?php
85
- }
86
- }
87
- ?>
88
- </div>
89
- <a href="http://quizandsurveymaster.com/addons/?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-bottom&utm_campaign=qsm_plugin" target="_blank" class="button-primary"><?php _e('Browse All Addons', 'quiz-master-next'); ?></a>
90
- </div>
91
- <div class="qsm-news-ads">
92
- <h3 class="qsm-news-ads-title">QSM Bundle</h3>
93
- <?php
94
- if(isset($xml->qsm_bundle)){
95
- ?>
96
- <div class="qsm-info-widget">
97
- <h3><?php echo $xml->qsm_bundle->starter_bundle->name; ?></h3>
98
- <p><?php echo $xml->qsm_bundle->starter_bundle->desc; ?></p>
99
- <button class="button button-default">$<?php echo $xml->qsm_bundle->starter_bundle->price; ?></button>
100
- <a target="_blank" href="<?php echo $xml->qsm_bundle->starter_bundle->link; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary">Get Now</a>
101
- </div>
102
- <div class="qsm-info-widget">
103
- <h3><?php echo $xml->qsm_bundle->premium_bundle->name; ?></h3>
104
- <p><?php echo $xml->qsm_bundle->premium_bundle->desc; ?></p>
105
- <button class="button button-default">$<?php echo $xml->qsm_bundle->premium_bundle->price; ?></button>
106
- <a target="_blank" href="<?php echo $xml->qsm_bundle->premium_bundle->link; ?>?utm_source=qsm-addons-page&utm_medium=plugin&utm_content=all-addons-top&utm_campaign=qsm_plugin" class="button-primary">Get Now</a>
107
- </div>
108
- <?php } ?>
109
- <!-- <div class="remove-ads-adv-link">
110
- <a target="_blank" href="https://quizandsurveymaster.com/downloads/advertisement-gone/"><span class="dashicons dashicons-no-alt"></span> Remove Ads</a>
111
- </div> -->
112
- </div>
113
- <?php
114
- }
115
-
116
- /**
117
- * This function registers the feature add ons tab.
118
- *
119
- * @return void
120
- * @since 4.4.0
121
- */
122
- function qsm_featured_addons_tab() {
123
- global $mlwQuizMasterNext;
124
- $mlwQuizMasterNext->pluginHelper->register_addon_settings_tab(__('Featured Addons', 'quiz-master-next'), 'qsm_generate_featured_addons');
125
- }
126
-
127
- add_action('plugins_loaded', 'qsm_featured_addons_tab');
128
-
129
- /**
130
- * @version 3.2.0
131
- * Display get a free addon page
132
- */
133
- function qsm_display_optin_page() {
134
- wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/admin.js', __FILE__ ), array( 'jquery' ), $mlwQuizMasterNext->version );
135
- ?>
136
- <div class="wrap about-wrap">
137
-
138
- <h1><?php esc_html_e('Get Your Free Addon!', 'quiz-master-next'); ?></h1>
139
-
140
- <div class="about-text"><?php esc_html_e('Wanna get more out of Quiz and Survey Master, but not yet ready to spend the cash? Get one free addon today!', 'quiz-master-next'); ?></div>
141
-
142
- <div class="changelog">
143
-
144
- <div class="row">
145
- <!-- <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
146
- <div class="about-body">
147
- <img src="" alt="Improved Custom Fields">
148
- </div>
149
- </div> -->
150
- <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
151
- <div class="about-body">
152
- <h3><?php esc_attr_e('Advertisment Be Gone', 'quiz-master-next'); ?></h3>
153
- <p><?php esc_attr_e('The Quiz And Survey Master News widgets from the Quizzes/Surveys page as well as all the green bordered ads at the top of pages will disappear when you activate this addon!', 'quiz-master-next'); ?></p>
154
- <p><a href="https://quizandsurveymaster.com/downloads/advertisement-gone/" target="_blank"><?php esc_attr_e('Read more about this addon on our site >', 'quiz-master-next'); ?></a></p>
155
- </div>
156
- </div>
157
- </div>
158
-
159
- <h2><?php esc_html_e('How to Get Your Free Addon', 'quiz-master-next'); ?></h2>
160
-
161
- <p><?php echo sprintf(__('Getting your addon is dead simple: just subscribe to our newsletter and then you will get the free addon by e-mail. We will not spam you. We usually send out newsletters to talk about new features in Awesome Support, let you know when new or updated addons are being released and provide informative articles that show you how to use Awesome Support to its full potential. <a href="%s" %s>View our privacy policy</a>', 'quiz-master-next'), 'https://quizandsurveymaster.com/privacy-policy/', 'target="_blank"'); ?></p>
162
-
163
- <div id="wpas-mailchimp-signup-form-wrapper">
164
- <div id="status"></div>
165
- <form id="sendySignupForm" action="http://sendy.expresstech.io/subscribe" method="POST" accept-charset="utf-8">
166
- <table class="form-table">
167
- <tr>
168
- <td class="row-title"><label for="name">First Name</label> <input type="text" name="name" id="name"/></td>
169
- <td class="row-title">
170
- <label for="email">Email Address</label>
171
- <input type="email" name="email" id="email"/>
172
- <div style="display:none;">
173
- <label for="hp">HP</label><br/>
174
- <input type="text" name="hp" id="hp"/>
175
- </div>
176
- <input type="hidden" name="list" value="4v8zvoyXyTHSS80jeavOpg"/>
177
- <input type="hidden" name="subform" value="yes"/>
178
- <input type="submit" name="submit" id="submit" value="Subscribe" class="button-secondary"/>
179
- </td>
180
- </tr>
181
- </table>
182
- </form>
183
- </div>
184
- </div>
185
-
186
- </div>
187
- <?php
188
- }
189
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/admin-results-details-page.php DELETED
@@ -1,172 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
3
- /**
4
- * This function generates the results details that are shown the results page.
5
- *
6
- * @return type void
7
- * @since 4.4.0
8
- */
9
- function qsm_generate_result_details() {
10
- if ( ! current_user_can( 'moderate_comments' ) ) {
11
- return;
12
- }
13
- global $mlwQuizMasterNext;
14
- $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'results';
15
- $tab_array = $mlwQuizMasterNext->pluginHelper->get_results_tabs();
16
- ?>
17
- <div class="wrap">
18
- <h2><?php _e('Quiz Results', 'quiz-master-next'); ?></h2>
19
- <h2 class="nav-tab-wrapper">
20
- <?php
21
- foreach( $tab_array as $tab ) {
22
- $active_class = '';
23
- if ( $active_tab == $tab['slug'] ) {
24
- $active_class = 'nav-tab-active';
25
- }
26
- echo "<a href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $_GET["result_id"] ) . "&&tab=" . $tab['slug'] . "\" class=\"nav-tab $active_class\">" . $tab['title'] . "</a>";
27
- }
28
- ?>
29
- </h2>
30
- <style type="text/css">
31
- .result-tab-content p{
32
- font-size: 16px;
33
- }
34
- .qmn_question_answer b {
35
- font-size: 18px;
36
- margin-bottom: 0;
37
- display: block;
38
- }
39
- .qmn_question_answer{
40
- margin-bottom: 30px;
41
- font-size: 16px;
42
- line-height: 1.5;
43
- }
44
- </style>
45
- <div class="result-tab-content">
46
- <?php
47
- foreach( $tab_array as $tab ) {
48
- if ( $active_tab == $tab['slug'] ) {
49
- call_user_func( $tab['function'] );
50
- }
51
- }
52
- ?>
53
- </div>
54
- </div>
55
- <?php
56
- }
57
-
58
-
59
- /**
60
- * This function generates the results details tab that shows the details of the quiz
61
- *
62
- * @param type description
63
- * @return void
64
- * @since 4.4.0
65
- */
66
- function qsm_generate_results_details_tab() {
67
-
68
- global $wpdb;
69
- global $mlwQuizMasterNext;
70
-
71
- // Gets results data.
72
- $result_id = intval( $_GET["result_id"] );
73
- $results_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = %d", $result_id ) );
74
-
75
- // Prepare plugin helper.
76
- $quiz_id = intval( $results_data->quiz_id );
77
- $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id );
78
-
79
- $previous_results = $wpdb->get_var( "SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE result_id = (SELECT MAX(result_id) FROM {$wpdb->prefix}mlw_results WHERE deleted = 0 AND result_id < $result_id)" );
80
- $next_results = $wpdb->get_var( "SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE result_id = (SELECT MIN(result_id) FROM {$wpdb->prefix}mlw_results WHERE deleted = 0 AND result_id > $result_id)" );
81
-
82
- // If there is previous or next results, show buttons.
83
- echo '<div style="text-align:right; margin-top: 10px;">';
84
- if ( ! is_null( $previous_results ) && $previous_results ) {
85
- echo "<a class='button' href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $previous_results ) . "\" >View Previous Results</a> ";
86
- }
87
- if ( ! is_null( $next_results ) && $next_results ) {
88
- echo " <a class='button' href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $next_results ) . "\" >View Next Results</a>";
89
- }
90
- echo '</div>';
91
-
92
- // Get template for admin results.
93
- $settings = (array) get_option( 'qmn-settings' );
94
- if ( isset( $settings['results_details_template'] ) ) {
95
- $template = htmlspecialchars_decode( $settings['results_details_template'], ENT_QUOTES );
96
- } else {
97
- $template = "<h2>Quiz Results for %QUIZ_NAME%</h2>
98
- <p>%CONTACT_ALL%</p>
99
- <p>Name Provided: %USER_NAME%</p>
100
- <p>Business Provided: %USER_BUSINESS%</p>
101
- <p>Phone Provided: %USER_PHONE%</p>
102
- <p>Email Provided: %USER_EMAIL%</p>
103
- <p>Score Received: %AMOUNT_CORRECT%/%TOTAL_QUESTIONS% or %CORRECT_SCORE%% or %POINT_SCORE% points</p>
104
- <h2>Answers Provided:</h2>
105
- <p>The user took %TIMER% to complete quiz.</p>
106
- <p>Comments entered were: %COMMENT_SECTION%</p>
107
- <p>The answers were as follows:</p>
108
- %QUESTIONS_ANSWERS%";
109
- }
110
-
111
- // Prepare responses array.
112
- if ( is_serialized( $results_data->quiz_results ) && is_array( @unserialize( $results_data->quiz_results ) ) ) {
113
- $results = unserialize($results_data->quiz_results);
114
- if ( ! isset( $results["contact"] ) ) {
115
- $results["contact"] = array();
116
- }
117
- } else {
118
- $template = str_replace( "%QUESTIONS_ANSWERS%" , $results_data->quiz_results, $template);
119
- $template = str_replace( "%TIMER%" , '', $template);
120
- $template = str_replace( "%COMMENT_SECTION%" , '', $template);
121
- $results = array(
122
- 0,
123
- array(),
124
- '',
125
- 'contact' => array()
126
- );
127
- }
128
-
129
- // Prepare full results array.
130
- $results_array = array(
131
- 'quiz_id' => $results_data->quiz_id,
132
- 'quiz_name' => $results_data->quiz_name,
133
- 'quiz_system' => $results_data->quiz_system,
134
- 'user_name' => $results_data->name,
135
- 'user_business' => $results_data->business,
136
- 'user_email' => $results_data->email,
137
- 'user_phone' => $results_data->phone,
138
- 'user_id' => $results_data->user,
139
- 'timer' => $results[0],
140
- 'time_taken' => $results_data->time_taken,
141
- 'total_points' => $results_data->point_score,
142
- 'total_score' => $results_data->correct_score,
143
- 'total_correct' => $results_data->correct,
144
- 'total_questions' => $results_data->total,
145
- 'comments' => $results[2],
146
- 'question_answers_array' => $results[1],
147
- 'contact' => $results["contact"],
148
- 'results' => $results,
149
- );
150
-
151
- // Pass through template variable filter
152
- $template = apply_filters( 'mlw_qmn_template_variable_results_page', $template, $results_array );
153
- $template = str_replace( "\n" , "<br>", $template );
154
- echo $template;
155
-
156
- // Hook for below admin results
157
- do_action( 'qsm_below_admin_results', $results_array );
158
- }
159
-
160
-
161
- /**
162
- * Generates the results details tab in the quiz results page
163
- *
164
- * @return void
165
- * @since 4.4.0
166
- */
167
- function qsm_results_details_tab() {
168
- global $mlwQuizMasterNext;
169
- $mlwQuizMasterNext->pluginHelper->register_results_settings_tab( __( "Results", 'quiz-master-next' ), "qsm_generate_results_details_tab" );
170
- }
171
- add_action( "plugins_loaded", 'qsm_results_details_tab' );
172
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/admin-results-page.php DELETED
@@ -1,394 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- }
5
-
6
- /**
7
- * This function generates the admin side quiz results page
8
- *
9
- * @return void
10
- * @since 4.4.0
11
- */
12
- function qsm_generate_admin_results_page() {
13
-
14
- // Makes sure user has the right privledges.
15
- if ( ! current_user_can( 'moderate_comments' ) ) {
16
- return;
17
- }
18
-
19
- // Retrieves the current stab and all registered tabs.
20
- global $mlwQuizMasterNext;
21
- $active_tab = strtolower( str_replace( ' ', '-', isset( $_GET['tab'] ) ? $_GET['tab'] : __( 'Quiz Results', 'quiz-master-next' ) ) );
22
- $tab_array = $mlwQuizMasterNext->pluginHelper->get_admin_results_tabs();
23
-
24
- ?>
25
- <div class="wrap">
26
- <h2><?php esc_html_e( 'Quiz Results', 'quiz-master-next' ); ?></h2>
27
- <?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
28
- <?php qsm_show_adverts(); ?>
29
- <h2 class="nav-tab-wrapper">
30
- <?php
31
- // Cycles through the tabs and creates the navigation.
32
- foreach ( $tab_array as $tab ) {
33
- $active_class = '';
34
- if ( $active_tab == $tab['slug'] ) {
35
- $active_class = 'nav-tab-active';
36
- }
37
- $tab_url = "?page=mlw_quiz_results&tab={$tab['slug']}";
38
- ?>
39
- <a href="<?php echo esc_url_raw( $tab_url ); ?>" class="nav-tab <?php echo esc_attr( $active_class ); ?>"><?php echo esc_html( $tab['title'] ); ?></a>
40
- <?php
41
- }
42
- ?>
43
- </h2>
44
- <div>
45
- <?php
46
- // Locates the active tab and calls its content function.
47
- foreach ( $tab_array as $tab ) {
48
- if ( $active_tab == $tab['slug'] ) {
49
- call_user_func( $tab['function'] );
50
- }
51
- }
52
- ?>
53
- </div>
54
- </div>
55
-
56
- <?php
57
-
58
- }
59
-
60
- /**
61
- * Adds Overview Tab To Admin Results Page
62
- *
63
- * @since 5.0.0
64
- * @return void
65
- */
66
- function qsm_results_overview_tab() {
67
- global $mlwQuizMasterNext;
68
- $mlwQuizMasterNext->pluginHelper->register_admin_results_tab( __( 'Quiz Results', 'quiz-master-next' ), 'qsm_results_overview_tab_content' );
69
- }
70
- add_action( 'plugins_loaded', 'qsm_results_overview_tab' );
71
-
72
- /**
73
- * Generates HTML For Overview Tab
74
- *
75
- * @since 5.0.0
76
- * @return void
77
- */
78
- function qsm_results_overview_tab_content() {
79
-
80
- global $wpdb;
81
- global $mlwQuizMasterNext;
82
-
83
- // If nonce is correct, delete results.
84
- if ( isset( $_POST['delete_results_nonce'] ) && wp_verify_nonce( $_POST['delete_results_nonce'], 'delete_results') ) {
85
-
86
- // Variables from delete result form.
87
- $mlw_delete_results_id = intval( $_POST['result_id'] );
88
- $mlw_delete_results_name = sanitize_text_field( $_POST['delete_quiz_name'] );
89
-
90
- // Updates table to mark results as deleted.
91
- $results = $wpdb->update(
92
- $wpdb->prefix . 'mlw_results',
93
- array(
94
- 'deleted' => 1,
95
- ),
96
- array( 'result_id' => $mlw_delete_results_id ),
97
- array(
98
- '%d',
99
- ),
100
- array( '%d' )
101
- );
102
-
103
- if ( false === $results ) {
104
- $error = $wpdb->last_error;
105
- if ( empty( $error ) ) {
106
- $error = __( 'Unknown error', 'quiz-master-next' );
107
- }
108
- $mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There was an error when deleting this result. Error from WordPress: %s', 'quiz-master-next' ), $error ), 'error' );
109
- $mlwQuizMasterNext->log_manager->add( 'Error deleting result', "Tried {$wpdb->last_query} but got $error.", 0, 'error' );
110
- } else {
111
- $mlwQuizMasterNext->alertManager->newAlert( __('Your results has been deleted successfully.','quiz-master-next' ), 'success');
112
- $mlwQuizMasterNext->audit_manager->new_audit( "Results Has Been Deleted From: $mlw_delete_results_name" );
113
-
114
- }
115
- }
116
-
117
- // Check if bulk delete has been selected. If so, verify nonce.
118
- if ( isset( $_POST["bulk_delete"] ) && wp_verify_nonce( $_POST['bulk_delete_nonce'], 'bulk_delete') ) {
119
-
120
- // Ensure the POST variable is an array
121
- if ( is_array( $_POST["delete_results"] ) ) {
122
-
123
- // Cycle through the POST array which should be an array of the result ids of the results the user wishes to delete
124
- foreach( $_POST["delete_results"] as $result ) {
125
-
126
- // Santize by ensuring the value is an int
127
- $result_id = intval( $result );
128
- $wpdb->update(
129
- $wpdb->prefix."mlw_results",
130
- array(
131
- 'deleted' => 1,
132
- ),
133
- array( 'result_id' => $result_id ),
134
- array(
135
- '%d'
136
- ),
137
- array( '%d' )
138
- );
139
- }
140
-
141
- $mlwQuizMasterNext->audit_manager->new_audit( "Results Have Been Bulk Deleted" );
142
- }
143
- }
144
-
145
- // Prepares the SQL to retrieve the results.
146
- $table_limit = 40;
147
- $search_phrase_sql = '';
148
- $order_by_sql = 'ORDER BY result_id DESC';
149
- if ( isset( $_GET['qsm_search_phrase'] ) && ! empty( $_GET['qsm_search_phrase'] ) ) {
150
- // Sanitizes the search phrase and then uses $wpdb->prepare to properly escape the queries after using $wpdb->esc_like.
151
- $sanitized_search_phrase = sanitize_text_field( $_GET['qsm_search_phrase'] );
152
- $search_phrase_percents = '%' . $wpdb->esc_like( $sanitized_search_phrase ) . '%';
153
- $search_phrase_sql = $wpdb->prepare( ' AND (quiz_name LIKE %s OR name LIKE %s OR business LIKE %s OR email LIKE %s OR phone LIKE %s)', $search_phrase_percents, $search_phrase_percents, $search_phrase_percents, $search_phrase_percents, $search_phrase_percents );
154
- $qsm_results_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(result_id) FROM {$wpdb->prefix}mlw_results WHERE deleted='0' AND (quiz_name LIKE %s OR name LIKE %s OR business LIKE %s OR email LIKE %s OR phone LIKE %s)", $search_phrase_percents, $search_phrase_percents, $search_phrase_percents, $search_phrase_percents, $search_phrase_percents ) );
155
- } else {
156
- $qsm_results_count = $wpdb->get_var( "SELECT COUNT(result_id) FROM {$wpdb->prefix}mlw_results WHERE deleted = '0'" );
157
- }
158
-
159
- // Gets the order by arg. Uses switch to create SQL to prevent SQL injection.
160
- if ( isset( $_GET['qmn_order_by'] ) ) {
161
- switch ( $_GET['qmn_order_by'] ) {
162
- case 'quiz_name':
163
- $order_by = 'quiz_name';
164
- $order_by_sql = ' ORDER BY quiz_name DESC';
165
- break;
166
- case 'name':
167
- $order_by = 'name';
168
- $order_by_sql = ' ORDER BY name DESC';
169
- break;
170
- case 'point_score':
171
- $order_by = 'point_score';
172
- $order_by_sql = ' ORDER BY point_score DESC';
173
- break;
174
- case 'correct_score':
175
- $order_by = 'correct_score';
176
- $order_by_sql = ' ORDER BY correct_score DESC';
177
- break;
178
- default:
179
- $order_by = 'quiz_name';
180
- $order_by_sql = ' ORDER BY result_id DESC';
181
- }
182
- }
183
-
184
- if ( isset( $_GET['qsm_results_page'] ) ) {
185
- $result_page = intval( $_GET['qsm_results_page'] ) + 1;
186
- $result_begin = $table_limit * $result_page;
187
- } else {
188
- $result_page = 0;
189
- $result_begin = 0;
190
- }
191
- $results_left = $qsm_results_count - ( $result_page * $table_limit );
192
- if ( isset( $_GET['quiz_id'] ) && ! empty( $_GET['quiz_id'] ) ) {
193
- $quiz_id = intval( $_GET['quiz_id'] );
194
- $mlw_quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE deleted='0' AND quiz_id = %d $search_phrase_sql $order_by_sql LIMIT %d, %d", $quiz_id, $result_begin, $table_limit ) );
195
- } else {
196
- $mlw_quiz_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE deleted = '0' $search_phrase_sql $order_by_sql LIMIT %d, %d", $result_begin, $table_limit ) );
197
- }
198
-
199
- wp_enqueue_script( 'jquery' );
200
- wp_enqueue_script( 'jquery-ui-core' );
201
- wp_enqueue_script( 'jquery-ui-dialog' );
202
- wp_enqueue_script( 'jquery-ui-button' );
203
- wp_enqueue_script( 'qmn_admin_js', plugins_url( '../../js/admin.js', __FILE__ ) );
204
- wp_enqueue_style( 'qmn_jquery_redmond_theme', plugins_url( '../../css/jquery-ui.css', __FILE__ ) );
205
- ?>
206
- <script type="text/javascript">
207
- var $j = jQuery.noConflict();
208
- function deleteResults(id,quizName){
209
- $j("#delete_dialog").dialog({
210
- autoOpen: false,
211
- buttons: {
212
- Cancel: function() {
213
- $j(this).dialog('close');
214
- }
215
- }
216
- });
217
- $j("#delete_dialog").dialog('open');
218
- var idHidden = document.getElementById("result_id");
219
- var idHiddenName = document.getElementById("delete_quiz_name");
220
- idHidden.value = id;
221
- idHiddenName.value = quizName;
222
- };
223
- </script>
224
- <div class="tablenav top">
225
- <div class="alignleft actions bulkactions">
226
- <a href="javascript: document.bulk_delete_form.submit();" class="button action">Bulk Delete</a>
227
- </div>
228
- <div class="tablenav-pages">
229
- <span class="displaying-num"><?php echo sprintf(_n('One result', '%s results', $qsm_results_count, 'quiz-master-next' ), number_format_i18n($qsm_results_count)); ?></span>
230
- <span class="pagination-links">
231
- <?php
232
- $mlw_qmn_previous_page = 0;
233
- $mlw_current_page = $result_page+1;
234
- $mlw_total_pages = ceil( $qsm_results_count / $table_limit );
235
-
236
- $url_query_string = '';
237
- if ( isset( $_GET['quiz_id'] ) && ! empty( $_GET['quiz_id'] ) ) {
238
- $url_query_string .= '&&quiz_id=' . intval( $_GET['quiz_id'] );
239
- }
240
-
241
- if ( isset( $_GET['qsm_search_phrase'] ) && ! empty( $_GET['qsm_search_phrase'] ) ) {
242
- $url_query_string .= "&&qsm_search_phrase=$sanitized_search_phrase";
243
- }
244
-
245
- if ( isset( $_GET['qmn_order_by'] ) && !empty( $_GET['qmn_order_by'] ) ) {
246
- $url_query_string .= "&&qmn_order_by=$order_by";
247
- }
248
-
249
- if ( $result_page > 0 ) {
250
- $mlw_qmn_previous_page = $result_page - 2;
251
- ?>
252
- <a class="prev-page button" href="<?php echo esc_url_raw( "?page=mlw_quiz_results&&qsm_results_page=$mlw_qmn_previous_page$url_query_string" ); ?>"><</a>
253
- <span class="paging-input"><?php echo esc_html( $mlw_current_page ); ?> of <?php echo esc_html( $mlw_total_pages ); ?></span>
254
- <?php
255
- if ( $results_left > $table_limit ) {
256
- ?>
257
- <a class="next-page button" href="<?php echo esc_url_raw( "?page=mlw_quiz_results&&qsm_results_page=$result_page$url_query_string" ); ?>">></a>
258
- <?php
259
- }
260
- } elseif ( 0 == $result_page ) {
261
- if ( $results_left > $table_limit ) {
262
- ?>
263
- <span class="paging-input"><?php echo esc_html( $mlw_current_page ); ?> of <?php echo esc_html( $mlw_total_pages ); ?></span>
264
- <a class="next-page button" href="<?php echo esc_url_raw( "?page=mlw_quiz_results&&qsm_results_page=$result_page$url_query_string" ); ?>">></a>
265
- <?php
266
- }
267
- } elseif ( $results_left < $table_limit ) {
268
- $mlw_qmn_previous_page = $result_page - 2;
269
- ?>
270
- <a class="prev-page button" href="<?php echo esc_url_raw( "?page=mlw_quiz_results&&qsm_results_page=$mlw_qmn_previous_page$url_query_string" ); ?>"><</a>
271
- <span class="paging-input"><?php echo esc_html( $mlw_current_page ); ?> of <?php echo esc_html( $mlw_total_pages ); ?></span>
272
- <a class="next-page button" href="<?php echo esc_url_raw( "?page=mlw_quiz_results&&qsm_results_page=$result_page$url_query_string" ); ?>">></a>
273
- <?php
274
- }
275
- ?>
276
- </span>
277
- <br class="clear">
278
- </div>
279
- </div>
280
- <form action='' method="get">
281
- <?php
282
- if ( isset( $_GET['quiz_id'] ) ) {
283
- ?>
284
- <input type="hidden" name="quiz_id" value="<?php echo esc_attr( intval( $_GET['quiz_id'] ) ); ?>" />
285
- <?php
286
- }
287
- ?>
288
- <input type="hidden" name="page" value="mlw_quiz_results">
289
- <p class="search-box">
290
- <label for="qsm_search_phrase"><?php esc_html_e( 'Search Results', 'quiz-master-next' ); ?></label>
291
- <input type="search" id="qsm_search_phrase" name="qsm_search_phrase" value="">
292
- <label for="qmn_order_by"><?php esc_html_e( 'Order By', 'quiz-master-next' ); ?></label>
293
- <select id="qmn_order_by" name="qmn_order_by">
294
- <option value="quiz_name"><?php esc_html_e( 'Quiz Name', 'quiz-master-next' ); ?></option>
295
- <option value="name"><?php esc_html_e( 'User Name', 'quiz-master-next' ); ?></option>
296
- <option value="point_score"><?php esc_html_e( 'Points', 'quiz-master-next' ); ?></option>
297
- <option value="correct_score"><?php esc_html_e( 'Correct Percent', 'quiz-master-next' ); ?></option>
298
- <option value="default"><?php esc_html_e( 'Default (Time)', 'quiz-master-next' ); ?></option>
299
- </select>
300
- <button class="button"><?php esc_html_e( 'Search Results', 'quiz-master-next' ); ?></button>
301
- </p>
302
- </form>
303
- <form action="" method="post" name="bulk_delete_form">
304
- <input type="hidden" name="bulk_delete" value="confirmation" />
305
- <?php wp_nonce_field( 'bulk_delete','bulk_delete_nonce' ); ?>
306
- <table class=widefat>
307
- <thead>
308
- <tr>
309
- <th><input type="checkbox" id="qmn_check_all" /></th>
310
- <th><?php esc_html_e( 'Actions','quiz-master-next' ); ?></th>
311
- <th><?php esc_html_e( 'Quiz Name','quiz-master-next' ); ?></th>
312
- <th><?php esc_html_e( 'Score','quiz-master-next' ); ?></th>
313
- <th><?php esc_html_e( 'Time To Complete','quiz-master-next' ); ?></th>
314
- <th><?php esc_html_e( 'Name','quiz-master-next' ); ?></th>
315
- <th><?php esc_html_e( 'Business','quiz-master-next' ); ?></th>
316
- <th><?php esc_html_e( 'Email','quiz-master-next' ); ?></th>
317
- <th><?php esc_html_e( 'Phone','quiz-master-next' ); ?></th>
318
- <th><?php esc_html_e( 'User','quiz-master-next' ); ?></th>
319
- <th><?php esc_html_e( 'Time Taken','quiz-master-next' ); ?></th>
320
- <th><?php esc_html_e( 'IP Address','quiz-master-next' ); ?></th>
321
- </tr>
322
- </thead>
323
- <?php
324
- $quotes_list = "";
325
- $display = "";
326
- $alternate = "";
327
- foreach ( $mlw_quiz_data as $mlw_quiz_info ) {
328
- if ( $alternate ) {
329
- $alternate = '';
330
- } else {
331
- $alternate = ' class="alternate"';
332
- }
333
- $mlw_complete_time = '';
334
- $mlw_qmn_results_array = @unserialize($mlw_quiz_info->quiz_results);
335
- if ( is_array( $mlw_qmn_results_array ) ) {
336
- $mlw_complete_hours = floor($mlw_qmn_results_array[0] / 3600);
337
- if ( $mlw_complete_hours > 0 ) {
338
- $mlw_complete_time .= "$mlw_complete_hours hours ";
339
- }
340
- $mlw_complete_minutes = floor(($mlw_qmn_results_array[0] % 3600) / 60);
341
- if ( $mlw_complete_minutes > 0 ) {
342
- $mlw_complete_time .= "$mlw_complete_minutes minutes ";
343
- }
344
- $mlw_complete_seconds = $mlw_qmn_results_array[0] % 60;
345
- $mlw_complete_time .= "$mlw_complete_seconds seconds";
346
- }
347
-
348
- $quotes_list .= "<tr{$alternate}>";
349
- $quotes_list .= "<td><input type='checkbox' class='qmn_delete_checkbox' name='delete_results[]' value='".$mlw_quiz_info->result_id. "' /></td>";
350
- $quotes_list .= "<td><span style='color:green;font-size:16px;'><a href='admin.php?page=qsm_quiz_result_details&&result_id=".$mlw_quiz_info->result_id."'>View</a>|<a onclick=\"deleteResults('".$mlw_quiz_info->result_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='#'>Delete</a></span></td>";
351
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name . "</span></td>";
352
- if ( $mlw_quiz_info->quiz_system == 0 ) {
353
- $quotes_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_quiz_info->correct ." out of ".$mlw_quiz_info->total." or ".$mlw_quiz_info->correct_score."%</span></td>";
354
- }
355
- if ( $mlw_quiz_info->quiz_system == 1 ) {
356
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->point_score . " Points</span></td>";
357
- }
358
- if ( $mlw_quiz_info->quiz_system == 2 ) {
359
- $quotes_list .= "<td><span style='font-size:16px;'>".__('Not Graded','quiz-master-next' )."</span></td>";
360
- }
361
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_complete_time ."</span></td>";
362
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->name ."</span></td>";
363
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->business ."</span></td>";
364
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->email ."</span></td>";
365
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->phone ."</span></td>";
366
- if ( 0 == $mlw_quiz_info->user ) {
367
- $quotes_list .= "<td><span style='font-size:16px;'>Visitor</span></td>";
368
- } else {
369
- $quotes_list .= "<td><span style='font-size:16px;'><a href='user-edit.php?user_id=" . $mlw_quiz_info->user ."'>" . $mlw_quiz_info->user ."</a></span></td>";
370
- }
371
- $date = date_i18n( get_option( 'date_format' ), strtotime( $mlw_quiz_info->time_taken ) );
372
- $time = date( "h:i:s A", strtotime( $mlw_quiz_info->time_taken ) );
373
- $quotes_list .= "<td><span style='font-size:16px;'>$date $time</span></td>";
374
- $quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->user_ip . "</span></td>";
375
- $quotes_list .= "</tr>";
376
- }
377
- $display .= "<tbody id=\"the-list\">{$quotes_list}</tbody>";
378
- echo $display;
379
- ?>
380
- </table>
381
- </form>
382
-
383
- <div id="delete_dialog" title="Delete Results?" style="display:none;">
384
- <h3><b><?php esc_html_e( 'Are you sure you want to delete these results?','quiz-master-next' ); ?></b></h3>
385
- <form action='' method='post'>
386
- <?php wp_nonce_field( 'delete_results','delete_results_nonce' ); ?>
387
- <input type='hidden' id='result_id' name='result_id' value='' />
388
- <input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />
389
- <p class='submit'><input type='submit' class='button-primary' value='<?php esc_html_e( 'Delete Results','quiz-master-next' ); ?>' /></p>
390
- </form>
391
- </div>
392
- <?php
393
- }
394
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/dashboard-widgets.php DELETED
@@ -1,280 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
3
-
4
- /**
5
- * This function adds a widget to the dashboard in wordpress.
6
- *
7
- * @return void
8
- * @since 4.4.0
9
- */
10
- function qmn_add_dashboard_widget()
11
- {
12
- if ( current_user_can( 'publish_posts' ) )
13
- {
14
- wp_add_dashboard_widget(
15
- 'qmn_snapshot_widget',
16
- __('Quiz And Survey Master Snapshot', 'quiz-master-next'),
17
- 'qmn_snapshot_dashboard_widget'
18
- );
19
- }
20
- }
21
-
22
- add_action( 'wp_dashboard_setup', 'qmn_add_dashboard_widget' );
23
-
24
- /**
25
- * This function creates the actual widget that is added to the dashboard.
26
- *
27
- * This widget adds things like the most popular/least popular quiz. How many people have taken the quiz etc.
28
- * @param type description
29
- * @return type description
30
- * @since 4.4.0
31
- */
32
- function qmn_snapshot_dashboard_widget()
33
- {
34
- global $wpdb;
35
- $mlw_qmn_today_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '" . date( "Y-m-d", current_time( 'timestamp' ) )." 00:00:00' AND '" . date( "Y-m-d", current_time( 'timestamp' ) )." 23:59:59') AND deleted=0");
36
- $mlw_last_week = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
37
- $mlw_last_week = date("Y-m-d", $mlw_last_week);
38
- $mlw_qmn_last_weekday_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0");
39
- if ($mlw_qmn_last_weekday_taken != 0)
40
- {
41
- $mlw_qmn_analyze_today = round((($mlw_qmn_today_taken - $mlw_qmn_last_weekday_taken) / $mlw_qmn_last_weekday_taken) * 100, 2);
42
- }
43
- else
44
- {
45
- $mlw_qmn_analyze_today = $mlw_qmn_today_taken * 100;
46
- }
47
-
48
- $mlw_this_week = mktime(0, 0, 0, date("m") , date("d")-6, date("Y"));
49
- $mlw_this_week = date("Y-m-d", $mlw_this_week);
50
- $mlw_qmn_this_week_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_week." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
51
-
52
- $mlw_last_week_start = mktime(0, 0, 0, date("m") , date("d")-13, date("Y"));
53
- $mlw_last_week_start = date("Y-m-d", $mlw_last_week_start);
54
- $mlw_last_week_end = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
55
- $mlw_last_week_end = date("Y-m-d", $mlw_last_week_end);
56
- $mlw_qmn_last_week_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week_start." 00:00:00' AND '".$mlw_last_week_end." 23:59:59') AND deleted=0");
57
-
58
- if ($mlw_qmn_last_week_taken != 0)
59
- {
60
- $mlw_qmn_analyze_week = round((($mlw_qmn_this_week_taken - $mlw_qmn_last_week_taken) / $mlw_qmn_last_week_taken) * 100, 2);
61
- }
62
- else
63
- {
64
- $mlw_qmn_analyze_week = $mlw_qmn_this_week_taken * 100;
65
- }
66
-
67
- $mlw_this_month = mktime(0, 0, 0, date("m") , date("d")-29, date("Y"));
68
- $mlw_this_month = date("Y-m-d", $mlw_this_month);
69
- $mlw_qmn_this_month_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_month." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
70
-
71
- $mlw_last_month_start = mktime(0, 0, 0, date("m") , date("d")-59, date("Y"));
72
- $mlw_last_month_start = date("Y-m-d", $mlw_last_month_start);
73
- $mlw_last_month_end = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
74
- $mlw_last_month_end = date("Y-m-d", $mlw_last_month_end);
75
- $mlw_qmn_last_month_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_month_start." 00:00:00' AND '".$mlw_last_month_end." 23:59:59') AND deleted=0");
76
-
77
- if ($mlw_qmn_last_month_taken != 0)
78
- {
79
- $mlw_qmn_analyze_month = round((($mlw_qmn_this_month_taken - $mlw_qmn_last_month_taken) / $mlw_qmn_last_month_taken) * 100, 2);
80
- }
81
- else
82
- {
83
- $mlw_qmn_analyze_month = $mlw_qmn_this_month_taken * 100;
84
- }
85
-
86
- $mlw_this_quater = mktime(0, 0, 0, date("m") , date("d")-89, date("Y"));
87
- $mlw_this_quater = date("Y-m-d", $mlw_this_quater);
88
- $mlw_qmn_this_quater_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_quater." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
89
-
90
- $mlw_last_quater_start = mktime(0, 0, 0, date("m") , date("d")-179, date("Y"));
91
- $mlw_last_quater_start = date("Y-m-d", $mlw_last_quater_start);
92
- $mlw_last_quater_end = mktime(0, 0, 0, date("m") , date("d")-90, date("Y"));
93
- $mlw_last_quater_end = date("Y-m-d", $mlw_last_quater_end);
94
- $mlw_qmn_last_quater_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_quater_start." 00:00:00' AND '".$mlw_last_quater_end." 23:59:59') AND deleted=0");
95
-
96
- if ($mlw_qmn_last_quater_taken != 0)
97
- {
98
- $mlw_qmn_analyze_quater = round((($mlw_qmn_this_quater_taken - $mlw_qmn_last_quater_taken) / $mlw_qmn_last_quater_taken) * 100, 2);
99
- }
100
- else
101
- {
102
- $mlw_qmn_analyze_quater = $mlw_qmn_this_quater_taken * 100;
103
- }
104
-
105
- $mlw_stat_total_active_quiz = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0 LIMIT 1" );
106
- $mlw_stat_total_questions = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_questions WHERE deleted=0 LIMIT 1" );
107
-
108
- $mlw_stat_most_popular_quiz = $wpdb->get_row( "SELECT quiz_name FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0 ORDER BY quiz_taken Desc LIMIT 1" );
109
- $mlw_stat_least_popular_quiz = $wpdb->get_row( "SELECT quiz_name FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0 ORDER BY quiz_taken ASC LIMIT 1" );
110
- ?>
111
- <style>
112
- .qmn_dashboard_list
113
- {
114
- overflow: hidden;
115
- margin: 0;
116
- }
117
- .qmn_dashboard_list li:first-child
118
- {
119
- border-top: 0;
120
- }
121
- .qmn_full_width
122
- {
123
- width: 100%;
124
- }
125
- .qmn_half_width
126
- {
127
- width: 50%;
128
- }
129
- .qmn_dashboard_element
130
- {
131
- float: left;
132
- padding: 0;
133
- -webkit-box-sizing: border-box;
134
- -moz-box-sizing: border-box;
135
- box-sizing: border-box;
136
- margin: 0;
137
- border-top: 1px solid #ececec;
138
- color: #aaa;
139
- }
140
- .qmn_dashboard_inside
141
- {
142
- display: block;
143
- color: #aaa;
144
- padding: 9px 12px;
145
- -webkit-transition: all ease .5s;
146
- position: relative;
147
- font-size: 12px;
148
- }
149
- .qmn_dashboard_inside strong
150
- {
151
- font-size: 18px;
152
- line-height: 1.2em;
153
- font-weight: 400;
154
- display: block;
155
- color: #21759b;
156
- }
157
- .qmn_dashboard_graph
158
- {
159
- width: 25%;
160
- height: 10px;
161
- display: block;
162
- float: right;
163
- position: absolute;
164
- right: 0;
165
- top: 50%;
166
- margin-right: 12px;
167
- margin-top: -1.25em;
168
- font-size: 18px
169
- }
170
- .qmn_dashboard_graph img
171
- {
172
- width: 15px;
173
- height: 15px;
174
- }
175
- </style>
176
- <ul class="qmn_dashboard_list">
177
- <li class="qmn_dashboard_element qmn_full_width">
178
- <div class="qmn_dashboard_inside">
179
- <strong><?php echo $mlw_qmn_today_taken; ?></strong>
180
- <?php _e('quizzes taken today', 'quiz-master-next'); ?>
181
- <span class="qmn_dashboard_graph">
182
- <?php
183
- echo $mlw_qmn_analyze_today."% ";
184
- if ($mlw_qmn_analyze_today >= 0)
185
- {
186
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/green_triangle.png'/>";
187
- }
188
- else
189
- {
190
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/red_triangle.png'/>";
191
- }
192
- ?>
193
- </span>
194
- </div>
195
- </li>
196
- <li class="qmn_dashboard_element qmn_full_width">
197
- <div class="qmn_dashboard_inside">
198
- <strong><?php echo $mlw_qmn_this_week_taken; ?></strong>
199
- <?php _e('quizzes taken last 7 days', 'quiz-master-next'); ?>
200
- <span class="qmn_dashboard_graph">
201
- <?php
202
- echo $mlw_qmn_analyze_week."% ";
203
- if ($mlw_qmn_analyze_week >= 0)
204
- {
205
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/green_triangle.png'/>";
206
- }
207
- else
208
- {
209
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/red_triangle.png'/>";
210
- }
211
- ?>
212
- </span>
213
- </div>
214
- </li>
215
- <li class="qmn_dashboard_element qmn_full_width">
216
- <div class="qmn_dashboard_inside">
217
- <strong><?php echo $mlw_qmn_this_month_taken; ?></strong>
218
- <?php _e('quizzes taken last 30 days', 'quiz-master-next'); ?>
219
- <span class="qmn_dashboard_graph">
220
- <?php
221
- echo $mlw_qmn_analyze_month."% ";
222
- if ($mlw_qmn_analyze_month >= 0)
223
- {
224
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/green_triangle.png'/>";
225
- }
226
- else
227
- {
228
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/red_triangle.png'/>";
229
- }
230
- ?>
231
- </span>
232
- </div>
233
- </li>
234
- <li class="qmn_dashboard_element qmn_full_width">
235
- <div class="qmn_dashboard_inside">
236
- <strong><?php echo $mlw_qmn_this_quater_taken; ?></strong>
237
- <?php _e('quizzes taken last 120 days', 'quiz-master-next'); ?>
238
- <span class="qmn_dashboard_graph">
239
- <?php
240
- echo $mlw_qmn_analyze_quater."% ";
241
- if ($mlw_qmn_analyze_quater >= 0)
242
- {
243
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/green_triangle.png'/>";
244
- }
245
- else
246
- {
247
- echo "<img src='".plugin_dir_url( __FILE__ )."../images/red_triangle.png'/>";
248
- }
249
- ?>
250
- </span>
251
- </div>
252
- </li>
253
- <li class="qmn_dashboard_element qmn_half_width">
254
- <div class="qmn_dashboard_inside">
255
- <strong><?php echo $mlw_stat_total_active_quiz; ?></strong>
256
- <?php _e('total active quizzes', 'quiz-master-next'); ?>
257
- </div>
258
- </li>
259
- <li class="qmn_dashboard_element qmn_half_width">
260
- <div class="qmn_dashboard_inside">
261
- <strong><?php echo $mlw_stat_total_questions; ?></strong>
262
- <?php _e('total active questions', 'quiz-master-next'); ?>
263
- </div>
264
- </li>
265
- <li class="qmn_dashboard_element qmn_half_width">
266
- <div class="qmn_dashboard_inside">
267
- <strong><?php if (!is_null($mlw_stat_most_popular_quiz)) { echo $mlw_stat_most_popular_quiz->quiz_name; } ?></strong>
268
- <?php _e('most popular quiz', 'quiz-master-next'); ?>
269
- </div>
270
- </li>
271
- <li class="qmn_dashboard_element qmn_half_width">
272
- <div class="qmn_dashboard_inside">
273
- <strong><?php if (!is_null($mlw_stat_least_popular_quiz)) { echo $mlw_stat_least_popular_quiz->quiz_name; } ?></strong>
274
- <?php _e('least popular quiz', 'quiz-master-next'); ?>
275
- </div>
276
- </li>
277
- </ul>
278
- <?php
279
- }
280
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/functions.php DELETED
@@ -1,13 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/help-page.php DELETED
@@ -1,166 +0,0 @@
1
- <?php
2
- /**
3
- * Creates the Help page within the admin area
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * This function generates the help page.
14
- *
15
- * @return void
16
- * @since 6.2.0
17
- */
18
- function qsm_generate_help_page() {
19
- if ( ! current_user_can( 'moderate_comments' ) ) {
20
- return;
21
- }
22
-
23
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ) );
24
-
25
- // Creates the widgets.
26
- add_meta_box( 'wpss_mrts', __( 'Need Help?', 'quiz-master-next' ), 'qsm_documentation_meta_box_content', 'meta_box_help' );
27
- add_meta_box( 'wpss_mrts', __( 'System Info', 'quiz-master-next' ), 'qsm_system_meta_box_content', 'meta_box_sys_info' );
28
- ?>
29
- <div class="wrap">
30
- <h2><?php esc_html_e( 'Help Page', 'quiz-master-next' ); ?></h2>
31
- <?php qsm_show_adverts(); ?>
32
-
33
- <!--Display Widget Boxes-->
34
- <div style="width:100%;" class="inner-sidebar1">
35
- <?php do_meta_boxes( 'meta_box_help', 'advanced', '' ); ?>
36
- </div>
37
-
38
- <div style="width:100%;" class="inner-sidebar1">
39
- <?php do_meta_boxes( 'meta_box_sys_info', 'advanced', '' ); ?>
40
- </div>
41
-
42
- </div>
43
- <?php
44
- }
45
-
46
- /**
47
- * This function creates the text that is displayed on the help page.
48
- *
49
- * @return void
50
- * @since 4.4.0
51
- */
52
- function qsm_documentation_meta_box_content() {
53
- ?>
54
- <p><?php esc_html_e( 'Need help with the plugin? Try any of the following:', 'quiz-master-next' ); ?></p>
55
- <ul>
56
- <li>For assistance in using the plugin, read our <a href="https://docs.quizandsurveymaster.com" target="_blank">documentation</a></li>
57
- <li>For support, fill out the form on our <a href="https://quizandsurveymaster.com/quiz/contact/?utm_source=qsm-help-page&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=contact_us" target="_blank">Contact Us Page</a></li>
58
- </ul>
59
- <?php
60
- }
61
-
62
- /**
63
- * This function echoes out the system info for the user.
64
- *
65
- * @return void
66
- * @since 4.4.0
67
- */
68
- function qsm_system_meta_box_content() {
69
- echo qsm_get_system_info();
70
- }
71
-
72
- /**
73
- * This function gets the content that is in the system info
74
- *
75
- * @return return string This contains all of the system info from the admins server.
76
- * @since 4.4.0
77
- */
78
- function qsm_get_system_info() {
79
- global $wpdb;
80
- global $mlwQuizMasterNext;
81
-
82
- $sys_info = '';
83
-
84
- $theme_data = wp_get_theme();
85
- $theme = $theme_data->Name . ' ' . $theme_data->Version;
86
- $parent_theme = $theme_data->Template;
87
- if ( ! empty( $parent_theme ) ) {
88
- $parent_theme_data = wp_get_theme( $parent_theme );
89
- $parent_theme = $parent_theme_data->Name . ' ' . $parent_theme_data->Version;
90
- }
91
-
92
- $sys_info .= '<h3>Site Information</h3><br />';
93
- $sys_info .= 'Site URL: ' . site_url() . '<br />';
94
- $sys_info .= 'Home URL: ' . home_url() . '<br />';
95
- $sys_info .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . '<br />';
96
-
97
- $sys_info .= '<h3>WordPress Information</h3><br />';
98
- $sys_info .= 'Version: ' . get_bloginfo( 'version' ) . '<br />';
99
- $sys_info .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . '<br />';
100
- $sys_info .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . '<br>';
101
- $sys_info .= "Active Theme: {$theme}<br />";
102
- $sys_info .= "Parent Theme: {$parent_theme}<br>";
103
- $sys_info .= 'Debug Mode: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . '<br />';
104
- $sys_info .= 'Memory Limit: ' . WP_MEMORY_LIMIT . '<br />';
105
-
106
- $sys_info .= '<h3>Plugins Information</h3><br />';
107
- $plugin_mu = get_mu_plugins();
108
- if ( count( $plugin_mu ) > 0 ) {
109
- $sys_info .= '<h4>Must Use</h4><br />';
110
- foreach ( $plugin_mu as $plugin => $plugin_data ) {
111
- $sys_info .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "<br />";
112
- }
113
- }
114
- $sys_info .= '<h4>Active</h4><br />';
115
- $plugins = get_plugins();
116
- $active_plugins = get_option( 'active_plugins', array() );
117
- foreach ( $plugins as $plugin_path => $plugin ) {
118
- if ( ! in_array( $plugin_path, $active_plugins ) ) {
119
- continue;
120
- }
121
- $sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
122
- }
123
- $sys_info .= '<h4>Inactive</h4><br />';
124
- foreach ( $plugins as $plugin_path => $plugin ) {
125
- if ( in_array( $plugin_path, $active_plugins ) ) {
126
- continue;
127
- }
128
- $sys_info .= $plugin['Name'] . ': ' . $plugin['Version'] . '<br />';
129
- }
130
-
131
- $sys_info .= '<h3>Server Information</h3><br />';
132
- $sys_info .= 'PHP : ' . PHP_VERSION . '<br />';
133
- $sys_info .= 'MySQL : ' . $wpdb->db_version() . '<br />';
134
- $sys_info .= 'Webserver : ' . $_SERVER['SERVER_SOFTWARE'] . '<br />';
135
-
136
- $total_quizzes = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_quizzes LIMIT 1" );
137
- $total_active_quizzes = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0 LIMIT 1" );
138
- $total_questions = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_questions LIMIT 1" );
139
- $total_active_questions = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_questions WHERE deleted = 0 LIMIT 1" );
140
- $total_results = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_results LIMIT 1" );
141
- $total_active_results = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_results WHERE deleted = 0 LIMIT 1" );
142
-
143
- $sys_info .= '<h3>QSM Information</h3><br />';
144
- $sys_info .= 'Initial Version : ' . get_option( 'qmn_original_version' ) . '<br />';
145
- $sys_info .= 'Current Version : ' . $mlwQuizMasterNext->version . '<br />';
146
- $sys_info .= "Total Quizzes : {$total_quizzes}<br />";
147
- $sys_info .= "Total Active Quizzes : {$total_active_quizzes}<br />";
148
- $sys_info .= "Total Questions : {$total_questions}<br />";
149
- $sys_info .= "Total Active Questions : {$total_active_questions}<br />";
150
- $sys_info .= "Total Results : {$total_results}<br />";
151
- $sys_info .= "Total Active Results : {$total_active_results}<br />";
152
-
153
- $sys_info .= '<h3>QSM Recent Logs</h3><br />';
154
- $recent_errors = $mlwQuizMasterNext->log_manager->get_logs();
155
- if ( $recent_errors ) {
156
- foreach ( $recent_errors as $error ) {
157
- $sys_info .= "Log created at {$error->post_date}: {$error->post_title} - {$error->post_content}<br />";
158
- }
159
- } else {
160
- $sys_info .= 'No recent logs<br />';
161
- }
162
-
163
- return $sys_info;
164
- }
165
-
166
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/index.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- die("Error: Unauthorized Access");
4
- ?>
 
 
 
 
trunk/php/admin/options-page-contact-tab.php DELETED
@@ -1,78 +0,0 @@
1
- <?php
2
-
3
- // Exit if accessed directly
4
- if ( ! defined( 'ABSPATH' ) ) exit;
5
-
6
- /**
7
- * This function adds the contact tab using our API.
8
- *
9
- * @return type description
10
- * @since 4.7.0
11
- */
12
- function qsm_settings_contact_tab() {
13
- global $mlwQuizMasterNext;
14
- $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( "Contact", 'quiz-master-next' ), 'qsm_options_contact_tab_content' );
15
- }
16
- add_action("plugins_loaded", 'qsm_settings_contact_tab', 5);
17
-
18
- /**
19
- * Adds the content for the options for contact tab.
20
- *
21
- * @return void
22
- * @since 4.7.0
23
- */
24
- function qsm_options_contact_tab_content() {
25
- global $wpdb;
26
- global $mlwQuizMasterNext;
27
- $quiz_id = intval( $_GET["quiz_id"] );
28
-
29
- $contact_form = QSM_Contact_Manager::load_fields();
30
-
31
- wp_enqueue_script( 'qsm_contact_admin_script', plugins_url( '../../js/qsm-admin-contact.js' , __FILE__ ), array( 'jquery-ui-sortable' ), $mlwQuizMasterNext->version );
32
- wp_localize_script( 'qsm_contact_admin_script', 'qsmContactObject', array( 'contactForm' => $contact_form, 'quizID' => $quiz_id ) );
33
- wp_enqueue_style( 'qsm_contact_admin_style', plugins_url( '../../css/qsm-admin-contact.css' , __FILE__ ), array(), $mlwQuizMasterNext->version );
34
-
35
- /**
36
- * Example contact form array
37
- * array(
38
- * array(
39
- * 'label' => 'Name',
40
- * 'type' => 'text',
41
- * 'answers' => array(
42
- * 'one',
43
- * 'two'
44
- * ),
45
- * 'required' => true
46
- * )
47
- * )
48
- */
49
-
50
- ?>
51
- <h2><?php _e( 'Contact', 'quiz-master-next' ); ?></h2>
52
- <p>Need assistance with this tab? <a href="https://docs.quizandsurveymaster.com/article/20-collecting-users-information-using-contact-fields" target="_blank">Check out the documentation</a> for this tab!</p>
53
- <div class="contact-message"></div>
54
- <a class="save-contact button-primary"><?php _e( 'Save Contact Fields', 'quiz-master-next' ); ?></a>
55
- <div class="contact-form"></div>
56
- <a class="add-contact-field button-primary"><?php _e( 'Add New Field', 'quiz-master-next' ); ?></a>
57
- <?php
58
- }
59
-
60
- add_action( 'wp_ajax_qsm_save_contact', 'qsm_contact_form_admin_ajax' );
61
- add_action( 'wp_ajax_nopriv_qsm_save_contact', 'qsm_contact_form_admin_ajax' );
62
-
63
- /**
64
- * Saves the contact form from the quiz settings tab
65
- *
66
- * @since 0.1.0
67
- * @return void
68
- */
69
- function qsm_contact_form_admin_ajax() {
70
- global $wpdb;
71
- global $mlwQuizMasterNext;
72
- // Sends posted form data to Contact Manager to sanitize and save.
73
- $results['status'] = QSM_Contact_Manager::save_fields( intval( $_POST['quiz_id'] ), $_POST['contact_form'] );
74
- echo wp_json_encode( $results );
75
- die();
76
- }
77
-
78
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/options-page-email-tab.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
- /**
3
- * Creates the emails page tab when editing quizzes.
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * Creates the email tab in the Quiz Settings Page
14
- *
15
- * @return void
16
- * @since 6.1.0
17
- */
18
- function qsm_settings_email_tab() {
19
- global $mlwQuizMasterNext;
20
- $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Emails', 'quiz-master-next' ), 'qsm_options_emails_tab_content' );
21
- }
22
- add_action( 'plugins_loaded', 'qsm_settings_email_tab', 5 );
23
-
24
- /**
25
- * Creates the email content that is displayed on the email tab.
26
- *
27
- * @return void
28
- * @since 4.4.0
29
- */
30
- function qsm_options_emails_tab_content() {
31
- global $wpdb;
32
- global $mlwQuizMasterNext;
33
- $quiz_id = intval( $_GET['quiz_id'] );
34
- $js_data = array(
35
- 'quizID' => $quiz_id,
36
- 'nonce' => wp_create_nonce( 'wp_rest' ),
37
- );
38
- wp_enqueue_script( 'qsm_emails_admin_script', plugins_url( '../../js/qsm-admin-emails.js', __FILE__ ), array( 'jquery-ui-sortable', 'qmn_admin_js' ), $mlwQuizMasterNext->version );
39
- wp_localize_script( 'qsm_emails_admin_script', 'qsmEmailsObject', $js_data );
40
- wp_enqueue_editor();
41
- wp_enqueue_media();
42
- ?>
43
- <h2><?php esc_html_e( 'Emails', 'quiz-master-next' ); ?></h2>
44
- <p>Need assistance with this tab? <a href="https://docs.quizandsurveymaster.com/article/17-sending-emails" target="_blank">Check out the documentation</a> for this tab!</p>
45
-
46
- <!-- Template Variable Section -->
47
- <section>
48
- <h3 style="text-align: center;"><?php esc_html_e( 'Template Variables', 'quiz-master-next' ); ?></h3>
49
- <div class="template_list_holder">
50
- <div class="template_variable">
51
- <span class="template_name">%CONTACT_X%</span> - <?php _e( 'Value user entered into contact field. X is # of contact field. For example, first contact field would be %CONTACT_1%', 'quiz-master-next' ); ?>
52
- </div>
53
- <div class="template_variable">
54
- <span class="template_name">%CONTACT_ALL%</span> - <?php _e( 'List user values for all contact fields', 'quiz-master-next' ); ?>
55
- </div>
56
- <div class="template_variable">
57
- <span class="template_name">%POINT_SCORE%</span> - <?php _e('Score for the quiz when using points', 'quiz-master-next'); ?>
58
- </div>
59
- <div class="template_variable">
60
- <span class="template_name">%AVERAGE_POINT%</span> - <?php _e('The average amount of points user had per question', 'quiz-master-next'); ?>
61
- </div>
62
- <div class="template_variable">
63
- <span class="template_name">%AMOUNT_CORRECT%</span> - <?php _e('The number of correct answers the user had', 'quiz-master-next'); ?>
64
- </div>
65
- <div class="template_variable">
66
- <span class="template_name">%TOTAL_QUESTIONS%</span> - <?php _e('The total number of questions in the quiz', 'quiz-master-next'); ?>
67
- </div>
68
- <div class="template_variable">
69
- <span class="template_name">%CORRECT_SCORE%</span> - <?php _e('Score for the quiz when using correct answers', 'quiz-master-next'); ?>
70
- </div>
71
- <div class="template_variable">
72
- <span class="template_name">%USER_NAME%</span> - <?php _e('The name the user entered before the quiz', 'quiz-master-next'); ?>
73
- </div>
74
- <div class="template_variable">
75
- <span class="template_name">%USER_BUSINESS%</span> - <?php _e('The business the user entered before the quiz', 'quiz-master-next'); ?>
76
- </div>
77
- <div class="template_variable">
78
- <span class="template_name">%USER_PHONE%</span> - <?php _e('The phone number the user entered before the quiz', 'quiz-master-next'); ?>
79
- </div>
80
- <div class="template_variable">
81
- <span class="template_name">%USER_EMAIL%</span> - <?php _e('The email the user entered before the quiz', 'quiz-master-next'); ?>
82
- </div>
83
- <div class="template_variable">
84
- <span class="template_name">%QUIZ_NAME%</span> - <?php _e('The name of the quiz', 'quiz-master-next'); ?>
85
- </div>
86
- <div class="template_variable">
87
- <span class="template_name">%QUESTIONS_ANSWERS%</span> - <?php _e('Shows the question, the answer the user provided, and the correct answer', 'quiz-master-next'); ?>
88
- </div>
89
- <div class="template_variable">
90
- <span class="template_name">%COMMENT_SECTION%</span> - <?php _e('The comments the user entered into comment box if enabled', 'quiz-master-next'); ?>
91
- </div>
92
- <div class="template_variable">
93
- <span class="template_name">%TIMER%</span> - <?php _e('The amount of time user spent on quiz in seconds', 'quiz-master-next'); ?>
94
- </div>
95
- <div class="template_variable">
96
- <span class="template_name">%TIMER_MINUTES%</span> - <?php _e('The amount of time user spent on quiz in minutes', 'quiz-master-next'); ?>
97
- </div>
98
- <div class="template_variable">
99
- <span class="template_name">%CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The amount of points a specific category earned.', 'quiz-master-next'); ?>
100
- </div>
101
- <div class="template_variable">
102
- <span class="template_name">%AVERAGE_CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The average amount of points a specific category earned.', 'quiz-master-next'); ?>
103
- </div>
104
- <div class="template_variable">
105
- <span class="template_name">%CATEGORY_SCORE_X%</span> - <?php _e('X: Category name - The score a specific category earned.', 'quiz-master-next'); ?>
106
- </div>
107
- <div class="template_variable">
108
- <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
109
- </div>
110
- <div class="template_variable">
111
- <span class="template_name">%CATEGORY_AVERAGE_SCORE%</span> - <?php _e('The average score from all categories.', 'quiz-master-next'); ?>
112
- </div>
113
- <div class="template_variable">
114
- <span class="template_name">%CURRENT_DATE%</span> - <?php _e('The Current Date', 'quiz-master-next'); ?>
115
- </div>
116
- <?php do_action('qmn_template_variable_list'); ?>
117
- </div>
118
- <div style="clear:both;"></div>
119
- </section>
120
-
121
- <!-- Emails Section -->
122
- <section>
123
- <h3>Your Emails</h3>
124
- <button class="save-emails button-primary"><?php esc_html_e( 'Save Emails', 'quiz-master-next' ); ?></button>
125
- <button class="add-new-email button"><?php esc_html_e( 'Add New Email', 'quiz-master-next' ); ?></button>
126
- <div id="emails"></div>
127
- <button class="save-emails button-primary"><?php esc_html_e( 'Save Emails', 'quiz-master-next' ); ?></button>
128
- <button class="add-new-email button"><?php esc_html_e( 'Add New Email', 'quiz-master-next' ); ?></button>
129
- </section>
130
-
131
- <!-- Templates -->
132
- <script type="text/template" id="tmpl-email">
133
- <div class="email">
134
- <header class="email-header">
135
- <div><button class="delete-email-button"><span class="dashicons dashicons-trash"></span></button></div>
136
- </header>
137
- <main class="email-content">
138
- <div class="email-when">
139
- <div class="email-content-header">
140
- <h4>When...</h4>
141
- <p>Set conditions for when this email should be sent. Leave empty to set this as an email that is always sent.</p>
142
- </div>
143
- <div class="email-when-conditions">
144
- <!-- Conditions go here. Review template below. -->
145
- </div>
146
- <button class="new-condition button"><?php esc_html_e( 'Add additional condition', 'quiz-master-next' ); ?></button>
147
- </div>
148
- <div class="email-show">
149
- <div class="email-content-header">
150
- <h4>...Send</h4>
151
- <p>Create the email that should be sent when the conditions are met.</p>
152
- </div>
153
- <label>Who to send the email to? Put %USER_EMAIL% to send to user</label>
154
- <input type="email" class="to-email" value="{{ data.to }}">
155
- <label>Email Subject</label>
156
- <input type="text" class="subject" value="{{ data.subject }}">
157
- <label>Email Content</label>
158
- <textarea id="email-template-{{ data.id }}" class="email-template">{{{ data.content }}}</textarea>
159
- <label><input type="checkbox" class="reply-to" <# if ( "true" == data.replyTo || true == data.replyTo ) { #>checked<# } #>>Add user email as Reply-To</label>
160
- </div>
161
- </main>
162
- </div>
163
- </script>
164
-
165
- <script type="text/template" id="tmpl-email-condition">
166
- <div class="email-condition">
167
- <button class="delete-condition-button"><span class="dashicons dashicons-trash"></span></button>
168
- <select class="email-condition-criteria">
169
- <option value="points" <# if (data.criteria == 'points') { #>selected<# } #>>Total points earned</option>
170
- <option value="score" <# if (data.criteria == 'score') { #>selected<# } #>>Correct score percentage</option>
171
- <?php do_action( 'qsm_email_condition_criteria' ); ?>
172
- </select>
173
- <select class="email-condition-operator">
174
- <option value="equal" <# if (data.operator == 'equal') { #>selected<# } #>>is equal to</option>
175
- <option value="not-equal" <# if (data.operator == 'not-equal') { #>selected<# } #>>is not equal to</option>
176
- <option value="greater-equal" <# if (data.operator == 'greater-equal') { #>selected<# } #>>is greater than or equal to</option>
177
- <option value="greater" <# if (data.operator == 'greater') { #>selected<# } #>>is greater than</option>
178
- <option value="less-equal" <# if (data.operator == 'less-equal') { #>selected<# } #>>is less than or equal to</option>
179
- <option value="less" <# if (data.operator == 'less') { #>selected<# } #>>is less than</option>
180
- <?php do_action( 'qsm_email_condition_operator' ); ?>
181
- </select>
182
- <input type="text" class="email-condition-value" value="{{ data.value }}">
183
- </div>
184
- </script>
185
- <?php
186
- }
187
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/options-page-option-tab.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- }
5
-
6
- /**
7
- * Adds the Options tab to the Quiz Settings page.
8
- *
9
- * @return void
10
- * @since 6.2.0
11
- */
12
- function qsm_settings_options_tab() {
13
- global $mlwQuizMasterNext;
14
- $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Options', 'quiz-master-next' ), 'qsm_options_option_tab_content' );
15
- }
16
- add_action( 'plugins_loaded', 'qsm_settings_options_tab', 5 );
17
-
18
- /**
19
- * Adds the options content to the Quiz Settings page.
20
- *
21
- * @return void
22
- * @since 6.2.0
23
- */
24
- function qsm_options_option_tab_content() {
25
- global $wpdb;
26
- global $mlwQuizMasterNext;
27
- $mlwQuizMasterNext->pluginHelper->generate_settings_section( 'quiz_options' );
28
- }
29
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/options-page-preview-tab.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /**
3
- * Creates the "Preview" tab when editing the quiz.
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * Adds the Settings Preview tab to the Quiz Settings page.
14
- *
15
- * @since 6.2.0
16
- */
17
- function qsm_settings_preview_tab() {
18
- global $mlwQuizMasterNext;
19
- $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Preview', 'quiz-master-next' ), 'qsm_options_preview_tab_content' );
20
- }
21
- add_action( 'plugins_loaded', 'qsm_settings_preview_tab', 5 );
22
-
23
- /**
24
- * Adds the options preview content to the Options preview tab.
25
- *
26
- * @since 6.2.0
27
- */
28
- function qsm_options_preview_tab_content() {
29
- ?>
30
- <p>If your quiz looks different on the front end compared to this preview, then there is a conflict with your theme. Check out our <a href="https://docs.quizandsurveymaster.com/article/21-common-theme-conflict-fixes" target="_blank">Common Theme Conflict Fixes</a>.</p>
31
- <?php
32
- echo do_shortcode( '[qsm quiz=' . intval( $_GET['quiz_id'] ) . ']' );
33
- ?>
34
- <?php
35
- }
36
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/options-page-questions-tab.php DELETED
@@ -1,355 +0,0 @@
1
- <?php
2
- /**
3
- * This file handles the "Questions" tab when editing a quiz/survey
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
- /**
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
- *
27
- * @return void
28
- * @since 4.4.0
29
- */
30
- function qsm_options_questions_tab_content() {
31
-
32
- global $wpdb;
33
- global $mlwQuizMasterNext;
34
- $quiz_id = intval( $_GET['quiz_id'] );
35
-
36
- $json_data = array(
37
- 'quizID' => $quiz_id,
38
- 'answerText' => __( 'Answer', 'quiz-master-next' ),
39
- 'nonce' => wp_create_nonce( 'wp_rest' ),
40
- 'pages' => $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() ),
41
- );
42
-
43
- // Scripts and styles.
44
- wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
45
- 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 );
46
- wp_localize_script( 'qsm_admin_question_js', 'qsmQuestionSettings', $json_data );
47
- wp_enqueue_style( 'qsm_admin_question_css', plugins_url( '../../css/qsm-admin-question.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
48
- wp_enqueue_script( 'math_jax', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' );
49
- wp_enqueue_editor();
50
- wp_enqueue_media();
51
-
52
- // Load Question Types.
53
- $question_types = $mlwQuizMasterNext->pluginHelper->get_question_type_options();
54
-
55
- // Display warning if using competing options.
56
- $pagination = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'pagination' );
57
- if ( 0 != $pagination ) {
58
- ?>
59
- <div class="notice notice-warning">
60
- <p>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.</p>
61
- </div>
62
- <?php
63
- }
64
- $from_total = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'question_from_total' );
65
- if ( 0 != $from_total ) {
66
- ?>
67
- <div class="notice notice-warning">
68
- <p>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.</p>
69
- </div>
70
- <?php
71
- }
72
- $randomness = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'randomness_order' );
73
- if ( 0 != $randomness ) {
74
- ?>
75
- <div class="notice notice-warning">
76
- <p>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".</p>
77
- </div>
78
- <?php
79
- }
80
- ?>
81
- <h3>Questions</h3>
82
- <p>Use this tab to create and modify the different pages of your quiz or survey as well as the questions on each page. Click "Create New Page" to get started! Need more information? Check out the <a href="https://docs.quizandsurveymaster.com/article/19-creating-pages-and-questions" target="_blank">documentation for this tab!</a></p>
83
- <div class="question-controls">
84
- <div>
85
- <button class="new-page-button button">Create New Page</button>
86
- <button class="save-page-button button-primary">Save Questions and Pages</button>
87
- </div>
88
- <span>Total Questions: <span id="total-questions"></span></span>
89
- <p class="search-box">
90
- <label class="screen-reader-text" for="question_search">Search Questions:</label>
91
- <input type="search" id="question_search" name="question_search" value="">
92
- <a href="#" class="button">Search Questions</a>
93
- </p>
94
- </div>
95
- <div class="questions"></div>
96
-
97
- <!-- Popup for question bank -->
98
- <div class="qsm-popup qsm-popup-slide qsm-popup-bank" id="modal-2" aria-hidden="true">
99
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
100
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
101
- <header class="qsm-popup__header">
102
- <h2 class="qsm-popup__title" id="modal-2-title">Add Question From Question Bank</h2>
103
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
104
- </header>
105
- <main class="qsm-popup__content" id="modal-2-content">
106
- <input type="hidden" name="add-question-bank-page" id="add-question-bank-page" value="">
107
- <div id="question-bank"></div>
108
- </main>
109
- <footer class="qsm-popup__footer">
110
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window">Close</button>
111
- </footer>
112
- </div>
113
- </div>
114
- </div>
115
-
116
-
117
- <!-- Popup for editing question -->
118
- <div class="qsm-popup qsm-popup-slide" id="modal-1" aria-hidden="true">
119
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
120
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
121
- <header class="qsm-popup__header">
122
- <h2 class="qsm-popup__title" id="modal-1-title">Edit Question [ ID: <span id="edit-question-id"></span> ]</h2>
123
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
124
- </header>
125
- <main class="qsm-popup__content" id="modal-1-content">
126
- <input type="hidden" name="edit_question_id" id="edit_question_id" value="">
127
- <div class="qsm-row">
128
- <label><?php _e( 'Question Type', 'quiz-master-next' ); ?></label>
129
- <select name="question_type" id="question_type">
130
- <?php
131
- foreach ( $question_types as $type ) {
132
- echo "<option value='{$type['slug']}'>{$type['name']}</option>";
133
- }
134
- ?>
135
- </select>
136
- </div>
137
- <p id="question_type_info"></p>
138
- <div class="qsm-row">
139
- <textarea id="question-text"></textarea>
140
- </div>
141
- <div class="qsm-row">
142
- <label><?php _e( 'Answers', 'quiz-master-next' ); ?></label>
143
- <div class="correct-header"><?php _e( 'Correct', 'quiz-master-next' ); ?></div>
144
- <div class="answers" id="answers">
145
-
146
- </div>
147
- <a href="#" class="button" id="new-answer-button"><?php _e( 'Add New Answer!', 'quiz-master-next'); ?></a>
148
- <label class="change-answer-editor-label">
149
- <?php _e( 'Answers Type: ', 'quiz-master-next' ); ?>
150
- <select id="change-answer-editor">
151
- <option value="text">Text Answers</option>
152
- <option value="rich">Rich Answers</option>
153
- </select>
154
- </label>
155
- </div>
156
- <p id="show-advanced-option">Show advance options &raquo;</p>
157
- <div class="advanced-content" style="display: none;">
158
- <div id="correct_answer_area" class="qsm-row">
159
- <label><?php _e( 'Correct Answer Info', 'quiz-master-next' ); ?></label>
160
- <input type="text" name="correct_answer_info" value="" id="correct_answer_info" />
161
- </div>
162
- <div id="hint_area" class="qsm-row">
163
- <label><?php _e( 'Hint', 'quiz-master-next' ); ?></label>
164
- <input type="text" name="hint" value="" id="hint"/>
165
- </div>
166
- <div id="comment_area" class="qsm-row">
167
- <label><?php _e( 'Comment Field', 'quiz-master-next' ); ?></label>
168
- <select name="comments" id="comments">
169
- <option value="0"><?php _e('Small Text Field', 'quiz-master-next'); ?></option>
170
- <option value="2"><?php _e('Large Text Field', 'quiz-master-next'); ?></option>
171
- <option value="1" selected="selected"><?php _e('None', 'quiz-master-next'); ?></option>
172
- <select>
173
- </div>
174
- <div id="required_area" class="qsm-row">
175
- <label><?php _e( 'Required?', 'quiz-master-next' ); ?></label>
176
- <select name="required" id="required">
177
- <option value="0" selected="selected"><?php _e( 'Yes', 'quiz-master-next' ); ?></option>
178
- <option value="1"><?php _e( 'No', 'quiz-master-next' ); ?></option>
179
- </select>
180
- </div>
181
- <div id="category_area" class="qsm-row">
182
- <label><?php _e( 'Category', 'quiz-master-next' ); ?></label>
183
- <div id="categories">
184
- <input type="radio" name="category" class="category-radio" id="new_category_new" value="new_category"><label for="new_category_new">New: <input type='text' id='new_category' value='' /></label>
185
- </div>
186
- </div>
187
- <div id="required_area" class="qsm-row">
188
- <label><?php _e( 'Hide Autofill?', 'quiz-master-next' ); ?></label>
189
- <select name="hide_autofill" id="hide_autofill">
190
- <option value="0" selected="selected"><?php _e( 'No', 'quiz-master-next' ); ?></option>
191
- <option value="1"><?php _e( 'Yes', 'quiz-master-next' ); ?></option>
192
- </select>
193
- </div>
194
- <div id="required_area" class="qsm-row">
195
- <label><?php _e( 'Limit Text( Works for text fields )', 'quiz-master-next' ); ?></label>
196
- <input type="number" name="limit_text" value="" id="limit_text"/>
197
- </div>
198
- </div>
199
- </main>
200
- <footer class="qsm-popup__footer">
201
- <button id="save-popup-button" class="qsm-popup__btn qsm-popup__btn-primary">Save Question</button>
202
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window">Cancel</button>
203
- </footer>
204
- </div>
205
- </div>
206
- </div>
207
-
208
- <!--Views-->
209
-
210
- <!-- View for Page -->
211
- <script type="text/template" id="tmpl-page">
212
- <div class="page page-new">
213
- <div class="page-header">
214
- <div><span class="dashicons dashicons-move"></span></div>
215
- <div class="page-header-buttons">
216
- <a href="#" class="new-question-button button">Create New Question</a>
217
- <a href="#" class="add-question-bank-button button">Add Question From Question Bank</a>
218
- </div>
219
- <div><a href="#" class="delete-page-button"><span class="dashicons dashicons-trash"></span></a></div>
220
- </div>
221
- </div>
222
- </script>
223
-
224
- <!-- View for Question -->
225
- <script type="text/template" id="tmpl-question">
226
- <div class="question question-new" data-question-id="{{data.id }}">
227
- <div class="question-content">
228
- <div><span class="dashicons dashicons-move"></span></div>
229
- <div><a href="#" class="edit-question-button"><span class="dashicons dashicons-edit"></span></a></div>
230
- <div><a href="#" class="duplicate-question-button"><span class="dashicons dashicons-controls-repeat"></span></a></div>
231
- <div class="question-content-text">{{{data.question}}}</div>
232
- <div><# if ( 0 !== data.category.length ) { #> Category: {{data.category}} <# } #></div>
233
- <div><a href="#" class="delete-question-button"><span class="dashicons dashicons-trash"></span></a><div>
234
- </div>
235
- </div>
236
- </script>
237
-
238
- <!-- View for question in question bank -->
239
- <script type="text/template" id="tmpl-single-question-bank-question">
240
- <div class="question-bank-question" data-question-id="{{data.id}}" data-category-name="{{data.category}}">
241
- <div><p>{{{data.question}}}</p><p style="font-size: 12px;color: gray;font-style: italic;"><b>Quiz Name:</b> {{data.quiz_name}} <# if ( data.category != '' ) { #> <b>Category:</b> {{data.category}} <# } #></p>
242
- </div>
243
- <div><a href="#" class="import-button button">Add Question</a></div>
244
- </div>
245
- </script>
246
-
247
- <!-- View for single category -->
248
- <script type="text/template" id="tmpl-single-category">
249
- <div class="category">
250
- <input type="radio" name="category" class="category-radio" value="{{data.category}}"><label>{{data.category}}</label>
251
- </div>
252
- </script>
253
-
254
- <!-- View for single answer -->
255
- <script type="text/template" id="tmpl-single-answer">
256
- <div class="answers-single">
257
- <div><a href="#" class="delete-answer-button"><span class="dashicons dashicons-trash"></span></a></div>
258
- <div class="answer-text-div">
259
- <# if ( 'rich' == data.answerType ) { #>
260
- <textarea id="answer-{{data.question_id}}-{{data.count}}"></textarea>
261
- <# } else { #>
262
- <input type="text" class="answer-text" value="{{data.answer}}" placeholder="Your answer"/>
263
- <# } #>
264
- </div>
265
- <div><input type="text" class="answer-points" value="{{data.points}}" placeholder="Points"/></div>
266
- <div><input type="checkbox" class="answer-correct" value="1" <# if ( 1 == data.correct ) { #> checked="checked"/> <# } #></div>
267
- </div>
268
- </script>
269
- <?php
270
- }
271
-
272
-
273
- add_action( 'wp_ajax_qsm_save_pages', 'qsm_ajax_save_pages' );
274
- add_action( 'wp_ajax_nopriv_qsm_save_pages', 'qsm_ajax_save_pages' );
275
-
276
-
277
- /**
278
- * Saves the pages and order from the Questions tab
279
- *
280
- * @since 5.2.0
281
- */
282
- function qsm_ajax_save_pages() {
283
- global $mlwQuizMasterNext;
284
- $json = array(
285
- 'status' => 'error',
286
- );
287
- $quiz_id = intval( $_POST['quiz_id'] );
288
- $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id );
289
- $response = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'pages', $_POST['pages'] );
290
- if ( $response ) {
291
- $json['status'] = 'success';
292
- }
293
- echo wp_json_encode( $json );
294
- wp_die();
295
- }
296
-
297
- add_action( 'wp_ajax_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
298
- add_action( 'wp_ajax_nopriv_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' );
299
-
300
- /**
301
- * Loads all the questions and echos out JSON
302
- *
303
- * @since 0.1.0
304
- * @return void
305
- */
306
- function qsm_load_all_quiz_questions_ajax() {
307
- global $wpdb;
308
- global $mlwQuizMasterNext;
309
-
310
- // Loads questions.
311
- $questions = $wpdb->get_results( "SELECT question_id, question_name FROM {$wpdb->prefix}mlw_questions WHERE deleted = '0' ORDER BY question_id DESC" );
312
-
313
- // Creates question array.
314
- $question_json = array();
315
- foreach ( $questions as $question ) {
316
- $question_json[] = array(
317
- 'id' => $question->question_id,
318
- 'question' => $question->question_name,
319
- );
320
- }
321
-
322
- // Echos JSON and dies.
323
- echo wp_json_encode( $question_json );
324
- wp_die();
325
- }
326
-
327
- add_action( 'wp_ajax_qsm_send_data_sendy', 'qsm_send_data_sendy' );
328
- add_action( 'wp_ajax_nopriv_qsm_send_data_sendy', 'qsm_send_data_sendy' );
329
-
330
- /**
331
- * @version 6.3.2
332
- * Send data to sendy
333
- */
334
- function qsm_send_data_sendy(){
335
- $sendy_url = 'http://sendy.expresstech.io';
336
- $list = '4v8zvoyXyTHSS80jeavOpg';
337
- $name = sanitize_text_field($_POST['name']);
338
- $email = sanitize_email($_POST['email']);
339
-
340
- //subscribe
341
- $postdata = http_build_query(
342
- array(
343
- 'name' => $name,
344
- 'email' => $email,
345
- 'list' => $list,
346
- 'boolean' => 'true'
347
- )
348
- );
349
- $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
350
- $context = stream_context_create($opts);
351
- $result = file_get_contents($sendy_url.'/subscribe', false, $context);
352
- echo $result;
353
- exit;
354
- }
355
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/options-page-results-page-tab.php DELETED
@@ -1,192 +0,0 @@
1
- <?php
2
- /**
3
- * Creates the results page tab when editing quizzes.
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * Adds the Results Page tab to the Quiz Settings page.
14
- *
15
- * @since 6.1.0
16
- */
17
- function qsm_options_results_tab() {
18
- global $mlwQuizMasterNext;
19
- $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Results Pages', 'quiz-master-next' ), 'qsm_options_results_tab_content' );
20
- }
21
- add_action( 'plugins_loaded', 'qsm_options_results_tab', 5 );
22
-
23
- /**
24
- * Adds the Results page content to the Results tab.
25
- *
26
- * @since 6.1.0
27
- */
28
- function qsm_options_results_tab_content() {
29
- global $wpdb;
30
- global $mlwQuizMasterNext;
31
- $quiz_id = intval( $_GET['quiz_id'] );
32
- $js_data = array(
33
- 'quizID' => $quiz_id,
34
- 'nonce' => wp_create_nonce( 'wp_rest' ),
35
- );
36
- wp_enqueue_script( 'qsm_results_admin_script', plugins_url( '../../js/qsm-admin-results.js', __FILE__ ), array( 'jquery-ui-sortable', 'qmn_admin_js' ), $mlwQuizMasterNext->version );
37
- wp_localize_script( 'qsm_results_admin_script', 'qsmResultsObject', $js_data );
38
- wp_enqueue_editor();
39
- wp_enqueue_media();
40
- ?>
41
- <h2><?php esc_html_e( 'Results Pages', 'quiz-master-next' ); ?></h2>
42
- <p>Need assistance with this tab? <a href="https://docs.quizandsurveymaster.com/article/25-setting-up-results-pages-and-thank-you-pages" target="_blank">Check out the documentation</a> for this tab!</p>
43
-
44
- <!-- Template Variables Section -->
45
- <section>
46
- <h3 style="text-align: center;"><?php esc_html_e( 'Template Variables', 'quiz-master-next' ); ?></h3>
47
- <div class="template_list_holder">
48
- <div class="template_variable">
49
- <span class="template_name">%CONTACT_X%</span> - <?php _e( 'Value user entered into contact field. X is # of contact field. For example, first contact field would be %CONTACT_1%', 'quiz-master-next' ); ?>
50
- </div>
51
- <div class="template_variable">
52
- <span class="template_name">%CONTACT_ALL%</span> - <?php _e( 'List user values for all contact fields', 'quiz-master-next' ); ?>
53
- </div>
54
- <div class="template_variable">
55
- <span class="template_name">%POINT_SCORE%</span> - <?php _e('Score for the quiz when using points', 'quiz-master-next'); ?>
56
- </div>
57
- <div class="template_variable">
58
- <span class="template_name">%AVERAGE_POINT%</span> - <?php _e('The average amount of points user had per question', 'quiz-master-next'); ?>
59
- </div>
60
- <div class="template_variable">
61
- <span class="template_name">%AMOUNT_CORRECT%</span> - <?php _e('The number of correct answers the user had', 'quiz-master-next'); ?>
62
- </div>
63
- <div class="template_variable">
64
- <span class="template_name">%TOTAL_QUESTIONS%</span> - <?php _e('The total number of questions in the quiz', 'quiz-master-next'); ?>
65
- </div>
66
- <div class="template_variable">
67
- <span class="template_name">%CORRECT_SCORE%</span> - <?php _e('Score for the quiz when using correct answers', 'quiz-master-next'); ?>
68
- </div>
69
- <div class="template_variable">
70
- <span class="template_name">%USER_NAME%</span> - <?php _e('The name the user entered before the quiz', 'quiz-master-next'); ?>
71
- </div>
72
- <div class="template_variable">
73
- <span class="template_name">%USER_BUSINESS%</span> - <?php _e('The business the user entered before the quiz', 'quiz-master-next'); ?>
74
- </div>
75
- <div class="template_variable">
76
- <span class="template_name">%USER_PHONE%</span> - <?php _e('The phone number the user entered before the quiz', 'quiz-master-next'); ?>
77
- </div>
78
- <div class="template_variable">
79
- <span class="template_name">%USER_EMAIL%</span> - <?php _e('The email the user entered before the quiz', 'quiz-master-next'); ?>
80
- </div>
81
- <div class="template_variable">
82
- <span class="template_name">%QUIZ_NAME%</span> - <?php _e('The name of the quiz', 'quiz-master-next'); ?>
83
- </div>
84
- <div class="template_variable">
85
- <span class="template_name">%QUESTIONS_ANSWERS%</span> - <?php _e('Shows the question, the answer the user provided, and the correct answer', 'quiz-master-next'); ?>
86
- </div>
87
- <div class="template_variable">
88
- <span class="template_name">%COMMENT_SECTION%</span> - <?php _e('The comments the user entered into comment box if enabled', 'quiz-master-next'); ?>
89
- </div>
90
- <div class="template_variable">
91
- <span class="template_name">%TIMER_MINUTES%</span> - <?php _e('The amount of time user spent taking quiz in minutes', 'quiz-master-next'); ?>
92
- </div>
93
- <div class="template_variable">
94
- <span class="template_name">%TIMER%</span> - <?php _e('The amount of time user spent taking quiz in seconds', 'quiz-master-next'); ?>
95
- </div>
96
- <div class="template_variable">
97
- <span class="template_name">%CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The amount of points a specific category earned.', 'quiz-master-next'); ?>
98
- </div>
99
- <div class="template_variable">
100
- <span class="template_name">%AVERAGE_CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The average amount of points a specific category earned.', 'quiz-master-next'); ?>
101
- </div>
102
- <div class="template_variable">
103
- <span class="template_name">%CATEGORY_SCORE_X%</span> - <?php _e('X: Category name - The score a specific category earned.', 'quiz-master-next'); ?>
104
- </div>
105
- <div class="template_variable">
106
- <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
107
- </div>
108
- <div class="template_variable">
109
- <span class="template_name">%CATEGORY_AVERAGE_SCORE%</span> - <?php _e('The average score from all categories.', 'quiz-master-next'); ?>
110
- </div>
111
- <div class="template_variable">
112
- <span class="template_name">%FACEBOOK_SHARE%</span> - <?php _e('Displays button to share on Facebook.', 'quiz-master-next'); ?>
113
- </div>
114
- <div class="template_variable">
115
- <span class="template_name">%TWITTER_SHARE%</span> - <?php _e('Displays button to share on Twitter.', 'quiz-master-next'); ?>
116
- </div>
117
- <div class="template_variable">
118
- <span class="template_name">%POLL_RESULTS_X%</span> - <?php _e('X = Question ID Note: only supported for multiple choice answers', 'quiz-master-next'); ?>
119
- </div>
120
- <div class="template_variable">
121
- <span class="template_name">%RESULT_ID%</span> - <?php _e('Show result id', 'quiz-master-next'); ?>
122
- </div>
123
- <?php do_action('qmn_template_variable_list'); ?>
124
- </div>
125
- <div style="clear:both;"></div>
126
- </section>
127
-
128
- <!-- Results Page Section -->
129
- <section>
130
- <h3>Your Pages</h3>
131
- <button class="save-pages button-primary"><?php esc_html_e( 'Save Results Pages', 'quiz-master-next' ); ?></button>
132
- <span class="spinner" style="float: none;"></span>
133
- <button class="add-new-page button"><?php esc_html_e( 'Add New Results Page', 'quiz-master-next' ); ?></button>
134
- <div id="results-pages"></div>
135
- <button class="save-pages button-primary"><?php esc_html_e( 'Save Results Pages', 'quiz-master-next' ); ?></button>
136
- <span class="spinner" style="float: none;"></span>
137
- <button class="add-new-page button"><?php esc_html_e( 'Add New Results Page', 'quiz-master-next' ); ?></button>
138
- </section>
139
-
140
- <!-- Templates -->
141
- <script type="text/template" id="tmpl-results-page">
142
- <div class="results-page">
143
- <header class="results-page-header">
144
- <div><button class="delete-page-button"><span class="dashicons dashicons-trash"></span></button></div>
145
- </header>
146
- <main class="results-page-content">
147
- <div class="results-page-when">
148
- <div class="results-page-content-header">
149
- <h4>When...</h4>
150
- <p>Set conditions for when this page should be shown. Leave empty to set this as the default page.</p>
151
- </div>
152
- <div class="results-page-when-conditions">
153
- <!-- Conditions go here. Review template below. -->
154
- </div>
155
- <button class="new-condition button"><?php esc_html_e( 'Add additional condition', 'quiz-master-next' ); ?></button>
156
- </div>
157
- <div class="results-page-show">
158
- <div class="results-page-content-header">
159
- <h4>...Show</h4>
160
- <p>Create the results page that should be shown when the conditions are met.</p>
161
- </div>
162
- <textarea id="results-page-{{ data.id }}" class="results-page-template">{{{ data.page }}}</textarea>
163
- <p>Or, redirect the user by entering the URL below:</p>
164
- <input type="text" class="results-page-redirect" value="<# if ( data.redirect ) { #>{{ data.redirect }}<# } #>">
165
- </div>
166
- </main>
167
- </div>
168
- </script>
169
-
170
- <script type="text/template" id="tmpl-results-page-condition">
171
- <div class="results-page-condition">
172
- <button class="delete-condition-button"><span class="dashicons dashicons-trash"></span></button>
173
- <select class="results-page-condition-criteria">
174
- <option value="points" <# if (data.criteria == 'points') { #>selected<# } #>>Total points earned</option>
175
- <option value="score" <# if (data.criteria == 'score') { #>selected<# } #>>Correct score percentage</option>
176
- <?php do_action( 'qsm_results_page_condition_criteria' ); ?>
177
- </select>
178
- <select class="results-page-condition-operator">
179
- <option value="equal" <# if (data.operator == 'equal') { #>selected<# } #>>is equal to</option>
180
- <option value="not-equal" <# if (data.operator == 'not-equal') { #>selected<# } #>>is not equal to</option>
181
- <option value="greater-equal" <# if (data.operator == 'greater-equal') { #>selected<# } #>>is greater than or equal to</option>
182
- <option value="greater" <# if (data.operator == 'greater') { #>selected<# } #>>is greater than</option>
183
- <option value="less-equal" <# if (data.operator == 'less-equal') { #>selected<# } #>>is less than or equal to</option>
184
- <option value="less" <# if (data.operator == 'less') { #>selected<# } #>>is less than</option>
185
- <?php do_action( 'qsm_results_page_condition_operator' ); ?>
186
- </select>
187
- <input type="text" class="results-page-condition-value" value="{{ data.value }}">
188
- </div>
189
- </script>
190
- <?php
191
- }
192
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/options-page-style-tab.php DELETED
@@ -1,105 +0,0 @@
1
- <?php
2
- /**
3
- * Handles the functions/views for the "Style" tab when editing a quiz or survey
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
- /**
11
- * Adds the Style tab to the Quiz Settings page.
12
- *
13
- * @return void
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 );
21
-
22
- /**
23
- * Adds the Style tab content to the tab.
24
- *
25
- * @return void
26
- * @since 6.0.2
27
- */
28
- function qsm_options_styling_tab_content() {
29
- global $wpdb;
30
- global $mlwQuizMasterNext;
31
-
32
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
33
-
34
- $quiz_id = intval( $_GET['quiz_id'] );
35
- if ( isset( $_POST['save_style_options'] ) && 'confirmation' == $_POST['save_style_options'] ) {
36
-
37
- $style_quiz_id = intval( $_POST['style_quiz_id'] );
38
- $quiz_theme = sanitize_text_field( $_POST['save_quiz_theme'] );
39
- $quiz_style = 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='" . date( 'Y-m-d H:i:s' ) . "' WHERE quiz_id=%d", $quiz_style, $quiz_theme, $style_quiz_id ) );
43
- if ( false !== $results ) {
44
- $mlwQuizMasterNext->alertManager->newAlert( __( 'The style has been saved successfully.', 'quiz-master-next' ), 'success' );
45
- $mlwQuizMasterNext->audit_manager->new_audit( "Styles Have Been Saved For Quiz Number $style_quiz_id" );
46
- } else {
47
- $mlwQuizMasterNext->alertManager->newAlert( __( 'Error occured when trying to save the styles. Please try again.', 'quiz-master-next' ), 'error' );
48
- $mlwQuizMasterNext->log_manager->add( 'Error saving styles', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
49
- }
50
- }
51
-
52
- if ( isset( $_GET['quiz_id'] ) ) {
53
- $table_name = $wpdb->prefix . 'mlw_quizzes';
54
- $mlw_quiz_options = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $quiz_id ) );
55
- }
56
- $registered_templates = $mlwQuizMasterNext->pluginHelper->get_quiz_templates();
57
- ?>
58
- <script>
59
- function mlw_qmn_theme(theme)
60
- {
61
- document.getElementById('save_quiz_theme').value = theme;
62
- jQuery("div.mlw_qmn_themeBlockActive").toggleClass("mlw_qmn_themeBlockActive");
63
- jQuery("#mlw_qmn_theme_block_"+theme).toggleClass("mlw_qmn_themeBlockActive");
64
-
65
- }
66
- </script>
67
- <form action='' method='post' name='quiz_style_form'>
68
- <input type='hidden' name='save_style_options' value='confirmation' />
69
- <input type='hidden' name='style_quiz_id' value='<?php echo esc_attr( $quiz_id ); ?>' />
70
- <input type='hidden' name='save_quiz_theme' id='save_quiz_theme' value='<?php echo esc_attr( $mlw_quiz_options->theme_selected ); ?>' />
71
- <h3><?php _e( 'Quiz Styles', 'quiz-master-next' ); ?></h3>
72
- <p><?php _e( 'Choose your style:', 'quiz-master-next' ); ?></p>
73
- <style>
74
- div.mlw_qmn_themeBlockActive {
75
- background-color: yellow;
76
- }
77
- </style>
78
- <div class="qsm-styles">
79
- <?php
80
- foreach ( $registered_templates as $slug => $template ) {
81
- ?>
82
- <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>
83
- <?php
84
- }
85
- ?>
86
- <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>
87
- <script>
88
- mlw_qmn_theme('<?php echo $mlw_quiz_options->theme_selected; ?>');
89
- </script>
90
- </div>
91
- <button id="save_styles_button" class="button-primary"><?php _e('Save Quiz Style', 'quiz-master-next'); ?></button>
92
- <hr />
93
- <h3><?php _e('Custom Style CSS', 'quiz-master-next'); ?></h3>
94
- <p><?php _e('For help and guidance along with a list of different classes used in this plugin, please visit the following link:', 'quiz-master-next'); ?>
95
- <a target="_blank" href="https://docs.quizandsurveymaster.com/article/34-css-in-qsm">CSS in QSM</a></p>
96
- <table class="form-table">
97
- <tr>
98
- <td><textarea style="width: 100%; height: 700px;" id="quiz_css" name="quiz_css"><?php echo $mlw_quiz_options->quiz_stye; ?></textarea></td>
99
- </tr>
100
- </table>
101
- <button id="save_styles_button" class="button-primary"><?php _e('Save Quiz Style', 'quiz-master-next'); ?></button>
102
- </form>
103
- <?php
104
- }
105
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/options-page-text-tab.php DELETED
@@ -1,106 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
3
-
4
- /**
5
- * Adds the Text tab to the Quiz Settings page.
6
- *
7
- * @return void
8
- * @since 4.4.0
9
- */
10
- function qmn_settings_text_tab() {
11
- global $mlwQuizMasterNext;
12
- $mlwQuizMasterNext->pluginHelper->register_quiz_settings_tabs( __( 'Text', 'quiz-master-next' ), 'mlw_options_text_tab_content' );
13
- }
14
- add_action( "plugins_loaded", 'qmn_settings_text_tab', 5 );
15
-
16
- /**
17
- * Adds the Text tab content to the tab.
18
- *
19
- * @return void
20
- * @since 4.4.0
21
- */
22
- function mlw_options_text_tab_content() {
23
- global $wpdb;
24
- global $mlwQuizMasterNext;
25
- wp_enqueue_style( 'qmn_admin_style', plugins_url( '../../css/qsm-admin.css' , __FILE__ ) );
26
- ?>
27
- <h3 style="text-align: center;"><?php _e("Template Variables", 'quiz-master-next'); ?></h3>
28
- <div class="template_list_holder">
29
- <div class="template_variable">
30
- <span class="template_name">%POINT_SCORE%</span> - <?php _e('Score for the quiz when using points', 'quiz-master-next'); ?>
31
- </div>
32
- <div class="template_variable">
33
- <span class="template_name">%AVERAGE_POINT%</span> - <?php _e('The average amount of points user had per question', 'quiz-master-next'); ?>
34
- </div>
35
- <div class="template_variable">
36
- <span class="template_name">%AMOUNT_CORRECT%</span> - <?php _e('The number of correct answers the user had', 'quiz-master-next'); ?>
37
- </div>
38
- <div class="template_variable">
39
- <span class="template_name">%TOTAL_QUESTIONS%</span> - <?php _e('The total number of questions in the quiz', 'quiz-master-next'); ?>
40
- </div>
41
- <div class="template_variable">
42
- <span class="template_name">%CORRECT_SCORE%</span> - <?php _e('Score for the quiz when using correct answers', 'quiz-master-next'); ?>
43
- </div>
44
- <div class="template_variable">
45
- <span class="template_name">%USER_NAME%</span> - <?php _e('The name the user entered before the quiz', 'quiz-master-next'); ?>
46
- </div>
47
- <div class="template_variable">
48
- <span class="template_name">%USER_BUSINESS%</span> - <?php _e('The business the user entered before the quiz', 'quiz-master-next'); ?>
49
- </div>
50
- <div class="template_variable">
51
- <span class="template_name">%USER_PHONE%</span> - <?php _e('The phone number the user entered before the quiz', 'quiz-master-next'); ?>
52
- </div>
53
- <div class="template_variable">
54
- <span class="template_name">%USER_EMAIL%</span> - <?php _e('The email the user entered before the quiz', 'quiz-master-next'); ?>
55
- </div>
56
- <div class="template_variable">
57
- <span class="template_name">%QUIZ_NAME%</span> - <?php _e('The name of the quiz', 'quiz-master-next'); ?>
58
- </div>
59
- <div class="template_variable">
60
- <span class="template_name">%QUESTIONS_ANSWERS%</span> - <?php _e('Shows the question, the answer the user provided, and the correct answer', 'quiz-master-next'); ?>
61
- </div>
62
- <div class="template_variable">
63
- <span class="template_name">%COMMENT_SECTION%</span> - <?php _e('The comments the user entered into comment box if enabled', 'quiz-master-next'); ?>
64
- </div>
65
- <div class="template_variable">
66
- <span class="template_name">%TIMER%</span> - <?php _e('The amount of time user spent on quiz in seconds', 'quiz-master-next'); ?>
67
- </div>
68
- <div class="template_variable">
69
- <span class="template_name">%TIMER_MINUTES%</span> - <?php _e('The amount of time user spent on quiz in minutes', 'quiz-master-next'); ?>
70
- </div>
71
- <div class="template_variable">
72
- <span class="template_name">%CATEGORY_POINTS_X%</span> - <?php _e('X: Category name - The amount of points a specific category earned.', 'quiz-master-next'); ?>
73
- </div>
74
- <div class="template_variable">
75
- <span class="template_name">%CATEGORY_SCORE_X%</span> - <?php _e('X: Category name - The score a specific category earned.', 'quiz-master-next'); ?>
76
- </div>
77
- <div class="template_variable">
78
- <span class="template_name">%CATEGORY_AVERAGE_POINTS%</span> - <?php _e('The average points from all categories.', 'quiz-master-next'); ?>
79
- </div>
80
- <div class="template_variable">
81
- <span class="template_name">%CATEGORY_AVERAGE_SCORE%</span> - <?php _e('The average score from all categories.', 'quiz-master-next'); ?>
82
- </div>
83
- <div class="template_variable">
84
- <span class="template_name">%QUESTION%</span> - <?php _e('The question that the user answered', 'quiz-master-next'); ?>
85
- </div>
86
- <div class="template_variable">
87
- <span class="template_name">%USER_ANSWER%</span> - <?php _e('The answer the user gave for the question', 'quiz-master-next'); ?>
88
- </div>
89
- <div class="template_variable">
90
- <span class="template_name">%CORRECT_ANSWER%</span> - <?php _e('The correct answer for the question', 'quiz-master-next'); ?>
91
- </div>
92
- <div class="template_variable">
93
- <span class="template_name">%USER_COMMENTS%</span> - <?php _e('The comments the user provided in the comment field for the question', 'quiz-master-next'); ?>
94
- </div>
95
- <div class="template_variable">
96
- <span class="template_name">%CORRECT_ANSWER_INFO%</span> - <?php _e('Reason why the correct answer is the correct answer', 'quiz-master-next'); ?>
97
- </div>
98
- <div class="template_variable">
99
- <span class="template_name">%CURRENT_DATE%</span> - <?php _e('The Current Date', 'quiz-master-next'); ?>
100
- </div>
101
- <?php do_action('qmn_template_variable_list'); ?>
102
- </div>
103
- <?php
104
- $mlwQuizMasterNext->pluginHelper->generate_settings_section( 'quiz_text' );
105
- }
106
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/quiz-options-page.php DELETED
@@ -1,185 +0,0 @@
1
- <?php
2
- /**
3
- * Creates the view for all tabs for editing the quiz.
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * This function allows for the editing of quiz options.
14
- *
15
- * @return void
16
- * @since 4.4.0
17
- */
18
- function qsm_generate_quiz_options() {
19
-
20
- // Checks if current user can.
21
- if ( ! current_user_can( 'moderate_comments' ) ) {
22
- return;
23
- }
24
-
25
- global $wpdb;
26
- global $mlwQuizMasterNext;
27
-
28
- $quiz_name = '';
29
-
30
- // Gets registered tabs for the options page and set current tab.
31
- $tab_array = $mlwQuizMasterNext->pluginHelper->get_settings_tabs();
32
- $active_tab = strtolower( str_replace( ' ', '-', isset( $_GET[ 'tab' ] ) ? stripslashes( $_GET[ 'tab' ] ) : __( 'Questions', 'quiz-master-next' ) ) );
33
-
34
- // Prepares quiz.
35
- $quiz_id = isset( $_GET['quiz_id'] ) ? intval( $_GET['quiz_id'] ) : 0;
36
- if ( isset( $_GET['quiz_id'] ) ) {
37
- $quiz_name = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $quiz_id ) );
38
- $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id );
39
- }
40
-
41
- wp_enqueue_script( 'jquery' );
42
- wp_enqueue_script( 'jquery-ui-core' );
43
- wp_enqueue_script( 'jquery-ui-dialog' );
44
- wp_enqueue_script( 'jquery-ui-button' );
45
- wp_enqueue_script( 'jquery-ui-datepicker' );
46
- wp_enqueue_script( 'jquery-ui-tabs' );
47
- wp_enqueue_script( 'jquery-effects-blind' );
48
- wp_enqueue_script( 'jquery-effects-explode' );
49
-
50
- wp_enqueue_script( 'qmn_admin_js', plugins_url( '../../js/admin.js', __FILE__ ), array( 'backbone', 'underscore', 'wp-util' ), $mlwQuizMasterNext->version, true );
51
- wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
52
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
53
- wp_enqueue_style( 'qmn_jquery_redmond_theme', plugins_url( '../../css/jquery-ui.css', __FILE__ ) );
54
- wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
55
-
56
- // Edit Quiz Name.
57
- if ( isset( $_POST['qsm_edit_name_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_edit_name_quiz_nonce'], 'qsm_edit_name_quiz' ) ) {
58
- $quiz_id = intval( $_POST['edit_quiz_id'] );
59
- $quiz_name = htmlspecialchars( stripslashes( $_POST['edit_quiz_name'] ), ENT_QUOTES );
60
- $mlwQuizMasterNext->quizCreator->edit_quiz_name( $quiz_id, $quiz_name );
61
- }
62
- ?>
63
- <div class="wrap">
64
- <div class='mlw_quiz_options'>
65
- <h1 style="display: inline-block;"><?php echo $quiz_name; ?></h1>
66
- <a style="display: inline-block;margin-top: 10px;margin-bottom: 15px;margin-left: 10px;" hre="#" class="edit-quiz-name button button-primary">Edit Name</a>
67
- <?php
68
- // Get quiz post based on quiz id
69
- $args = array(
70
- 'posts_per_page' => 1,
71
- 'post_type' => 'quiz',
72
- 'meta_query' => array(
73
- array(
74
- 'key' => 'quiz_id',
75
- 'value' => $quiz_id,
76
- 'compare' => '=',
77
- ),
78
- ),
79
- );
80
- $the_query = new WP_Query($args);
81
-
82
- // The Loop
83
- $post_permalink = '';
84
- if ($the_query->have_posts()) {
85
- while ($the_query->have_posts()) {
86
- $the_query->the_post();
87
- $post_permalink = get_the_permalink(get_the_ID());
88
- }
89
- /* Restore original Post Data */
90
- wp_reset_postdata();
91
- }
92
- ?>
93
- <a style="text-decoration: none; position: relative; top: 9px; left: 5px;" target="_blank" href="<?php echo $post_permalink; ?>">
94
- <span style="font-size: 30px;" class="dashicons dashicons-external"></span>
95
- </a>
96
- <?php
97
- // Puts all output from tab into ob_get_contents below.
98
- ob_start();
99
-
100
- // If the quiz is set and not empty.
101
- if ( ! empty( $quiz_id ) ) {
102
- ?>
103
- <nav class="nav-tab-wrapper">
104
- <?php
105
- // Cycles through registered tabs to create navigation.
106
- foreach ( $tab_array as $tab ) {
107
- $active_class = '';
108
- if ( $active_tab == $tab['slug'] ) {
109
- $active_class = 'nav-tab-active';
110
- }
111
- ?>
112
- <a href="?page=mlw_quiz_options&quiz_id=<?php echo esc_attr( $quiz_id ); ?>&tab=<?php echo esc_attr( $tab['slug'] ); ?>" class="nav-tab <?php echo esc_attr( $active_class ); ?>"><?php echo esc_html( $tab['title'] ); ?></a>
113
- <?php
114
- }
115
- ?>
116
- </nav>
117
- <div class="qsm_tab_content">
118
- <?php
119
- // Cycles through tabs looking for current tab to create tab's content.
120
- foreach ( $tab_array as $tab ) {
121
- if ( $active_tab == $tab['slug'] ) {
122
- call_user_func( $tab['function'] );
123
- }
124
- }
125
- ?>
126
- </div>
127
- <?php
128
- } else {
129
- ?>
130
- <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
131
- <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
132
- <strong><?php esc_html_e( 'Error!', 'quiz-master-next' ); ?></strong> <?php esc_html_e( 'Please go to the quizzes page and click on the Edit link from the quiz you wish to edit.', 'quiz-master-next' ); ?></p>
133
- </div>
134
- <?php
135
- }
136
- $mlw_output = ob_get_contents();
137
- ob_end_clean();
138
-
139
- // Shows alerts, ads, then tab content.
140
- ?>
141
- <div class="qsm-alerts">
142
- <?php
143
- $mlwQuizMasterNext->alertManager->showAlerts();
144
- ?>
145
- </div>
146
- <?php
147
- qsm_show_adverts();
148
- echo $mlw_output;
149
- ?>
150
- </div>
151
- <div class="qsm-popup qsm-popup-slide" id="modal-3" aria-hidden="false">
152
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close="">
153
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-3-title">
154
- <header class="qsm-popup__header">
155
- <h2 class="qsm-popup__title" id="modal-3-title">Edit Name</h2>
156
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close=""></a>
157
- </header>
158
- <main class="qsm-popup__content" id="modal-3-content">
159
- <form action='' method='post' id="edit-name-form">
160
- <label><?php _e( 'Name', 'quiz-master-next' ); ?></label>
161
- <input type="text" id="edit_quiz_name" name="edit_quiz_name" value="<?php echo $quiz_name; ?>" />
162
- <input type="hidden" id="edit_quiz_id" name="edit_quiz_id" value="<?php echo isset($_GET['quiz_id']) ? $_GET['quiz_id'] : ''; ?>" />
163
- <?php wp_nonce_field( 'qsm_edit_name_quiz', 'qsm_edit_name_quiz_nonce' ); ?>
164
- </form>
165
- </main>
166
- <footer class="qsm-popup__footer">
167
- <button id="edit-name-button" class="qsm-popup__btn qsm-popup__btn-primary">Edit</button>
168
- <button class="qsm-popup__btn" data-micromodal-close="" aria-label="Close this dialog window">Cancel</button>
169
- </footer>
170
- </div>
171
- </div>
172
- </div>
173
- </div>
174
-
175
- <!-- Backbone Views -->
176
-
177
- <!-- View for Notices -->
178
- <script type="text/template" id="tmpl-notice">
179
- <div class="notice notice-large notice-{{data.type}}">
180
- <p>{{data.message}}</p>
181
- </div>
182
- </script>
183
- <?php
184
- }
185
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/quizzes-page.php DELETED
@@ -1,394 +0,0 @@
1
- <?php
2
- /**
3
- * This file handles the contents on the "Quizzes/Surveys" page.
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * Generates the quizzes and surveys page
14
- *
15
- * @since 5.0
16
- */
17
- function qsm_generate_quizzes_surveys_page() {
18
-
19
- // Only let admins and editors see this page.
20
- if ( ! current_user_can( 'moderate_comments' ) ) {
21
- return;
22
- }
23
-
24
- // Retrieve our globals.
25
- global $wpdb;
26
- global $mlwQuizMasterNext;
27
-
28
- // Enqueue our styles and scripts.
29
- wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) );
30
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
31
- wp_enqueue_script( 'qsm_admin_script', plugins_url( '../../js/qsm-admin.js', __FILE__ ), array( 'wp-util', 'underscore', 'jquery', 'micromodal_script' ), $mlwQuizMasterNext->version );
32
-
33
- // Create new quiz.
34
- if ( isset( $_POST['qsm_new_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_new_quiz_nonce'], 'qsm_new_quiz' ) ) {
35
- $quiz_name = htmlspecialchars( stripslashes( $_POST['quiz_name'] ), ENT_QUOTES );
36
- $mlwQuizMasterNext->quizCreator->create_quiz( $quiz_name );
37
- }
38
-
39
- // Delete quiz.
40
- if ( isset( $_POST['qsm_delete_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_delete_quiz_nonce'], 'qsm_delete_quiz' ) ) {
41
- $quiz_id = intval( $_POST['delete_quiz_id'] );
42
- $quiz_name = sanitize_text_field( $_POST['delete_quiz_name'] );
43
- $mlwQuizMasterNext->quizCreator->delete_quiz( $quiz_id, $quiz_name );
44
- }
45
-
46
- // Duplicate Quiz.
47
- if ( isset( $_POST['qsm_duplicate_quiz_nonce'] ) && wp_verify_nonce( $_POST['qsm_duplicate_quiz_nonce'], 'qsm_duplicate_quiz' ) ) {
48
- $quiz_id = intval( $_POST['duplicate_quiz_id'] );
49
- $quiz_name = htmlspecialchars( $_POST['duplicate_new_quiz_name'], ENT_QUOTES );
50
- $mlwQuizMasterNext->quizCreator->duplicate_quiz( $quiz_id, $quiz_name, isset( $_POST['duplicate_questions'] ) );
51
- }
52
-
53
- // Resets stats for a quiz.
54
- if ( isset( $_POST['qsm_reset_stats_nonce'] ) && wp_verify_nonce( $_POST['qsm_reset_stats_nonce'] , 'qsm_reset_stats' ) ) {
55
- $quiz_id = intval( $_POST['reset_quiz_id'] );
56
- $results = $wpdb->update(
57
- $wpdb->prefix . 'mlw_quizzes',
58
- array(
59
- 'quiz_views' => 0,
60
- 'quiz_taken' => 0,
61
- 'last_activity' => date( 'Y-m-d H:i:s' ),
62
- ),
63
- array( 'quiz_id' => $quiz_id ),
64
- array(
65
- '%d',
66
- '%d',
67
- '%s',
68
- ),
69
- array( '%d' )
70
- );
71
- if ( false !== $results ) {
72
- $mlwQuizMasterNext->alertManager->newAlert( __( 'The stats has been reset successfully.', 'quiz-master-next' ), 'success' );
73
- $mlwQuizMasterNext->audit_manager->new_audit( "Quiz Stats Have Been Reset For Quiz Number $quiz_id" );
74
- } else {
75
- $mlwQuizMasterNext->alertManager->newAlert( __( 'Error trying to reset stats. Please try again.', 'quiz-master-next' ), 'error' );
76
- $mlwQuizMasterNext->log_manager->add( 'Error resetting stats', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
77
- }
78
- }
79
-
80
- // Load our quizzes.
81
- $quizzes = $mlwQuizMasterNext->pluginHelper->get_quizzes();
82
-
83
- // Load quiz posts.
84
- $post_to_quiz_array = array();
85
- $my_query = new WP_Query( array(
86
- 'post_type' => 'quiz',
87
- 'posts_per_page' => -1,
88
- 'post_status' => 'publish',
89
- ));
90
- if ( $my_query->have_posts() ) {
91
- while ( $my_query->have_posts() ) {
92
- $my_query->the_post();
93
- $post_to_quiz_array[ get_post_meta( get_the_ID(), 'quiz_id', true ) ] = array(
94
- 'link' => get_permalink(),
95
- 'id' => get_the_ID(),
96
- );
97
- }
98
- }
99
- wp_reset_postdata();
100
-
101
- $quiz_json_array = array();
102
- foreach ( $quizzes as $quiz ) {
103
- if ( ! isset( $post_to_quiz_array[ $quiz->quiz_id ] ) ) {
104
- $current_user = wp_get_current_user();
105
- $quiz_post = array(
106
- 'post_title' => $quiz->quiz_name,
107
- 'post_content' => "[qsm quiz={$quiz->quiz_id}]",
108
- 'post_status' => 'publish',
109
- 'post_author' => $current_user->ID,
110
- 'post_type' => 'quiz',
111
- );
112
- $quiz_post_id = wp_insert_post( $quiz_post );
113
- add_post_meta( $quiz_post_id, 'quiz_id', $quiz->quiz_id );
114
- $post_to_quiz_array[ $quiz->quiz_id ] = array(
115
- 'link' => get_permalink( $quiz_post_id ),
116
- 'id' => $quiz_post_id,
117
- );
118
- }
119
-
120
- $activity_date = date_i18n( get_option( 'date_format' ), strtotime( $quiz->last_activity ) );
121
- $activity_time = date( 'h:i:s A', strtotime( $quiz->last_activity ) );
122
- $quiz_json_array[] = array(
123
- 'id' => $quiz->quiz_id,
124
- 'name' => esc_html( $quiz->quiz_name ),
125
- 'link' => $post_to_quiz_array[ $quiz->quiz_id ]['link'],
126
- 'postID' => $post_to_quiz_array[ $quiz->quiz_id ]['id'],
127
- 'views' => $quiz->quiz_views,
128
- 'taken' => $quiz->quiz_taken,
129
- 'lastActivity' => $activity_date,
130
- 'lastActivityDateTime' => $activity_date . ' ' .$activity_time,
131
- );
132
- }
133
- $total_count = count( $quiz_json_array );
134
- wp_localize_script( 'qsm_admin_script', 'qsmQuizObject', $quiz_json_array );
135
- ?>
136
- <div class="wrap qsm-quizes-page">
137
- <h1><?php esc_html_e( 'Quizzes/Surveys', 'quiz-master-next' ); ?><a id="new_quiz_button" href="#" class="add-new-h2"><?php _e( 'Add New', 'quiz-master-next' ); ?></a></h1>
138
- <?php $mlwQuizMasterNext->alertManager->showAlerts(); ?>
139
- <?php
140
- if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) {
141
- ?>
142
- <div class="qsm-info-box">
143
- <p>Your site is using PHP version <?php echo esc_html( PHP_VERSION ); ?>! Starting in QSM 6.0, your version of PHP will no longer be supported. <a href="http://bit.ly/2lyrrm8" target="_blank">Click here to learn more about QSM's minimum PHP version change.</a></p>
144
- </div>
145
- <?php
146
- }
147
- ?>
148
- <div class="qsm-quizzes-page-content">
149
- <div class="<?php if ( 'false' != get_option( 'mlw_advert_shows' ) ) { echo 'qsm-quiz-page-wrapper-with-ads'; } else { echo 'qsm-quiz-page-wrapper'; } ?>">
150
- <p class="search-box">
151
- <label class="screen-reader-text" for="quiz_search"><?php esc_html_e( 'Search', 'quiz-master-next' ); ?></label>
152
- <input type="search" id="quiz_search" name="quiz_search" value="">
153
- <a href="#" class="button"><?php esc_html_e( 'Search', 'quiz-master-next' ); ?></a>
154
- </p>
155
- <div class="tablenav top">
156
- <div class="tablenav-pages">
157
- <span class="displaying-num"><?php echo sprintf( _n( 'One quiz or survey', '%s quizzes or surveys', $total_count, 'quiz-master-next' ), number_format_i18n( $total_count ) ); ?></span>
158
- <br class="clear">
159
- </div>
160
- </div>
161
- <table class="widefat">
162
- <thead>
163
- <tr>
164
- <th><?php esc_html_e( 'Name', 'quiz-master-next' ); ?></th>
165
- <th><?php esc_html_e( 'Shortcode', 'quiz-master-next' ); ?></th>
166
- <th><?php esc_html_e( 'Views/Taken', 'quiz-master-next' ); ?></th>
167
- <th><?php esc_html_e( 'Last Modified', 'quiz-master-next' ); ?></th>
168
- </tr>
169
- </thead>
170
- <tbody id="the-list">
171
-
172
- </tbody>
173
- <tfoot>
174
- <tr>
175
- <th><?php esc_html_e( 'Name', 'quiz-master-next' ); ?></th>
176
- <th><?php esc_html_e( 'Shortcode', 'quiz-master-next' ); ?></th>
177
- <th><?php esc_html_e( 'Views/Taken', 'quiz-master-next' ); ?></th>
178
- <th><?php esc_html_e( 'Last Modified', 'quiz-master-next' ); ?></th>
179
- </tr>
180
- </tfoot>
181
- </table>
182
- </div>
183
- <?php
184
- if ( 'true' == get_option( 'mlw_advert_shows' ) ) {
185
- ?>
186
- <div class="qsm-news-ads">
187
- <h3 class="qsm-news-ads-title"><?php esc_html_e( 'QSM News', 'quiz-master-next' ); ?></h3>
188
- <!-- <div class="qsm-info-widget">
189
- <h3>Keep your WordPress site healthy and secure!</h3>
190
- <p>Easily monitor your WordPress sites to ensure they stay up, healthy, and secure with our new WordPress plugin, WP Health!</p>
191
- <a target="_blank" href="http://bit.ly/2Mr2SqC" class="button-primary"><?php esc_html_e( 'Learn More', 'quiz-master-next' ); ?></a>
192
- </div>-->
193
- <?php
194
- $xml = qsm_fetch_data_from_xml();
195
- if(isset($xml->qsm_news)){
196
- ?>
197
- <div class="qsm-info-widget">
198
- <h3><?php echo $xml->qsm_news->title; ?></h3>
199
- <p><?php echo $xml->qsm_news->desc; ?></p>
200
- <a target="_blank" href="<?php echo $xml->qsm_news->link; ?>?utm_source=qsm-quizzes-page&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=subscribe-to-newsletter" class="button-primary"><?php _e( 'Subscribe Now', 'quiz-master-next' ); ?></a>
201
- </div>
202
- <?php
203
- }
204
- $qmn_rss = array();
205
- if( false === get_transient('qsm_sidebar_feed_data') ){
206
- $qmn_feed = fetch_feed( 'https://quizandsurveymaster.com/feed' );
207
- if ( ! is_wp_error( $qmn_feed ) ) {
208
- $qmn_feed_items = $qmn_feed->get_items( 0, 5 );
209
- foreach ( $qmn_feed_items as $feed_item ) {
210
- $qmn_rss[] = array(
211
- 'link' => $feed_item->get_link(),
212
- 'title' => $feed_item->get_title(),
213
- 'description' => $feed_item->get_description(),
214
- 'date' => $feed_item->get_date( 'F j Y' ),
215
- 'author' => $feed_item->get_author()->get_name(),
216
- );
217
- }
218
- }
219
- set_transient( 'qsm_sidebar_feed_data', $qmn_rss, 60*60*24 );
220
- }else{
221
- $qmn_rss = get_transient('qsm_sidebar_feed_data');
222
- }
223
- foreach ( $qmn_rss as $item ) {
224
- ?>
225
- <div class="qsm-info-widget">
226
- <h3><?php echo esc_html( $item['title'] ); ?></h3>
227
- <p>By <?php echo esc_html( $item['author'] ); ?></p>
228
- <div>
229
- <?php echo esc_html( $item['description'] ); ?>
230
- </div>
231
- <a target='_blank' href="<?php echo esc_attr( $item['link'] ); ?>?utm_source=qsm-quizzes-page&utm_medium=plugin&utm_campaign=qsm_plugin" class="button-primary"><?php _e( 'Read More', 'quiz-master-next' ); ?></a>
232
- </div>
233
- <?php
234
- }
235
- ?>
236
- <div class="remove-ads-adv-link">
237
- <a target="_blank" href="https://quizandsurveymaster.com/downloads/advertisement-gone/"><span class="dashicons dashicons-no-alt"></span> Remove Ads</a>
238
- </div>
239
- </div>
240
- <?php
241
- }
242
- ?>
243
- </div>
244
-
245
- <!-- Popup for resetting stats -->
246
- <div class="qsm-popup qsm-popup-slide" id="modal-1" aria-hidden="true">
247
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
248
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-1-title">
249
- <header class="qsm-popup__header">
250
- <h2 class="qsm-popup__title" id="modal-1-title">Reset stats for this quiz?</h2>
251
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
252
- </header>
253
- <main class="qsm-popup__content" id="modal-1-content">
254
- <p><?php _e('Are you sure you want to reset the stats to 0? All views and taken stats for this quiz will be reset. This is permanent and cannot be undone.', 'quiz-master-next'); ?></p>
255
- <form action="" method="post" id="reset_quiz_form">
256
- <?php wp_nonce_field( 'qsm_reset_stats', 'qsm_reset_stats_nonce' ); ?>
257
- <input type="hidden" id="reset_quiz_id" name="reset_quiz_id" value="0" />
258
- </form>
259
- </main>
260
- <footer class="qsm-popup__footer">
261
- <button id="reset-stats-button" class="qsm-popup__btn qsm-popup__btn-primary"><?php _e('Reset All Stats For Quiz', 'quiz-master-next'); ?></button>
262
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window"><?php _e('Cancel', 'quiz-master-next'); ?></button>
263
- </footer>
264
- </div>
265
- </div>
266
- </div>
267
-
268
- <!-- Popup for new quiz -->
269
- <div class="qsm-popup qsm-popup-slide" id="modal-2" aria-hidden="true">
270
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
271
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-2-title">
272
- <header class="qsm-popup__header">
273
- <h2 class="qsm-popup__title" id="modal-2-title"><?php _e( 'Create New Quiz Or Survey', 'quiz-master-next' ); ?></h2>
274
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
275
- </header>
276
- <main class="qsm-popup__content" id="modal-2-content">
277
- <form action="" method="post" id="new-quiz-form">
278
- <?php wp_nonce_field( 'qsm_new_quiz', 'qsm_new_quiz_nonce' ); ?>
279
- <label><?php _e( 'Name', 'quiz-master-next' ); ?></label>
280
- <input type="text" name="quiz_name" value="" />
281
- </form>
282
- </main>
283
- <footer class="qsm-popup__footer">
284
- <button id="create-quiz-button" class="qsm-popup__btn qsm-popup__btn-primary"><?php _e('Create', 'quiz-master-next'); ?></button>
285
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window"><?php _e('Cancel', 'quiz-master-next'); ?></button>
286
- </footer>
287
- </div>
288
- </div>
289
- </div>
290
-
291
- <!-- Popup for duplicate quiz -->
292
- <div class="qsm-popup qsm-popup-slide" id="modal-4" aria-hidden="true">
293
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
294
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-4-title">
295
- <header class="qsm-popup__header">
296
- <h2 class="qsm-popup__title" id="modal-4-title"><?php _e( 'Duplicate', 'quiz-master-next' ); ?></h2>
297
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
298
- </header>
299
- <main class="qsm-popup__content" id="modal-4-content">
300
- <form action='' method='post' id="duplicate-quiz-form">
301
- <label for="duplicate_questions"><?php _e( 'Duplicate questions also?', 'quiz-master-next' ); ?></label><input type="checkbox" name="duplicate_questions" id="duplicate_questions"/><br />
302
- <br />
303
- <label for="duplicate_new_quiz_name"><?php _e( 'Name Of New Quiz Or Survey:', 'quiz-master-next' ); ?></label><input type="text" id="duplicate_new_quiz_name" name="duplicate_new_quiz_name" />
304
- <input type="hidden" id="duplicate_quiz_id" name="duplicate_quiz_id" />
305
- <?php wp_nonce_field( 'qsm_duplicate_quiz', 'qsm_duplicate_quiz_nonce' ); ?>
306
- </form>
307
- </main>
308
- <footer class="qsm-popup__footer">
309
- <button id="duplicate-quiz-button" class="qsm-popup__btn qsm-popup__btn-primary"><?php _e('Duplicate', 'quiz-master-next'); ?></button>
310
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window"><?php _e('Cancel', 'quiz-master-next'); ?></button>
311
- </footer>
312
- </div>
313
- </div>
314
- </div>
315
-
316
- <!-- Popup for delete quiz -->
317
- <div class="qsm-popup qsm-popup-slide" id="modal-5" aria-hidden="true">
318
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
319
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-5-title">
320
- <header class="qsm-popup__header">
321
- <h2 class="qsm-popup__title" id="modal-5-title"><?php _e( 'Delete', 'quiz-master-next' ); ?></h2>
322
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
323
- </header>
324
- <main class="qsm-popup__content" id="modal-5-content">
325
- <form action='' method='post' id="delete-quiz-form">
326
- <h3><b><?php _e( 'Are you sure you want to delete this quiz or survey?', 'quiz-master-next' ); ?></b></h3>
327
- <?php wp_nonce_field( 'qsm_delete_quiz', 'qsm_delete_quiz_nonce' ); ?>
328
- <input type='hidden' id='delete_quiz_id' name='delete_quiz_id' value='' />
329
- <input type='hidden' id='delete_quiz_name' name='delete_quiz_name' value='' />
330
- </form>
331
- </main>
332
- <footer class="qsm-popup__footer">
333
- <button id="delete-quiz-button" class="qsm-popup__btn qsm-popup__btn-primary"><?php _e('Delete', 'quiz-master-next'); ?></button>
334
- <button class="qsm-popup__btn" data-micromodal-close aria-label="Close this dialog window"><?php _e('Cancel', 'quiz-master-next'); ?></button>
335
- </footer>
336
- </div>
337
- </div>
338
- </div>
339
-
340
- <!-- Popup for delete quiz -->
341
- <div class="qsm-popup qsm-popup-slide" id="modal-6" aria-hidden="true">
342
- <div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close>
343
- <div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-5-title">
344
- <header class="qsm-popup__header">
345
- <h2 class="qsm-popup__title" id="modal-5-title"><?php _e( 'Shortcode', 'quiz-master-next' ); ?></h2>
346
- <a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close></a>
347
- </header>
348
- <main class="qsm-popup__content" id="modal-5-content">
349
- <input type="text" value="" id="sc-shortcode-model-text" style="width: 72%;padding: 5px;">
350
- <button class="button button-primary" id="sc-copy-shortcode">Copy Shortcode</button>
351
- </main>
352
- </div>
353
- </div>
354
- </div>
355
-
356
- <!-- Templates -->
357
- <script type="text/template" id="tmpl-no-quiz">
358
- <h2><?php _e( 'You do not have any quizzes or surveys. Click "Add New" to get started.', 'quiz-master-next' ); ?></h2>
359
- <h2>Is this your first time using this plugin? Check out our <a href="https://docs.quizandsurveymaster.com" target="_blank">Documentation</a> or watch our Getting Started Video below</h2>
360
- <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/coE5W_WB-48" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
361
- </script>
362
-
363
- <script type="text/template" id="tmpl-quiz-row">
364
- <tr class="qsm-quiz-row" data-id="{{ data.id }}">
365
- <td class="post-title column-title">
366
- <a class="row-title" href="admin.php?page=mlw_quiz_options&&quiz_id={{ data.id }}" aria-label="{{ data.name }}">{{ data.name }}</a><a target="_blank" class="quiz-preview-link" href="{{ data.link }}"><span class="dashicons dashicons-external"></span></a>
367
- <div class="row-actions">
368
- <a class="qsm-action-link" href="admin.php?page=mlw_quiz_options&&quiz_id={{ data.id }}"><?php _e( 'Edit', 'quiz-master-next' ); ?></a> |
369
- <a class="qsm-action-link" href="post.php?post={{ data.postID }}&action=edit"><?php _e( 'Post Settings', 'quiz-master-next' ); ?></a> |
370
- <a class="qsm-action-link qsm-action-link-duplicate" href="#"><?php _e( 'Duplicate', 'quiz-master-next' ); ?></a> |
371
- <a class="qsm-action-link qsm-action-link-delete" href="#"><?php _e( 'Delete', 'quiz-master-next' ); ?></a> |
372
- <a class="qsm-action-link" target="_blank" href="{{ data.link }}"><?php _e( 'Preview', 'quiz-master-next' ); ?></a>
373
- </div>
374
- </td>
375
- <td>
376
- <p class="sc-opener"><span class="dashicons dashicons-editor-contract"></span> Embed</p>
377
- <div class="sc-content">[qsm quiz={{ data.id }}]</div>
378
- <p class="sc-opener"><span class="dashicons dashicons-admin-links"></span> Link</p>
379
- <div class="sc-content">[qsm_link id={{ data.id }}]<?php _e( 'Click here', 'quiz-master-next' ); ?>[/qsm_link]</div>
380
- </td>
381
- <td>
382
- {{ data.views }}/{{ data.taken }}
383
- <div class="row-actions">
384
- <a class="qsm-action-link qsm-action-link-reset" href="#"><?php _e( 'Reset', 'quiz-master-next' ); ?></a> |
385
- <a class="qsm-action-link" href="admin.php?page=mlw_quiz_results&&quiz_id={{ data.id }}"><?php _e( 'Results', 'quiz-master-next' ); ?></a>
386
- </div>
387
- </td>
388
- <td><abbr title="{{ data.lastActivityDateTime }}">{{ data.lastActivity }}</abbr></td>
389
- </tr>
390
- </script>
391
- </div>
392
- <?php
393
- }
394
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/settings-page.php DELETED
@@ -1,292 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
3
-
4
- /**
5
- * Generates The Settings Page For The Plugin
6
- *
7
- * @since 4.1.0
8
- */
9
- class QMNGlobalSettingsPage {
10
-
11
- /**
12
- * Main Construct Function
13
- *
14
- * Call functions within class
15
- *
16
- * @since 4.1.0
17
- * @uses QMNGlobalSettingsPage::load_dependencies() Loads required filed
18
- * @uses QMNGlobalSettingsPage::add_hooks() Adds actions to hooks and filters
19
- * @return void
20
- */
21
- function __construct() {
22
- $this->add_hooks();
23
- }
24
-
25
- /**
26
- * Add Hooks
27
- *
28
- * Adds functions to relavent hooks and filters
29
- *
30
- * @since 4.1.0
31
- * @return void
32
- */
33
- private function add_hooks() {
34
- add_action( "admin_init", array( $this, 'init' ) );
35
- }
36
-
37
- /**
38
- * Prepares Settings Fields And Sections
39
- *
40
- * @since 4.1.0
41
- * @return void
42
- */
43
- public function init() {
44
- register_setting( 'qmn-settings-group', 'qmn-settings' );
45
- add_settings_section( 'qmn-global-section', __( 'Main Settings', 'quiz-master-next' ), array( $this, 'global_section' ), 'qmn_global_settings' );
46
- add_settings_field( 'usage-tracker', __( 'Allow Usage Tracking?', 'quiz-master-next' ), array( $this, 'usage_tracker_field' ), 'qmn_global_settings', 'qmn-global-section' );
47
- add_settings_field( 'ip-collection', __( 'Disable collecting and storing IP addresses?', 'quiz-master-next' ), array( $this, 'ip_collection_field' ), 'qmn_global_settings', 'qmn-global-section' );
48
- add_settings_field( 'cpt-search', __( 'Disable Quiz Posts From Being Searched?', 'quiz-master-next' ), array( $this, 'cpt_search_field' ), 'qmn_global_settings', 'qmn-global-section' );
49
- add_settings_field( 'cpt-archive', __( 'Disable Quiz Archive?', 'quiz-master-next' ), array( $this, 'cpt_archive_field' ), 'qmn_global_settings', 'qmn-global-section' );
50
- add_settings_field( 'cpt-slug', __( 'Quiz Url Slug', 'quiz-master-next' ), array( $this, 'cpt_slug_field' ), 'qmn_global_settings', 'qmn-global-section' );
51
- add_settings_field( 'plural-name', __( 'Post Type Plural Name (Shown in various places such as on archive pages)', 'quiz-master-next' ), array( $this, 'plural_name_field' ), 'qmn_global_settings', 'qmn-global-section' );
52
- add_settings_field( 'facebook-app-id', __( 'Facebook App Id', 'quiz-master-next' ), array( $this, 'facebook_app_id' ), 'qmn_global_settings', 'qmn-global-section' );
53
- add_settings_field( 'from-name', __( 'From Name (The name emails come from)', 'quiz-master-next' ), array( $this, 'from_name' ), 'qmn_global_settings', 'qmn-global-section' );
54
- add_settings_field( 'from-email', __( 'From Email (The email address that emails come from)', 'quiz-master-next' ), array( $this, 'from_email' ), 'qmn_global_settings', 'qmn-global-section' );
55
- add_settings_field( 'results-details', __( 'Template For Admin Results Details', 'quiz-master-next' ), array( $this, 'results_details_template' ), 'qmn_global_settings', 'qmn-global-section' );
56
- }
57
-
58
- /**
59
- * Generates Section Text
60
- *
61
- * Generates the section text. If page has been saved, flush rewrite rules for updated post type slug
62
- *
63
- * @since 4.1.0
64
- * @return void
65
- */
66
- public function global_section() {
67
- _e( 'These settings are applied to the entire plugin and all quizzes.', 'quiz-master-next' );
68
- if ( isset( $_GET["settings-updated"] ) && $_GET["settings-updated"] ) {
69
- flush_rewrite_rules( true );
70
- echo "<span style='color:red;'>" . __( 'Settings have been updated!', 'quiz-master-next' ) . "</span>";
71
- }
72
- }
73
-
74
- /**
75
- * Generates Setting Field For From Email
76
- *
77
- * @since 6.2.0
78
- * @return void
79
- */
80
- public function from_email() {
81
- $settings = (array) get_option( 'qmn-settings' );
82
- $from_email = get_option( 'admin_email', '' );
83
- if ( isset( $settings['from_email'] ) ) {
84
- $from_email = $settings['from_email'];
85
- }
86
- ?>
87
- <input type='email' name='qmn-settings[from_email]' id='qmn-settings[from_email]' value='<?php echo esc_attr( $from_email ); ?>' />
88
- <?php
89
- }
90
-
91
- /**
92
- * Generates Setting Field For From Name
93
- *
94
- * @since 6.2.0
95
- * @return void
96
- */
97
- public function from_name() {
98
- $settings = (array) get_option( 'qmn-settings' );
99
- $from_name = get_bloginfo( 'name' );
100
- if ( isset( $settings['from_name'] ) ) {
101
- $from_name = $settings['from_name'];
102
- }
103
- ?>
104
- <input type='text' name='qmn-settings[from_name]' id='qmn-settings[from_name]' value='<?php echo esc_attr( $from_name ); ?>' />
105
- <?php
106
- }
107
-
108
- /**
109
- * Generates Setting Field For App Id
110
- *
111
- * @since 4.1.0
112
- * @return void
113
- */
114
- public function facebook_app_id() {
115
- $settings = (array) get_option( 'qmn-settings' );
116
- $facebook_app_id = '483815031724529';
117
- if (isset($settings['facebook_app_id']))
118
- {
119
- $facebook_app_id = esc_attr( $settings['facebook_app_id'] );
120
- }
121
- echo "<input type='text' name='qmn-settings[facebook_app_id]' id='qmn-settings[facebook_app_id]' value='$facebook_app_id' />";
122
- }
123
-
124
- /**
125
- * Generates Setting Field For Post Slug
126
- *
127
- * @since 4.1.0
128
- * @return void
129
- */
130
- public function cpt_slug_field() {
131
- $settings = (array) get_option( 'qmn-settings' );
132
- $cpt_slug = 'quiz';
133
- if ( isset( $settings['cpt_slug'] ) ) {
134
- $cpt_slug = esc_attr( $settings['cpt_slug'] );
135
- }
136
- echo "<input type='text' name='qmn-settings[cpt_slug]' id='qmn-settings[cpt_slug]' value='$cpt_slug' />";
137
- }
138
-
139
- /**
140
- * Generates Setting Field For Plural name
141
- *
142
- * @since 5.3.0
143
- * @return void
144
- */
145
- public function plural_name_field() {
146
- $settings = (array) get_option( 'qmn-settings' );
147
- $plural_name = __( 'Quizzes & Surveys', 'quiz-master-next' );
148
- if ( isset( $settings['plural_name'] ) ) {
149
- $plural_name = esc_attr( $settings['plural_name'] );
150
- }
151
- echo "<input type='text' name='qmn-settings[plural_name]' id='qmn-settings[plural_name]' value='$plural_name' />";
152
- }
153
-
154
- /**
155
- * Generates Setting Field For Exclude Search
156
- *
157
- * @since 4.1.0
158
- * @return void
159
- */
160
- public function cpt_search_field()
161
- {
162
- $settings = (array) get_option( 'qmn-settings' );
163
- $cpt_search = '0';
164
- if (isset($settings['cpt_search']))
165
- {
166
- $cpt_search = esc_attr( $settings['cpt_search'] );
167
- }
168
- $checked = '';
169
- if ($cpt_search == '1')
170
- {
171
- $checked = " checked='checked'";
172
- }
173
- echo "<input type='checkbox' name='qmn-settings[cpt_search]' id='qmn-settings[cpt_search]' value='1'$checked />";
174
- }
175
-
176
- /**
177
- * Generates Setting Field For Post Archive
178
- *
179
- * @since 4.1.0
180
- * @return void
181
- */
182
- public function cpt_archive_field()
183
- {
184
- $settings = (array) get_option( 'qmn-settings' );
185
- $cpt_archive = '0';
186
- if (isset($settings['cpt_archive']))
187
- {
188
- $cpt_archive = esc_attr( $settings['cpt_archive'] );
189
- }
190
- $checked = '';
191
- if ($cpt_archive == '1')
192
- {
193
- $checked = " checked='checked'";
194
- }
195
- echo "<input type='checkbox' name='qmn-settings[cpt_archive]' id='qmn-settings[cpt_archive]' value='1'$checked />";
196
- }
197
-
198
- /**
199
- * Generates Setting Field For Results Details Template
200
- *
201
- * @since 4.1.0
202
- * @return void
203
- */
204
- public function results_details_template()
205
- {
206
- $settings = (array) get_option( 'qmn-settings' );
207
- if (isset($settings['results_details_template']))
208
- {
209
- $template = htmlspecialchars_decode($settings['results_details_template'], ENT_QUOTES);
210
- }
211
- else
212
- {
213
- $template = "<h2>Quiz Results for %QUIZ_NAME%</h2>
214
- <p>%CONTACT_ALL%</p>
215
- <p>Name Provided: %USER_NAME%</p>
216
- <p>Business Provided: %USER_BUSINESS%</p>
217
- <p>Phone Provided: %USER_PHONE%</p>
218
- <p>Email Provided: %USER_EMAIL%</p>
219
- <p>Score Received: %AMOUNT_CORRECT%/%TOTAL_QUESTIONS% or %CORRECT_SCORE%% or %POINT_SCORE% points</p>
220
- <h2>Answers Provided:</h2>
221
- <p>The user took %TIMER% to complete quiz.</p>
222
- <p>Comments entered were: %COMMENT_SECTION%</p>
223
- <p>The answers were as follows:</p>
224
- %QUESTIONS_ANSWERS%";
225
- }
226
- wp_editor( $template, 'results_template', array('textarea_name' => 'qmn-settings[results_details_template]') );
227
- }
228
-
229
- /**
230
- * Generates Setting Field For Usage Tracker Authorization
231
- *
232
- * @since 4.1.0
233
- * @return void
234
- */
235
- public function usage_tracker_field()
236
- {
237
- $settings = (array) get_option( 'qmn-settings' );
238
- $tracking_allowed = '0';
239
- if (isset($settings['tracking_allowed']))
240
- {
241
- $tracking_allowed = esc_attr( $settings['tracking_allowed'] );
242
- }
243
- $checked = '';
244
- if ($tracking_allowed == '2')
245
- {
246
- $checked = " checked='checked'";
247
- }
248
- echo "<input type='checkbox' name='qmn-settings[tracking_allowed]' id='qmn-settings[tracking_allowed]' value='2'$checked />";
249
- echo "<label for='qmn-settings[tracking_allowed]'>" . __( "Allow Quiz And Survey Master to anonymously track this plugin's usage and help us make this plugin better.", 'quiz-master-next' ) . "</label>";
250
- }
251
-
252
- /**
253
- * Generates Setting Field For IP Collection
254
- *
255
- * @since 5.3.0
256
- * @return void
257
- */
258
- public function ip_collection_field() {
259
- $settings = (array) get_option( 'qmn-settings' );
260
- $ip_collection = '0';
261
- if ( isset( $settings['ip_collection'] ) ) {
262
- $ip_collection = esc_attr( $settings['ip_collection'] );
263
- }
264
- $checked = '';
265
- if ( '1' == $ip_collection ) {
266
- $checked = " checked='checked'";
267
- }
268
- echo "<input type='checkbox' name='qmn-settings[ip_collection]' id='qmn-settings[ip_collection]' value='1'$checked />";
269
- }
270
-
271
- /**
272
- * Generates Settings Page
273
- *
274
- * @since 4.1.0
275
- * @return void
276
- */
277
- public static function display_page() {
278
- ?>
279
- <div class="wrap">
280
- <h2><?php _e( 'Global Settings', 'quiz-master-next' ); ?></h2>
281
- <form action="options.php" method="POST">
282
- <?php settings_fields( 'qmn-settings-group' ); ?>
283
- <?php do_settings_sections( 'qmn_global_settings' ); ?>
284
- <?php submit_button(); ?>
285
- </form>
286
- </div>
287
- <?php
288
- }
289
- }
290
-
291
- $qmnGlobalSettingsPage = new QMNGlobalSettingsPage();
292
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/stats-page.php DELETED
@@ -1,199 +0,0 @@
1
- <?php
2
- /**
3
- * This file creates the Stats page
4
- *
5
- * @since 4.3.0
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) exit;
9
-
10
- /**
11
- * Generates the HTML for the Stats page
12
- *
13
- * Retrieves the HTML for the tab of Stats page from the plugin helper
14
- *
15
- * @since 4.3.0
16
- * @return void
17
- */
18
- function qmn_generate_stats_page()
19
- {
20
- if ( !current_user_can('moderate_comments') )
21
- {
22
- return;
23
- }
24
- global $mlwQuizMasterNext;
25
- $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'quiz-and-survey-submissions';
26
- $tab_array = $mlwQuizMasterNext->pluginHelper->get_stats_tabs();
27
- ?>
28
- <div class="wrap">
29
- <h2><?php _e('Quiz/Survey Statistics', 'quiz-master-next'); ?></h2>
30
- <?php qsm_show_adverts(); ?>
31
- <h2 class="nav-tab-wrapper">
32
- <?php
33
- foreach($tab_array as $tab)
34
- {
35
- $active_class = '';
36
- if ($active_tab == $tab['slug'])
37
- {
38
- $active_class = 'nav-tab-active';
39
- }
40
- echo "<a href=\"?page=qmn_stats&tab=".$tab['slug']."\" class=\"nav-tab $active_class\">".$tab['title']."</a>";
41
- }
42
- ?>
43
- </h2>
44
- <div>
45
- <?php
46
- foreach($tab_array as $tab)
47
- {
48
- if ($active_tab == $tab['slug'])
49
- {
50
- call_user_func($tab['function']);
51
- }
52
- }
53
- ?>
54
- </div>
55
- </div>
56
- <?php
57
- }
58
-
59
- /**
60
- * Adds Overview Tab To Stats Page
61
- *
62
- * @since 4.3.0
63
- * @return void
64
- */
65
- function qmn_stats_overview_tab()
66
- {
67
- global $mlwQuizMasterNext;
68
- $mlwQuizMasterNext->pluginHelper->register_stats_settings_tab(__("Quiz And Survey Submissions", 'quiz-master-next'), "qmn_stats_overview_content");
69
- }
70
- add_action("plugins_loaded", 'qmn_stats_overview_tab');
71
-
72
- /**
73
- * Generates HTML For Overview Tab
74
- *
75
- * @since 4.3.0
76
- * @return void
77
- */
78
- function qmn_stats_overview_content()
79
- {
80
- wp_enqueue_script('ChartJS', plugins_url( '../../js/Chart.min.js' , __FILE__ ));
81
- $range = "daily";
82
- if (isset($_POST["range"])) {
83
- $range = sanitize_text_field( $_POST["range"] );
84
- }
85
- $data = qmn_load_stats($range, 7);
86
- $labels = "";
87
- $value = "";
88
- foreach($data as $stat) {
89
- $labels .= '"",' ;
90
- $value .= "$stat,";
91
- }
92
- ?>
93
- <style>
94
- .postbox:after {
95
- display:table;
96
- content:" ";
97
- clear:both;
98
- }
99
- .postbox {
100
- padding: 10px 1%;
101
- }
102
- .postbox h3 {
103
- padding: 0;
104
- margin: 0 0 20px;
105
- }
106
- </style>
107
- <div class="metabox-holder">
108
- <div class="postbox">
109
- <form action="" method="post">
110
- <select name="range">
111
- <option value="daily" <?php if ( $range == "daily" ) { echo 'selected="selected"'; } ?>>Daily</option>
112
- <option value="weekly" <?php if ( $range == "weekly" ) { echo 'selected="selected"'; } ?>>Weekly</option>
113
- <option value="monthly" <?php if ( $range == "monthly" ) { echo 'selected="selected"'; } ?>>Monthly</option>
114
- <?php do_action('qmn_quiz_taken_stats_options'); ?>
115
- </select>
116
- <button type="submit" class="button">Filter</button>
117
- </form>
118
- <div>
119
- <canvas id="graph_canvas"></canvas>
120
- <script>
121
- var graph_data = {
122
- labels : [<?php echo $labels; ?>],
123
- datasets : [
124
- {
125
- label: "",
126
- fillColor : "rgba(220,220,220,0.2)",
127
- strokeColor : "rgba(220,220,220,1)",
128
- pointColor : "rgba(220,220,220,1)",
129
- pointStrokeColor : "#fff",
130
- pointHighlightFill : "#fff",
131
- pointHighlightStroke : "rgba(220,220,220,1)",
132
- data : [<?php echo $value; ?>]
133
- }
134
- ]
135
- }
136
- window.onload = function(){
137
- var graph_ctx = document.getElementById("graph_canvas").getContext("2d");
138
- window.stats_graph = new Chart(graph_ctx).Line(graph_data, {
139
- responsive: true
140
- });
141
- }
142
- </script>
143
- </div>
144
- </div>
145
- </div>
146
- <?php
147
- }
148
-
149
-
150
- /**
151
- * Loads Stats From mlw_results
152
- *
153
- * Creates array of stats from counting the amount of rows in mlw_results according to the $type.
154
- *
155
- * @since 4.3.0
156
- * @param $type string The type of stat report
157
- * @param $amount int The amount of stats to pull
158
- * @return array The array of stats
159
- */
160
- function qmn_load_stats($type, $amount = 0) {
161
- $stats = array();
162
- switch ($type) {
163
- case 'daily':
164
- global $wpdb;
165
- for ($i=0; $i < $amount; $i++) {
166
- $stat_date = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")-$i, date("Y")));
167
- $retrieved_stats = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$stat_date." 00:00:00' AND '".$stat_date." 23:59:59') AND deleted=0");
168
- array_unshift($stats, $retrieved_stats);
169
- }
170
- break;
171
-
172
- case 'weekly':
173
- global $wpdb;
174
- for ($i=0; $i < $amount; $i++) {
175
- $stat_date = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")-(6+($i*7)), date("Y")));
176
- $stat_end_date = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")-($i*7), date("Y")));
177
- $retrieved_stats = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$stat_date." 00:00:00' AND '".$stat_end_date." 23:59:59') AND deleted=0");
178
- array_unshift($stats, $retrieved_stats);
179
- }
180
- break;
181
-
182
- case 'monthly':
183
- global $wpdb;
184
- for ($i=0; $i < $amount; $i++) {
185
- $stat_date = date("Y-m-d", mktime(0, 0, 0, date("m")-$i, 1, date("Y")));
186
- $stat_end_date = date("Y-m-t", mktime(0, 0, 0, date("m")-$i, date("d"), date("Y")));
187
- $retrieved_stats = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$stat_date." 00:00:00' AND '".$stat_end_date." 23:59:59') AND deleted=0");
188
- array_unshift($stats, $retrieved_stats);
189
- }
190
- break;
191
-
192
- default:
193
- # code...
194
- break;
195
- }
196
- $stats = apply_filters('qmn_quiz_taken_stats_load_stats', $stats, $type, $amount);
197
- return $stats;
198
- }
199
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/admin/tools-page.php DELETED
@@ -1,199 +0,0 @@
1
- <?php
2
- /**
3
- * Generates the content for the tools page.
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
-
10
-
11
- /**
12
- * Generates all of the quiz tools that are used
13
- *
14
- * @return void
15
- * @since 6.2.0
16
- */
17
- function qsm_generate_quiz_tools() {
18
- if ( ! current_user_can( 'moderate_comments' ) ) {
19
- return;
20
- }
21
- add_meta_box( 'qsm_restore_box', 'Restore Quiz', 'qsm_restore_function', 'quiz_wpss' );
22
- add_meta_box( 'qsm_audit_box', 'Audit Trail', 'qsm_audit_box', 'quiz_wpss' );
23
- ?>
24
- <div class="wrap">
25
- <h2><?php esc_html_e('Tools', 'quiz-master-next'); ?></h2>
26
-
27
- <div style="float:left; width:100%;" class="inner-sidebar1">
28
- <?php do_meta_boxes( 'quiz_wpss', 'advanced', null ); ?>
29
- </div>
30
-
31
- <div style="clear:both"></div>
32
-
33
- <?php qsm_show_adverts(); ?>
34
-
35
- </div>
36
- <?php
37
- }
38
-
39
- /**
40
- * Allows the admin to restore a deleted quiz
41
- *
42
- * @return void
43
- * @since 6.2.0
44
- */
45
- function qsm_restore_function() {
46
- global $wpdb;
47
-
48
- // Checks if form was submitted.
49
- if ( isset( $_POST['restore_quiz'] ) ) {
50
- $restore = $wpdb->update(
51
- $wpdb->prefix.'mlw_quizzes',
52
- array(
53
- 'deleted' => 0,
54
- ),
55
- array(
56
- 'quiz_id' => intval( $_POST['restore_quiz'] ),
57
- ),
58
- array(
59
- '%d',
60
- ),
61
- array(
62
- '%d',
63
- )
64
- );
65
- if ( ! $restore ) {
66
- ?>
67
- <span style="color:red;"><?php esc_html_e( 'There has been an error! Please try again.', 'quiz-master-next' ); ?></span>
68
- <?php
69
- } else {
70
- // Restores the quiz post type for the quiz.
71
- $my_query = new WP_Query( array(
72
- 'post_type' => 'quiz',
73
- 'meta_key' => 'quiz_id',
74
- 'meta_value' => intval( $_POST['restore_quiz'] ),
75
- ));
76
- if ( $my_query->have_posts() ) {
77
- while ( $my_query->have_posts() ) {
78
- $my_query->the_post();
79
- $my_post = array(
80
- 'ID' => get_the_ID(),
81
- 'post_status' => 'publish',
82
- );
83
- wp_update_post( $my_post );
84
- }
85
- }
86
- wp_reset_postdata();
87
- ?>
88
- <span style="color:red;"><?php esc_html_e( 'Quiz Has Been Restored!', 'quiz-master-next' ); ?></span>
89
- <?php
90
- }
91
- }
92
- $quizzes = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 1" );
93
- ?>
94
- <h3><?php esc_html_e( 'Choose a quiz in the drop down and then click the button to restore a deleted quiz.', 'quiz-master-next' ); ?></h3>
95
- <form action='' method="post">
96
- <select name="restore_quiz">
97
- <?php
98
- foreach ( $quizzes as $quiz ) {
99
- ?>
100
- <option value="<?php echo esc_attr( $quiz->quiz_id ); ?>"><?php echo esc_html( $quiz->quiz_name ); ?></option>
101
- <?php
102
- }
103
- ?>
104
- </select>
105
- <button class="button"><?php esc_html_e( 'Restore Quiz', 'quiz-master-next' ); ?></button>
106
- </form>
107
- <?php
108
- }
109
-
110
- /**
111
- * Creates the tools page that is used to make audits on the quizzes.
112
- *
113
- * @return void
114
- * @since 6.2.0
115
- */
116
- function qsm_audit_box() {
117
- global $wpdb;
118
- $table_limit = 30;
119
- $audit_total = $wpdb->get_var( "SELECT COUNT(trail_id) FROM {$wpdb->prefix}mlw_qm_audit_trail" );
120
-
121
- // If user has gone to the next audit page, load current page and beginning.
122
- // Else, start at 0.
123
- if ( isset( $_GET['audit_page'] ) ) {
124
- $page = intval( $_GET['audit_page'] ) + 1;
125
- $begin = $table_limit * $begin;
126
- } else {
127
- $page = 0;
128
- $begin = 0;
129
- }
130
- $left = $audit_total - ( $page * $table_limit );
131
- $audit_trails = $wpdb->get_results( $wpdb->prepare( "SELECT trail_id, action_user, action, time
132
- FROM {$wpdb->prefix}mlw_qm_audit_trail ORDER BY trail_id DESC LIMIT %d, %d", $begin, $table_limit ) );
133
- ?>
134
- <p>Total actions since QSM installed: <?php echo esc_html( $audit_total ); ?></p>
135
- <?php
136
-
137
- // Determine which navigation to show.
138
- if ( $page > 0 ) {
139
- $previous = $page - 2;
140
- ?>
141
- <a class="button" id="prev_page" href="?page=qsm_quiz_tools&&audit_page=<?php esc_attr( $previous ); ?>">
142
- <?php echo sprintf( esc_html__( 'Previous %s Audits', 'quiz-master-next' ), $table_limit ); ?>
143
- </a>
144
- <?php
145
- if ( $left > $table_limit ) {
146
- ?>
147
- <a class="button" id="next_page" href="?page=qsm_quiz_tools&&audit_page=<?php esc_attr( $page ); ?>">
148
- <?php echo sprintf( esc_html__( 'Next %s Audits', 'quiz-master-next' ), $table_limit ); ?>
149
- </a>
150
- <?php
151
- }
152
- } elseif ( $page == 0 ) {
153
- if ( $left > $table_limit ) {
154
- ?>
155
- <a class="button" id="next_page" href="?page=qsm_quiz_tools&&audit_page=<?php esc_attr( $page ); ?>">
156
- <?php echo sprintf( esc_html__( 'Next %s Audits', 'quiz-master-next' ), $table_limit ); ?>
157
- </a>
158
- <?php
159
- }
160
- } elseif ( $left < $table_limit ) {
161
- $previous = $page - 2;
162
- ?>
163
- <a class="button" id="prev_page" href="?page=qsm_quiz_tools&&audit_page=<?php esc_attr( $previous ); ?>">
164
- <?php echo sprintf( esc_html__( 'Previous %s Audits', 'quiz-master-next' ), $table_limit ); ?>
165
- </a>
166
- <?php
167
- }
168
- ?>
169
- <table class=widefat>
170
- <thead>
171
- <tr>
172
- <th>ID</th>
173
- <th><?php esc_html_e( 'User', 'quiz-master-next' ); ?></th>
174
- <th><?php esc_html_e( 'Action', 'quiz-master-next' ); ?></th>
175
- <th><?php esc_html_e( 'Time', 'quiz-master-next' ); ?></th>
176
- </tr>
177
- </thead>
178
- <tbody id="the-list">
179
- <?php
180
- $alternate = '';
181
- foreach ( $audit_trails as $audit ) {
182
- if ( $alternate ) {
183
- $alternate = '';
184
- } else {
185
- $alternate = ' class="alternate"';
186
- }
187
- echo "<tr{$alternate}>";
188
- echo "<td>{$audit->trail_id}</td>";
189
- echo "<td>{$audit->action_user}</td>";
190
- echo "<td>{$audit->action}</td>";
191
- echo "<td>{$audit->time}</td>";
192
- echo "</tr>";
193
- }
194
- ?>
195
- </tbody>
196
- </table>
197
- <?php
198
- }
199
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/adverts-generate.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Generates the ads in the plugin.
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * Creates the advertisements that are used throughout the plugin page.
14
- *
15
- * The advertisements are randomly generated every time the page is loaded. The function also handles the CSS for this.
16
- *
17
- * @since 6.2.0
18
- */
19
- function qsm_show_adverts() {
20
-
21
- // Checks if the option for showing ads if True. Will be false if the No Ads addon is installed.
22
- if ( 'true' == get_option( 'mlw_advert_shows' ) ) {
23
-
24
- global $mlwQuizMasterNext;
25
- wp_enqueue_style( 'qsm_admin_style', plugins_url( '../css/qsm-admin.css', __FILE__ ), array(), $mlwQuizMasterNext->version );
26
-
27
- if( false === get_transient('qsm_ads_data') ){
28
- $xml = qsm_fetch_data_from_xml();
29
- if(isset($xml->qsm_ads)){
30
- $all_ads = $xml->qsm_ads;
31
- $json_ads = json_encode($all_ads);
32
- $all_ads = $array_into_ads = json_decode($json_ads,TRUE);
33
- set_transient( 'qsm_ads_data', $array_into_ads, 60*60*24 );
34
- }
35
- }else{
36
- $all_ads = get_transient('qsm_ads_data');
37
- }
38
- $count_ads = count($all_ads['ads']);
39
- $ad_text = '';
40
- $rand_int = rand( 0, $count_ads - 1 );
41
- $link = '<a target="_blank" href="'. $all_ads['ads'][$rand_int]['link'] .'">'. $all_ads['ads'][$rand_int]['link_text'] .'</a>';
42
- $link = str_replace('#38', '&', $link);
43
- $ad_text = str_replace('[link]', $link, $all_ads['ads'][$rand_int]['text']);
44
- ?>
45
- <div class="help-decide">
46
- <p><?php echo $ad_text . ' <a class="remove-adv-button" target="_blank" href="https://quizandsurveymaster.com/downloads/advertisement-gone/"><span class="dashicons dashicons-no-alt"></span> Remove Ads</a>'; ?></p>
47
- </div>
48
- <?php
49
- }
50
- }
51
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qmn-alert-manager.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
3
-
4
- /**
5
- * This class handles all of the alerts. Tells the admin if something was added successfully or not.
6
- *
7
- * @since 4.4.0
8
- */
9
- class MlwQmnAlertManager {
10
-
11
- public $alerts = array();
12
-
13
- /**
14
- * This function passes the alert message into the arrray $alerts
15
- *
16
- * @param $message This is the variable that contains the message to given as an alert.
17
- * @param $type This variable holds either success/error and displays the correct message accordingly.
18
- * @since 4.4.0
19
- */
20
- public function newAlert($message, $type)
21
- {
22
- $this->alerts[] = array( 'message' => $message, 'type' => $type );
23
- }
24
-
25
- /**
26
- * This function shows the alerts. It shows either a success or error message.
27
- *
28
- * @since 4.4.0
29
- */
30
- public function showAlerts()
31
- {
32
- $alert_list = "";
33
- foreach ($this->alerts as $alert)
34
- {
35
- if ($alert['type'] == "success")
36
- {
37
- $alert_list .= "<div id=\"message\" class=\"updated below-h2\"><p><strong>".__('Success!', 'quiz-master-next')." </strong>".$alert["message"]."</p></div>";
38
- }
39
- if ($alert['type'] == "error")
40
- {
41
- $alert_list .= "<div id=\"message\" class=\"error below-h2\"><p><strong>".__('Error!', 'quiz-master-next')." </strong>".$alert["message"]."</p></div>";
42
- }
43
- }
44
- echo $alert_list;
45
- }
46
-
47
- }
48
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qmn-log-manager.php DELETED
@@ -1,177 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Log Manager For Quiz And Survey Master
5
- *
6
- * Used to log errors and events into a custom post type of qmn_log
7
- *
8
- * @since 4.5.0
9
- */
10
- class QMN_Log_Manager
11
- {
12
-
13
- /**
14
- * Main constructor
15
- *
16
- * @since 4.5.0
17
- */
18
- function __construct()
19
- {
20
- // create the log post type
21
- add_action( 'init', array( $this, 'register_post_type' ) );
22
- // create types taxonomy and default types
23
- add_action( 'init', array( $this, 'register_taxonomy' ) );
24
- }
25
-
26
- /**
27
- * Returns an array of the available log types
28
- *
29
- * @return array The available log types
30
- * @since 4.5.0
31
- */
32
- private function log_types() {
33
- $terms = array( 'error', 'event' );
34
-
35
- // Filters the taxomony for the QSM logs
36
- return apply_filters( 'qmn_log_types', $terms );
37
- }
38
-
39
- /**
40
- * Registers the qmn_log custom post type
41
- *
42
- * @since 4.5.0
43
- */
44
- public function register_post_type() {
45
- /* logs post type */
46
- $log_args = array(
47
- 'labels' => array( 'name' => 'QSM Logs' ),
48
- 'public' => defined( 'WP_DEBUG' ) && WP_DEBUG,
49
- 'query_var' => false,
50
- 'rewrite' => false,
51
- 'capability_type' => 'post',
52
- 'supports' => array( 'title', 'editor' ),
53
- 'can_export' => false
54
- );
55
-
56
- // Registers QSM logs post type with filtered $args
57
- register_post_type( 'qmn_log', apply_filters( 'qmn_log_post_type_args', $log_args ) );
58
- }
59
-
60
- /**
61
- * Registers the qmn_log taxonomies which are the log types
62
- *
63
- * @since 4.5.0
64
- */
65
- public function register_taxonomy() {
66
- register_taxonomy( 'qmn_log_type', 'qmn_log', array( 'public' => defined( 'WP_DEBUG' ) && WP_DEBUG ) );
67
- $types = $this->log_types();
68
- foreach ( $types as $type ) {
69
- if( ! term_exists( $type, 'qmn_log_type' ) ) {
70
- wp_insert_term( $type, 'qmn_log_type' );
71
- }
72
- }
73
- }
74
-
75
- /**
76
- * Checks to see if the type is one of the available types
77
- *
78
- *
79
- * @param $type string A type that needs to be check to see if available
80
- * @since 4.5.0
81
- * @return bool True if the type is available
82
- */
83
- private function valid_type( $type ) {
84
- return in_array( $type, $this->log_types() );
85
- }
86
-
87
- /**
88
- * Prepares the log to be inserted
89
- *
90
- * @since 4.5.0
91
- * @param $title string The title of the log
92
- * @param $message string The message of the log
93
- * @param $parent int The object ID associated with the log
94
- * @param $type string The type of the log
95
- * @return bool|int False if error else id of the newly inserted post
96
- */
97
- public function add( $title = '', $message = '', $parent = 0, $type = null ) {
98
- $log_data = array(
99
- 'post_title' => $title,
100
- 'post_content' => $message,
101
- 'post_parent' => $parent,
102
- 'log_type' => $type
103
- );
104
- return $this->insert_log( $log_data );
105
- }
106
-
107
- /**
108
- * Inserts the log into the posts
109
- *
110
- * @since 4.5.0
111
- * @param $log_data Array of data about the log including title, message, and type
112
- * @return bool|int False if error else id of the newly inserted post
113
- */
114
- public function insert_log( $log_data = array() ) {
115
- $defaults = array(
116
- 'post_type' => 'qmn_log',
117
- 'post_status' => 'publish',
118
- 'post_parent' => 0,
119
- 'post_content' => '',
120
- 'log_type' => false
121
- );
122
- $args = wp_parse_args( $log_data, $defaults );
123
-
124
- // Hook called before a QSM log is inserted
125
- do_action( 'wp_pre_insert_qmn_log' );
126
-
127
- // store the log entry
128
- $log_id = wp_insert_post( $args );
129
- // set the log type, if any
130
- if( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
131
- wp_set_object_terms( $log_id, $log_data['log_type'], 'qmn_log_type', false );
132
- }
133
- // set log meta, if any
134
- if( $log_id && ! empty( $log_meta ) ) {
135
- foreach( (array) $log_meta as $key => $meta ) {
136
- update_post_meta( $log_id, '_qmn_log_' . sanitize_key( $key ), $meta );
137
- }
138
- }
139
-
140
- // Hook called after a QSM log is inserted
141
- do_action( 'wp_post_insert_qmn_log', $log_id );
142
- return $log_id;
143
- }
144
-
145
- /**
146
- * Retrieves the logs
147
- *
148
- * @since 4.5.0
149
- * @param $type string The type of log to return
150
- * @param $amount int The amount of logs to return
151
- * @return bool|array Returns an array of logs or false on error
152
- */
153
- public function get_logs( $type = false, $amount = 5 ) {
154
- $query_args = array(
155
- 'post_parent' => 0,
156
- 'post_type' => 'qmn_log',
157
- 'posts_per_page' => intval($amount),
158
- 'post_status' => 'publish'
159
- );
160
- if( $type && $this->valid_type( $type ) ) {
161
- $query_args['tax_query'] = array(
162
- array(
163
- 'taxonomy' => 'qmn_log_type',
164
- 'field' => 'slug',
165
- 'terms' => $type
166
- )
167
- );
168
- }
169
- $logs = get_posts( $query_args );
170
- if( $logs )
171
- return $logs;
172
- // no logs found
173
- return false;
174
- }
175
- }
176
-
177
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qmn-plugin-helper.php DELETED
@@ -1,638 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
3
-
4
- /**
5
- * This class is a helper class to be used for extending the plugin
6
- *
7
- * This class contains many functions for extending the plugin
8
- *
9
- * @since 4.0.0
10
- */
11
- class QMNPluginHelper {
12
-
13
- /**
14
- * Addon Page tabs array
15
- *
16
- * @var array
17
- * @since 4.0.0
18
- */
19
- public $addon_tabs = array();
20
-
21
- /**
22
- * Stats Page tabs array
23
- *
24
- * @var array
25
- * @since 4.0.0
26
- */
27
- public $stats_tabs = array();
28
-
29
- /**
30
- * Admin Results Page tabs array
31
- *
32
- * @var array
33
- * @since 5.0.0
34
- */
35
- public $admin_results_tabs = array();
36
-
37
- /**
38
- * Results Details Page tabs array
39
- *
40
- * @var array
41
- * @since 4.1.0
42
- */
43
- public $results_tabs = array();
44
-
45
- /**
46
- * Settings Page tabs array
47
- *
48
- * @var array
49
- * @since 4.0.0
50
- */
51
- public $settings_tabs = array();
52
-
53
- /**
54
- * Question types array
55
- *
56
- * @var array
57
- * @since 4.0.0
58
- */
59
- public $question_types = array();
60
-
61
- /**
62
- * Template array
63
- *
64
- * @var array
65
- * @since 4.5.0
66
- */
67
- public $quiz_templates = array();
68
-
69
- /**
70
- * Main Construct Function
71
- *
72
- * Call functions within class
73
- *
74
- * @since 4.0.0
75
- * @return void
76
- */
77
- public function __construct() {
78
- add_action( 'wp_ajax_qmn_question_type_change', array( $this, 'get_question_type_edit_content' ) );
79
- }
80
-
81
- /**
82
- * Calls all class functions to initialize quiz
83
- *
84
- * @param int $quiz_id The ID of the quiz or survey to load.
85
- * @return bool True or False if ID is valid.
86
- */
87
- public function prepare_quiz( $quiz_id ) {
88
- $quiz_id = intval( $quiz_id );
89
-
90
- // Tries to load quiz name to ensure this is a valid ID.
91
- global $wpdb;
92
- $quiz_name = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_name FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $quiz_id ) );
93
- if ( is_null( $quiz_name ) ) {
94
- return false;
95
- }
96
-
97
- global $mlwQuizMasterNext;
98
- $mlwQuizMasterNext->quizCreator->set_id( $quiz_id );
99
- $mlwQuizMasterNext->quiz_settings->prepare_quiz( $quiz_id );
100
-
101
- return True;
102
- }
103
-
104
- /**
105
- * Retrieves all quizzes.
106
- *
107
- * @param bool $include_deleted If set to true, returned array will include all deleted quizzes
108
- * @param string $order_by The column the quizzes should be ordered by
109
- * @param string $order whether the $order_by should be ordered as ascending or decending. Can be "ASC" or "DESC"
110
- * @return array All of the quizzes as a numerical array of objects
111
- */
112
- public function get_quizzes( $include_deleted = false, $order_by = 'quiz_id', $order = 'DESC' ) {
113
- global $wpdb;
114
-
115
- // Set order direction
116
- $order_direction = 'DESC';
117
- if ( 'ASC' == $order ) {
118
- $order_direction = 'ASC';
119
- }
120
-
121
- // Set field to sort by
122
- switch ( $order_by ) {
123
- case 'last_activity':
124
- $order_field = 'last_activity';
125
- break;
126
-
127
- case 'quiz_views':
128
- $order_field = 'quiz_views';
129
- break;
130
-
131
- case 'quiz_taken':
132
- $order_field = 'quiz_taken';
133
- break;
134
-
135
- default:
136
- $order_field = 'quiz_id';
137
- break;
138
- }
139
-
140
- // Should we include deleted?
141
- $delete = "WHERE deleted='0'";
142
- if ( $include_deleted ) {
143
- $delete = '';
144
- }
145
-
146
- // Get quizzes and return them
147
- $quizzes = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_quizzes $delete ORDER BY $order_field $order_direction" );
148
- return $quizzes;
149
- }
150
-
151
- /**
152
- * Registers a quiz setting
153
- *
154
- * @since 5.0.0
155
- * @param array $field_array An array of the components for the settings field
156
- */
157
- public function register_quiz_setting( $field_array, $section = 'quiz_options' ) {
158
- global $mlwQuizMasterNext;
159
- $mlwQuizMasterNext->quiz_settings->register_setting( $field_array, $section );
160
- }
161
-
162
- /**
163
- * Retrieves a setting value from a section based on name of section and setting
164
- *
165
- * @since 5.0.0
166
- * @param string $section The name of the section the setting is registered in
167
- * @param string $setting The name of the setting whose value we need to retrieve
168
- * @param mixed $default What we need to return if no setting exists with given $setting
169
- * @return $mixed Value set for $setting or $default if setting does not exist
170
- */
171
- public function get_section_setting( $section, $setting, $default = false ) {
172
- global $mlwQuizMasterNext;
173
- return $mlwQuizMasterNext->quiz_settings->get_section_setting( $section, $setting, $default );
174
- }
175
-
176
- /**
177
- * Retrieves setting value based on name of setting
178
- *
179
- * @since 4.0.0
180
- * @param string $setting The name of the setting whose value we need to retrieve
181
- * @param mixed $default What we need to return if no setting exists with given $setting
182
- * @return $mixed Value set for $setting or $default if setting does not exist
183
- */
184
- public function get_quiz_setting( $setting, $default = false ) {
185
- global $mlwQuizMasterNext;
186
- return $mlwQuizMasterNext->quiz_settings->get_setting( $setting, $default );
187
- }
188
-
189
-
190
- /**
191
- * Updates a settings value, adding it if it didn't already exist
192
- *
193
- * @since 4.0.0
194
- * @param string $setting The name of the setting whose value we need to retrieve
195
- * @param mixed $value The value that needs to be stored for the setting
196
- * @return bool True if successful or false if fails
197
- */
198
- public function update_quiz_setting( $setting, $value ) {
199
- global $mlwQuizMasterNext;
200
- return $mlwQuizMasterNext->quiz_settings->update_setting( $setting, $value );
201
- }
202
-
203
- /**
204
- * Outputs the section of input fields
205
- *
206
- * @since 5.0.0
207
- * @param string $section The section that the settings were registered with
208
- */
209
- public function generate_settings_section( $section = 'quiz_options' ) {
210
- global $mlwQuizMasterNext;
211
- QSM_Fields::generate_section( $mlwQuizMasterNext->quiz_settings->load_setting_fields( $section ), $section );
212
- }
213
-
214
- /**
215
- * Registers Quiz Templates
216
- *
217
- * @since 4.5.0
218
- * @param $name String of the name of the template
219
- * @param $file_path String of the path to the css file
220
- */
221
- public function register_quiz_template( $name, $file_path ) {
222
- $slug = strtolower(str_replace( " ", "-", $name));
223
- $this->quiz_templates[$slug] = array(
224
- "name" => $name,
225
- "path" => $file_path
226
- );
227
- }
228
-
229
- /**
230
- * Returns Template Array
231
- *
232
- * @since 4.5.0
233
- * @param $name String of the name of the template. If left empty, will return all templates
234
- * @return array The array of quiz templates
235
- */
236
- public function get_quiz_templates( $slug = null ) {
237
- if ( is_null( $slug ) ) {
238
- return $this->quiz_templates;
239
- } elseif ( isset( $this->quiz_templates[$slug] ) ) {
240
- return $this->quiz_templates[$slug];
241
- } else {
242
- return false;
243
- }
244
- }
245
-
246
- /**
247
- * Register Question Types
248
- *
249
- * Adds a question type to the question type array using the parameters given
250
- *
251
- * @since 4.0.0
252
- * @param string $name The name of the Question Type which will be shown when selecting type
253
- * @param string $display_function The name of the function to call when displaying the question
254
- * @param bool $graded Tells the plugin if this question is graded or not. This will affect scoring.
255
- * @param string $review_function The name of the function to call when scoring the question
256
- * @param string $slug The slug of the question type to be stored with question in database
257
- * @return void
258
- */
259
- public function register_question_type($name, $display_function, $graded, $review_function = null, $edit_args = null, $save_edit_function = null, $slug = null)
260
- {
261
- if (is_null($slug)) {
262
- $slug = strtolower(str_replace( " ", "-", $name));
263
- } else {
264
- $slug = strtolower(str_replace( " ", "-", $slug));
265
- }
266
- if ( is_null( $edit_args ) || !is_array( $edit_args ) ) {
267
- $validated_edit_function = array(
268
- 'inputs' => array(
269
- 'question',
270
- 'answer',
271
- 'hint',
272
- 'correct_info',
273
- 'comments',
274
- 'category',
275
- 'required'
276
- ),
277
- 'information' => '',
278
- 'extra_inputs' => array(),
279
- 'function' => ''
280
- );
281
- } else {
282
- $validated_edit_function = array(
283
- 'inputs' => $edit_args['inputs'],
284
- 'information' => $edit_args['information'],
285
- 'extra_inputs' => $edit_args['extra_inputs'],
286
- 'function' => $edit_args['function']
287
- );
288
- }
289
- if ( is_null( $save_edit_function ) ) {
290
- $save_edit_function = '';
291
- }
292
- $new_type = array(
293
- 'name' => $name,
294
- 'display' => $display_function,
295
- 'review' => $review_function,
296
- 'graded' => $graded,
297
- 'edit' => $validated_edit_function,
298
- 'save' => $save_edit_function,
299
- 'slug' => $slug
300
- );
301
- $this->question_types[] = $new_type;
302
- }
303
-
304
- /**
305
- * Retrieves List Of Question Types
306
- *
307
- * retrieves a list of the slugs and names of the question types
308
- *
309
- * @since 4.0.0
310
- * @return array An array which contains the slug and name of question types that have been registered
311
- */
312
- public function get_question_type_options()
313
- {
314
- $type_array = array();
315
- foreach($this->question_types as $type)
316
- {
317
- $type_array[] = array(
318
- 'slug' => $type["slug"],
319
- 'name' => $type["name"]
320
- );
321
- }
322
- return $type_array;
323
- }
324
-
325
- public function get_question_type_edit_fields() {
326
- $type_array = array();
327
- foreach($this->question_types as $type)
328
- {
329
- $type_array[$type["slug"]] = $type["edit"];
330
- }
331
- return $type_array;
332
- }
333
-
334
- /**
335
- * Displays A Question
336
- *
337
- * Retrieves the question types display function and creates the HTML for the question
338
- *
339
- * @since 4.0.0
340
- * @param string $slug The slug of the question type that the question is
341
- * @param int $question_id The id of the question
342
- * @param array $quiz_options An array of the columns of the quiz row from the database
343
- * @return string The HTML for the question
344
- */
345
- public function display_question($slug, $question_id, $quiz_options)
346
- {
347
- $display = '';
348
- global $wpdb;
349
- global $qmn_total_questions;
350
- $question = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."mlw_questions WHERE question_id=%d", intval($question_id)));
351
- $answers = array();
352
- if (is_serialized($question->answer_array) && is_array(@unserialize($question->answer_array)))
353
- {
354
- $answers = @unserialize($question->answer_array);
355
- }
356
- else
357
- {
358
- $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
359
- $mlw_answer_array_correct[$question->correct_answer-1] = 1;
360
- $answers = array(
361
- array($question->answer_one, $question->answer_one_points, $mlw_answer_array_correct[0]),
362
- array($question->answer_two, $question->answer_two_points, $mlw_answer_array_correct[1]),
363
- array($question->answer_three, $question->answer_three_points, $mlw_answer_array_correct[2]),
364
- array($question->answer_four, $question->answer_four_points, $mlw_answer_array_correct[3]),
365
- array($question->answer_five, $question->answer_five_points, $mlw_answer_array_correct[4]),
366
- array($question->answer_six, $question->answer_six_points, $mlw_answer_array_correct[5]));
367
- }
368
- if ( 2 == $quiz_options->randomness_order || 3 == $quiz_options->randomness_order ) {
369
- shuffle( $answers );
370
- }
371
- foreach($this->question_types as $type)
372
- {
373
- if ($type["slug"] == strtolower(str_replace( " ", "-", $slug)))
374
- {
375
- if ($type["graded"])
376
- {
377
- $qmn_total_questions += 1;
378
- if ($quiz_options->question_numbering == 1)
379
- {
380
- $display .= "<span class='mlw_qmn_question_number'>$qmn_total_questions. </span>";
381
- }
382
- }
383
- if($quiz_options->show_category_on_front && $question->category != ''){
384
- $display .= '<div class="quiz-cat">[ ' . $question->category .' ]</div>';
385
- }
386
- $display .= call_user_func($type['display'], intval($question_id), $question->question_name, $answers);
387
- }
388
- }
389
- return $display;
390
- }
391
-
392
- /**
393
- * Calculates Score For Question
394
- *
395
- * Calculates the score for the question based on the question type
396
- *
397
- * @since 4.0.0
398
- * @param string $slug The slug of the question type that the question is
399
- * @param int $question_id The id of the question
400
- * @return array An array of the user's score from the question
401
- */
402
- public function display_review($slug, $question_id)
403
- {
404
- $results_array = array();
405
- global $wpdb;
406
- $question = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."mlw_questions WHERE question_id=%d", intval($question_id)));
407
- $answers = array();
408
- if (is_serialized($question->answer_array) && is_array(@unserialize($question->answer_array)))
409
- {
410
- $answers = @unserialize($question->answer_array);
411
- }
412
- else
413
- {
414
- $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
415
- $mlw_answer_array_correct[$question->correct_answer-1] = 1;
416
- $answers = array(
417
- array($question->answer_one, $question->answer_one_points, $mlw_answer_array_correct[0]),
418
- array($question->answer_two, $question->answer_two_points, $mlw_answer_array_correct[1]),
419
- array($question->answer_three, $question->answer_three_points, $mlw_answer_array_correct[2]),
420
- array($question->answer_four, $question->answer_four_points, $mlw_answer_array_correct[3]),
421
- array($question->answer_five, $question->answer_five_points, $mlw_answer_array_correct[4]),
422
- array($question->answer_six, $question->answer_six_points, $mlw_answer_array_correct[5]));
423
- }
424
- foreach($this->question_types as $type)
425
- {
426
- if ($type["slug"] == strtolower(str_replace( " ", "-", $slug)))
427
- {
428
- if (!is_null($type["review"]))
429
- {
430
- $results_array = call_user_func($type['review'], intval($question_id), $question->question_name, $answers);
431
- }
432
- else
433
- {
434
- $results_array = array('null_review' => true);
435
- }
436
- }
437
- }
438
- return $results_array;
439
- }
440
-
441
- /**
442
- * Retrieves A Question Setting
443
- *
444
- * Retrieves a setting stored in the question settings array
445
- *
446
- * @since 4.0.0
447
- * @param int $question_id The id of the question
448
- * @param string $setting The name of the setting
449
- * @return string The value stored for the setting
450
- */
451
- public function get_question_setting($question_id, $setting)
452
- {
453
- global $wpdb;
454
- $qmn_settings_array = '';
455
- $settings = $wpdb->get_var( $wpdb->prepare( "SELECT question_settings FROM " . $wpdb->prefix . "mlw_questions WHERE question_id=%d", $question_id ) );
456
- if (is_serialized($settings) && is_array(@unserialize($settings)))
457
- {
458
- $qmn_settings_array = @unserialize($settings);
459
- }
460
- if (is_array($qmn_settings_array) && isset($qmn_settings_array[$setting]))
461
- {
462
- return $qmn_settings_array[$setting];
463
- }
464
- else
465
- {
466
- return '';
467
- }
468
- }
469
-
470
- /**
471
- * Registers Addon Settings Tab
472
- *
473
- * Registers a new tab on the addon settings page
474
- *
475
- * @since 4.0.0
476
- * @param string $title The name of the tab
477
- * @param string $function The function that displays the tab's content
478
- * @return void
479
- */
480
- public function register_addon_settings_tab($title, $function)
481
- {
482
- $slug = strtolower(str_replace( " ", "-", $title));
483
- $new_tab = array(
484
- 'title' => $title,
485
- 'function' => $function,
486
- 'slug' => $slug
487
- );
488
- $this->addon_tabs[] = $new_tab;
489
- }
490
-
491
- /**
492
- * Retrieves Addon Settings Tab Array
493
- *
494
- * Retrieves the array of titles and functions of the registered tabs
495
- *
496
- * @since 4.0.0
497
- * @return array The array of registered tabs
498
- */
499
- public function get_addon_tabs()
500
- {
501
- return $this->addon_tabs;
502
- }
503
-
504
- /**
505
- * Registers Stats Tab
506
- *
507
- * Registers a new tab on the stats page
508
- *
509
- * @since 4.3.0
510
- * @param string $title The name of the tab
511
- * @param string $function The function that displays the tab's content
512
- * @return void
513
- */
514
- public function register_stats_settings_tab($title, $function)
515
- {
516
- $slug = strtolower(str_replace( " ", "-", $title));
517
- $new_tab = array(
518
- 'title' => $title,
519
- 'function' => $function,
520
- 'slug' => $slug
521
- );
522
- $this->stats_tabs[] = $new_tab;
523
- }
524
-
525
- /**
526
- * Retrieves Stats Tab Array
527
- *
528
- * Retrieves the array of titles and functions of the registered tabs
529
- *
530
- * @since 4.3.0
531
- * @return array The array of registered tabs
532
- */
533
- public function get_stats_tabs()
534
- {
535
- return $this->stats_tabs;
536
- }
537
-
538
- /**
539
- * Registers tabs for the Admin Results page
540
- *
541
- * Registers a new tab on the admin results page
542
- *
543
- * @since 5.0.0
544
- * @param string $title The name of the tab
545
- * @param string $function The function that displays the tab's content
546
- * @return void
547
- */
548
- public function register_admin_results_tab( $title, $function) {
549
- $slug = strtolower( str_replace( " ", "-", $title ) );
550
- $new_tab = array(
551
- 'title' => $title,
552
- 'function' => $function,
553
- 'slug' => $slug
554
- );
555
- $this->admin_results_tabs[] = $new_tab;
556
- }
557
-
558
- /**
559
- * Retrieves Admin Results Tab Array
560
- *
561
- * Retrieves the array of titles and functions for the tabs registered for the admin results page
562
- *
563
- * @since 5.0.0
564
- * @return array The array of registered tabs
565
- */
566
- public function get_admin_results_tabs() {
567
- return $this->admin_results_tabs;
568
- }
569
-
570
- /**
571
- * Registers Results Tab
572
- *
573
- * Registers a new tab on the results page
574
- *
575
- * @since 4.1.0
576
- * @param string $title The name of the tab
577
- * @param string $function The function that displays the tab's content
578
- * @return void
579
- */
580
- public function register_results_settings_tab($title, $function)
581
- {
582
- $slug = strtolower(str_replace( " ", "-", $title));
583
- $new_tab = array(
584
- 'title' => $title,
585
- 'function' => $function,
586
- 'slug' => $slug
587
- );
588
- $this->results_tabs[] = $new_tab;
589
- }
590
-
591
- /**
592
- * Retrieves Results Tab Array
593
- *
594
- * Retrieves the array of titles and functions of the registered tabs
595
- *
596
- * @since 4.1.0
597
- * @return array The array of registered tabs
598
- */
599
- public function get_results_tabs()
600
- {
601
- return $this->results_tabs;
602
- }
603
-
604
- /**
605
- * Registers Quiz Settings Tab
606
- *
607
- * Registers a new tab on the quiz settings page
608
- *
609
- * @since 4.0.0
610
- * @param string $title The name of the tab
611
- * @param string $function The function that displays the tab's content
612
- * @return void
613
- */
614
- public function register_quiz_settings_tabs($title, $function)
615
- {
616
- $slug = strtolower(str_replace( " ", "-", $title));
617
- $new_tab = array(
618
- 'title' => $title,
619
- 'function' => $function,
620
- 'slug' => $slug
621
- );
622
- $this->settings_tabs[] = $new_tab;
623
- }
624
-
625
- /**
626
- * Echos Registered Tabs Title Link
627
- *
628
- * Echos the title link of the registered tabs
629
- *
630
- * @since 4.0.0
631
- * @return array The array of registered tabs
632
- */
633
- public function get_settings_tabs()
634
- {
635
- return $this->settings_tabs;
636
- }
637
- }
638
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qmn-quiz-creator.php DELETED
@@ -1,648 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- }
5
-
6
- /**
7
- * QMN Quiz Creator Class
8
- *
9
- * This class handles quiz creation, update, and deletion from the admin panel
10
- *
11
- * The Quiz Creator class handles all the quiz management functions that is done from the admin panel
12
- *
13
- * @since 3.7.1
14
- */
15
- class QMNQuizCreator {
16
-
17
- /**
18
- * QMN ID of quiz
19
- *
20
- * @var object
21
- * @since 3.7.1
22
- */
23
- private $quiz_id;
24
-
25
- /**
26
- * If the quiz ID is set, store it as the class quiz ID
27
- *
28
- * @since 3.7.1
29
- */
30
- public function __construct() {
31
- if ( isset( $_GET['quiz_id'] ) ) {
32
- $this->quiz_id = intval( $_GET['quiz_id'] );
33
- }
34
- }
35
-
36
- /**
37
- * Sets quiz ID
38
- *
39
- * @since 3.8.1
40
- * @param int $quiz_id The ID of the quiz.
41
- * @access public
42
- * @return void
43
- */
44
- public function set_id( $quiz_id ) {
45
- $this->quiz_id = intval( $quiz_id );
46
- }
47
-
48
- /**
49
- * Gets the quiz ID stored (for backwards compatibility)
50
- *
51
- * @since 5.0.0
52
- * @return int|false The ID of the quiz stored or false
53
- */
54
- public function get_id() {
55
- if ( $this->quiz_id ) {
56
- return intval( $this->quiz_id );
57
- } else {
58
- return false;
59
- }
60
- }
61
-
62
- /**
63
- * Creates a new quiz with the default settings
64
- *
65
- * @access public
66
- * @since 3.7.1
67
- * @param string $quiz_name The name of the new quiz.
68
- * @return void
69
- */
70
- public function create_quiz( $quiz_name ) {
71
- global $mlwQuizMasterNext;
72
- global $wpdb;
73
- $results = $wpdb->insert(
74
- $wpdb->prefix . 'mlw_quizzes',
75
- array(
76
- 'quiz_name' => $quiz_name,
77
- 'message_before' => 'Welcome to your %QUIZ_NAME%',
78
- 'message_after' => 'Thanks for submitting your response! You can edit this message on the "Results Pages" tab. <br>%CONTACT_ALL% <br>%QUESTIONS_ANSWERS%',
79
- 'message_comment' => 'Please fill in the comment box below.',
80
- 'message_end_template' => '',
81
- 'user_email_template' => '%QUESTIONS_ANSWERS%',
82
- 'admin_email_template' => '%QUESTIONS_ANSWERS%',
83
- 'submit_button_text' => 'Submit',
84
- 'name_field_text' => 'Name',
85
- 'business_field_text' => 'Business',
86
- 'email_field_text' => 'Email',
87
- 'phone_field_text' => 'Phone Number',
88
- 'comment_field_text' => 'Comments',
89
- 'email_from_text' => 'Wordpress',
90
- 'question_answer_template' => '%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />',
91
- 'leaderboard_template' => '',
92
- 'system' => 0,
93
- 'randomness_order' => 0,
94
- 'loggedin_user_contact' => 0,
95
- 'show_score' => 0,
96
- 'send_user_email' => 0,
97
- 'send_admin_email' => 0,
98
- 'contact_info_location' => 0,
99
- 'user_name' => 2,
100
- 'user_comp' => 2,
101
- 'user_email' => 2,
102
- 'user_phone' => 2,
103
- 'admin_email' => get_option( 'admin_email', 'Enter email' ),
104
- 'comment_section' => 1,
105
- 'question_from_total' => 0,
106
- 'total_user_tries' => 0,
107
- 'total_user_tries_text' => 'You are only allowed 1 try and have already submitted your quiz.',
108
- 'certificate_template' => '',
109
- 'social_media' => 0,
110
- 'social_media_text' => 'I just scored %CORRECT_SCORE%% on %QUIZ_NAME%!',
111
- 'pagination' => 0,
112
- 'pagination_text' => 'Next',
113
- 'timer_limit' => 0,
114
- 'quiz_stye' => '',
115
- 'question_numbering' => 0,
116
- 'quiz_settings' => '',
117
- 'theme_selected' => 'primary',
118
- 'last_activity' => current_time( 'mysql' ),
119
- 'require_log_in' => 0,
120
- 'require_log_in_text' => 'This quiz is for logged in users only.',
121
- 'limit_total_entries' => 0,
122
- 'limit_total_entries_text' => 'Unfortunately, this quiz has a limited amount of entries it can recieve and has already reached that limit.',
123
- 'scheduled_timeframe' => '',
124
- 'scheduled_timeframe_text' => '',
125
- 'quiz_views' => 0,
126
- 'quiz_taken' => 0,
127
- 'deleted' => 0,
128
- ),
129
- array(
130
- '%s',
131
- '%s',
132
- '%s',
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
- '%d',
147
- '%d',
148
- '%d',
149
- '%d',
150
- '%d',
151
- '%d',
152
- '%d',
153
- '%d',
154
- '%d',
155
- '%d',
156
- '%d',
157
- '%s',
158
- '%d',
159
- '%d',
160
- '%d',
161
- '%s',
162
- '%s',
163
- '%d',
164
- '%s',
165
- '%d',
166
- '%s',
167
- '%d',
168
- '%s',
169
- '%d',
170
- '%s',
171
- '%s',
172
- '%s',
173
- '%d',
174
- '%s',
175
- '%d',
176
- '%s',
177
- '%s',
178
- '%s',
179
- '%d',
180
- '%d',
181
- '%d',
182
- )
183
- );
184
- if ( false !== $results ) {
185
- $new_quiz = $wpdb->insert_id;
186
- $current_user = wp_get_current_user();
187
- $quiz_post = array(
188
- 'post_title' => $quiz_name,
189
- 'post_content' => "[mlw_quizmaster quiz=$new_quiz]",
190
- 'post_status' => 'publish',
191
- 'post_author' => $current_user->ID,
192
- 'post_type' => 'quiz',
193
- );
194
- $quiz_post_id = wp_insert_post( $quiz_post );
195
- add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
196
-
197
- $mlwQuizMasterNext->alertManager->newAlert(__('Your new quiz or survey has been created successfully. To begin editing, click the Edit link.', 'quiz-master-next'), 'success');
198
- $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz/Survey Has Been Created: $quiz_name" );
199
-
200
- // Hook called after new quiz or survey has been created. Passes quiz_id to hook
201
- do_action('qmn_quiz_created', $new_quiz);
202
- } else {
203
- $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');
204
- $mlwQuizMasterNext->log_manager->add("Error 0001", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
205
- }
206
- }
207
-
208
- /**
209
- * Deletes a quiz with the given quiz_id
210
- *
211
- * @access public
212
- * @since 3.7.1
213
- * @return void
214
- */
215
- public function delete_quiz($quiz_id, $quiz_name)
216
- {
217
- global $mlwQuizMasterNext;
218
- global $wpdb;
219
- $results = $wpdb->update(
220
- $wpdb->prefix . "mlw_quizzes",
221
- array(
222
- 'deleted' => 1
223
- ),
224
- array( 'quiz_id' => $quiz_id ),
225
- array(
226
- '%d'
227
- ),
228
- array( '%d' )
229
- );
230
- $delete_question_results = $wpdb->update(
231
- $wpdb->prefix . "mlw_questions",
232
- array(
233
- 'deleted' => 1
234
- ),
235
- array( 'quiz_id' => $quiz_id ),
236
- array(
237
- '%d'
238
- ),
239
- array( '%d' )
240
- );
241
- if ($results != false)
242
- {
243
- $my_query = new WP_Query( array('post_type' => 'quiz', 'meta_key' => 'quiz_id', 'meta_value' => $quiz_id) );
244
- if( $my_query->have_posts() )
245
- {
246
- while( $my_query->have_posts() )
247
- {
248
- $my_query->the_post();
249
- $my_post = array(
250
- 'ID' => get_the_ID(),
251
- 'post_status' => 'trash'
252
- );
253
- wp_update_post( $my_post );
254
- }
255
- }
256
- wp_reset_postdata();
257
- $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz or survey has been deleted successfully.', 'quiz-master-next'), 'success');
258
- $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Has Been Deleted: $quiz_name" );
259
- }
260
- else
261
- {
262
- $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');
263
- $mlwQuizMasterNext->log_manager->add("Error 0002", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
264
- }
265
-
266
- // Hook called after quiz or survey is deleted. Hook passes quiz_id to function
267
- do_action('qmn_quiz_deleted', $quiz_id);
268
- }
269
-
270
- /**
271
- * Edits the name of the quiz with the given ID
272
- *
273
- * @access public
274
- * @since 3.7.1
275
- * @param int $quiz_id The ID of the quiz.
276
- * @param string $quiz_name The new name of the quiz.
277
- * @return void
278
- */
279
- public function edit_quiz_name( $quiz_id, $quiz_name ) {
280
- global $mlwQuizMasterNext;
281
- global $wpdb;
282
- $results = $wpdb->update(
283
- $wpdb->prefix . 'mlw_quizzes',
284
- array(
285
- 'quiz_name' => $quiz_name,
286
- ),
287
- array( 'quiz_id' => $quiz_id ),
288
- array(
289
- '%s',
290
- ),
291
- array( '%d' )
292
- );
293
- if ( false !== $results ) {
294
- $mlwQuizMasterNext->alertManager->newAlert( __( 'The name of your quiz or survey has been updated successfully.', 'quiz-master-next' ), 'success' );
295
- $mlwQuizMasterNext->audit_manager->new_audit( "Quiz/Survey Name Has Been Edited: $quiz_name" );
296
- } else {
297
- $error = $wpdb->last_error;
298
- if ( empty( $error ) ) {
299
- $error = __( 'Unknown error', 'quiz-master-next' );
300
- }
301
- $mlwQuizMasterNext->alertManager->newAlert( __( 'An error occurred while trying to update the name of your quiz or survey. Please try again.', 'quiz-master-next' ), 'error' );
302
- $mlwQuizMasterNext->log_manager->add( 'Error when updating quiz name', "Tried {$wpdb->last_query} but got $error", 0, 'error' );
303
- }
304
-
305
- // Fires when the name of a quiz/survey is edited.
306
- do_action( 'qsm_quiz_name_edited', $quiz_id, $quiz_name );
307
-
308
- // Legacy code.
309
- do_action( 'qmn_quiz_name_edited', $quiz_id );
310
- }
311
-
312
- /**
313
- * Duplicates the quiz with the given ID and gives new quiz the given quiz name
314
- *
315
- * @access public
316
- * @since 3.7.1
317
- * @return void
318
- */
319
- public function duplicate_quiz($quiz_id, $quiz_name, $is_duplicating_questions)
320
- {
321
- global $mlwQuizMasterNext;
322
- global $wpdb;
323
-
324
- $table_name = $wpdb->prefix . "mlw_quizzes";
325
- $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE quiz_id=%d", $quiz_id ) );
326
- $results = $wpdb->insert(
327
- $table_name,
328
- array(
329
- 'quiz_name' => $quiz_name,
330
- 'message_before' => $mlw_qmn_duplicate_data->message_before,
331
- 'message_after' => $mlw_qmn_duplicate_data->message_after,
332
- 'message_comment' => $mlw_qmn_duplicate_data->message_comment,
333
- 'message_end_template' => $mlw_qmn_duplicate_data->message_end_template,
334
- 'user_email_template' => $mlw_qmn_duplicate_data->user_email_template,
335
- 'admin_email_template' => $mlw_qmn_duplicate_data->admin_email_template,
336
- 'submit_button_text' => $mlw_qmn_duplicate_data->submit_button_text,
337
- 'name_field_text' => $mlw_qmn_duplicate_data->name_field_text,
338
- 'business_field_text' => $mlw_qmn_duplicate_data->business_field_text,
339
- 'email_field_text' => $mlw_qmn_duplicate_data->email_field_text,
340
- 'phone_field_text' => $mlw_qmn_duplicate_data->phone_field_text,
341
- 'comment_field_text' => $mlw_qmn_duplicate_data->comment_field_text,
342
- 'email_from_text' => $mlw_qmn_duplicate_data->email_from_text,
343
- 'question_answer_template' => $mlw_qmn_duplicate_data->question_answer_template,
344
- 'leaderboard_template' => $mlw_qmn_duplicate_data->leaderboard_template,
345
- 'system' => $mlw_qmn_duplicate_data->system,
346
- 'randomness_order' => $mlw_qmn_duplicate_data->randomness_order,
347
- 'loggedin_user_contact' => $mlw_qmn_duplicate_data->loggedin_user_contact,
348
- 'show_score' => $mlw_qmn_duplicate_data->show_score,
349
- 'send_user_email' => $mlw_qmn_duplicate_data->send_user_email,
350
- 'send_admin_email' => $mlw_qmn_duplicate_data->send_admin_email,
351
- 'contact_info_location' => $mlw_qmn_duplicate_data->contact_info_location,
352
- 'user_name' => $mlw_qmn_duplicate_data->user_name,
353
- 'user_comp' => $mlw_qmn_duplicate_data->user_comp,
354
- 'user_email' => $mlw_qmn_duplicate_data->user_email,
355
- 'user_phone' => $mlw_qmn_duplicate_data->user_phone,
356
- 'admin_email' => get_option( 'admin_email', 'Enter email' ),
357
- 'comment_section' => $mlw_qmn_duplicate_data->comment_section,
358
- 'question_from_total' => $mlw_qmn_duplicate_data->question_from_total,
359
- 'total_user_tries' => $mlw_qmn_duplicate_data->total_user_tries,
360
- 'total_user_tries_text' => $mlw_qmn_duplicate_data->total_user_tries_text,
361
- 'certificate_template' => $mlw_qmn_duplicate_data->certificate_template,
362
- 'social_media' => $mlw_qmn_duplicate_data->social_media,
363
- 'social_media_text' => $mlw_qmn_duplicate_data->social_media_text,
364
- 'pagination' => $mlw_qmn_duplicate_data->pagination,
365
- 'pagination_text' => $mlw_qmn_duplicate_data->pagination_text,
366
- 'timer_limit' => $mlw_qmn_duplicate_data->timer_limit,
367
- 'quiz_stye' => $mlw_qmn_duplicate_data->quiz_stye,
368
- 'question_numbering' => $mlw_qmn_duplicate_data->question_numbering,
369
- 'quiz_settings' => $mlw_qmn_duplicate_data->quiz_settings,
370
- 'theme_selected' => $mlw_qmn_duplicate_data->theme_selected,
371
- 'last_activity' => date("Y-m-d H:i:s"),
372
- 'require_log_in' => $mlw_qmn_duplicate_data->require_log_in,
373
- 'require_log_in_text' => $mlw_qmn_duplicate_data->require_log_in_text,
374
- 'limit_total_entries' => $mlw_qmn_duplicate_data->limit_total_entries,
375
- 'limit_total_entries_text' => $mlw_qmn_duplicate_data->limit_total_entries_text,
376
- 'scheduled_timeframe' => $mlw_qmn_duplicate_data->scheduled_timeframe,
377
- 'scheduled_timeframe_text' => $mlw_qmn_duplicate_data->scheduled_timeframe_text,
378
- 'quiz_views' => 0,
379
- 'quiz_taken' => 0,
380
- 'deleted' => 0
381
- ),
382
- array(
383
- '%s',
384
- '%s',
385
- '%s',
386
- '%s',
387
- '%s',
388
- '%s',
389
- '%s',
390
- '%s',
391
- '%s',
392
- '%s',
393
- '%s',
394
- '%s',
395
- '%s',
396
- '%s',
397
- '%s',
398
- '%s',
399
- '%d',
400
- '%d',
401
- '%d',
402
- '%d',
403
- '%d',
404
- '%d',
405
- '%d',
406
- '%d',
407
- '%d',
408
- '%d',
409
- '%d',
410
- '%s',
411
- '%d',
412
- '%d',
413
- '%d',
414
- '%s',
415
- '%s',
416
- '%d',
417
- '%s',
418
- '%d',
419
- '%s',
420
- '%d',
421
- '%s',
422
- '%d',
423
- '%s',
424
- '%s',
425
- '%s',
426
- '%d',
427
- '%s',
428
- '%d',
429
- '%s',
430
- '%s',
431
- '%s',
432
- '%d',
433
- '%d',
434
- '%d',
435
- )
436
- );
437
- $mlw_new_id = $wpdb->insert_id;
438
-
439
- //Update quiz settings
440
- $update_quiz_settings = unserialize($mlw_qmn_duplicate_data->quiz_settings);
441
- $update_pages = unserialize($update_quiz_settings['pages']);
442
-
443
- if ( false != $results ) {
444
- $current_user = wp_get_current_user();
445
- $quiz_post = array(
446
- 'post_title' => $quiz_name,
447
- 'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
448
- 'post_status' => 'publish',
449
- 'post_author' => $current_user->ID,
450
- 'post_type' => 'quiz'
451
- );
452
- $quiz_post_id = wp_insert_post( $quiz_post );
453
- add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
454
- $mlwQuizMasterNext->alertManager->newAlert(__('Your quiz or survey has been duplicated successfully.', 'quiz-master-next'), 'success');
455
- $mlwQuizMasterNext->audit_manager->new_audit( "New Quiz/Survey Has Been Created: $quiz_name" );
456
- do_action('qmn_quiz_duplicated', $quiz_id, $mlw_new_id);
457
- }
458
- else
459
- {
460
- $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');
461
- $mlwQuizMasterNext->log_manager->add("Error 0011", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
462
- }
463
- if ($is_duplicating_questions)
464
- {
465
- $table_name = $wpdb->prefix."mlw_questions";
466
- $mlw_current_questions = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table_name WHERE deleted=0 AND quiz_id=%d", $quiz_id ) );
467
- foreach ($mlw_current_questions as $mlw_question)
468
- {
469
- $question_results = $wpdb->insert(
470
- $table_name,
471
- array(
472
- 'quiz_id' => $mlw_new_id,
473
- 'question_name' => $mlw_question->question_name,
474
- 'answer_array' => $mlw_question->answer_array,
475
- 'answer_one' => $mlw_question->answer_one,
476
- 'answer_one_points' => $mlw_question->answer_one_points,
477
- 'answer_two' => $mlw_question->answer_two,
478
- 'answer_two_points' => $mlw_question->answer_two_points,
479
- 'answer_three' => $mlw_question->answer_three,
480
- 'answer_three_points' => $mlw_question->answer_three_points,
481
- 'answer_four' => $mlw_question->answer_four,
482
- 'answer_four_points' => $mlw_question->answer_four_points,
483
- 'answer_five' => $mlw_question->answer_five,
484
- 'answer_five_points' => $mlw_question->answer_five_points,
485
- 'answer_six' => $mlw_question->answer_six,
486
- 'answer_six_points' => $mlw_question->answer_six_points,
487
- 'correct_answer' => $mlw_question->correct_answer,
488
- 'question_answer_info' => $mlw_question->question_answer_info,
489
- 'comments' => $mlw_question->comments,
490
- 'hints' => $mlw_question->hints,
491
- 'question_order' => $mlw_question->question_order,
492
- 'question_type_new' => $mlw_question->question_type_new,
493
- 'question_settings' => $mlw_question->question_settings,
494
- 'category' => $mlw_question->category,
495
- 'deleted' => 0
496
- ),
497
- array(
498
- '%d',
499
- '%s',
500
- '%s',
501
- '%s',
502
- '%d',
503
- '%s',
504
- '%d',
505
- '%s',
506
- '%d',
507
- '%s',
508
- '%d',
509
- '%s',
510
- '%d',
511
- '%s',
512
- '%d',
513
- '%d',
514
- '%s',
515
- '%d',
516
- '%s',
517
- '%d',
518
- '%s',
519
- '%s',
520
- '%s',
521
- '%d'
522
- )
523
- );
524
- foreach ($update_pages as $pages_key => $pages_value) {
525
- foreach ($pages_value as $pages_k_q => $page_q_id) {
526
- if($page_q_id == $mlw_question->question_id){
527
- $update_pages[$pages_key][$pages_k_q] = $wpdb->insert_id;
528
- }
529
- }
530
- }
531
- if ($question_results == false)
532
- {
533
- $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');
534
- $mlwQuizMasterNext->log_manager->add("Error 0020", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
535
- }
536
- }
537
- $update_quiz_settings['pages'] = serialize($update_pages);
538
- $wpdb->update(
539
- $wpdb->prefix . "mlw_quizzes",
540
- array(
541
- 'quiz_settings' => serialize($update_quiz_settings),
542
- ),
543
- array(
544
- 'quiz_id' => $mlw_new_id
545
- )
546
- );
547
- }
548
- }
549
-
550
- /**
551
- * Retrieves setting store in quiz_settings
552
- *
553
- * @deprecated 6.0.3 Use the get_quiz_setting function in the pluginHelper object.
554
- * @since 3.8.1
555
- * @access public
556
- * @param string $setting_name The slug of the setting.
557
- * @return string The value of the setting
558
- */
559
- public function get_setting( $setting_name ) {
560
- global $wpdb;
561
- $qmn_settings_array = '';
562
- $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id ) );
563
- if ( is_serialized( $qmn_quiz_settings ) && is_array( @unserialize( $qmn_quiz_settings ) ) ) {
564
- $qmn_settings_array = @unserialize( $qmn_quiz_settings );
565
- }
566
- if ( is_array( $qmn_settings_array ) && isset( $qmn_settings_array[ $setting_name ] ) ) {
567
- return $qmn_settings_array[ $setting_name ];
568
- } else {
569
- return '';
570
- }
571
-
572
- }
573
-
574
- /**
575
- * Updates setting stored in quiz_settings
576
- *
577
- * @deprecated 6.0.3 Use the update_quiz_setting function in the pluginHelper object.
578
- * @since 3.8.1
579
- * @access public
580
- * @param string $setting_name The slug of the setting.
581
- * @param mixed $setting_value The value for the setting.
582
- * @return bool True if update was successful
583
- */
584
- public function update_setting( $setting_name, $setting_value ) {
585
- global $wpdb;
586
- $qmn_settings_array = array();
587
- $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id ) );
588
- if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings)))
589
- {
590
- $qmn_settings_array = @unserialize($qmn_quiz_settings);
591
- }
592
- $qmn_settings_array[$setting_name] = $setting_value;
593
- $qmn_serialized_array = serialize($qmn_settings_array);
594
- $results = $wpdb->update(
595
- $wpdb->prefix . "mlw_quizzes",
596
- array(
597
- 'quiz_settings' => $qmn_serialized_array
598
- ),
599
- array( 'quiz_id' => $this->quiz_id ),
600
- array(
601
- '%s'
602
- ),
603
- array( '%d' )
604
- );
605
- if ($results != false)
606
- {
607
- return true;
608
- }
609
- else
610
- {
611
- return false;
612
- }
613
- }
614
-
615
- /**
616
- * Deletes setting stored in quiz_settings
617
- *
618
- * @deprecated 6.0.3
619
- * @since 3.8.1
620
- * @access public
621
- * @return void
622
- */
623
- public function delete_setting( $setting_name ) {
624
- global $wpdb;
625
- $qmn_settings_array = array();
626
- $qmn_quiz_settings = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_settings FROM " . $wpdb->prefix . "mlw_quizzes" . " WHERE quiz_id=%d", $this->quiz_id ) );
627
- if (is_serialized($qmn_quiz_settings) && is_array(@unserialize($qmn_quiz_settings)))
628
- {
629
- $qmn_settings_array = @unserialize($qmn_quiz_settings);
630
- }
631
- if (is_array($qmn_settings_array) && isset($qmn_settings_array[$setting_name]))
632
- {
633
- unset($qmn_settings_array[$setting_name]);
634
- }
635
- $qmn_serialized_array = serialize($qmn_settings_array);
636
- $results = $wpdb->update(
637
- $wpdb->prefix . "mlw_quizzes",
638
- array(
639
- 'quiz_settings' => $qmn_serialized_array
640
- ),
641
- array( 'quiz_id' => $this->quiz_id ),
642
- array(
643
- '%s'
644
- ),
645
- array( '%d' )
646
- );
647
- }
648
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qmn-quiz-manager.php DELETED
@@ -1,1664 +0,0 @@
1
- <?php
2
- /**
3
- * File for the QMNQuizManager class
4
- *
5
- * @package QSM
6
- */
7
- if (!defined('ABSPATH')) {
8
- exit;
9
- }
10
-
11
- /**
12
- * This class generates the contents of the quiz shortcode
13
- *
14
- * @since 4.0.0
15
- */
16
- class QMNQuizManager {
17
-
18
- /**
19
- * Main Construct Function
20
- *
21
- * Call functions within class
22
- *
23
- * @since 4.0.0
24
- * @uses QMNQuizManager::add_hooks() Adds actions to hooks and filters
25
- * @return void
26
- */
27
- public function __construct() {
28
- $this->add_hooks();
29
- }
30
-
31
- /**
32
- * Add Hooks
33
- *
34
- * Adds functions to relavent hooks and filters
35
- *
36
- * @since 4.0.0
37
- * @return void
38
- */
39
- public function add_hooks() {
40
- add_shortcode('mlw_quizmaster', array($this, 'display_shortcode'));
41
- add_shortcode('qsm', array($this, 'display_shortcode'));
42
- add_shortcode('qsm_result', array($this, 'shortcode_display_result'));
43
- add_action('wp_ajax_qmn_process_quiz', array($this, 'ajax_submit_results'));
44
- add_action('wp_ajax_nopriv_qmn_process_quiz', array($this, 'ajax_submit_results'));
45
- add_action('wp_ajax_qsm_get_quiz_to_reload', array($this, 'qsm_get_quiz_to_reload'));
46
- add_action('wp_ajax_nopriv_qsm_get_quiz_to_reload', array($this, 'qsm_get_quiz_to_reload'));
47
- add_action('wp_ajax_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
48
- add_action('wp_ajax_nopriv_qsm_get_question_quick_result', array($this, 'qsm_get_question_quick_result'));
49
- }
50
-
51
- /**
52
- * @version 6.3.2
53
- * Get question quick result
54
- */
55
- public function qsm_get_question_quick_result(){
56
- global $wpdb;
57
- $question_id = isset($_POST['question_id']) ? $_POST['question_id'] : 0;
58
- $answer = isset($_POST['answer']) ? $_POST['answer'] : '';
59
- $question_array = $wpdb->get_row( "SELECT answer_array FROM {$wpdb->prefix}mlw_questions WHERE question_id = ($question_id)", 'ARRAY_A' );
60
- $answer_array = unserialize($question_array['answer_array']);
61
- $got_ans = false;
62
- if($answer_array && $got_ans === false){
63
- foreach ($answer_array as $key => $value) {
64
- if($value[0] == $answer && $value[2] == 1){
65
- $got_ans = true;
66
- break;
67
- }
68
- }
69
- }
70
- echo $got_ans ? 'correct' : 'incorrect';
71
- exit;
72
- }
73
-
74
- /**
75
- * Generates Content For Quiz Shortcode
76
- *
77
- * Generates the content for the [mlw_quizmaster] shortcode
78
- *
79
- * @since 4.0.0
80
- * @param array $atts The attributes passed from the shortcode.
81
- * @uses QMNQuizManager:load_questions() Loads questions
82
- * @uses QMNQuizManager:create_answer_array() Prepares answers
83
- * @uses QMNQuizManager:display_quiz() Generates and prepares quiz page
84
- * @uses QMNQuizManager:display_results() Generates and prepares results page
85
- * @return string The content for the shortcode
86
- */
87
- public function display_shortcode($atts) {
88
- extract(shortcode_atts(array(
89
- 'quiz' => 0,
90
- 'question_amount' => 0,
91
- ), $atts));
92
-
93
- ob_start();
94
-
95
- global $wpdb;
96
- global $mlwQuizMasterNext;
97
- global $qmn_allowed_visit;
98
- global $qmn_json_data;
99
- $qmn_json_data = array();
100
- $qmn_allowed_visit = true;
101
- $success = $mlwQuizMasterNext->pluginHelper->prepare_quiz($quiz);
102
- if (false === $success) {
103
- return __('It appears that this quiz is not set up correctly', 'quiz-master-next');
104
- }
105
- $question_amount = intval($question_amount);
106
-
107
- // Legacy variable.
108
- global $mlw_qmn_quiz;
109
- $mlw_qmn_quiz = $quiz;
110
-
111
- $return_display = '';
112
- $qmn_quiz_options = $mlwQuizMasterNext->quiz_settings->get_quiz_options();
113
-
114
- // If quiz options isn't found, stop function.
115
- if (is_null($qmn_quiz_options) || empty($qmn_quiz_options->quiz_name)) {
116
- return __('It appears that this quiz is not set up correctly', 'quiz-master-next');
117
- }
118
-
119
- // Loads Quiz Template.
120
- // The quiz_stye is misspelled because it has always been misspelled and fixing it would break many sites :(.
121
- if ('default' == $qmn_quiz_options->theme_selected) {
122
- $return_display .= '<style type="text/css">' . $qmn_quiz_options->quiz_stye . '</style>';
123
- wp_enqueue_style('qmn_quiz_style', plugins_url('../../css/qmn_quiz.css', __FILE__));
124
- } else {
125
- $registered_template = $mlwQuizMasterNext->pluginHelper->get_quiz_templates($qmn_quiz_options->theme_selected);
126
- // Check direct file first, then check templates folder in plugin, then check templates file in theme.
127
- // If all fails, then load custom styling instead.
128
- if ($registered_template && file_exists($registered_template['path'])) {
129
- wp_enqueue_style('qmn_quiz_template', $registered_template['path'], array(), $mlwQuizMasterNext->version);
130
- } elseif ($registered_template && file_exists(plugin_dir_path(__FILE__) . '../../templates/' . $registered_template['path'])) {
131
- wp_enqueue_style('qmn_quiz_template', plugins_url('../../templates/' . $registered_template['path'], __FILE__), array(), $mlwQuizMasterNext->version);
132
- } elseif ($registered_template && file_exists(get_stylesheet_directory_uri() . '/templates/' . $registered_template['path'])) {
133
- wp_enqueue_style('qmn_quiz_template', get_stylesheet_directory_uri() . '/templates/' . $registered_template['path'], array(), $mlwQuizMasterNext->version);
134
- } else {
135
- echo "<style type='text/css'>{$qmn_quiz_options->quiz_stye}</style>";
136
- }
137
- }
138
-
139
- // Starts to prepare variable array for filters.
140
- $qmn_array_for_variables = array(
141
- 'quiz_id' => $qmn_quiz_options->quiz_id,
142
- 'quiz_name' => $qmn_quiz_options->quiz_name,
143
- 'quiz_system' => $qmn_quiz_options->system,
144
- 'user_ip' => $this->get_user_ip(),
145
- );
146
-
147
- $return_display .= "<script>
148
- if (window.qmn_quiz_data === undefined) {
149
- window.qmn_quiz_data = new Object();
150
- }
151
- </script>";
152
- $qmn_json_data = array(
153
- 'quiz_id' => $qmn_array_for_variables['quiz_id'],
154
- 'quiz_name' => $qmn_array_for_variables['quiz_name'],
155
- 'disable_answer' => $qmn_quiz_options->disable_answer_onselect,
156
- 'ajax_show_correct' => $qmn_quiz_options->ajax_show_correct,
157
- 'progress_bar' => $qmn_quiz_options->progress_bar,
158
- );
159
-
160
- $return_display = apply_filters('qmn_begin_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
161
-
162
- // Checks if we should be showing quiz or results page.
163
- if ($qmn_allowed_visit && !isset($_POST["complete_quiz"]) && !empty($qmn_quiz_options->quiz_name)) {
164
- $return_display .= $this->display_quiz($qmn_quiz_options, $qmn_array_for_variables, $question_amount);
165
- } elseif (isset($_POST["complete_quiz"]) && 'confirmation' == $_POST["complete_quiz"] && $_POST["qmn_quiz_id"] == $qmn_array_for_variables["quiz_id"]) {
166
- $return_display .= $this->display_results($qmn_quiz_options, $qmn_array_for_variables);
167
- }
168
-
169
- $qmn_filtered_json = apply_filters('qmn_json_data', $qmn_json_data, $qmn_quiz_options, $qmn_array_for_variables);
170
-
171
- $return_display .= '<script>
172
- window.qmn_quiz_data["' . $qmn_json_data["quiz_id"] . '"] = ' . json_encode($qmn_json_data) . '
173
- </script>';
174
-
175
- $return_display .= ob_get_clean();
176
- $return_display = apply_filters('qmn_end_shortcode', $return_display, $qmn_quiz_options, $qmn_array_for_variables);
177
- return $return_display;
178
- }
179
-
180
- public function shortcode_display_result($atts){
181
- extract(shortcode_atts(array(
182
- 'id' => 0,
183
- ), $atts));
184
- ob_start();
185
- global $wpdb;
186
- $result_data = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = {$id}", ARRAY_A);
187
- $quiz_result = unserialize($result_data['quiz_results']);
188
- $response_data = array(
189
- 'quiz_id' => $result_data['quiz_id'],
190
- 'quiz_name' => $result_data['quiz_name'],
191
- 'quiz_system' => $result_data['quiz_system'],
192
- 'quiz_payment_id' => '',
193
- 'user_ip' => $result_data['user_ip'],
194
- 'user_name' => $result_data['name'],
195
- 'user_business' => $result_data['business'],
196
- 'user_email' => $result_data['email'],
197
- 'user_phone' => $result_data['phone'],
198
- 'user_id' => $result_data['user'],
199
- 'timer' => 0,
200
- 'time_taken' => $result_data['time_taken'],
201
- 'contact' => $quiz_result['contact'],
202
- 'total_points' => $result_data['point_score'],
203
- 'total_score' => $result_data['correct_score'],
204
- 'total_correct' => $result_data['correct'],
205
- 'total_questions' => $result_data['total'],
206
- 'question_answers_array' => $quiz_result[1],
207
- 'comments' => ''
208
- );
209
- $data = QSM_Results_Pages::generate_pages($response_data);
210
- echo htmlspecialchars_decode($data['display']);
211
- $content = ob_get_clean();
212
- return $content;
213
- }
214
-
215
- /**
216
- * Loads Questions
217
- *
218
- * Retrieves the questions from the database
219
- *
220
- * @since 4.0.0
221
- * @param int $quiz_id The id for the quiz.
222
- * @param array $quiz_options The database row for the quiz.
223
- * @param bool $is_quiz_page If the page being loaded is the quiz page or not.
224
- * @param int $question_amount The amount of questions entered using the shortcode attribute.
225
- * @return array The questions for the quiz
226
- * @deprecated 5.2.0 Use new class: QSM_Questions instead
227
- */
228
- public function load_questions($quiz_id, $quiz_options, $is_quiz_page, $question_amount = 0) {
229
-
230
- // Prepare variables.
231
- global $wpdb;
232
- global $mlwQuizMasterNext;
233
- $questions = array();
234
- $order_by_sql = 'ORDER BY question_order ASC';
235
- $limit_sql = '';
236
-
237
- // Checks if the questions should be randomized.
238
- if (1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order) {
239
- $order_by_sql = 'ORDER BY rand()';
240
- }
241
-
242
- // Check if we should load all questions or only a selcted amount.
243
- if ($is_quiz_page && ( 0 != $quiz_options->question_from_total || 0 !== $question_amount )) {
244
- if (0 !== $question_amount) {
245
- $limit_sql = " LIMIT $question_amount";
246
- } else {
247
- $limit_sql = ' LIMIT ' . intval($quiz_options->question_from_total);
248
- }
249
- }
250
-
251
- // If using newer pages system from 5.2.
252
- $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('pages', array());
253
- // Get all question IDs needed.
254
- $total_pages = count($pages);
255
- if ($total_pages > 0) {
256
- for ($i = 0; $i < $total_pages; $i++) {
257
- foreach ($pages[$i] as $question) {
258
- $question_ids[] = intval($question);
259
- }
260
- }
261
- $question_sql = implode(', ', $question_ids);
262
- $questions = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id IN ($question_sql) " . $order_by_sql . $limit_sql);
263
-
264
- // If we are not using randomization, we need to put the questions in the order of the new question editor.
265
- // If a user has saved the pages in the question editor but still uses the older pagination options
266
- // Then they will make it here. So, we need to order the questions based on the new editor.
267
- if (1 != $quiz_options->randomness_order && 2 != $quiz_options->randomness_order) {
268
- $ordered_questions = array();
269
- foreach ($questions as $question) {
270
- $key = array_search($question->question_id, $question_ids);
271
- if (false !== $key) {
272
- $ordered_questions[$key] = $question;
273
- }
274
- }
275
- ksort($ordered_questions);
276
- $questions = $ordered_questions;
277
- }
278
- } else {
279
- $questions = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "mlw_questions WHERE quiz_id=%d AND deleted=0 " . $order_by_sql . $limit_sql, $quiz_id));
280
- }
281
-
282
- // Returns an array of all the loaded questions.
283
- return $questions;
284
- }
285
-
286
- /**
287
- * Prepares Answers
288
- *
289
- * Prepares or creates the answer array for the quiz
290
- *
291
- * @since 4.0.0
292
- * @param array $questions The questions for the quiz.
293
- * @param bool $is_ajax Pass true if this is an ajax call.
294
- * @return array The answers for the quiz
295
- * @deprecated 5.2.0 Use new class: QSM_Questions instead
296
- */
297
- public function create_answer_array($questions, $is_ajax = false) {
298
-
299
- // Load and prepare answer arrays.
300
- $mlw_qmn_answer_arrays = array();
301
- $question_list = array();
302
- foreach ($questions as $mlw_question_info) {
303
- $question_list[$mlw_question_info->question_id] = get_object_vars($mlw_question_info);
304
- if (is_serialized($mlw_question_info->answer_array) && is_array(@unserialize($mlw_question_info->answer_array))) {
305
- $mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
306
- $mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
307
- $question_list[$mlw_question_info->question_id]["answers"] = $mlw_qmn_answer_array_each;
308
- } else {
309
- $mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
310
- $mlw_answer_array_correct[$mlw_question_info->correct_answer - 1] = 1;
311
- $mlw_qmn_answer_arrays[$mlw_question_info->question_id] = array(
312
- array($mlw_question_info->answer_one, $mlw_question_info->answer_one_points, $mlw_answer_array_correct[0]),
313
- array($mlw_question_info->answer_two, $mlw_question_info->answer_two_points, $mlw_answer_array_correct[1]),
314
- array($mlw_question_info->answer_three, $mlw_question_info->answer_three_points, $mlw_answer_array_correct[2]),
315
- array($mlw_question_info->answer_four, $mlw_question_info->answer_four_points, $mlw_answer_array_correct[3]),
316
- array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
317
- array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
318
- $question_list[$mlw_question_info->question_id]["answers"] = $mlw_qmn_answer_arrays[$mlw_question_info->question_id];
319
- }
320
- }
321
- if (!$is_ajax) {
322
- global $qmn_json_data;
323
- $qmn_json_data["question_list"] = $question_list;
324
- }
325
- return $mlw_qmn_answer_arrays;
326
- }
327
-
328
- /**
329
- * Generates Content Quiz Page
330
- *
331
- * Generates the content for the quiz page part of the shortcode
332
- *
333
- * @since 4.0.0
334
- * @param array $options The database row of the quiz.
335
- * @param array $quiz_data The array of results for the quiz.
336
- * @param int $question_amount The number of questions to load for quiz.
337
- * @uses QMNQuizManager:display_begin_section() Creates display for beginning section
338
- * @uses QMNQuizManager:display_questions() Creates display for questions
339
- * @uses QMNQuizManager:display_comment_section() Creates display for comment section
340
- * @uses QMNQuizManager:display_end_section() Creates display for end section
341
- * @return string The content for the quiz page section
342
- */
343
- public function display_quiz($options, $quiz_data, $question_amount) {
344
-
345
- global $qmn_allowed_visit;
346
- global $mlwQuizMasterNext;
347
- $quiz_display = '';
348
- $quiz_display = apply_filters('qmn_begin_quiz', $quiz_display, $options, $quiz_data);
349
- if (!$qmn_allowed_visit) {
350
- return $quiz_display;
351
- }
352
- wp_enqueue_script('json2');
353
- wp_enqueue_script('jquery');
354
- wp_enqueue_script('jquery-ui-core');
355
- wp_enqueue_script('jquery-ui-tooltip');
356
- wp_enqueue_style('jquery-redmond-theme', plugins_url('../../css/jquery-ui.css', __FILE__));
357
-
358
- global $qmn_json_data;
359
- $qmn_json_data['error_messages'] = array(
360
- 'email' => $options->email_error_text,
361
- 'number' => $options->number_error_text,
362
- 'incorrect' => $options->incorrect_error_text,
363
- 'empty' => $options->empty_error_text,
364
- );
365
-
366
- wp_enqueue_script('progress-bar', plugins_url('../../js/progressbar.min.js', __FILE__));
367
- wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
368
- wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'enable_quick_result_mc' => isset($options->enable_quick_result_mc) ? $options->enable_quick_result_mc : '','enable_result_after_timer_end' => isset($options->enable_result_after_timer_end) ? $options->enable_result_after_timer_end : ''));
369
- wp_enqueue_script('math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML');
370
-
371
- global $qmn_total_questions;
372
- $qmn_total_questions = 0;
373
- global $mlw_qmn_section_count;
374
- $mlw_qmn_section_count = 0;
375
-
376
- $quiz_display .= "<div class='qsm-quiz-container qmn_quiz_container mlw_qmn_quiz'>";
377
- // Get quiz post based on quiz id
378
- $args = array(
379
- 'posts_per_page' => 1,
380
- 'post_type' => 'quiz',
381
- 'meta_query' => array(
382
- array(
383
- 'key' => 'quiz_id',
384
- 'value' => $quiz_data['quiz_id'],
385
- 'compare' => '=',
386
- ),
387
- ),
388
- );
389
- $the_query = new WP_Query($args);
390
-
391
- // The Loop
392
- if ($the_query->have_posts()) {
393
- while ($the_query->have_posts()) {
394
- $the_query->the_post();
395
- $quiz_display .= get_the_post_thumbnail(get_the_ID(),'full');
396
- }
397
- /* Restore original Post Data */
398
- wp_reset_postdata();
399
- }
400
- $quiz_display = apply_filters('qsm_display_before_form', $quiz_display);
401
- $quiz_display .= "<form name='quizForm{$quiz_data['quiz_id']}' id='quizForm{$quiz_data['quiz_id']}' action='' method='post' class='qsm-quiz-form qmn_quiz_form mlw_quiz_form' novalidate >";
402
- $quiz_display .= "<div name='mlw_error_message' id='mlw_error_message' class='qsm-error-message qmn_error_message_section'></div>";
403
- $quiz_display .= "<span id='mlw_top_of_quiz'></span>";
404
- $quiz_display = apply_filters('qmn_begin_quiz_form', $quiz_display, $options, $quiz_data);
405
-
406
- // If deprecated pagination setting is not used, use new system...
407
- $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('pages', array());
408
- if (0 == $options->randomness_order && 0 == $options->question_from_total && 0 == $options->pagination && 0 !== count($pages)) {
409
- $quiz_display .= $this->display_pages($options, $quiz_data);
410
- } else {
411
- // ... else, use older system.
412
- $questions = $this->load_questions($quiz_data['quiz_id'], $options, true, $question_amount);
413
- $answers = $this->create_answer_array($questions);
414
- $quiz_display .= $this->display_begin_section($options, $quiz_data);
415
- $quiz_display = apply_filters('qmn_begin_quiz_questions', $quiz_display, $options, $quiz_data);
416
- $quiz_display .= $this->display_questions($options, $questions, $answers);
417
- $quiz_display = apply_filters('qmn_before_comment_section', $quiz_display, $options, $quiz_data);
418
- $quiz_display .= $this->display_comment_section($options, $quiz_data);
419
- $quiz_display = apply_filters('qmn_after_comment_section', $quiz_display, $options, $quiz_data);
420
- $quiz_display .= $this->display_end_section($options, $quiz_data);
421
- }
422
- $quiz_display = apply_filters('qmn_before_error_message', $quiz_display, $options, $quiz_data);
423
- $quiz_display .= "<div name='mlw_error_message_bottom' id='mlw_error_message_bottom' class='qsm-error-message qmn_error_message_section'></div>";
424
- $quiz_display .= "<input type='hidden' name='total_questions' id='total_questions' value='$qmn_total_questions'/>";
425
- $quiz_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
426
- $quiz_display .= "<input type='hidden' class='qmn_quiz_id' name='qmn_quiz_id' id='qmn_quiz_id' value='{$quiz_data['quiz_id']}'/>";
427
- $quiz_display .= "<input type='hidden' name='complete_quiz' value='confirmation' />";
428
- if (isset($_GET['payment_id']) && $_GET['payment_id'] != '') {
429
- $quiz_display .= "<input type='hidden' name='main_payment_id' value='" . $_GET['payment_id'] . "' />";
430
- }
431
- $quiz_display = apply_filters('qmn_end_quiz_form', $quiz_display, $options, $quiz_data);
432
- $quiz_display .= '</form>';
433
- $quiz_display .= '</div>';
434
-
435
- $quiz_display = apply_filters('qmn_end_quiz', $quiz_display, $options, $quiz_data);
436
- return $quiz_display;
437
- }
438
-
439
- /**
440
- * Creates the pages of content for the quiz/survey
441
- *
442
- * @since 5.2.0
443
- * @param array $options The settings for the quiz.
444
- * @param array $quiz_data The array of quiz data.
445
- * @return string The HTML for the pages
446
- */
447
- public function display_pages($options, $quiz_data) {
448
- global $mlwQuizMasterNext;
449
- global $qmn_json_data;
450
- ob_start();
451
- $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('pages', array());
452
- $questions = QSM_Questions::load_questions_by_pages($options->quiz_id);
453
- $question_list = '';
454
- $contact_fields = QSM_Contact_Manager::load_fields();
455
- if (count($pages) > 1 && (!empty($options->message_before) || ( 0 == $options->contact_info_location && $contact_fields ) )) {
456
- $qmn_json_data['first_page'] = true;
457
- $message_before = wpautop(htmlspecialchars_decode($options->message_before, ENT_QUOTES));
458
- $message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $quiz_data);
459
- ?>
460
- <section class="qsm-page">
461
- <div class="quiz_section quiz_begin">
462
- <div class='qsm-before-message mlw_qmn_message_before'><?php echo $message_before; ?></div>
463
- <?php
464
- if (0 == $options->contact_info_location) {
465
- echo QSM_Contact_Manager::display_fields($options);
466
- }
467
- ?>
468
- </div>
469
- </section>
470
- <?php
471
- }
472
-
473
- // If there is only one page.
474
- if (1 == count($pages)) {
475
- ?>
476
- <section class="qsm-page">
477
- <?php
478
- if (!empty($options->message_before) || ( 0 == $options->contact_info_location && $contact_fields )) {
479
- $qmn_json_data['first_page'] = false;
480
- $message_before = wpautop(htmlspecialchars_decode($options->message_before, ENT_QUOTES));
481
- $message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $quiz_data);
482
- ?>
483
- <div class="quiz_section quiz_begin">
484
- <div class='qsm-before-message mlw_qmn_message_before'><?php echo $message_before; ?></div>
485
- <?php
486
- if (0 == $options->contact_info_location) {
487
- echo QSM_Contact_Manager::display_fields($options);
488
- }
489
- ?>
490
- </div>
491
- <?php
492
- }
493
- foreach ($pages[0] as $question_id) {
494
- $question_list .= $question_id . 'Q';
495
- $question = $questions[$question_id];
496
- ?>
497
- <div class='quiz_section question-section-id-<?php echo esc_attr($question_id); ?>'>
498
- <?php
499
- echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
500
- if (0 == $question['comments']) {
501
- echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' x-webkit-speech id='mlwComment$question_id' name='mlwComment$question_id' value='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
502
- }
503
- if (2 == $question['comments']) {
504
- echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' onclick='qmnClearField(this)'>" . htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES) . "</textarea>";
505
- }
506
- // Checks if a hint is entered.
507
- if (!empty($question['hints'])) {
508
- echo '<div title="' . esc_attr(htmlspecialchars_decode($question['hints'], ENT_QUOTES)) . '" class="qsm-hint qsm_hint mlw_qmn_hint_link">' . $options->hint_text . '</div>';
509
- }
510
- ?>
511
- </div>
512
- <?php
513
- }
514
- if (0 == $options->comment_section) {
515
- $message_comments = wpautop(htmlspecialchars_decode($options->message_comment, ENT_QUOTES));
516
- $message_comments = apply_filters('mlw_qmn_template_variable_quiz_page', $message_comments, $quiz_data);
517
- ?>
518
- <div class="quiz_section quiz_begin">
519
- <label for='mlwQuizComments' class='qsm-comments-label mlw_qmn_comment_section_text'><?php echo $message_comments; ?></label>
520
- <textarea id='mlwQuizComments' name='mlwQuizComments' class='qsm-comments qmn_comment_section'></textarea>
521
- </div>
522
- <?php
523
- }
524
- if (!empty($options->message_end_template) || ( 1 == $options->contact_info_location && $contact_fields )) {
525
- $message_after = wpautop(htmlspecialchars_decode($options->message_end_template, ENT_QUOTES));
526
- $message_after = apply_filters('mlw_qmn_template_variable_quiz_page', $message_after, $quiz_data);
527
- ?>
528
- <div class="quiz_section">
529
- <div class='qsm-after-message mlw_qmn_message_end'><?php echo $message_after; ?></div>
530
- <?php
531
- if (1 == $options->contact_info_location) {
532
- echo QSM_Contact_Manager::display_fields($options);
533
- }
534
- ?>
535
- </div>
536
- <?php
537
- }
538
- ?>
539
- </section>
540
- <?php
541
- } else {
542
- foreach ($pages as $page) {
543
- ?>
544
- <section class="qsm-page">
545
- <?php
546
- foreach ($page as $question_id) {
547
- $question_list .= $question_id . 'Q';
548
- $question = $questions[$question_id];
549
- ?>
550
- <div class='quiz_section question-section-id-<?php echo esc_attr($question_id); ?>'>
551
- <?php
552
- echo $mlwQuizMasterNext->pluginHelper->display_question($question['question_type_new'], $question_id, $options);
553
- if (0 == $question['comments']) {
554
- echo "<input type='text' class='qsm-question-comment qsm-question-comment-small mlw_qmn_question_comment' x-webkit-speech id='mlwComment$question_id' name='mlwComment$question_id' value='" . esc_attr(htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
555
- }
556
- if (2 == $question['comments']) {
557
- echo "<textarea class='qsm-question-comment qsm-question-comment-large mlw_qmn_question_comment' id='mlwComment$question_id' name='mlwComment$question_id' onclick='qmnClearField(this)'>" . htmlspecialchars_decode($options->comment_field_text, ENT_QUOTES) . "</textarea>";
558
- }
559
- // Checks if a hint is entered.
560
- if (!empty($question['hints'])) {
561
- echo '<div title="' . esc_attr(htmlspecialchars_decode($question['hints'], ENT_QUOTES)) . '" class="qsm-hint qsm_hint mlw_qmn_hint_link">' . $options->hint_text . '</div>';
562
- }
563
- ?>
564
- </div>
565
- <?php
566
- }
567
- ?>
568
- </section>
569
- <?php
570
- }
571
- }
572
-
573
- if (count($pages) > 1 && 0 == $options->comment_section) {
574
- $message_comments = wpautop(htmlspecialchars_decode($options->message_comment, ENT_QUOTES));
575
- $message_comments = apply_filters('mlw_qmn_template_variable_quiz_page', $message_comments, $quiz_data);
576
- ?>
577
- <section class="qsm-page">
578
- <div class="quiz_section quiz_begin">
579
- <label for='mlwQuizComments' class='qsm-comments-label mlw_qmn_comment_section_text'><?php echo $message_comments; ?></label>
580
- <textarea id='mlwQuizComments' name='mlwQuizComments' class='qsm-comments qmn_comment_section'></textarea>
581
- </div>
582
- </section>
583
- <?php
584
- }
585
- if (count($pages) > 1 && (!empty($options->message_end_template) || ( 1 == $options->contact_info_location && $contact_fields ) )) {
586
- $message_after = wpautop(htmlspecialchars_decode($options->message_end_template, ENT_QUOTES));
587
- $message_after = apply_filters('mlw_qmn_template_variable_quiz_page', $message_after, $quiz_data);
588
- ?>
589
- <section class="qsm-page">
590
- <div class="quiz_section">
591
- <div class='qsm-after-message mlw_qmn_message_end'><?php echo $message_after; ?></div>
592
- <?php
593
- if (1 == $options->contact_info_location) {
594
- echo QSM_Contact_Manager::display_fields($options);
595
- }
596
- ?>
597
- </div>
598
- <?php
599
- // Legacy code.
600
- do_action('mlw_qmn_end_quiz_section');
601
- ?>
602
- </section>
603
- <?php
604
- }
605
- ?>
606
- <!-- View for pagination -->
607
- <script type="text/template" id="tmpl-qsm-pagination">
608
- <div class="qsm-pagination qmn_pagination border margin-bottom">
609
- <a class="qsm-btn qsm-previous qmn_btn mlw_qmn_quiz_link mlw_previous" href="#"><?php echo esc_html($options->previous_button_text); ?></a>
610
- <span class="qmn_page_message"></span>
611
- <div class="qmn_page_counter_message"></div>
612
- <div id="qsm-progress-bar" style="display:none;"></div>
613
- <a class="qsm-btn qsm-next qmn_btn mlw_qmn_quiz_link mlw_next" href="#"><?php echo esc_html($options->next_button_text); ?></a>
614
- <input type='submit' class='qsm-btn qsm-submit-btn qmn_btn' value='<?php echo esc_attr(htmlspecialchars_decode($options->submit_button_text, ENT_QUOTES)); ?>' />
615
- </div>
616
- </script>
617
- <input type='hidden' name='qmn_question_list' value='<?php echo esc_attr($question_list); ?>' />
618
- <?php
619
- return ob_get_clean();
620
- }
621
-
622
- /**
623
- * Creates Display For Beginning Section
624
- *
625
- * Generates the content for the beginning section of the quiz page
626
- *
627
- * @since 4.0.0
628
- * @param array $qmn_quiz_options The database row of the quiz.
629
- * @param array $qmn_array_for_variables The array of results for the quiz.
630
- * @return string The content for the beginning section
631
- * @deprecated 5.2.0 Use new page system instead
632
- */
633
- public function display_begin_section($qmn_quiz_options, $qmn_array_for_variables) {
634
- $section_display = '';
635
- global $qmn_json_data;
636
- $contact_fields = QSM_Contact_Manager::load_fields();
637
- if (!empty($qmn_quiz_options->message_before) || ( 0 == $qmn_quiz_options->contact_info_location && $contact_fields )) {
638
- $qmn_json_data["first_page"] = true;
639
- global $mlw_qmn_section_count;
640
- $mlw_qmn_section_count += 1;
641
- $section_display .= "<div class='quiz_section quiz_begin slide$mlw_qmn_section_count'>";
642
-
643
- $message_before = wpautop(htmlspecialchars_decode($qmn_quiz_options->message_before, ENT_QUOTES));
644
- $message_before = apply_filters('mlw_qmn_template_variable_quiz_page', $message_before, $qmn_array_for_variables);
645
-
646
- $section_display .= "<div class='mlw_qmn_message_before'>$message_before</div>";
647
- if (0 == $qmn_quiz_options->contact_info_location) {
648
- $section_display .= QSM_Contact_Manager::display_fields($qmn_quiz_options);
649
- }
650
- $section_display .= "</div>";
651
- } else {
652
- $qmn_json_data["first_page"] = false;
653
- }
654
- return $section_display;
655
- }
656
-
657
- /**
658
- * Creates Display For Questions
659
- *
660
- * Generates the content for the questions part of the quiz page
661
- *
662
- * @since 4.0.0
663
- * @param array $qmn_quiz_options The database row of the quiz.
664
- * @param array $qmn_quiz_questions The questions of the quiz.
665
- * @param array $qmn_quiz_answers The answers of the quiz.
666
- * @uses QMNPluginHelper:display_question() Displays a question
667
- * @return string The content for the questions section
668
- * @deprecated 5.2.0 Use new page system instead
669
- */
670
- public function display_questions($qmn_quiz_options, $qmn_quiz_questions, $qmn_quiz_answers) {
671
- $question_display = '';
672
- global $mlwQuizMasterNext;
673
- global $qmn_total_questions;
674
- global $mlw_qmn_section_count;
675
- $question_id_list = '';
676
- foreach ($qmn_quiz_questions as $mlw_question) {
677
- $question_id_list .= $mlw_question->question_id . "Q";
678
- $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
679
- $question_display .= "<div class='quiz_section question-section-id-{$mlw_question->question_id} slide{$mlw_qmn_section_count}'>";
680
-
681
- $question_display .= $mlwQuizMasterNext->pluginHelper->display_question($mlw_question->question_type_new, $mlw_question->question_id, $qmn_quiz_options);
682
-
683
- if (0 == $mlw_question->comments) {
684
- $question_display .= "<input type='text' class='mlw_qmn_question_comment' x-webkit-speech id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "' value='" . esc_attr(htmlspecialchars_decode($qmn_quiz_options->comment_field_text, ENT_QUOTES)) . "' onclick='qmnClearField(this)'/>";
685
- $question_display .= "<br />";
686
- }
687
- if (2 == $mlw_question->comments) {
688
- $question_display .= "<textarea cols='70' rows='5' class='mlw_qmn_question_comment' id='mlwComment" . $mlw_question->question_id . "' name='mlwComment" . $mlw_question->question_id . "' onclick='qmnClearField(this)'>" . htmlspecialchars_decode($qmn_quiz_options->comment_field_text, ENT_QUOTES) . "</textarea>";
689
- $question_display .= "<br />";
690
- }
691
-
692
- // Checks if a hint is entered.
693
- if (!empty($mlw_question->hints)) {
694
- $question_display .= "<div title=\"" . esc_attr(htmlspecialchars_decode($mlw_question->hints, ENT_QUOTES)) . "\" class='qsm_hint mlw_qmn_hint_link'>{$qmn_quiz_options->hint_text}</div>";
695
- $question_display .= "<br /><br />";
696
- }
697
- $question_display .= "</div>";
698
- }
699
- $question_display .= "<input type='hidden' name='qmn_question_list' value='$question_id_list' />";
700
- return $question_display;
701
- }
702
-
703
- /**
704
- * Creates Display For Comment Section
705
- *
706
- * Generates the content for the comment section part of the quiz page
707
- *
708
- * @since 4.0.0
709
- * @param array $qmn_quiz_options The database row of the quiz.
710
- * @param array $qmn_array_for_variables The array of results for the quiz.
711
- * @return string The content for the comment section
712
- * @deprecated 5.2.0 Use new page system instead
713
- */
714
- public function display_comment_section($qmn_quiz_options, $qmn_array_for_variables) {
715
- global $mlw_qmn_section_count;
716
- $comment_display = '';
717
- if (0 == $qmn_quiz_options->comment_section) {
718
- $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
719
- $comment_display .= "<div class='quiz_section slide" . $mlw_qmn_section_count . "'>";
720
- $message_comments = wpautop(htmlspecialchars_decode($qmn_quiz_options->message_comment, ENT_QUOTES));
721
- $message_comments = apply_filters('mlw_qmn_template_variable_quiz_page', $message_comments, $qmn_array_for_variables);
722
- $comment_display .= "<label for='mlwQuizComments' class='mlw_qmn_comment_section_text'>$message_comments</label><br />";
723
- $comment_display .= "<textarea cols='60' rows='10' id='mlwQuizComments' name='mlwQuizComments' class='qmn_comment_section'></textarea>";
724
- $comment_display .= "</div>";
725
- }
726
- return $comment_display;
727
- }
728
-
729
- /**
730
- * Creates Display For End Section Of Quiz Page
731
- *
732
- * Generates the content for the end section of the quiz page
733
- *
734
- * @since 4.0.0
735
- * @param array $qmn_quiz_options The database row of the quiz.
736
- * @param array $qmn_array_for_variables The array of results for the quiz.
737
- * @return string The content for the end section
738
- * @deprecated 5.2.0 Use new page system instead
739
- */
740
- public function display_end_section($qmn_quiz_options, $qmn_array_for_variables) {
741
- global $mlw_qmn_section_count;
742
- $section_display = '';
743
- $section_display .= '<br />';
744
- $mlw_qmn_section_count = $mlw_qmn_section_count + 1;
745
- $section_display .= "<div class='quiz_section slide$mlw_qmn_section_count quiz_end'>";
746
- if (!empty($qmn_quiz_options->message_end_template)) {
747
- $message_end = wpautop(htmlspecialchars_decode($qmn_quiz_options->message_end_template, ENT_QUOTES));
748
- $message_end = apply_filters('mlw_qmn_template_variable_quiz_page', $message_end, $qmn_array_for_variables);
749
- $section_display .= "<span class='mlw_qmn_message_end'>$message_end</span>";
750
- $section_display .= '<br /><br />';
751
- }
752
- if (1 == $qmn_quiz_options->contact_info_location) {
753
- $section_display .= QSM_Contact_Manager::display_fields($qmn_quiz_options);
754
- }
755
-
756
- // Legacy Code.
757
- ob_start();
758
- do_action('mlw_qmn_end_quiz_section');
759
- $section_display .= ob_get_contents();
760
- ob_end_clean();
761
-
762
- $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)) . "' />";
763
- $section_display .= "</div>";
764
-
765
- return $section_display;
766
- }
767
-
768
- /**
769
- * Generates Content Results Page
770
- *
771
- * Generates the content for the results page part of the shortcode
772
- *
773
- * @since 4.0.0
774
- * @param array $options The database row of the quiz.
775
- * @param array $data The array of results for the quiz.
776
- * @uses QMNQuizManager:submit_results() Perform The Quiz/Survey Submission
777
- * @return string The content for the results page section
778
- */
779
- public function display_results($options, $data) {
780
- $result = $this->submit_results($options, $data);
781
- $results_array = $result;
782
- return $results_array['display'];
783
- }
784
-
785
- /**
786
- * Calls the results page from ajax
787
- *
788
- * @since 4.6.0
789
- * @uses QMNQuizManager:submit_results() Perform The Quiz/Survey Submission
790
- * @return string The content for the results page section
791
- */
792
- public function ajax_submit_results() {
793
- global $qmn_allowed_visit;
794
- global $mlwQuizMasterNext;
795
- parse_str($_POST["quizData"], $_POST);
796
- $qmn_allowed_visit = true;
797
- $quiz = intval($_POST["qmn_quiz_id"]);
798
- $mlwQuizMasterNext->pluginHelper->prepare_quiz($quiz);
799
- $options = $mlwQuizMasterNext->quiz_settings->get_quiz_options();
800
- $data = array(
801
- 'quiz_id' => $options->quiz_id,
802
- 'quiz_name' => $options->quiz_name,
803
- 'quiz_system' => $options->system,
804
- 'quiz_payment_id' => isset($_POST['main_payment_id']) ? $_POST['main_payment_id'] : ''
805
- );
806
- $post_data = $_POST;
807
- if(class_exists('QSM_Recaptcha')){
808
- $verified = qsm_verify_recaptcha($post_data);
809
- if(!$verified){
810
- echo json_encode(array(
811
- 'display' => htmlspecialchars_decode('ReCaptcha Validation failed'),
812
- 'redirect' => FALSE,
813
- ));
814
- exit;
815
- }
816
- }
817
- echo json_encode($this->submit_results($options, $data));
818
- die();
819
- }
820
-
821
- /**
822
- * @version 6.3.2
823
- * Show quiz on button click
824
- */
825
- public function qsm_get_quiz_to_reload(){
826
- $quiz_id = $_POST['quiz_id'];
827
- echo do_shortcode('[qsm quiz="'. $quiz_id .'"]');
828
- exit;
829
- }
830
-
831
- /**
832
- * Perform The Quiz/Survey Submission
833
- *
834
- * Prepares and save the results, prepares and send emails, prepare results page
835
- *
836
- * @since 4.6.0
837
- * @param array $qmn_quiz_options The database row of the quiz.
838
- * @param array $qmn_array_for_variables The array of results for the quiz.
839
- * @uses QMNQuizManager:check_answers() Creates display for beginning section
840
- * @uses QMNQuizManager:check_comment_section() Creates display for questions
841
- * @uses QMNQuizManager:display_results_text() Creates display for end section
842
- * @uses QMNQuizManager:display_social() Creates display for comment section
843
- * @uses QMNQuizManager:send_user_email() Creates display for end section
844
- * @uses QMNQuizManager:send_admin_email() Creates display for end section
845
- * @return string The content for the results page section
846
- */
847
- public function submit_results($qmn_quiz_options, $qmn_array_for_variables) {
848
- global $qmn_allowed_visit;
849
- $result_display = '';
850
-
851
- $qmn_array_for_variables['user_ip'] = $this->get_user_ip();
852
-
853
- $result_display = apply_filters('qmn_begin_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
854
- if (!$qmn_allowed_visit) {
855
- return $result_display;
856
- }
857
-
858
- // Gathers contact information.
859
- $qmn_array_for_variables['user_name'] = 'None';
860
- $qmn_array_for_variables['user_business'] = 'None';
861
- $qmn_array_for_variables['user_email'] = 'None';
862
- $qmn_array_for_variables['user_phone'] = 'None';
863
- $contact_responses = QSM_Contact_Manager::process_fields($qmn_quiz_options);
864
- foreach ($contact_responses as $field) {
865
- if (isset($field['use'])) {
866
- if ('name' === $field['use']) {
867
- $qmn_array_for_variables['user_name'] = $field["value"];
868
- }
869
- if ('comp' === $field['use']) {
870
- $qmn_array_for_variables['user_business'] = $field["value"];
871
- }
872
- if ('email' === $field['use']) {
873
- $qmn_array_for_variables['user_email'] = $field["value"];
874
- }
875
- if ('phone' === $field['use']) {
876
- $qmn_array_for_variables['user_phone'] = $field["value"];
877
- }
878
- }
879
- }
880
-
881
- $mlw_qmn_timer = isset($_POST["timer"]) ? intval($_POST["timer"]) : 0;
882
- $qmn_array_for_variables['user_id'] = get_current_user_id();
883
- $qmn_array_for_variables['timer'] = $mlw_qmn_timer;
884
- $qmn_array_for_variables['time_taken'] = current_time('h:i:s A m/d/Y');
885
- $qmn_array_for_variables['contact'] = $contact_responses;
886
-
887
- if (!isset($_POST["mlw_code_captcha"]) || ( isset($_POST["mlw_code_captcha"]) && $_POST["mlw_user_captcha"] == $_POST["mlw_code_captcha"] )) {
888
-
889
- $qmn_array_for_variables = array_merge($qmn_array_for_variables, $this->check_answers($qmn_quiz_options, $qmn_array_for_variables));
890
- $result_display = apply_filters('qmn_after_check_answers', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
891
- $qmn_array_for_variables['comments'] = $this->check_comment_section($qmn_quiz_options, $qmn_array_for_variables);
892
- $result_display = apply_filters('qmn_after_check_comments', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
893
-
894
- // Determines redirect/results page.
895
- $results_pages = $this->display_results_text($qmn_quiz_options, $qmn_array_for_variables);
896
- $result_display .= $results_pages['display'];
897
- $result_display = apply_filters('qmn_after_results_text', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
898
-
899
- $result_display .= $this->display_social($qmn_quiz_options, $qmn_array_for_variables);
900
- $result_display = apply_filters('qmn_after_social_media', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
901
- if ( is_plugin_active( 'qsm-save-resume/qsm-save-resume.php' ) != 1 && $qmn_quiz_options->enable_retake_quiz_button == 1 ) {
902
- $result_display .= '<a style="float: right;" class="button btn-reload-quiz" data-quiz_id="'. $qmn_array_for_variables['quiz_id'] .'" href="#" >'. __('Retake Quiz','quiz-master-next') .'</a>';
903
- }
904
- // If the store responses in database option is set to Yes.
905
- if (0 != $qmn_quiz_options->store_responses) {
906
-
907
- // Creates our results array.
908
- $results_array = array(
909
- intval($qmn_array_for_variables['timer']),
910
- $qmn_array_for_variables['question_answers_array'],
911
- htmlspecialchars(stripslashes($qmn_array_for_variables['comments']), ENT_QUOTES),
912
- 'contact' => $contact_responses,
913
- );
914
- $results_array = apply_filters('qsm_results_array', $results_array, $qmn_array_for_variables);
915
- $serialized_results = serialize($results_array);
916
-
917
- // Inserts the responses in the database.
918
- global $wpdb;
919
- $table_name = $wpdb->prefix . "mlw_results";
920
- $results_insert = $wpdb->insert(
921
- $table_name, array(
922
- 'quiz_id' => $qmn_array_for_variables['quiz_id'],
923
- 'quiz_name' => $qmn_array_for_variables['quiz_name'],
924
- 'quiz_system' => $qmn_array_for_variables['quiz_system'],
925
- 'point_score' => $qmn_array_for_variables['total_points'],
926
- 'correct_score' => $qmn_array_for_variables['total_score'],
927
- 'correct' => $qmn_array_for_variables['total_correct'],
928
- 'total' => $qmn_array_for_variables['total_questions'],
929
- 'name' => $qmn_array_for_variables['user_name'],
930
- 'business' => $qmn_array_for_variables['user_business'],
931
- 'email' => $qmn_array_for_variables['user_email'],
932
- 'phone' => $qmn_array_for_variables['user_phone'],
933
- 'user' => $qmn_array_for_variables['user_id'],
934
- 'user_ip' => $qmn_array_for_variables['user_ip'],
935
- 'time_taken' => $qmn_array_for_variables['time_taken'],
936
- 'time_taken_real' => date('Y-m-d H:i:s', strtotime($qmn_array_for_variables['time_taken'])),
937
- 'quiz_results' => $serialized_results,
938
- 'deleted' => 0,
939
- ), array(
940
- '%d',
941
- '%s',
942
- '%d',
943
- '%d',
944
- '%d',
945
- '%d',
946
- '%d',
947
- '%s',
948
- '%s',
949
- '%s',
950
- '%s',
951
- '%d',
952
- '%s',
953
- '%s',
954
- '%s',
955
- '%s',
956
- '%d',
957
- )
958
- );
959
- }
960
-
961
- $results_id = $wpdb->insert_id;
962
-
963
- // Hook is fired after the responses are submitted. Passes responses, result ID, quiz settings, and response data.
964
- do_action('qsm_quiz_submitted', $results_array, $results_id, $qmn_quiz_options, $qmn_array_for_variables);
965
-
966
- // Sends the emails.
967
- QSM_Emails::send_emails($qmn_array_for_variables);
968
-
969
- /**
970
- * Filters for filtering the results text after emails are sent.
971
- *
972
- * @deprecated 6.2.0 There's no reason to use these over the actions
973
- * in the QSM_Results_Pages class or the other filters in this function.
974
- */
975
- $result_display = apply_filters('qmn_after_send_user_email', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
976
- $result_display = apply_filters('qmn_after_send_admin_email', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
977
-
978
- // Last time to filter the HTML results page.
979
- $result_display = apply_filters('qmn_end_results', $result_display, $qmn_quiz_options, $qmn_array_for_variables);
980
-
981
- // Legacy Code.
982
- do_action('mlw_qmn_load_results_page', $wpdb->insert_id, $qmn_quiz_options->quiz_settings);
983
- } else {
984
- $result_display .= 'Thank you.';
985
- }
986
-
987
- // Prepares data to be sent back to front-end.
988
- $return_array = array(
989
- 'display' => htmlspecialchars_decode($result_display),
990
- 'redirect' => $results_pages['redirect'],
991
- );
992
-
993
- return $return_array;
994
- }
995
-
996
- /**
997
- * Scores User Answers
998
- *
999
- * Calculates the users scores for the quiz
1000
- *
1001
- * @since 4.0.0
1002
- * @param array $options The database row of the quiz
1003
- * @param array $quiz_data The array of results for the quiz
1004
- * @uses QMNPluginHelper:display_review() Scores the question
1005
- * @return array The results of the user's score
1006
- */
1007
- public function check_answers($options, $quiz_data) {
1008
-
1009
- global $mlwQuizMasterNext;
1010
-
1011
- // Load the pages and questions
1012
- $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting('pages', array());
1013
- $questions = QSM_Questions::load_questions_by_pages($options->quiz_id);
1014
-
1015
- // Retrieve data from submission
1016
- $total_questions = isset($_POST["total_questions"]) ? intval($_POST["total_questions"]) : 0;
1017
- $question_list = isset($_POST["qmn_question_list"]) ? explode('Q', $_POST["qmn_question_list"]) : array();
1018
-
1019
- // Prepare variables
1020
- $points_earned = 0;
1021
- $total_correct = 0;
1022
- $total_score = 0;
1023
- $user_answer = "";
1024
- $correct_answer = "";
1025
- $correct_status = "incorrect";
1026
- $answer_points = 0;
1027
- $question_data = array();
1028
-
1029
- // If deprecated pagination setting is not used, use new system...
1030
- if (0 == $options->question_from_total && 0 !== count($pages)) {
1031
-
1032
- // Cycle through each page in quiz.
1033
- foreach ($pages as $page) {
1034
-
1035
- // Cycle through each question on a page
1036
- foreach ($page as $page_question_id) {
1037
-
1038
- // Cycle through each question that appeared to the user
1039
- foreach ($question_list as $question_id) {
1040
-
1041
- // When the questions are the same...
1042
- if ($page_question_id == $question_id) {
1043
-
1044
- $question = $questions[$page_question_id];
1045
-
1046
- // Reset question-specific variables
1047
- $user_answer = "";
1048
- $correct_answer = "";
1049
- $correct_status = "incorrect";
1050
- $answer_points = 0;
1051
-
1052
- // Send question to our grading function
1053
- $results_array = $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']);
1054
-
1055
- // If question was graded correctly.
1056
- if (!isset($results_array["null_review"])) {
1057
- $points_earned += $results_array["points"];
1058
- $answer_points += $results_array["points"];
1059
-
1060
- // If the user's answer was correct
1061
- if ('correct' == $results_array["correct"]) {
1062
- $total_correct += 1;
1063
- $correct_status = "correct";
1064
- }
1065
- $user_answer = $results_array["user_text"];
1066
- $correct_answer = $results_array["correct_text"];
1067
-
1068
- // If a comment was submitted
1069
- if (isset($_POST["mlwComment" . $question['question_id']])) {
1070
- $comment = htmlspecialchars(stripslashes($_POST["mlwComment" . $question['question_id']]), ENT_QUOTES);
1071
- } else {
1072
- $comment = "";
1073
- }
1074
-
1075
- // Get text for question
1076
- $question_text = $question['question_name'];
1077
- if (isset($results_array["question_text"])) {
1078
- $question_text = $results_array["question_text"];
1079
- }
1080
-
1081
- // Save question data into new array in our array
1082
- $question_data[] = apply_filters('qmn_answer_array', array(
1083
- $question_text,
1084
- htmlspecialchars($user_answer, ENT_QUOTES),
1085
- htmlspecialchars($correct_answer, ENT_QUOTES),
1086
- $comment,
1087
- "correct" => $correct_status,
1088
- "id" => $question['question_id'],
1089
- "points" => $answer_points,
1090
- "category" => $question['category']
1091
- ), $options, $quiz_data);
1092
- }
1093
- break;
1094
- }
1095
- }
1096
- }
1097
- }
1098
- } else {
1099
- // Cycle through each page in quiz.
1100
- foreach ($questions as $question) {
1101
-
1102
- // Cycle through each question that appeared to the user
1103
- foreach ($question_list as $question_id) {
1104
-
1105
- // When the questions are the same...
1106
- if ($question['question_id'] == $question_id) {
1107
-
1108
- // Reset question-specific variables
1109
- $user_answer = "";
1110
- $correct_answer = "";
1111
- $correct_status = "incorrect";
1112
- $answer_points = 0;
1113
-
1114
- // Send question to our grading function
1115
- $results_array = $mlwQuizMasterNext->pluginHelper->display_review($question['question_type_new'], $question['question_id']);
1116
-
1117
- // If question was graded correctly.
1118
- if (!isset($results_array["null_review"])) {
1119
- $points_earned += $results_array["points"];
1120
- $answer_points += $results_array["points"];
1121
-
1122
- // If the user's answer was correct
1123
- if ('correct' == $results_array["correct"]) {
1124
- $total_correct += 1;
1125
- $correct_status = "correct";
1126
- }
1127
- $user_answer = $results_array["user_text"];
1128
- $correct_answer = $results_array["correct_text"];
1129
-
1130
- // If a comment was submitted
1131
- if (isset($_POST["mlwComment" . $question['question_id']])) {
1132
- $comment = htmlspecialchars(stripslashes($_POST["mlwComment" . $question['question_id']]), ENT_QUOTES);
1133
- } else {
1134
- $comment = "";
1135
- }
1136
-
1137
- // Get text for question
1138
- $question_text = $question['question_name'];
1139
- if (isset($results_array["question_text"])) {
1140
- $question_text = $results_array["question_text"];
1141
- }
1142
-
1143
- // Save question data into new array in our array
1144
- $question_data[] = apply_filters('qmn_answer_array', array(
1145
- $question_text,
1146
- htmlspecialchars($user_answer, ENT_QUOTES),
1147
- htmlspecialchars($correct_answer, ENT_QUOTES),
1148
- $comment,
1149
- "correct" => $correct_status,
1150
- "id" => $question['question_id'],
1151
- "points" => $answer_points,
1152
- "category" => $question['category']
1153
- ), $options, $quiz_data);
1154
- }
1155
- break;
1156
- }
1157
- }
1158
- }
1159
- }
1160
-
1161
- // Calculate Total Percent Score And Average Points Only If Total Questions Doesn't Equal Zero To Avoid Division By Zero Error
1162
- if (0 !== $total_questions) {
1163
- $total_score = round(( ( $total_correct / $total_questions ) * 100), 2);
1164
- } else {
1165
- $total_score = 0;
1166
- }
1167
-
1168
- // Return array to be merged with main user response array
1169
- return array(
1170
- 'total_points' => $points_earned,
1171
- 'total_score' => $total_score,
1172
- 'total_correct' => $total_correct,
1173
- 'total_questions' => $total_questions,
1174
- 'question_answers_display' => '', // Kept for backwards compatibility
1175
- 'question_answers_array' => $question_data,
1176
- );
1177
- }
1178
-
1179
- /**
1180
- * Retrieves User's Comments
1181
- *
1182
- * Checks to see if the user left a comment and returns the comment
1183
- *
1184
- * @since 4.0.0
1185
- * @param array $qmn_quiz_options The database row of the quiz
1186
- * @param array $qmn_array_for_variables The array of results for the quiz
1187
- * @return string The user's comments
1188
- */
1189
- public function check_comment_section($qmn_quiz_options, $qmn_array_for_variables) {
1190
- $qmn_quiz_comments = "";
1191
- if (isset($_POST["mlwQuizComments"])) {
1192
- $qmn_quiz_comments = esc_textarea(stripslashes($_POST["mlwQuizComments"]));
1193
- }
1194
- return apply_filters('qmn_returned_comments', $qmn_quiz_comments, $qmn_quiz_options, $qmn_array_for_variables);
1195
- }
1196
-
1197
- /**
1198
- * Displays Results Text
1199
- *
1200
- * @since 4.0.0
1201
- * @deprecated 6.1.0 Use the newer results page class instead.
1202
- * @param array $options The quiz settings.
1203
- * @param array $response_data The array of results for the quiz.
1204
- * @return string The contents for the results text
1205
- */
1206
- public function display_results_text($options, $response_data) {
1207
- return QSM_Results_Pages::generate_pages($response_data);
1208
- }
1209
-
1210
- /**
1211
- * Displays social media buttons
1212
- *
1213
- * @deprecated 6.1.0 Use the social media template variables instead.
1214
- * @since 4.0.0
1215
- * @param array $qmn_quiz_options The database row of the quiz.
1216
- * @param array $qmn_array_for_variables The array of results for the quiz.
1217
- * @return string The content of the social media button section
1218
- */
1219
- public function display_social($qmn_quiz_options, $qmn_array_for_variables) {
1220
- $social_display = '';
1221
- if ($qmn_quiz_options->social_media == 1) {
1222
- $settings = (array) get_option('qmn-settings');
1223
- $facebook_app_id = '483815031724529';
1224
- if (isset($settings['facebook_app_id'])) {
1225
- $facebook_app_id = esc_js($settings['facebook_app_id']);
1226
- }
1227
-
1228
- // Loads Social Media Text.
1229
- $qmn_social_media_text = "";
1230
- if (is_serialized($qmn_quiz_options->social_media_text) && is_array(@unserialize($qmn_quiz_options->social_media_text))) {
1231
- $qmn_social_media_text = @unserialize($qmn_quiz_options->social_media_text);
1232
- } else {
1233
- $qmn_social_media_text = array(
1234
- 'twitter' => $qmn_quiz_options->social_media_text,
1235
- 'facebook' => $qmn_quiz_options->social_media_text,
1236
- );
1237
- }
1238
- $qmn_social_media_text["twitter"] = apply_filters('mlw_qmn_template_variable_results_page', $qmn_social_media_text["twitter"], $qmn_array_for_variables);
1239
- $qmn_social_media_text["facebook"] = apply_filters('mlw_qmn_template_variable_results_page', $qmn_social_media_text["facebook"], $qmn_array_for_variables);
1240
- $social_display .= "<br /><a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '" . esc_js($qmn_social_media_text["facebook"]) . "', '" . esc_js($qmn_quiz_options->quiz_name) . "', '$facebook_app_id');\">Facebook</a><a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '" . esc_js($qmn_social_media_text["twitter"]) . "', '" . esc_js($qmn_quiz_options->quiz_name) . "');\">Twitter</a><br />";
1241
- }
1242
- return apply_filters('qmn_returned_social_buttons', $social_display, $qmn_quiz_options, $qmn_array_for_variables);
1243
- }
1244
-
1245
- /**
1246
- * Send User Email
1247
- *
1248
- * Prepares the email to the user and then sends the email
1249
- *
1250
- * @deprecated 6.2.0 Use the newer QSM_Emails class instead.
1251
- * @since 4.0.0
1252
- * @param array $qmn_quiz_options The database row of the quiz
1253
- * @param array $qmn_array_for_variables The array of results for the quiz
1254
- */
1255
- public function send_user_email($qmn_quiz_options, $qmn_array_for_variables) {
1256
- add_filter('wp_mail_content_type', 'mlw_qmn_set_html_content_type');
1257
- $mlw_message = "";
1258
-
1259
- //Check if this quiz has user emails turned on
1260
- if ($qmn_quiz_options->send_user_email == "0") {
1261
-
1262
- //Make sure that the user filled in the email field
1263
- if ($qmn_array_for_variables['user_email'] != "") {
1264
-
1265
- //Prepare from email and name
1266
- $from_email_array = maybe_unserialize($qmn_quiz_options->email_from_text);
1267
- if (!isset($from_email_array["from_email"])) {
1268
- $from_email_array = array(
1269
- 'from_name' => $qmn_quiz_options->email_from_text,
1270
- 'from_email' => $qmn_quiz_options->admin_email,
1271
- 'reply_to' => 1
1272
- );
1273
- }
1274
-
1275
- if (!is_email($from_email_array["from_email"])) {
1276
- if (is_email($qmn_quiz_options->admin_email)) {
1277
- $from_email_array["from_email"] = $qmn_quiz_options->admin_email;
1278
- } else {
1279
- $from_email_array["from_email"] = get_option('admin_email ', 'test@example.com');
1280
- }
1281
- }
1282
-
1283
- //Prepare email attachments
1284
- $attachments = array();
1285
- $attachments = apply_filters('qsm_user_email_attachments', $attachments, $qmn_array_for_variables);
1286
-
1287
- if (is_serialized($qmn_quiz_options->user_email_template) && is_array(@unserialize($qmn_quiz_options->user_email_template))) {
1288
-
1289
- $mlw_user_email_array = @unserialize($qmn_quiz_options->user_email_template);
1290
-
1291
- //Cycle through emails
1292
- foreach ($mlw_user_email_array as $mlw_each) {
1293
-
1294
- //Generate Email Subject
1295
- if (!isset($mlw_each[3])) {
1296
- $mlw_each[3] = "Quiz Results For %QUIZ_NAME";
1297
- }
1298
- $mlw_each[3] = apply_filters('mlw_qmn_template_variable_results_page', $mlw_each[3], $qmn_array_for_variables);
1299
-
1300
- //Check to see if default
1301
- if ($mlw_each[0] == 0 && $mlw_each[1] == 0) {
1302
- $mlw_message = htmlspecialchars_decode($mlw_each[2], ENT_QUOTES);
1303
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1304
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1305
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1306
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1307
- $mlw_headers = 'From: ' . $from_email_array["from_name"] . ' <' . $from_email_array["from_email"] . '>' . "\r\n";
1308
- wp_mail($qmn_array_for_variables['user_email'], $mlw_each[3], $mlw_message, $mlw_headers, $attachments);
1309
- break;
1310
- } else {
1311
-
1312
- //Check to see if this quiz uses points and check if the points earned falls in the point range for this email
1313
- if ($qmn_quiz_options->system == 1 && $qmn_array_for_variables['total_points'] >= $mlw_each[0] && $qmn_array_for_variables['total_points'] <= $mlw_each[1]) {
1314
- $mlw_message = htmlspecialchars_decode($mlw_each[2], ENT_QUOTES);
1315
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1316
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1317
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1318
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1319
- $mlw_headers = 'From: ' . $from_email_array["from_name"] . ' <' . $from_email_array["from_email"] . '>' . "\r\n";
1320
- wp_mail($qmn_array_for_variables['user_email'], $mlw_each[3], $mlw_message, $mlw_headers, $attachments);
1321
- break;
1322
- }
1323
-
1324
- //Check to see if score fall in correct range
1325
- if ($qmn_quiz_options->system == 0 && $qmn_array_for_variables['total_score'] >= $mlw_each[0] && $qmn_array_for_variables['total_score'] <= $mlw_each[1]) {
1326
- $mlw_message = htmlspecialchars_decode($mlw_each[2], ENT_QUOTES);
1327
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1328
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1329
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1330
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1331
- $mlw_headers = 'From: ' . $from_email_array["from_name"] . ' <' . $from_email_array["from_email"] . '>' . "\r\n";
1332
- wp_mail($qmn_array_for_variables['user_email'], $mlw_each[3], $mlw_message, $mlw_headers, $attachments);
1333
- break;
1334
- }
1335
- }
1336
- }
1337
- } else {
1338
-
1339
- //Uses older email system still which was before different emails were created.
1340
- $mlw_message = htmlspecialchars_decode($qmn_quiz_options->user_email_template, ENT_QUOTES);
1341
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1342
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1343
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1344
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1345
- $mlw_headers = 'From: ' . $from_email_array["from_name"] . ' <' . $from_email_array["from_email"] . '>' . "\r\n";
1346
- wp_mail($qmn_array_for_variables['user_email'], "Quiz Results For " . $qmn_quiz_options->quiz_name, $mlw_message, $mlw_headers, $attachments);
1347
- }
1348
- }
1349
- }
1350
- remove_filter('wp_mail_content_type', 'mlw_qmn_set_html_content_type');
1351
- }
1352
-
1353
- /**
1354
- * Send Admin Email
1355
- *
1356
- * Prepares the email to the admin and then sends the email
1357
- *
1358
- * @deprecated 6.2.0 Use the newer QSM_Emails class instead.
1359
- * @since 4.0.0
1360
- * @param array $qmn_quiz_options The database row of the quiz
1361
- * @param arrar $qmn_array_for_variables The array of results for the quiz
1362
- */
1363
- public function send_admin_email($qmn_quiz_options, $qmn_array_for_variables) {
1364
- //Switch email type to HTML
1365
- add_filter('wp_mail_content_type', 'mlw_qmn_set_html_content_type');
1366
-
1367
- $mlw_message = "";
1368
- if ($qmn_quiz_options->send_admin_email == "0") {
1369
- if ($qmn_quiz_options->admin_email != "") {
1370
- $from_email_array = maybe_unserialize($qmn_quiz_options->email_from_text);
1371
- if (!isset($from_email_array["from_email"])) {
1372
- $from_email_array = array(
1373
- 'from_name' => $qmn_quiz_options->email_from_text,
1374
- 'from_email' => $qmn_quiz_options->admin_email,
1375
- 'reply_to' => 1
1376
- );
1377
- }
1378
-
1379
- if (!is_email($from_email_array["from_email"])) {
1380
- if (is_email($qmn_quiz_options->admin_email)) {
1381
- $from_email_array["from_email"] = $qmn_quiz_options->admin_email;
1382
- } else {
1383
- $from_email_array["from_email"] = get_option('admin_email ', 'test@example.com');
1384
- }
1385
- }
1386
-
1387
- $mlw_message = "";
1388
- $mlw_subject = "";
1389
- if (is_serialized($qmn_quiz_options->admin_email_template) && is_array(@unserialize($qmn_quiz_options->admin_email_template))) {
1390
- $mlw_admin_email_array = @unserialize($qmn_quiz_options->admin_email_template);
1391
-
1392
- //Cycle through landing pages
1393
- foreach ($mlw_admin_email_array as $mlw_each) {
1394
-
1395
- //Generate Email Subject
1396
- if (!isset($mlw_each["subject"])) {
1397
- $mlw_each["subject"] = "Quiz Results For %QUIZ_NAME";
1398
- }
1399
- $mlw_each["subject"] = apply_filters('mlw_qmn_template_variable_results_page', $mlw_each["subject"], $qmn_array_for_variables);
1400
-
1401
- //Check to see if default
1402
- if ($mlw_each["begin_score"] == 0 && $mlw_each["end_score"] == 0) {
1403
- $mlw_message = htmlspecialchars_decode($mlw_each["message"], ENT_QUOTES);
1404
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1405
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1406
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1407
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1408
- $mlw_subject = $mlw_each["subject"];
1409
- break;
1410
- } else {
1411
- //Check to see if points fall in correct range
1412
- if ($qmn_quiz_options->system == 1 && $qmn_array_for_variables['total_points'] >= $mlw_each["begin_score"] && $qmn_array_for_variables['total_points'] <= $mlw_each["end_score"]) {
1413
- $mlw_message = htmlspecialchars_decode($mlw_each["message"], ENT_QUOTES);
1414
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1415
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1416
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1417
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1418
- $mlw_subject = $mlw_each["subject"];
1419
- break;
1420
- }
1421
-
1422
- //Check to see if score fall in correct range
1423
- if ($qmn_quiz_options->system == 0 && $qmn_array_for_variables['total_score'] >= $mlw_each["begin_score"] && $qmn_array_for_variables['total_score'] <= $mlw_each["end_score"]) {
1424
- $mlw_message = htmlspecialchars_decode($mlw_each["message"], ENT_QUOTES);
1425
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1426
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1427
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1428
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1429
- $mlw_subject = $mlw_each["subject"];
1430
- break;
1431
- }
1432
- }
1433
- }
1434
- } else {
1435
- $mlw_message = htmlspecialchars_decode($qmn_quiz_options->admin_email_template, ENT_QUOTES);
1436
- $mlw_message = apply_filters('mlw_qmn_template_variable_results_page', $mlw_message, $qmn_array_for_variables);
1437
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1438
- $mlw_message = str_replace("<br/>", "<br>", $mlw_message);
1439
- $mlw_message = str_replace("<br />", "<br>", $mlw_message);
1440
- $mlw_subject = "Quiz Results For " . $qmn_quiz_options->quiz_name;
1441
- }
1442
- }
1443
- if (get_option('mlw_advert_shows') == 'true') {
1444
- $mlw_message .= "<br>This email was generated by the Quiz And Survey Master plugin";
1445
- }
1446
- $headers = array(
1447
- 'From: ' . $from_email_array["from_name"] . ' <' . $from_email_array["from_email"] . '>'
1448
- );
1449
- if ($from_email_array["reply_to"] == 0) {
1450
- $headers[] = 'Reply-To: ' . $qmn_array_for_variables["user_name"] . " <" . $qmn_array_for_variables["user_email"] . ">";
1451
- }
1452
- $admin_emails = explode(",", $qmn_quiz_options->admin_email);
1453
- foreach ($admin_emails as $admin_email) {
1454
- if (is_email($admin_email)) {
1455
- wp_mail($admin_email, $mlw_subject, $mlw_message, $headers);
1456
- }
1457
- }
1458
- }
1459
-
1460
- //Remove HTML type for emails
1461
- remove_filter('wp_mail_content_type', 'mlw_qmn_set_html_content_type');
1462
- }
1463
-
1464
- /**
1465
- * Returns the quiz taker's IP if IP collection is enabled
1466
- *
1467
- * @since 5.3.0
1468
- * @return string The IP address or a phrase if not collected
1469
- */
1470
- private function get_user_ip() {
1471
- $ip = __('Not collected', 'quiz-master-next');
1472
- $settings = (array) get_option('qmn-settings');
1473
- $ip_collection = '0';
1474
- if (isset($settings['ip_collection'])) {
1475
- $ip_collection = $settings['ip_collection'];
1476
- }
1477
- if ('1' != $ip_collection) {
1478
- if ($_SERVER['REMOTE_ADDR']) {
1479
- $ip = $_SERVER['REMOTE_ADDR'];
1480
- } else {
1481
- $ip = __('Unknown', 'quiz-master-next');
1482
- }
1483
- }
1484
- return $ip;
1485
- }
1486
-
1487
- }
1488
-
1489
- global $qmnQuizManager;
1490
- $qmnQuizManager = new QMNQuizManager();
1491
-
1492
- add_filter('qmn_begin_shortcode', 'qmn_require_login_check', 10, 3);
1493
-
1494
- function qmn_require_login_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
1495
- global $qmn_allowed_visit;
1496
- if ($qmn_quiz_options->require_log_in == 1 && !is_user_logged_in()) {
1497
- $qmn_allowed_visit = false;
1498
- $mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->require_log_in_text, ENT_QUOTES));
1499
- $mlw_message = apply_filters('mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
1500
- $mlw_message = str_replace("\n", "<br>", $mlw_message);
1501
- $display .= $mlw_message;
1502
- $display .= wp_login_form(array('echo' => false));
1503
- }
1504
- return $display;
1505
- }
1506
-
1507
- add_filter('qmn_begin_shortcode', 'qsm_scheduled_timeframe_check', 10, 3);
1508
-
1509
- function qsm_scheduled_timeframe_check($display, $options, $variable_data) {
1510
- global $qmn_allowed_visit;
1511
-
1512
- // Checks if the start and end dates have data
1513
- if (!empty($options->scheduled_time_start) && !empty($options->scheduled_time_end)) {
1514
- $start = strtotime($options->scheduled_time_start);
1515
- $end = strtotime($options->scheduled_time_end) + 86399;
1516
-
1517
- // Checks if the current timestamp is outside of scheduled timeframe
1518
- if (current_time('timestamp') < $start || current_time('timestamp') > $end) {
1519
- $qmn_allowed_visit = false;
1520
- $message = wpautop(htmlspecialchars_decode($options->scheduled_timeframe_text, ENT_QUOTES));
1521
- $message = apply_filters('mlw_qmn_template_variable_quiz_page', $message, $variable_data);
1522
- $display .= str_replace("\n", "<br>", $message);
1523
- }
1524
- }
1525
- return $display;
1526
- }
1527
-
1528
- add_filter('qmn_begin_shortcode', 'qmn_total_user_tries_check', 10, 3);
1529
-
1530
- /**
1531
- * Checks if user has already reach the user limit of the quiz
1532
- *
1533
- * @since 5.0.0
1534
- * @param string $display The HTML displayed for the quiz
1535
- * @param array $qmn_quiz_options The settings for the quiz
1536
- * @param array $qmn_array_for_variables The array of data by the quiz
1537
- * @return string The altered HTML display for the quiz
1538
- */
1539
- function qmn_total_user_tries_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
1540
-
1541
- global $qmn_allowed_visit;
1542
- if ($qmn_quiz_options->total_user_tries != 0) {
1543
-
1544
- // Prepares the variables
1545
- global $wpdb;
1546
- $mlw_qmn_user_try_count = 0;
1547
-
1548
- // Checks if the user is logged in. If so, check by user id. If not, check by IP.
1549
- if (is_user_logged_in()) {
1550
- $current_user = wp_get_current_user();
1551
- $mlw_qmn_user_try_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE user=%d AND deleted='0' AND quiz_id=%d", $current_user->ID, $qmn_array_for_variables['quiz_id']));
1552
- } else {
1553
- $mlw_qmn_user_try_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE user_ip='%s' AND deleted='0' AND quiz_id=%d", $qmn_array_for_variables['user_ip'], $qmn_array_for_variables['quiz_id']));
1554
- }
1555
-
1556
- // If user has already reached the limit for this quiz
1557
- if ($mlw_qmn_user_try_count >= $qmn_quiz_options->total_user_tries) {
1558
-
1559
- // Stops the quiz and prepares entered text
1560
- $qmn_allowed_visit = false;
1561
- $mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->total_user_tries_text, ENT_QUOTES));
1562
- $mlw_message = apply_filters('mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
1563
- $display .= $mlw_message;
1564
- }
1565
- }
1566
- return $display;
1567
- }
1568
-
1569
- add_filter('qmn_begin_quiz', 'qmn_total_tries_check', 10, 3);
1570
-
1571
- function qmn_total_tries_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
1572
- global $qmn_allowed_visit;
1573
- if ($qmn_quiz_options->limit_total_entries != 0) {
1574
- global $wpdb;
1575
- $mlw_qmn_entries_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(quiz_id) FROM " . $wpdb->prefix . "mlw_results WHERE deleted='0' AND quiz_id=%d", $qmn_array_for_variables['quiz_id']));
1576
- if ($mlw_qmn_entries_count >= $qmn_quiz_options->limit_total_entries) {
1577
- $mlw_message = wpautop(htmlspecialchars_decode($qmn_quiz_options->limit_total_entries_text, ENT_QUOTES));
1578
- $mlw_message = apply_filters('mlw_qmn_template_variable_quiz_page', $mlw_message, $qmn_array_for_variables);
1579
- $display .= $mlw_message;
1580
- $qmn_allowed_visit = false;
1581
- }
1582
- }
1583
- return $display;
1584
- }
1585
-
1586
- add_filter('qmn_begin_quiz', 'qmn_pagination_check', 10, 3);
1587
-
1588
- function qmn_pagination_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
1589
- if ($qmn_quiz_options->pagination != 0) {
1590
- global $wpdb;
1591
- global $qmn_json_data;
1592
- $total_questions = 0;
1593
- if ($qmn_quiz_options->question_from_total != 0) {
1594
- $total_questions = $qmn_quiz_options->question_from_total;
1595
- } else {
1596
- $questions = QSM_Questions::load_questions_by_pages($qmn_quiz_options->quiz_id);
1597
- $total_questions = count($questions);
1598
- }
1599
- $display .= "<style>.quiz_section { display: none; }</style>";
1600
-
1601
- $qmn_json_data["pagination"] = array(
1602
- 'amount' => $qmn_quiz_options->pagination,
1603
- 'section_comments' => $qmn_quiz_options->comment_section,
1604
- 'total_questions' => $total_questions,
1605
- 'previous_text' => $qmn_quiz_options->previous_button_text,
1606
- 'next_text' => $qmn_quiz_options->next_button_text
1607
- );
1608
- }
1609
- return $display;
1610
- }
1611
-
1612
- add_filter('qmn_begin_quiz_form', 'qmn_timer_check', 15, 3);
1613
-
1614
- function qmn_timer_check($display, $qmn_quiz_options, $qmn_array_for_variables) {
1615
- global $qmn_allowed_visit;
1616
- global $qmn_json_data;
1617
- if ($qmn_allowed_visit && $qmn_quiz_options->timer_limit != 0) {
1618
- $qmn_json_data["timer_limit"] = $qmn_quiz_options->timer_limit;
1619
- $display .= '<div style="display:none;" id="mlw_qmn_timer" class="mlw_qmn_timer"></div>';
1620
- }
1621
- return $display;
1622
- }
1623
-
1624
- add_filter('qmn_begin_quiz', 'qmn_update_views', 10, 3);
1625
-
1626
- function qmn_update_views($display, $qmn_quiz_options, $qmn_array_for_variables) {
1627
- global $wpdb;
1628
- $mlw_views = $qmn_quiz_options->quiz_views;
1629
- $mlw_views += 1;
1630
- $results = $wpdb->update(
1631
- $wpdb->prefix . "mlw_quizzes", array(
1632
- 'quiz_views' => $mlw_views
1633
- ), array('quiz_id' => $qmn_array_for_variables["quiz_id"]), array(
1634
- '%d'
1635
- ), array('%d')
1636
- );
1637
- return $display;
1638
- }
1639
-
1640
- add_filter('qmn_begin_results', 'qmn_update_taken', 10, 3);
1641
-
1642
- function qmn_update_taken($display, $qmn_quiz_options, $qmn_array_for_variables) {
1643
- global $wpdb;
1644
- $mlw_taken = $qmn_quiz_options->quiz_taken;
1645
- $mlw_taken += 1;
1646
- $results = $wpdb->update(
1647
- $wpdb->prefix . "mlw_quizzes", array(
1648
- 'quiz_taken' => $mlw_taken
1649
- ), array('quiz_id' => $qmn_array_for_variables["quiz_id"]), array(
1650
- '%d'
1651
- ), array('%d')
1652
- );
1653
- return $display;
1654
- }
1655
-
1656
- /*
1657
- This function helps set the email type to HTML
1658
- */
1659
-
1660
- function mlw_qmn_set_html_content_type() {
1661
-
1662
- return 'text/html';
1663
- }
1664
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qmn-review-message.php DELETED
@@ -1,131 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Class that handles displaying of review notice
5
- *
6
- * @since 4.5.0
7
- */
8
- class QMN_Review_Message {
9
-
10
- /**
11
- * Variable to hold how many results needed to show message
12
- *
13
- * @since 4.5.0
14
- */
15
- public $trigger = -1;
16
-
17
- /**
18
- * Main Construct Function
19
- *
20
- * Adds the notice check to init and then check to display message
21
- *
22
- * @since 4.5.0
23
- */
24
- function __construct() {
25
- $this->add_hooks();
26
- }
27
-
28
- /**
29
- * Adds check message to admin_init hook
30
- *
31
- * @since 5.0.0
32
- */
33
- public function add_hooks() {
34
- add_action( 'admin_init', array( $this, 'check_message_display' ) );
35
- }
36
-
37
- /**
38
- * Checks if message should be displayed
39
- *
40
- * @since 4.5.0
41
- */
42
- public function check_message_display() {
43
- $this->admin_notice_check();
44
- $this->trigger = $this->check_message_trigger();
45
- if ( $this->trigger !== -1 ) {
46
- $amount = $this->check_results_amount();
47
- if ( $amount > $this->trigger ) {
48
- add_action( 'admin_notices', array( $this, 'display_admin_message' ) );
49
- }
50
- }
51
- }
52
-
53
- /**
54
- * Retrieves what the next trigger value is
55
- *
56
- * @since 4.5.0
57
- * @return int The amount of results needed to display message
58
- */
59
- public function check_message_trigger() {
60
- $trigger = get_option( 'qmn_review_message_trigger' );
61
- if ( empty( $trigger ) || is_null( $trigger ) ) {
62
- add_option('qmn_review_message_trigger', 20 );
63
- return 20;
64
- }
65
- return intval( $trigger );
66
- }
67
-
68
- /**
69
- * Checks the amount of results
70
- *
71
- * @since 4.5.0
72
- * @return int The amount of quiz results
73
- */
74
- public function check_results_amount() {
75
- global $wpdb;
76
- $table_name = $wpdb->prefix."mlw_results";
77
- $amount = $wpdb->get_var( "SELECT COUNT(result_id) FROM $table_name WHERE deleted=0" );
78
- return intval( $amount );
79
- }
80
-
81
- /**
82
- * Displays the message
83
- *
84
- * Displays the message asking for review
85
- *
86
- * @since 4.5.0
87
- */
88
- public function display_admin_message() {
89
- $already_url = esc_url( add_query_arg( 'qmn_review_notice_check', 'already_did' ) );
90
- $nope_url = esc_url( add_query_arg( 'qmn_review_notice_check', 'remove_message' ) );
91
- echo "<div class='updated'><br />";
92
- echo sprintf( __('Greetings! I just noticed that you now have more than %d quiz results. That is
93
- awesome! Could you please help me out by giving this plugin a 5-star rating on WordPress? This
94
- will help us by helping other users discover this plugin. %s', 'quiz_master_next'),
95
- $this->trigger,
96
- '<br /><strong><em>~ QSM Team</em></strong><br /><br />'
97
- );
98
- echo '&nbsp;<a target="_blank" href="https://wordpress.org/support/plugin/quiz-master-next/reviews/#new-topic-0" class="button-primary">' . __( 'Yeah, you deserve it!', 'quiz-master-next' ) . '</a>';
99
- echo '&nbsp;<a href="' . esc_url( $already_url ) . '" class="button-secondary">' . __( 'I already did!', 'quiz-master-next' ) . '</a>';
100
- echo '&nbsp;<a href="' . esc_url( $nope_url ) . '" class="button-secondary">' . __( 'No, this plugin is not good enough', 'quiz-master-next' ) . '</a>';
101
- echo "<br /><br /></div>";
102
- }
103
-
104
- /**
105
- * Checks if a link in the admin message has been clicked
106
- *
107
- * @since 4.5.0
108
- */
109
- public function admin_notice_check() {
110
- if ( isset( $_GET["qmn_review_notice_check"] ) && $_GET["qmn_review_notice_check"] == 'remove_message' ) {
111
- $this->trigger = $this->check_message_trigger();
112
- $update_trigger = -1;
113
- if ( $this->trigger === -1 ) {
114
- exit;
115
- } else if ( $this->trigger === 20 ) {
116
- $update_trigger = 100;
117
- } else if ( $this->trigger === 100 ) {
118
- $update_trigger = 1000;
119
- } else if ( $this->trigger === 1000 ) {
120
- $update_trigger = -1;
121
- }
122
- update_option( 'qmn_review_message_trigger', $update_trigger );
123
- }
124
- if ( isset( $_GET["qmn_review_notice_check"] ) && $_GET["qmn_review_notice_check"] == 'already_did' ) {
125
- update_option( 'qmn_review_message_trigger', -1 );
126
- }
127
- }
128
- }
129
-
130
- $qmn_review_message = new QMN_Review_Message();
131
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-audit.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit;
4
-
5
- /**
6
- * This class handles the audit trail of the plugin
7
- */
8
- class QSM_Audit {
9
-
10
- /**
11
- * Adds new audit to Audit Trail table
12
- *
13
- * @since 4.7.1
14
- * @param string $action The action that is to be saved into the audit trail
15
- * @return bool Returns true if successfull and false if fails
16
- */
17
- public function new_audit( $action, $user = null ) {
18
-
19
- // Sanitizes action just in case 3rd party uses this funtion
20
- $action = sanitize_text_field( $action );
21
-
22
- // Retrieves current user's data
23
- if ( is_null( $user ) ) {
24
- $current_user = wp_get_current_user();
25
- } else {
26
- $current_user = $user;
27
- }
28
-
29
- // Returns if the current user is not valid
30
- if ( ! ( $current_user instanceof WP_User ) ) {
31
- return false;
32
- }
33
-
34
- global $wpdb;
35
-
36
- // Inserts new audit into table
37
- $inserted = $wpdb->insert(
38
- $wpdb->prefix . "mlw_qm_audit_trail",
39
- array(
40
- 'action_user' => $current_user->display_name,
41
- 'action' => $action,
42
- 'time' => date("h:i:s A m/d/Y")
43
- ),
44
- array(
45
- '%s',
46
- '%s',
47
- '%s'
48
- )
49
- );
50
-
51
- // If the insert returns false, then return false
52
- if ( false === $inserted ) {
53
- return false;
54
- }
55
-
56
- return true;
57
- }
58
- }
59
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-changelog-generator.php DELETED
@@ -1,155 +0,0 @@
1
- <?php
2
- /**
3
- * Changelog class
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * This class pings the GitHub API to load in the changelog for a particular milestone
14
- *
15
- * @since 4.7.0
16
- */
17
- class QSM_Changelog_Generator {
18
-
19
- /**
20
- * Gets the changelog as an HTML list. Either echos or returns the list
21
- *
22
- * @since 4.7.0
23
- * @uses QSM_Changelog_Generator::get_changelog Used to retrieve the changelog from GitHub
24
- * @param string $repo The name of the GitHub repo. Should be similar to 'QuizandSurveyMaster/quiz_master_next'
25
- * @param int $milestone The number of the milestone in your GitHub repo
26
- * @param bool $echo Whether to echo or return the HTML list. Defaults to true
27
- * @return string The HTML list is returned if $echo is set to false
28
- */
29
- public static function get_changelog_list( $repo, $milestone, $echo = true ) {
30
-
31
- // Gets the changelog array
32
- $changelog = QSM_Changelog_Generator::get_changelog( $repo, $milestone );
33
-
34
- if ( $changelog && is_array( $changelog ) ) {
35
-
36
- // Creates header for milestone
37
- $display = "<h3>{$changelog["milestone"]["title"]}</h3>";
38
-
39
- // Creates paragraph for description
40
- if ( ! empty( $changelog["milestone"]["description"] ) ) {
41
- $display .= "<p>{$changelog["milestone"]["description"]}</p>";
42
- }
43
-
44
- // Creates paragraph for closed date
45
- $display .= "<p>Closed on {$changelog["milestone"]["closed_date"]}</p>";
46
-
47
- // Converts the issues array into HTML list
48
- $display .= '<ul class="changelog">';
49
- foreach ( $changelog["issues"] as $change ) {
50
- $label_type = $change["labels"][0]["name"];
51
- $display .= "<li class='fixed'><div class='two'>Closed</div>$label_type: {$change['title']} - <a target='_blank' href='{$change['url']}'>Issue #{$change['issue']}</a></li>";
52
- }
53
- $display .= '</ul>';
54
-
55
- // Echos or returns HTML list based on $echo parameter
56
- if ( true === $echo ) {
57
- echo $display;
58
- } else {
59
- return $display;
60
- }
61
- }
62
- }
63
-
64
- /**
65
- * Gets the changelog from GitHub and returns as an array
66
- *
67
- * @since 4.7.0
68
- * @uses QSM_Changelog_Generator::api_call Used to retrieve the changelog from GitHub
69
- * @param string $repo The name of the GitHub repo. Should be similar to 'QuizandSurveyMaster/quiz_master_next'
70
- * @param int $milestone The number of the milestone in your GitHub repo
71
- * @return array An array of all the titles of closed issues for the milestone
72
- */
73
- public static function get_changelog( $repo, $milestone ) {
74
-
75
- // Gets transient if available
76
- $changelog = get_transient( "changelog-$repo-$milestone" );
77
- if ( false === $changelog ) {
78
-
79
- $changelog = array();
80
-
81
- // Constructs url and then calls the api
82
- $issue_url = "https://api.github.com/repos/$repo/issues?milestone=$milestone&state=all";
83
- $issue_data = QSM_Changelog_Generator::api_call( $issue_url );
84
-
85
- if ( $issue_data ) {
86
-
87
- // Constructs url and then calls the api
88
- $milestone_url = "https://api.github.com/repos/$repo/milestones/$milestone";
89
- $milestone_data = QSM_Changelog_Generator::api_call( $milestone_url );
90
-
91
- if ( $milestone_data && isset( $milestone_data['title'] ) ) {
92
- $milestone_array = array(
93
- 'title' => $milestone_data["title"],
94
- 'description' => $milestone_data["description"],
95
- 'closed_date' => $milestone_data["closed_at"]
96
- );
97
- } else {
98
- $milestone_array = array(
99
- 'title' => '',
100
- 'description' => '',
101
- 'closed_date' => ''
102
- );
103
- }
104
-
105
- $changelog["milestone"] = $milestone_array;
106
- $changelog["issues"] = array();
107
-
108
- // Creates an array of all issues that are closed
109
- foreach ( $issue_data as $issue ) {
110
- if ( ! isset( $issue["pull_request"] ) ) {
111
- if ( "closed" === $issue["state"] ) {
112
- $changelog["issues"][] = array(
113
- 'title' => $issue["title"],
114
- 'labels' => $issue["labels"],
115
- 'issue' => $issue["number"],
116
- 'url' => $issue["html_url"]
117
- );
118
- }
119
- }
120
- }
121
- }
122
-
123
- // Sets the transient
124
- set_transient( "changelog-$repo-$milestone", $changelog, 3600 );
125
- }
126
- return $changelog;
127
- }
128
-
129
- /**
130
- * Gets the contents of the $url that is passed
131
- *
132
- * @since 4.7.0
133
- * @param string $url The url to get the contents of
134
- * @return bool|array Returns false if encounters an error. Returns an associated array if successful
135
- */
136
- public static function api_call( $url ) {
137
-
138
- // Gets the url
139
- $response = wp_remote_get( $url );
140
-
141
- // If an error occurs, return false. If successful, return json_decoded array
142
- if ( is_wp_error( $response ) ) {
143
- return false;
144
- } else {
145
- $data = wp_remote_retrieve_body( $response );
146
- if ( is_wp_error( $data ) ) {
147
- return false;
148
- } else {
149
- return json_decode( $data, true );
150
- }
151
- }
152
- }
153
- }
154
-
155
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-contact-manager.php DELETED
@@ -1,301 +0,0 @@
1
- <?php
2
-
3
- // Exit if accessed directly.
4
- if ( ! defined( 'ABSPATH' ) ) exit;
5
-
6
- /**
7
- * This class handles the contact fields for the quiz
8
- *
9
- * @since 5.0.0
10
- */
11
- class QSM_Contact_Manager {
12
-
13
- /** @var array The fields loaded for the quiz. */
14
- private static $fields = array();
15
-
16
-
17
- /**
18
- * Displays the contact fields during form
19
- *
20
- * @since 5.0.0
21
- * @param object $options The quiz options.
22
- * @return string The HTML for the contact fields
23
- */
24
- public static function display_fields( $options ) {
25
-
26
- $fields_hidden = false;
27
- $name = '';
28
- $email = '';
29
-
30
- ob_start();
31
-
32
- // Prepares name and email if user is logged in.
33
- if ( is_user_logged_in() ) {
34
- $current_user = wp_get_current_user();
35
- $name = $current_user->display_name;
36
- $email = $current_user->user_email;
37
- }
38
-
39
- // If user is logged in and the option to allow users to edit is set to no...
40
- if ( is_user_logged_in() && 1 == $options->loggedin_user_contact ) {
41
- // ..then, hide the fields.
42
- $fields_hidden = true;
43
- ?>
44
- <div style="display:none;">
45
- <?php
46
- }
47
-
48
- // Loads fields.
49
- $fields = self::load_fields();
50
-
51
- $contact_disable_autofill = $options->contact_disable_autofill;
52
-
53
- // If fields are empty and backwards-compatible fields are turned on then, use older system.
54
- if ( ( empty( $fields ) || ! is_array( $fields ) ) && ( 2 != $options->user_name || 2 != $options->user_comp || 2 != $options->user_email || 2 != $options->user_phone ) ) {
55
-
56
- // Check for name field.
57
- if ( 2 != $options->user_name ) {
58
- $class = '';
59
- if ( 1 == $options->user_name && ! $fields_hidden ) {
60
- $class = 'mlwRequiredText qsm_required_text';
61
- }
62
- ?>
63
- <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->name_field_text, ENT_QUOTES ); ?></span>
64
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserName' placeholder="<?php echo htmlspecialchars_decode( $options->name_field_text, ENT_QUOTES ); ?>" value='<?php echo esc_attr( $name ); ?>' />
65
- <?php
66
- }
67
-
68
- // Check for comp field.
69
- if ( 2 != $options->user_comp ) {
70
- $class = '';
71
- if ( 1 == $options->user_comp && ! $fields_hidden ) {
72
- $class = 'mlwRequiredText qsm_required_text';
73
- }
74
- ?>
75
- <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->business_field_text, ENT_QUOTES ); ?></span>
76
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserComp' placeholder="<?php echo htmlspecialchars_decode( $options->business_field_text, ENT_QUOTES ); ?>" value='' />
77
- <?php
78
- }
79
-
80
- // Check for email field.
81
- if ( 2 != $options->user_email ) {
82
- $class = '';
83
- if ( 1 == $options->user_email && ! $fields_hidden ) {
84
- $class = 'mlwRequiredText qsm_required_text';
85
- }
86
- ?>
87
- <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->email_field_text, ENT_QUOTES ); ?></span>
88
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='email' class='mlwEmail <?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserEmail' placeholder="<?php echo htmlspecialchars_decode( $options->email_field_text, ENT_QUOTES ); ?>" value='<?php echo esc_attr( $email ); ?>' />
89
- <?php
90
- }
91
-
92
- // Check for phone field.
93
- if ( 2 != $options->user_phone ) {
94
- $class = '';
95
- if ( 1 == $options->user_phone && ! $fields_hidden ) {
96
- $class = 'mlwRequiredText qsm_required_text';
97
- }
98
- ?>
99
- <span class='mlw_qmn_question qsm_question'><?php echo htmlspecialchars_decode( $options->phone_field_text, ENT_QUOTES ); ?></span>
100
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='mlwUserPhone' placeholder="<?php echo htmlspecialchars_decode( $options->phone_field_text, ENT_QUOTES ); ?>" value='' />
101
- <?php
102
- }
103
- } elseif ( ! empty( $fields ) && is_array( $fields ) ) {
104
-
105
- // Cycle through each of the contact fields.
106
- $total_fields = count( $fields );
107
- for ( $i = 0; $i < $total_fields; $i++ ) {
108
-
109
- $class = '';
110
- $value = '';
111
- ?>
112
- <div class="qsm_contact_div qsm-contact-type-<?php echo esc_attr( $fields[ $i ]['type'] ); ?>">
113
- <?php
114
- if ( 'name' == $fields[ $i ]['use'] ) {
115
- $value = $name;
116
- }
117
- if ( 'email' == $fields[ $i ]['use'] ) {
118
- $value = $email;
119
- }
120
-
121
- // Switch for contact field type.
122
- switch ( $fields[ $i ]['type'] ) {
123
- case 'text':
124
- if ( ( 'true' === $fields[ $i ]["required"] || true === $fields[ $i ]["required"] ) && ! $fields_hidden ) {
125
- $class = 'mlwRequiredText qsm_required_text';
126
- }
127
- ?>
128
- <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
129
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' placeholder="<?php echo $fields[ $i ]['label']; ?>" />
130
- <?php
131
- break;
132
-
133
- case 'email':
134
- if ( ( 'true' === $fields[ $i ]["required"] || true === $fields[ $i ]["required"] ) && ! $fields_hidden ) {
135
- $class = 'mlwRequiredText qsm_required_text';
136
- }
137
- ?>
138
- <span class='mlw_qmn_question qsm_question'><?php echo $fields[ $i ]['label']; ?></span>
139
- <input <?php if($contact_disable_autofill){ echo "autocomplete='off'"; } ?> type='text' class='mlwEmail <?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='<?php echo esc_attr( $value ); ?>' placeholder="<?php echo $fields[ $i ]['label']; ?>" />
140
- <?php
141
- break;
142
-
143
- case 'checkbox':
144
- if ( ( 'true' === $fields[ $i ]["required"] || true === $fields[ $i ]["required"] ) && ! $fields_hidden ) {
145
- $class = 'mlwRequiredAccept qsm_required_accept';
146
- }
147
- ?>
148
- <input type='checkbox' id='contact_field_<?php echo $i; ?>' class='<?php echo esc_attr( $class ); ?>' x-webkit-speech name='contact_field_<?php echo $i; ?>' value='checked' />
149
- <label class='mlw_qmn_question qsm_question' for='contact_field_<?php echo $i; ?>'><?php echo $fields[ $i ]['label']; ?></label>
150
- <?php
151
- break;
152
-
153
- default:
154
- break;
155
- }
156
- ?>
157
- </div>
158
- <?php
159
- }
160
- }
161
-
162
- // Extend contact fields section.
163
- do_action( 'qsm_contact_fields_end' );
164
-
165
- // If logged in user should see fields.
166
- if ( is_user_logged_in() && 1 == $options->loggedin_user_contact ) {
167
- ?>
168
- </div>
169
- <?php
170
- }
171
-
172
- // Return contact field HTML.
173
- return ob_get_clean();
174
- }
175
-
176
- /**
177
- * Process the contact fields and return the values
178
- *
179
- * @since 5.0.0
180
- * @param object $options The quiz options.
181
- * @return array An array of all labels and values for the contact fields
182
- */
183
- public static function process_fields( $options ) {
184
-
185
- $responses = array();
186
-
187
- // Loads the fields for the quiz.
188
- $fields = self::load_fields();
189
-
190
- // If fields are empty, check for backwards compatibility.
191
- if ( ( empty( $fields ) || ! is_array( $fields ) ) && ( 2 != $options->user_name || 2 != $options->user_comp || 2 != $options->user_email || 2 != $options->user_phone ) ) {
192
- $responses[] = array(
193
- 'label' => 'Name',
194
- 'value' => isset( $_POST["mlwUserName"] ) ? sanitize_text_field( $_POST["mlwUserName"] ) : 'None',
195
- 'use' => 'name'
196
- );
197
- $responses[] = array(
198
- 'label' => 'Business',
199
- 'value' => isset( $_POST["mlwUserComp"] ) ? sanitize_text_field( $_POST["mlwUserComp"] ) : 'None',
200
- 'use' => 'comp'
201
- );
202
- $responses[] = array(
203
- 'label' => 'Email',
204
- 'value' => isset( $_POST["mlwUserEmail"] ) ? sanitize_text_field( $_POST["mlwUserEmail"] ) : 'None',
205
- 'use' => 'email'
206
- );
207
- $responses[] = array(
208
- 'label' => 'Phone',
209
- 'value' => isset( $_POST["mlwUserPhone"] ) ? sanitize_text_field( $_POST["mlwUserPhone"] ) : 'None',
210
- 'use' => 'phone'
211
- );
212
- } elseif ( ! empty( $fields ) && is_array( $fields ) ) {
213
- $total_fields = count( $fields );
214
- for ( $i = 0; $i < $total_fields; $i++ ) {
215
- $field_array = array(
216
- 'label' => $fields[ $i ]['label'],
217
- 'value' => isset( $_POST["contact_field_$i"] ) ? sanitize_text_field( $_POST["contact_field_$i"] ) : 'None'
218
- );
219
- if ( isset( $fields[ $i ]['use'] ) ) {
220
- $field_array['use'] = $fields[ $i ]['use'];
221
- }
222
- $responses[] = $field_array;
223
- }
224
- }
225
-
226
- // For backwards compatibility, use the 'use' fields for setting $_POST values of older version of contact fields.
227
- foreach ( $responses as $field ) {
228
- if ( isset( $field['use'] ) ) {
229
- switch ( $field['use'] ) {
230
- case 'name':
231
- $_POST["mlwUserName"] = $field["value"];
232
- break;
233
-
234
- case 'comp':
235
- $_POST["mlwUserComp"] = $field["value"];
236
- break;
237
-
238
- case 'email':
239
- $_POST["mlwUserEmail"] = $field["value"];
240
- break;
241
-
242
- case 'phone':
243
- $_POST["mlwUserPhone"] = $field["value"];
244
- break;
245
- }
246
- }
247
- }
248
-
249
- return $responses;
250
- }
251
-
252
- /**
253
- * Loads the fields
254
- *
255
- * @since 5.0.0
256
- * @uses QMNPluginHelper::get_quiz_setting
257
- * @return array The array of contact fields
258
- */
259
- public static function load_fields() {
260
- global $mlwQuizMasterNext;
261
- return maybe_unserialize( $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'contact_form' ) );
262
- }
263
-
264
- /**
265
- * Saves the contact fields
266
- *
267
- * @since 5.0.0
268
- * @uses QMNPluginHelper::prepare_quiz
269
- * @uses QMNPluginHelper::update_quiz_setting
270
- * @param int $quiz_id The ID for the quiz.
271
- * @param array $fields The fields for the quiz.
272
- */
273
- public static function save_fields( $quiz_id, $fields ) {
274
- if ( self::load_fields() === $fields ) {
275
- return true;
276
- }
277
-
278
- if ( ! is_array( $fields ) || empty( $fields ) ) {
279
- //return false;
280
- }
281
-
282
- $quiz_id = intval( $quiz_id );
283
- if ( 0 === $quiz_id ) {
284
- return false;
285
- }
286
-
287
- $total_fields = count( $fields );
288
- for ( $i = 0; $i < $total_fields; $i++ ) {
289
- $fields[ $i ] = array(
290
- 'label' => sanitize_text_field( $fields[ $i ]['label'] ),
291
- 'use' => sanitize_text_field( $fields[ $i ]['use'] ),
292
- 'type' => sanitize_text_field( $fields[ $i ]['type'] ),
293
- 'required' => sanitize_text_field( $fields[ $i ]['required'] ),
294
- );
295
- }
296
- global $mlwQuizMasterNext;
297
- $mlwQuizMasterNext->pluginHelper->prepare_quiz( intval( $quiz_id ) );
298
- return $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'contact_form', serialize( $fields ) );
299
- }
300
- }
301
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-emails.php DELETED
@@ -1,469 +0,0 @@
1
- <?php
2
- /**
3
- * Handles relevant functions for emails
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * This class contains functions for loading, saving, and send quiz emails.
14
- *
15
- * @since 6.2.0
16
- */
17
- class QSM_Emails {
18
-
19
- /**
20
- * Sends the emails for the quiz.
21
- *
22
- * @since 6.2.0
23
- * @param array $response_data The data for the user's submission.
24
- */
25
- public static function send_emails( $response_data ) {
26
- $emails = QSM_Emails::load_emails( $response_data['quiz_id'] );
27
-
28
- if ( ! is_array( $emails ) || empty( $emails ) ) {
29
- return;
30
- }
31
-
32
- add_filter( 'wp_mail_content_type', 'mlw_qmn_set_html_content_type' );
33
-
34
- // Cycles through each possible email.
35
- foreach ( $emails as $email ) {
36
-
37
- // Checks if any conditions are present. Else, send it always.
38
- if ( ! empty( $email['conditions'] ) ) {
39
- /**
40
- * Since we have many conditions to test, we set this to true first.
41
- * Then, we test each condition to see if it fails.
42
- * If one condition fails, the value will be set to false.
43
- * If all conditions pass, this will still be true and the email will
44
- * be sent.
45
- */
46
- $show = true;
47
-
48
- // Cycle through each condition to see if we should sent this email.
49
- foreach ( $email['conditions'] as $condition ) {
50
- $value = $condition['value'];
51
-
52
- // First, determine which value we need to test.
53
- switch ( $condition['criteria'] ) {
54
- case 'score':
55
- $test = $response_data['total_score'];
56
- break;
57
-
58
- case 'points':
59
- $test = $response_data['total_points'];
60
- break;
61
-
62
- default:
63
- $test = 0;
64
- break;
65
- }
66
-
67
- // Then, determine how to test the vaue.
68
- switch ( $condition['operator'] ) {
69
- case 'greater-equal':
70
- if ( $test < $value ) {
71
- $show = false;
72
- }
73
- break;
74
-
75
- case 'greater':
76
- if ( $test <= $value ) {
77
- $show = false;
78
- }
79
- break;
80
-
81
- case 'less-equal':
82
- if ( $test > $value ) {
83
- $show = false;
84
- }
85
- break;
86
-
87
- case 'less':
88
- if ( $test >= $value ) {
89
- $show = false;
90
- }
91
- break;
92
-
93
- case 'not-equal':
94
- if ( $test == $value ) {
95
- $show = false;
96
- }
97
- break;
98
-
99
- case 'equal':
100
- default:
101
- if ( $test != $value ) {
102
- $show = false;
103
- }
104
- break;
105
- }
106
-
107
- /**
108
- * Added custom criterias/operators to the email?
109
- * Use this filter to check if the condition passed.
110
- * If it fails your conditions, return false to prevent the
111
- * email from sending.
112
- * If it passes your condition or is not your custom criterias
113
- * or operators, then return the value as-is.
114
- * DO NOT RETURN TRUE IF IT PASSES THE CONDITION!!!
115
- * The value may have been set to false when failing a previous condition.
116
- */
117
- $show = apply_filters( 'qsm_email_condition_check', $show, $condition, $response_data );
118
- }
119
-
120
- if ( $show ) {
121
- QSM_Emails::send_results_email( $response_data, $email['to'], $email['subject'], $email['content'], $email['replyTo'] );
122
- }
123
- } else {
124
- QSM_Emails::send_results_email( $response_data, $email['to'], $email['subject'], $email['content'], $email['replyTo'] );
125
- }
126
- }
127
-
128
- remove_filter( 'wp_mail_content_type', 'mlw_qmn_set_html_content_type' );
129
- }
130
-
131
- /**
132
- * Sends the results email.
133
- *
134
- * @since 6.2.0
135
- * @param array $response_data The data for the user's submission.
136
- * @param string $to The email(s) to send to. Can be separated with commas.
137
- * @param string $subject The subject of the email.
138
- * @param string $content The body of the email.
139
- * @param bool $reply_to True if set user email as Reply To header.
140
- */
141
- public static function send_results_email( $response_data, $to, $subject, $content, $reply_to ) {
142
-
143
- global $mlwQuizMasterNext;
144
-
145
- // Sets up our to email addresses.
146
- $user_email = sanitize_email( $response_data['user_email'] );
147
- $count = 0;
148
- if ( is_email( $user_email ) ) {
149
- $to = str_replace( '%USER_EMAIL%', $response_data['user_email'], $to, $count );
150
- } else {
151
- $to = str_replace( '%USER_EMAIL%', '', $to );
152
- }
153
- $to_array = explode( ',', $to );
154
-
155
- // Prepares our subject.
156
- $subject = apply_filters( 'mlw_qmn_template_variable_results_page', $subject, $response_data );
157
-
158
- // Prepares our content.
159
- $content = htmlspecialchars_decode( $content, ENT_QUOTES );
160
- $content = apply_filters( 'mlw_qmn_template_variable_results_page', $content, $response_data );
161
- $content = str_replace( "\n", '<br>', $content );
162
- $content = str_replace( '<br/>', '<br>', $content );
163
- $content = str_replace( '<br />', '<br>', $content );
164
-
165
- // Prepares our from name and email.
166
- $settings = (array) get_option( 'qmn-settings' );
167
- $from_email = get_option( 'admin_email', 'a@example.com' );
168
- $from_name = get_bloginfo( 'name' );
169
- if ( ! isset( $settings['from_email'] ) && ! isset( $settings['from_name'] ) ) {
170
- $options = $mlwQuizMasterNext->quiz_settings->get_quiz_options();
171
- $from_array = maybe_unserialize( $options->email_from_text );
172
- if ( isset( $from_array['from_email'] ) ) {
173
- $from_email = $from_array['from_email'];
174
- $from_name = $from_array['from_name'];
175
-
176
- // Updates option with this quiz's from values.
177
- $settings['from_email'] = $from_email;
178
- $settings['from_name'] = $from_name;
179
- update_option( 'qmn-settings', $settings );
180
- }
181
- } else {
182
- if ( isset( $settings['from_email'] ) ) {
183
- $from_email = $settings['from_email'];
184
- }
185
- if ( isset( $settings['from_name'] ) ) {
186
- $from_name = $settings['from_name'];
187
- }
188
- }
189
-
190
- // Prepares our headers.
191
- $headers = array();
192
- if ( is_email( $from_email ) ) {
193
- $headers[] = 'From: ' . $from_name . ' <' . $from_email . '>';
194
- }
195
- if ( is_email( $user_email ) && true === $reply_to ) {
196
- $name = sanitize_text_field( $response_data['user_name'] );
197
- $headers[] = 'Reply-To: ' . $name . ' <' . $user_email . '>';
198
- }
199
-
200
- // Prepares our attachments. If %USER_EMAIL% was in the $to, then use the user email attachment filter.
201
- $attachments = array();
202
- if ( 0 < intval( $count ) ) {
203
- $attachments = apply_filters( 'qsm_user_email_attachments', $attachments, $response_data );
204
- } else {
205
- $attachments = apply_filters( 'qsm_admin_email_attachments', $attachments, $response_data );
206
- }
207
-
208
- // Cycle through each to email address and send the email.
209
- foreach ( $to_array as $to_email ) {
210
- if ( is_email( $to_email ) ) {
211
- wp_mail( $to_email, $subject, $content, $headers, $attachments );
212
- }
213
- }
214
- }
215
-
216
- /**
217
- * Loads the emails for a single quiz.
218
- *
219
- * @since 6.2.0
220
- * @param int $quiz_id The ID for the quiz.
221
- * @return bool|array The array of emails or false.
222
- */
223
- public static function load_emails( $quiz_id ) {
224
- $emails = array();
225
- $quiz_id = intval( $quiz_id );
226
-
227
- // If the parameter supplied turns to 0 after intval, returns false.
228
- if ( 0 === $quiz_id ) {
229
- return false;
230
- }
231
-
232
- global $wpdb;
233
- $data = $wpdb->get_var( $wpdb->prepare( "SELECT user_email_template FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $quiz_id ) );
234
-
235
- // Checks if the emails is an array.
236
- if ( is_serialized( $data ) && is_array( maybe_unserialize( $data ) ) ) {
237
- $data = maybe_unserialize( $data );
238
-
239
- // Checks if the emails array is not the newer version.
240
- if ( ! empty( $data ) && ! isset( $data[0]['conditions'] ) ) {
241
- $emails = QSM_Emails::convert_to_new_system( $quiz_id );
242
- } else {
243
- $emails = $data;
244
- }
245
- } else {
246
- $emails = QSM_Emails::convert_to_new_system( $quiz_id );
247
- }
248
-
249
- return $emails;
250
- }
251
-
252
- /**
253
- * Loads and converts emails from the old system to new system
254
- *
255
- * @since 6.2.0
256
- * @param int $quiz_id The ID for the quiz.
257
- * @return array The combined newer versions of the emails.
258
- */
259
- public static function convert_to_new_system( $quiz_id ) {
260
- $emails = array();
261
- $quiz_id = intval( $quiz_id );
262
-
263
- // If the parameter supplied turns to 0 after intval, returns empty array.
264
- if ( 0 === $quiz_id ) {
265
- return $emails;
266
- }
267
-
268
- /**
269
- * Loads the old user and admin emails. Checks if they are enabled and converts them.
270
- */
271
- global $wpdb;
272
- global $mlwQuizMasterNext;
273
- $data = $wpdb->get_row( $wpdb->prepare( "SELECT send_user_email, user_email_template, send_admin_email, admin_email_template, email_from_text, admin_email FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $quiz_id ), ARRAY_A );
274
- $system = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'system', 0 );
275
- if ( 0 === intval( $data['send_user_email'] ) ) {
276
- $emails = array_merge( $emails, QSM_Emails::convert_emails( $system, $data['user_email_template'] ) );
277
- }
278
- if ( 0 === intval( $data['send_admin_email'] ) ) {
279
- $from_email_array = maybe_unserialize( $data['email_from_text'] );
280
- if ( ! is_array( $from_email_array ) || ! isset( $from_email_array['reply_to'] ) ) {
281
- $from_email_array = array(
282
- 'reply_to' => 1,
283
- );
284
- }
285
- $emails = array_merge( $emails, QSM_Emails::convert_emails( $system, $data['admin_email_template'], $data['admin_email'], $from_email_array['reply_to'] ) );
286
- }
287
-
288
- // Updates the database with new array to prevent running this step next time.
289
- $wpdb->update(
290
- $wpdb->prefix . 'mlw_quizzes',
291
- array( 'user_email_template' => serialize( $emails ) ),
292
- array( 'quiz_id' => $quiz_id ),
293
- array( '%s' ),
294
- array( '%d' )
295
- );
296
-
297
- return $emails;
298
- }
299
-
300
- /**
301
- * Converts emails to new system.
302
- *
303
- * @since 6.2.0
304
- * @param int $system The grading system of the quiz.
305
- * @param array $emails The emails to convert.
306
- * @param string $admin_emails The emails to send admin emails to, separated by comma.
307
- * @param int $reply_to Whether to add user email as Reply-To header (0 is enabled).
308
- * @return array The emails that have been converted.
309
- */
310
- public static function convert_emails( $system, $emails, $admin_emails = false, $reply_to = false ) {
311
- $new_emails = array();
312
- $emails = maybe_unserialize( $emails );
313
-
314
- // Checks if emails is an array to cycle through.
315
- if ( is_array( $emails ) ) {
316
-
317
- // Cycles through the emails.
318
- foreach ( $emails as $email ) {
319
-
320
- // Because I didn't appreciate consistency as a young developer...
321
- if ( isset( $email['subject'] ) ) {
322
- $subject = $email['subject'];
323
- $message = $email['message'];
324
- $begin = $email['begin_score'];
325
- $end = $email['end_score'];
326
- } else {
327
- $subject = $email[3];
328
- $message = $email[2];
329
- $begin = $email[0];
330
- $end = $email[1];
331
- }
332
-
333
- // Sets up our basic email.
334
- $new_email = array(
335
- 'conditions' => array(),
336
- 'subject' => $subject,
337
- 'content' => $message,
338
- 'replyTo' => false,
339
- );
340
-
341
- // Prepares the to email.
342
- if ( false === $admin_emails ) {
343
- $new_email['to'] = '%USER_EMAIL%';
344
- } elseif ( is_string( $admin_emails ) ) {
345
- $new_email['to'] = $admin_emails;
346
- } else {
347
- $new_email['to'] = get_option( 'admin_email ', 'test@example.com' );
348
- }
349
-
350
- // Sets reply to option to True if was enabled previously.
351
- if ( false !== $reply_to ) {
352
- if ( 0 === intval( $reply_to ) ) {
353
- $new_email['replyTo'] = true;
354
- }
355
- }
356
-
357
- // Checks to see if the email is not the older version's default page.
358
- if ( 0 !== intval( $begin ) || 0 !== intval( $end ) ) {
359
-
360
- // Checks if the system is points.
361
- if ( 1 === intval( $system ) ) {
362
- $new_email['conditions'][] = array(
363
- 'criteria' => 'points',
364
- 'operator' => 'greater-equal',
365
- 'value' => $begin,
366
- );
367
- $new_email['conditions'][] = array(
368
- 'criteria' => 'points',
369
- 'operator' => 'less-equal',
370
- 'value' => $end,
371
- );
372
- } else {
373
- $new_email['conditions'][] = array(
374
- 'criteria' => 'score',
375
- 'operator' => 'greater-equal',
376
- 'value' => $begin,
377
- );
378
- $new_email['conditions'][] = array(
379
- 'criteria' => 'score',
380
- 'operator' => 'less-equal',
381
- 'value' => $end,
382
- );
383
- }
384
- }
385
-
386
- $new_emails[] = $new_email;
387
- }
388
- } else {
389
- $new_emails[] = array(
390
- 'conditions' => array(),
391
- 'content' => $emails,
392
- 'subject' => 'Quiz results for %QUIZ_NAME%',
393
- 'replyTo' => false,
394
- );
395
-
396
- // Prepares the to email.
397
- if ( false === $admin_emails ) {
398
- $new_emails[0]['to'] = '%USER_EMAIL%';
399
- } elseif ( is_string( $admin_emails ) ) {
400
- $new_emails[0]['to'] = $admin_emails;
401
- } else {
402
- $new_emails[0]['to'] = get_option( 'admin_email ', 'test@example.com' );
403
- }
404
- }
405
- return $new_emails;
406
- }
407
-
408
- /**
409
- * Saves the emails for a quiz.
410
- *
411
- * @since 6.2.0
412
- * @param int $quiz_id The ID for the quiz.
413
- * @param array $emails The emails to be saved.
414
- * @return bool True or false depending on success.
415
- */
416
- public static function save_emails( $quiz_id, $emails ) {
417
- if ( ! is_array( $emails ) ) {
418
- return false;
419
- }
420
-
421
- $quiz_id = intval( $quiz_id );
422
- if ( 0 === $quiz_id ) {
423
- return false;
424
- }
425
-
426
- // Sanitizes data in emails.
427
- $total = count( $emails );
428
- for ( $i = 0; $i < $total; $i++ ) {
429
- $emails[ $i ]['to'] = sanitize_text_field( $emails[ $i ]['to'] );
430
- $emails[ $i ]['subject'] = sanitize_text_field( $emails[ $i ]['subject'] );
431
-
432
- /**
433
- * The jQuery AJAX function won't send the conditions key
434
- * if it's empty. So, check if it's set. If set, sanitize
435
- * data. If not set, set to empty array.
436
- */
437
- if ( isset( $emails[ $i ]['conditions'] ) ) {
438
- // Sanitizes the conditions.
439
- $total_conditions = count( $emails[ $i ]['conditions'] );
440
- for ( $j = 0; $j < $total_conditions; $j++ ) {
441
- $emails[ $i ]['conditions'][ $j ]['value'] = sanitize_text_field( $emails[ $i ]['conditions'][ $j ]['value'] );
442
- }
443
- } else {
444
- $emails[ $i ]['conditions'] = array();
445
- }
446
-
447
- if ( 'true' === $emails[ $i ]['replyTo'] || true === $emails[ $i ]['replyTo'] ) {
448
- $emails[ $i ]['replyTo'] = true;
449
- } else {
450
- $emails[ $i ]['replyTo'] = false;
451
- }
452
- }
453
-
454
- global $wpdb;
455
- $results = $wpdb->update(
456
- $wpdb->prefix . 'mlw_quizzes',
457
- array( 'user_email_template' => serialize( $emails ) ),
458
- array( 'quiz_id' => $quiz_id ),
459
- array( '%s' ),
460
- array( '%d' )
461
- );
462
- if ( false !== $results ) {
463
- return true;
464
- } else {
465
- return false;
466
- }
467
- }
468
- }
469
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-fields.php DELETED
@@ -1,248 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit;
4
-
5
- /**
6
- * This class handles creating form fields based on supplied arrays
7
- *
8
- * @since 5.0.0
9
- */
10
- class QSM_Fields {
11
-
12
- /**
13
- * Cycles through the fields in the array and generates each field
14
- *
15
- * @since 5.0.0
16
- * @param array $fields The array that contains the data for all fields
17
- * @param array $settings The array that holds the settings for this section
18
- */
19
- public static function generate_section( $fields, $section ) {
20
-
21
- global $mlwQuizMasterNext;
22
- global $wpdb;
23
-
24
- // If nonce is correct, save settings
25
- if ( isset( $_POST["save_settings_nonce"] ) && wp_verify_nonce( $_POST['save_settings_nonce'], 'save_settings') ) {
26
-
27
- // Cycle through fields to retrieve all posted values
28
- $settings_array = array();
29
- foreach ( $fields as $field ) {
30
-
31
- // Sanitize the values based on type
32
- $sanitized_value = '';
33
- switch ( $field["type"] ) {
34
- case 'text':
35
- $sanitized_value = sanitize_text_field( stripslashes( $_POST[ $field["id"] ] ) );
36
- break;
37
-
38
- case 'radio':
39
- case 'date':
40
- $sanitized_value = sanitize_text_field( $_POST[ $field["id"] ] );
41
- break;
42
-
43
- case 'number':
44
- $sanitized_value = intval( $_POST[ $field["id"] ] );
45
- break;
46
-
47
- case 'editor':
48
- $sanitized_value = wp_kses_post( stripslashes( $_POST[ $field["id"] ] ) );
49
- break;
50
-
51
- default:
52
- $sanitized_value = sanitize_text_field( $_POST[ $field["id"] ] );
53
- break;
54
- }
55
- $settings_array[ $field["id"] ] = $sanitized_value;
56
- }
57
-
58
- // Update the settings and show alert based on outcome
59
- $results = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( $section, $settings_array );
60
- if ( false !== $results ) {
61
- $mlwQuizMasterNext->alertManager->newAlert( __( 'The settings has been updated successfully.', 'quiz-master-next' ), 'success' );
62
- $mlwQuizMasterNext->audit_manager->new_audit( 'Settings Have Been Edited' );
63
- } else {
64
- $mlwQuizMasterNext->alertManager->newAlert( __( 'There was an error when updating the settings. Please try again.', 'quiz-master-next' ), 'error');
65
- }
66
- }
67
-
68
- // Retrieve the settings for this section
69
- $settings = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( $section );
70
-
71
- ?>
72
- <form action="" method="post">
73
- <?php wp_nonce_field( 'save_settings','save_settings_nonce' ); ?>
74
- <button class="button-primary"><?php _e('Save Changes', 'quiz-master-next'); ?></button>
75
- <table class="form-table" style="width: 100%;">
76
- <?php
77
-
78
- // Cycles through each field
79
- foreach ( $fields as $field ) {
80
-
81
- // Generate the field
82
- QSM_Fields::generate_field( $field, $settings[ $field["id"] ] );
83
- }
84
- ?>
85
- </table>
86
- <button class="button-primary"><?php _e('Save Changes', 'quiz-master-next'); ?></button>
87
- </form>
88
- <?php
89
- }
90
-
91
- /**
92
- * Prepares the field and calls the correct generate field function based on field's type
93
- *
94
- * @since 5.0.0
95
- * @param array $field The array that contains the data for the input field
96
- * @param mixed $value The current value of the setting
97
- * @return bool False if the field is invalid, true if successful
98
- */
99
- public static function generate_field( $field, $value ) {
100
-
101
- // Load default
102
- $defaults = array(
103
- 'id' => null,
104
- 'label' => '',
105
- 'type' => '',
106
- 'options' => array(),
107
- 'variables' => array()
108
- );
109
- $field = wp_parse_args( $field, $defaults );
110
-
111
- // If id is not valid, return false
112
- if ( is_null( $field["id"] ) || empty( $field["id"] ) ) {
113
- return false;
114
- }
115
-
116
- // If type is empty, assume text
117
- if ( empty( $field["type"] ) ) {
118
- $field["type"] = "text";
119
- }
120
-
121
- // Prepare function to call for field type
122
- $method = "generate_{$field["type"]}_field";
123
- QSM_Fields::$method( $field, $value );
124
-
125
- return true;
126
- }
127
-
128
- /**
129
- * Generates a text field
130
- *
131
- * @since 5.0.0
132
- * @param array $field The array that contains the data for the input field
133
- * @param mixed $value The current value of the setting
134
- */
135
- public static function generate_text_field( $field, $value ) {
136
- ?>
137
- <tr valign="top">
138
- <th scope="row"><label for="<?php echo $field["id"]; ?>"><?php echo $field["label"]; ?></label></th>
139
- <td>
140
- <input type="text" id="<?php echo $field["id"]; ?>" name="<?php echo $field["id"]; ?>" value="<?php echo $value; ?>" />
141
- </td>
142
- </tr>
143
- <?php
144
- }
145
-
146
- /**
147
- * Generates a textarea field using the WP Editor
148
- *
149
- * @since 5.0.0
150
- * @param array $field The array that contains the data for the input field
151
- * @param mixed $value The current value of the setting
152
- */
153
- public static function generate_editor_field( $field, $value ) {
154
- ?>
155
- <tr>
156
- <th scope="row">
157
- <label for="<?php echo $field["id"]; ?>"><?php echo $field["label"]; ?>
158
- <?php
159
- if ( is_array( $field["variables"] ) ) {
160
- ?>
161
- <br>
162
- <p><?php _e( "Allowed Variables:", 'quiz-master-next' ); ?></p>
163
- <?php
164
- foreach ( $field["variables"] as $variable ) {
165
- ?>
166
- <p style="margin: 2px 0">- <?php echo $variable; ?></p>
167
- <?php
168
- }
169
- }
170
- ?>
171
- </label>
172
- </th>
173
- <td>
174
- <?php wp_editor( htmlspecialchars_decode( $value, ENT_QUOTES ), $field["id"] ); ?>
175
- </td>
176
- </tr>
177
- <?php
178
- }
179
-
180
- /**
181
- * Generates a date field
182
- *
183
- * @since 5.0.0
184
- * @param array $field The array that contains the data for the input field
185
- * @param mixed $value The current value of the setting
186
- */
187
- public static function generate_date_field( $field, $value ) {
188
- wp_enqueue_script( 'jquery-ui-datepicker' );
189
- ?>
190
- <script>
191
- jQuery(function() {
192
- jQuery( "#<?php echo $field["id"]; ?>" ).datepicker();
193
- });
194
- </script>
195
- <tr valign="top">
196
- <th scope="row"><label for="<?php echo $field["id"]; ?>"><?php echo $field["label"]; ?></label></th>
197
- <td>
198
- <input type="text" id="<?php echo $field["id"]; ?>" name="<?php echo $field["id"]; ?>" value="<?php echo $value; ?>" />
199
- </td>
200
- </tr>
201
- <?php
202
- }
203
-
204
- /**
205
- * Generates a number field
206
- *
207
- * @since 5.0.0
208
- * @param array $field The array that contains the data for the input field
209
- * @param mixed $value The current value of the setting
210
- */
211
- public static function generate_number_field( $field, $value ) {
212
- ?>
213
- <tr valign="top">
214
- <th scope="row"><label for="<?php echo $field["id"]; ?>"><?php echo $field["label"]; ?></label></th>
215
- <td>
216
- <input type="number" step="1" min="0" id="<?php echo $field["id"]; ?>" name="<?php echo $field["id"]; ?>" value="<?php echo $value; ?>" />
217
- </td>
218
- </tr>
219
- <?php
220
- }
221
-
222
- /**
223
- * Generates radio inputs
224
- *
225
- * @since 5.0.0
226
- * @param array $field The array that contains the data for the input field
227
- * @param mixed $value The current value of the setting
228
- */
229
- public static function generate_radio_field( $field, $value ) {
230
- ?>
231
- <tr valign="top">
232
- <th scope="row"><label for="<?php echo $field["id"]; ?>"><?php echo $field["label"]; ?></label></th>
233
- <td>
234
- <?php
235
- foreach ( $field["options"] as $option ) {
236
- ?>
237
- <input type="radio" id="<?php echo $field["id"] . '-' . $option["value"]; ?>" name="<?php echo $field["id"]; ?>" <?php checked( $option["value"], $value ); ?> value="<?php echo $option["value"]; ?>" />
238
- <label for="<?php echo $field["id"] . '-' . $option["value"]; ?>"><?php echo $option["label"]; ?></label><br>
239
- <?php
240
- }
241
- ?>
242
- </td>
243
- </tr>
244
- <?php
245
- }
246
- }
247
-
248
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-install.php DELETED
@@ -1,1435 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit;
4
-
5
- /**
6
- * Class that handles installation, updates, and plugin row meta
7
- *
8
- * @since 4.7.1
9
- */
10
- class QSM_Install {
11
-
12
- /**
13
- * Main Constructor
14
- *
15
- * @uses QSM_Install::add_hooks
16
- * @since 4.7.1
17
- */
18
- function __construct() {
19
- $this->add_hooks();
20
- }
21
-
22
- /**
23
- * Adds the various class functions to hooks and filters
24
- *
25
- * @since 4.7.1
26
- */
27
- public function add_hooks() {
28
- add_action( 'admin_init', array( $this, 'update' ) );
29
- add_filter( 'plugin_action_links_' . QSM_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
30
- add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
31
- add_action( 'plugins_loaded', array( $this, 'register_default_settings' ) );
32
- }
33
-
34
- /**
35
- * Adds the default quiz settings
36
- *
37
- * @since 5.0.0
38
- */
39
- public function register_default_settings() {
40
-
41
- global $mlwQuizMasterNext;
42
-
43
- // Registers system setting
44
- $field_array = array(
45
- 'id' => 'system',
46
- 'label' => __('Which system is this quiz graded on?', 'quiz-master-next'),
47
- 'type' => 'radio',
48
- 'options' => array(
49
- array(
50
- 'label' => __('Correct/Incorrect', 'quiz-master-next'),
51
- 'value' => 0
52
- ),
53
- array(
54
- 'label' => __('Points', 'quiz-master-next'),
55
- 'value' => 1
56
- ),
57
- array(
58
- 'label' => __('Not Graded', 'quiz-master-next'),
59
- 'value' => 2
60
- )
61
- ),
62
- 'default' => 0
63
- );
64
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
65
-
66
- // Registers progress_bar setting
67
- $field_array = array(
68
- 'id' => 'progress_bar',
69
- 'label' => __( 'Show a progress bar?', 'quiz-master-next' ),
70
- 'type' => 'radio',
71
- 'options' => array(
72
- array(
73
- 'label' => __( 'Yes', 'quiz-master-next' ),
74
- 'value' => 1
75
- ),
76
- array(
77
- 'label' => __( 'No', 'quiz-master-next' ),
78
- 'value' => 0
79
- )
80
- ),
81
- 'default' => 0
82
- );
83
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
84
-
85
- // Registers require_log_in setting
86
- $field_array = array(
87
- 'id' => 'require_log_in',
88
- 'label' => __('Should the user be required to be logged in to take this quiz?', 'quiz-master-next'),
89
- 'type' => 'radio',
90
- 'options' => array(
91
- array(
92
- 'label' => __('Yes', 'quiz-master-next'),
93
- 'value' => 1
94
- ),
95
- array(
96
- 'label' => __('No', 'quiz-master-next'),
97
- 'value' => 0
98
- )
99
- ),
100
- 'default' => 0
101
- );
102
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
103
-
104
- // Registers pagination setting
105
- $field_array = array(
106
- 'id' => 'pagination',
107
- 'label' => __('How many questions per page would you like? (Leave 0 to use pages created on Questions tab)', 'quiz-master-next'),
108
- 'type' => 'number',
109
- 'options' => array(
110
-
111
- ),
112
- 'default' => 0
113
- );
114
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
115
-
116
- // Registers timer_limit setting
117
- $field_array = array(
118
- 'id' => 'timer_limit',
119
- 'label' => __('How many minutes does the user have to finish the quiz? (Leave 0 for no time limit)', 'quiz-master-next'),
120
- 'type' => 'number',
121
- 'options' => array(
122
-
123
- ),
124
- 'default' => 0
125
- );
126
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
127
-
128
- // Settings for quick result
129
- $field_array = array(
130
- 'id' => 'enable_result_after_timer_end',
131
- 'label' => __('Force submit after timer expiry?', 'quiz-master-next'),
132
- 'type' => 'radio',
133
- 'options' => array(
134
- array(
135
- 'label' => __('No', 'quiz-master-next'),
136
- 'value' => 0
137
- ),
138
- array(
139
- 'label' => __('Yes', 'quiz-master-next'),
140
- 'value' => 1
141
- )
142
- ),
143
- 'default' => 0
144
- );
145
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
146
-
147
- // Registers total_user_tries setting
148
- $field_array = array(
149
- 'id' => 'total_user_tries',
150
- 'label' => __('How many times can a user take this quiz? (Leave 0 for as many times as the user wants to.)', 'quiz-master-next'),
151
- 'type' => 'number',
152
- 'options' => array(
153
-
154
- ),
155
- 'default' => 0
156
- );
157
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
158
-
159
- // Registers limit_total_entries setting
160
- $field_array = array(
161
- 'id' => 'limit_total_entries',
162
- 'label' => __('How many total entries can this quiz have? (Leave 0 for unlimited entries)', 'quiz-master-next'),
163
- 'type' => 'number',
164
- 'options' => array(
165
-
166
- ),
167
- 'default' => 0
168
- );
169
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
170
-
171
- // Registers question_from_total setting
172
- $field_array = array(
173
- 'id' => 'question_from_total',
174
- 'label' => __('How many questions should be loaded for quiz? (Leave 0 to load all questions)', 'quiz-master-next'),
175
- 'type' => 'number',
176
- 'options' => array(
177
-
178
- ),
179
- 'default' => 0
180
- );
181
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
182
-
183
- // Registers scheduled_time_start setting
184
- $field_array = array(
185
- 'id' => 'scheduled_time_start',
186
- 'label' => __('When should the user be able to start accessing the quiz? (Leave blank if the user can access anytime)', 'quiz-master-next'),
187
- 'type' => 'date',
188
- 'options' => array(
189
-
190
- ),
191
- 'default' => ''
192
- );
193
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
194
-
195
- // Registers scheduled_time_end setting
196
- $field_array = array(
197
- 'id' => 'scheduled_time_end',
198
- 'label' => __('When should the user stop accessing the quiz? (Leave blank if the user can access anytime)', 'quiz-master-next'),
199
- 'type' => 'date',
200
- 'options' => array(
201
-
202
- ),
203
- 'default' => ''
204
- );
205
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
206
-
207
- // Registers randomness_order setting
208
- $field_array = array(
209
- 'id' => 'randomness_order',
210
- 'label' => __('Are the questions random? (Question Order will not apply if this is yes)', 'quiz-master-next'),
211
- 'type' => 'radio',
212
- 'options' => array(
213
- array(
214
- 'label' => __('Random Questions', 'quiz-master-next'),
215
- 'value' => 1
216
- ),
217
- array(
218
- 'label' => __('Random Questions And Answers', 'quiz-master-next'),
219
- 'value' => 2
220
- ),
221
- array(
222
- 'label' => __('Random Answers', 'quiz-master-next'),
223
- 'value' => 3
224
- ),
225
- array(
226
- 'label' => __('No', 'quiz-master-next'),
227
- 'value' => 0
228
- )
229
- ),
230
- 'default' => 0
231
- );
232
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
233
-
234
- // Registers contact_info_location setting
235
- $field_array = array(
236
- 'id' => 'contact_info_location',
237
- 'label' => __('Would you like to ask for the contact information at the beginning or at the end of the quiz?', 'quiz-master-next'),
238
- 'type' => 'radio',
239
- 'options' => array(
240
- array(
241
- 'label' => __('Beginning', 'quiz-master-next'),
242
- 'value' => 0
243
- ),
244
- array(
245
- 'label' => __('End', 'quiz-master-next'),
246
- 'value' => 1
247
- )
248
- ),
249
- 'default' => 0
250
- );
251
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
252
-
253
- // Registers loggedin_user_contact setting
254
- $field_array = array(
255
- 'id' => 'loggedin_user_contact',
256
- 'label' => __('If a logged-in user takes the quiz, would you like them to be able to edit contact information? If set to no, the fields will not show up for logged in users; however, the users information will be saved for the fields.', 'quiz-master-next'),
257
- 'type' => 'radio',
258
- 'options' => array(
259
- array(
260
- 'label' => __('Yes', 'quiz-master-next'),
261
- 'value' => 0
262
- ),
263
- array(
264
- 'label' => __('No', 'quiz-master-next'),
265
- 'value' => 1
266
- )
267
- ),
268
- 'default' => 0
269
- );
270
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
271
-
272
- // Registers comment_section setting
273
- $field_array = array(
274
- 'id' => 'comment_section',
275
- 'label' => __('Would you like a place for the user to enter comments?', 'quiz-master-next'),
276
- 'type' => 'radio',
277
- 'options' => array(
278
- array(
279
- 'label' => __('Yes', 'quiz-master-next'),
280
- 'value' => 0
281
- ),
282
- array(
283
- 'label' => __('No', 'quiz-master-next'),
284
- 'value' => 1
285
- )
286
- ),
287
- 'default' => 1
288
- );
289
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
290
-
291
- // Registers question_numbering setting
292
- $field_array = array(
293
- 'id' => 'question_numbering',
294
- 'label' => __('Show question number on quiz?', 'quiz-master-next'),
295
- 'type' => 'radio',
296
- 'options' => array(
297
- array(
298
- 'label' => __('Yes', 'quiz-master-next'),
299
- 'value' => 1
300
- ),
301
- array(
302
- 'label' => __('No', 'quiz-master-next'),
303
- 'value' => 0
304
- )
305
- ),
306
- 'default' => 0
307
- );
308
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
309
-
310
- // Registers store_responses setting
311
- $field_array = array(
312
- 'id' => 'store_responses',
313
- 'label' => __( 'Store the responses in the database?', 'quiz-master-next' ),
314
- 'type' => 'radio',
315
- 'options' => array(
316
- array(
317
- 'label' => __( 'Yes', 'quiz-master-next' ),
318
- 'value' => 1
319
- ),
320
- array(
321
- 'label' => __( 'No', 'quiz-master-next' ),
322
- 'value' => 0
323
- )
324
- ),
325
- 'default' => 1
326
- );
327
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
328
-
329
- // Registers social_media setting
330
- $field_array = array(
331
- 'id' => 'social_media',
332
- 'label' => __('Show social media sharing buttons? (Twitter & Facebook) This option is for here only for users of older versions. Please use the new template variables %FACEBOOK_SHARE% %TWITTER_SHARE% on your results pages instead of using this option!', 'quiz-master-next'),
333
- 'type' => 'radio',
334
- 'options' => array(
335
- array(
336
- 'label' => __('Yes', 'quiz-master-next'),
337
- 'value' => 1
338
- ),
339
- array(
340
- 'label' => __('No', 'quiz-master-next'),
341
- 'value' => 0
342
- )
343
- ),
344
- 'default' => 0
345
- );
346
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
347
-
348
- // Registers disable_answer_onselect setting
349
- $field_array = array(
350
- 'id' => 'disable_answer_onselect',
351
- 'label' => __('Disable question once user selects answer? (Currently only work on multiple choice)', 'quiz-master-next'),
352
- 'type' => 'radio',
353
- 'options' => array(
354
- array(
355
- 'label' => __('Yes', 'quiz-master-next'),
356
- 'value' => 1
357
- ),
358
- array(
359
- 'label' => __('No', 'quiz-master-next'),
360
- 'value' => 0
361
- )
362
- ),
363
- 'default' => 0
364
- );
365
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
366
-
367
- // Registers ajax_show_correct setting
368
- $field_array = array(
369
- 'id' => 'ajax_show_correct',
370
- 'label' => __('Dynamically add class for incorrect/correct answer after user selects answer? (Currently only works on multiple choice)', 'quiz-master-next'),
371
- 'type' => 'radio',
372
- 'options' => array(
373
- array(
374
- 'label' => __('Yes', 'quiz-master-next'),
375
- 'value' => 1
376
- ),
377
- array(
378
- 'label' => __('No', 'quiz-master-next'),
379
- 'value' => 0
380
- )
381
- ),
382
- 'default' => 0
383
- );
384
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
385
-
386
- // Registers user_name setting
387
- $field_array = array(
388
- 'id' => 'user_name',
389
- 'label' => __("Should we ask for the user's name? (Only here for older versions. Use Contact tab for this.)", 'quiz-master-next'),
390
- 'type' => 'radio',
391
- 'options' => array(
392
- array(
393
- 'label' => __('Yes', 'quiz-master-next'),
394
- 'value' => 0
395
- ),
396
- array(
397
- 'label' => __('Require', 'quiz-master-next'),
398
- 'value' => 1
399
- ),
400
- array(
401
- 'label' => __('No', 'quiz-master-next'),
402
- 'value' => 2
403
- )
404
- ),
405
- 'default' => 2
406
- );
407
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
408
-
409
- // Registers user_comp setting
410
- $field_array = array(
411
- 'id' => 'user_comp',
412
- 'label' => __('Should we ask for users business? (Only here for older versions. Use Contact tab for this.)', 'quiz-master-next'),
413
- 'type' => 'radio',
414
- 'options' => array(
415
- array(
416
- 'label' => __('Yes', 'quiz-master-next'),
417
- 'value' => 0
418
- ),
419
- array(
420
- 'label' => __('Require', 'quiz-master-next'),
421
- 'value' => 1
422
- ),
423
- array(
424
- 'label' => __('No', 'quiz-master-next'),
425
- 'value' => 2
426
- )
427
- ),
428
- 'default' => 2
429
- );
430
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
431
-
432
- // Registers user_email setting
433
- $field_array = array(
434
- 'id' => 'user_email',
435
- 'label' => __('Should we ask for users email? (Only here for older versions. Use Contact tab for this.)', 'quiz-master-next'),
436
- 'type' => 'radio',
437
- 'options' => array(
438
- array(
439
- 'label' => __('Yes', 'quiz-master-next'),
440
- 'value' => 0
441
- ),
442
- array(
443
- 'label' => __('Require', 'quiz-master-next'),
444
- 'value' => 1
445
- ),
446
- array(
447
- 'label' => __('No', 'quiz-master-next'),
448
- 'value' => 2
449
- )
450
- ),
451
- 'default' => 2
452
- );
453
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
454
-
455
- // Registers user_phone setting
456
- $field_array = array(
457
- 'id' => 'user_phone',
458
- 'label' => __('Should we ask for users phone number? (Only here for older versions. Use Contact tab for this.)', 'quiz-master-next'),
459
- 'type' => 'radio',
460
- 'options' => array(
461
- array(
462
- 'label' => __('Yes', 'quiz-master-next'),
463
- 'value' => 0
464
- ),
465
- array(
466
- 'label' => __('Require', 'quiz-master-next'),
467
- 'value' => 1
468
- ),
469
- array(
470
- 'label' => __('No', 'quiz-master-next'),
471
- 'value' => 2
472
- )
473
- ),
474
- 'default' => 2
475
- );
476
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
477
-
478
- // Registers hide_auto fill setting
479
- $field_array = array(
480
- 'id' => 'contact_disable_autofill',
481
- 'label' => __('Disable auto fill for contact input?', 'quiz-master-next'),
482
- 'type' => 'radio',
483
- 'options' => array(
484
- array(
485
- 'label' => __('No', 'quiz-master-next'),
486
- 'value' => 0
487
- ),
488
- array(
489
- 'label' => __('Yes', 'quiz-master-next'),
490
- 'value' => 1
491
- )
492
- ),
493
- 'default' => 0
494
- );
495
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
496
-
497
- // Registers show category on front setting
498
- $field_array = array(
499
- 'id' => 'show_category_on_front',
500
- 'label' => __('Show category on front?', 'quiz-master-next'),
501
- 'type' => 'radio',
502
- 'options' => array(
503
- array(
504
- 'label' => __('No', 'quiz-master-next'),
505
- 'value' => 0
506
- ),
507
- array(
508
- 'label' => __('Yes', 'quiz-master-next'),
509
- 'value' => 1
510
- )
511
- ),
512
- 'default' => 0
513
- );
514
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
515
-
516
- // Settings for quick result
517
- $field_array = array(
518
- 'id' => 'enable_quick_result_mc',
519
- 'label' => __('Show live results for questions inline', 'quiz-master-next'),
520
- 'type' => 'radio',
521
- 'options' => array(
522
- array(
523
- 'label' => __('No', 'quiz-master-next'),
524
- 'value' => 0
525
- ),
526
- array(
527
- 'label' => __('Yes', 'quiz-master-next'),
528
- 'value' => 1
529
- )
530
- ),
531
- 'default' => 0
532
- );
533
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
534
-
535
- //Setting for retake quiz
536
- // Settings for quick result
537
- $field_array = array(
538
- 'id' => 'enable_retake_quiz_button',
539
- 'label' => __('Show RETAKE QUIZ button on result page', 'quiz-master-next'),
540
- 'type' => 'radio',
541
- 'options' => array(
542
- array(
543
- 'label' => __('No', 'quiz-master-next'),
544
- 'value' => 0
545
- ),
546
- array(
547
- 'label' => __('Yes', 'quiz-master-next'),
548
- 'value' => 1
549
- )
550
- ),
551
- 'default' => 0
552
- );
553
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
554
-
555
- // Registers message_before setting
556
- $field_array = array(
557
- 'id' => 'message_before',
558
- 'label' => __("Message Displayed Before Quiz", 'quiz-master-next'),
559
- 'type' => 'editor',
560
- 'default' => 0,
561
- 'variables' => array(
562
- '%QUIZ_NAME%',
563
- '%CURRENT_DATE%'
564
- )
565
- );
566
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
567
-
568
- // Registers message_comment setting
569
- $field_array = array(
570
- 'id' => 'message_comment',
571
- 'label' => __("Message Displayed Before Comments Box If Enabled", 'quiz-master-next'),
572
- 'type' => 'editor',
573
- 'default' => 0,
574
- 'variables' => array(
575
- '%QUIZ_NAME%',
576
- '%CURRENT_DATE%'
577
- )
578
- );
579
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
580
-
581
- // Registers message_end_template setting
582
- $field_array = array(
583
- 'id' => 'message_end_template',
584
- 'label' => __("Message Displayed At End Of Quiz (Leave Blank To Omit Text Section)", 'quiz-master-next'),
585
- 'type' => 'editor',
586
- 'default' => 0,
587
- 'variables' => array(
588
- '%QUIZ_NAME%',
589
- '%CURRENT_DATE%'
590
- )
591
- );
592
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
593
-
594
- // Registers total_user_tries_text setting
595
- $field_array = array(
596
- 'id' => 'total_user_tries_text',
597
- 'label' => __("Message Displayed If User Has Tried Quiz Too Many Times", 'quiz-master-next'),
598
- 'type' => 'editor',
599
- 'default' => 0,
600
- 'variables' => array(
601
- '%QUIZ_NAME%',
602
- '%CURRENT_DATE%'
603
- )
604
- );
605
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
606
-
607
- // Registers require_log_in_text setting
608
- $field_array = array(
609
- 'id' => 'require_log_in_text',
610
- 'label' => __("Message Displayed If User Is Not Logged In And Quiz Requires Users To Be Logged In", 'quiz-master-next'),
611
- 'type' => 'editor',
612
- 'default' => 0,
613
- 'variables' => array(
614
- '%QUIZ_NAME%',
615
- '%CURRENT_DATE%'
616
- )
617
- );
618
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
619
-
620
- // Registers scheduled_timeframe_text setting
621
- $field_array = array(
622
- 'id' => 'scheduled_timeframe_text',
623
- 'label' => __("Message Displayed If Date Is Outside Scheduled Timeframe", 'quiz-master-next'),
624
- 'type' => 'editor',
625
- 'default' => 0,
626
- 'variables' => array(
627
- '%QUIZ_NAME%',
628
- '%CURRENT_DATE%'
629
- )
630
- );
631
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
632
-
633
- // Registers limit_total_entries_text setting
634
- $field_array = array(
635
- 'id' => 'limit_total_entries_text',
636
- 'label' => __("Message Displayed If The Limit Of Total Entries Has Been Reached", 'quiz-master-next'),
637
- 'type' => 'editor',
638
- 'default' => 0,
639
- 'variables' => array(
640
- '%QUIZ_NAME%',
641
- '%CURRENT_DATE%'
642
- )
643
- );
644
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
645
-
646
- // Registers question_answer_template setting
647
- $field_array = array(
648
- 'id' => 'question_answer_template',
649
- 'label' => __("%QUESTIONS_ANSWERS% Text", 'quiz-master-next'),
650
- 'type' => 'editor',
651
- 'default' => 0,
652
- 'variables' => array(
653
- '%QUESTION%',
654
- '%USER_ANSWER%',
655
- '%CORRECT_ANSWER%',
656
- '%USER_COMMENTS%',
657
- '%CORRECT_ANSWER_INFO%'
658
- )
659
- );
660
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
661
-
662
- // Registers twitter_sharing_text setting
663
- $field_array = array(
664
- 'id' => 'twitter_sharing_text',
665
- 'label' => __("Twitter Sharing Text", 'quiz-master-next'),
666
- 'type' => 'editor',
667
- 'default' => 0,
668
- 'variables' => array(
669
- '%POINT_SCORE%',
670
- '%AVERAGE_POINT%',
671
- '%AMOUNT_CORRECT%',
672
- '%TOTAL_QUESTIONS%',
673
- '%CORRECT_SCORE%',
674
- '%QUIZ_NAME%',
675
- '%TIMER%',
676
- '%CURRENT_DATE%'
677
- )
678
- );
679
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
680
-
681
- // Registers facebook_sharing_text setting
682
- $field_array = array(
683
- 'id' => 'facebook_sharing_text',
684
- 'label' => __("Facebook Sharing Text", 'quiz-master-next'),
685
- 'type' => 'editor',
686
- 'default' => 0,
687
- 'variables' => array(
688
- '%POINT_SCORE%',
689
- '%AVERAGE_POINT%',
690
- '%AMOUNT_CORRECT%',
691
- '%TOTAL_QUESTIONS%',
692
- '%CORRECT_SCORE%',
693
- '%QUIZ_NAME%',
694
- '%TIMER%',
695
- '%CURRENT_DATE%'
696
- )
697
- );
698
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
699
-
700
- // Registers submit_button_text setting
701
- $field_array = array(
702
- 'id' => 'submit_button_text',
703
- 'label' => __('Text for submit button', 'quiz-master-next'),
704
- 'type' => 'text',
705
- 'default' => 0
706
- );
707
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
708
-
709
- // Registers name_field_text setting
710
- $field_array = array(
711
- 'id' => 'name_field_text',
712
- 'label' => __('Text for name field', 'quiz-master-next'),
713
- 'type' => 'text',
714
- 'default' => 0
715
- );
716
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
717
-
718
- // Registers business_field_text setting
719
- $field_array = array(
720
- 'id' => 'business_field_text',
721
- 'label' => __('Text for business field', 'quiz-master-next'),
722
- 'type' => 'text',
723
- 'default' => 0
724
- );
725
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
726
-
727
- // Registers email_field_text setting
728
- $field_array = array(
729
- 'id' => 'email_field_text',
730
- 'label' => __('Text for email field', 'quiz-master-next'),
731
- 'type' => 'text',
732
- 'default' => 0
733
- );
734
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
735
-
736
- // Registers phone_field_text setting
737
- $field_array = array(
738
- 'id' => 'phone_field_text',
739
- 'label' => __('Text for phone number field', 'quiz-master-next'),
740
- 'type' => 'text',
741
- 'default' => 0
742
- );
743
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
744
-
745
- // Registers comment_field_text setting
746
- $field_array = array(
747
- 'id' => 'comment_field_text',
748
- 'label' => __('Text for comments field', 'quiz-master-next'),
749
- 'type' => 'text',
750
- 'default' => 0
751
- );
752
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
753
-
754
- // Registers previous_button_text setting
755
- $field_array = array(
756
- 'id' => 'previous_button_text',
757
- 'label' => __('Text for previous button', 'quiz-master-next'),
758
- 'type' => 'text',
759
- 'default' => 0
760
- );
761
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
762
-
763
- // Registers next_button_text setting
764
- $field_array = array(
765
- 'id' => 'next_button_text',
766
- 'label' => __('Text for next button', 'quiz-master-next'),
767
- 'type' => 'text',
768
- 'default' => 0
769
- );
770
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
771
-
772
- // Registers hint_text setting
773
- $field_array = array(
774
- 'id' => 'hint_text',
775
- 'label' => __('Text for hint', 'quiz-master-next'),
776
- 'type' => 'text',
777
- 'default' => 'Hint'
778
- );
779
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
780
-
781
- // Registers empty_error_text setting
782
- $field_array = array(
783
- 'id' => 'empty_error_text',
784
- 'label' => __('Text for when user has not filled in all required fields', 'quiz-master-next'),
785
- 'type' => 'text',
786
- 'default' => 'Please complete all required fields!'
787
- );
788
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
789
-
790
- // Registers email_error_text setting
791
- $field_array = array(
792
- 'id' => 'email_error_text',
793
- 'label' => __('Text for when user filled in email field with invalid email', 'quiz-master-next'),
794
- 'type' => 'text',
795
- 'default' => 'Not a valid e-mail address!'
796
- );
797
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
798
-
799
- // Registers number_error_text setting
800
- $field_array = array(
801
- 'id' => 'number_error_text',
802
- 'label' => __('Text for when user has filled in number field with invalid number', 'quiz-master-next'),
803
- 'type' => 'text',
804
- 'default' => 'This field must be a number!'
805
- );
806
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
807
-
808
- // Registers incorrect_error_text setting
809
- $field_array = array(
810
- 'id' => 'incorrect_error_text',
811
- 'label' => __('Text for when user has not filled in captcha correctly', 'quiz-master-next'),
812
- 'type' => 'text',
813
- 'default' => 'The entered text is not correct!'
814
- );
815
- $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_text' );
816
- }
817
-
818
- /**
819
- * Installs the plugin and its database tables
820
- *
821
- * @since 4.7.1
822
- */
823
- public static function install() {
824
-
825
- global $wpdb;
826
- $charset_collate = $wpdb->get_charset_collate();
827
-
828
- $quiz_table_name = $wpdb->prefix . "mlw_quizzes";
829
- $question_table_name = $wpdb->prefix . "mlw_questions";
830
- $results_table_name = $wpdb->prefix . "mlw_results";
831
- $audit_table_name = $wpdb->prefix . "mlw_qm_audit_trail";
832
-
833
- if( $wpdb->get_var( "SHOW TABLES LIKE '$quiz_table_name'" ) != $quiz_table_name ) {
834
- $sql = "CREATE TABLE $quiz_table_name (
835
- quiz_id mediumint(9) NOT NULL AUTO_INCREMENT,
836
- quiz_name TEXT NOT NULL,
837
- message_before TEXT NOT NULL,
838
- message_after TEXT NOT NULL,
839
- message_comment TEXT NOT NULL,
840
- message_end_template TEXT NOT NULL,
841
- user_email_template TEXT NOT NULL,
842
- admin_email_template TEXT NOT NULL,
843
- submit_button_text TEXT NOT NULL,
844
- name_field_text TEXT NOT NULL,
845
- business_field_text TEXT NOT NULL,
846
- email_field_text TEXT NOT NULL,
847
- phone_field_text TEXT NOT NULL,
848
- comment_field_text TEXT NOT NULL,
849
- email_from_text TEXT NOT NULL,
850
- question_answer_template TEXT NOT NULL,
851
- leaderboard_template TEXT NOT NULL,
852
- system INT NOT NULL,
853
- randomness_order INT NOT NULL,
854
- loggedin_user_contact INT NOT NULL,
855
- show_score INT NOT NULL,
856
- send_user_email INT NOT NULL,
857
- send_admin_email INT NOT NULL,
858
- contact_info_location INT NOT NULL,
859
- user_name INT NOT NULL,
860
- user_comp INT NOT NULL,
861
- user_email INT NOT NULL,
862
- user_phone INT NOT NULL,
863
- admin_email TEXT NOT NULL,
864
- comment_section INT NOT NULL,
865
- question_from_total INT NOT NULL,
866
- total_user_tries INT NOT NULL,
867
- total_user_tries_text TEXT NOT NULL,
868
- certificate_template TEXT NOT NULL,
869
- social_media INT NOT NULL,
870
- social_media_text TEXT NOT NULL,
871
- pagination INT NOT NULL,
872
- pagination_text TEXT NOT NULL,
873
- timer_limit INT NOT NULL,
874
- quiz_stye TEXT NOT NULL,
875
- question_numbering INT NOT NULL,
876
- quiz_settings TEXT NOT NULL,
877
- theme_selected TEXT NOT NULL,
878
- last_activity DATETIME NOT NULL,
879
- require_log_in INT NOT NULL,
880
- require_log_in_text TEXT NOT NULL,
881
- limit_total_entries INT NOT NULL,
882
- limit_total_entries_text TEXT NOT NULL,
883
- scheduled_timeframe TEXT NOT NULL,
884
- scheduled_timeframe_text TEXT NOT NULL,
885
- disable_answer_onselect INT NOT NULL,
886
- ajax_show_correct INT NOT NULL,
887
- quiz_views INT NOT NULL,
888
- quiz_taken INT NOT NULL,
889
- deleted INT NOT NULL,
890
- PRIMARY KEY (quiz_id)
891
- ) $charset_collate;";
892
-
893
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
894
- dbDelta( $sql );
895
- }
896
-
897
- if( $wpdb->get_var( "SHOW TABLES LIKE '$question_table_name'" ) != $question_table_name ) {
898
- $sql = "CREATE TABLE $question_table_name (
899
- question_id mediumint(9) NOT NULL AUTO_INCREMENT,
900
- quiz_id INT NOT NULL,
901
- question_name TEXT NOT NULL,
902
- answer_array TEXT NOT NULL,
903
- answer_one TEXT NOT NULL,
904
- answer_one_points INT NOT NULL,
905
- answer_two TEXT NOT NULL,
906
- answer_two_points INT NOT NULL,
907
- answer_three TEXT NOT NULL,
908
- answer_three_points INT NOT NULL,
909
- answer_four TEXT NOT NULL,
910
- answer_four_points INT NOT NULL,
911
- answer_five TEXT NOT NULL,
912
- answer_five_points INT NOT NULL,
913
- answer_six TEXT NOT NULL,
914
- answer_six_points INT NOT NULL,
915
- correct_answer INT NOT NULL,
916
- question_answer_info TEXT NOT NULL,
917
- comments INT NOT NULL,
918
- hints TEXT NOT NULL,
919
- question_order INT NOT NULL,
920
- question_type INT NOT NULL,
921
- question_type_new TEXT NOT NULL,
922
- question_settings TEXT NOT NULL,
923
- category TEXT NOT NULL,
924
- deleted INT NOT NULL,
925
- PRIMARY KEY (question_id)
926
- ) $charset_collate;";
927
-
928
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
929
- dbDelta( $sql );
930
- }
931
-
932
- if( $wpdb->get_var( "SHOW TABLES LIKE '$results_table_name'" ) != $results_table_name ) {
933
- $sql = "CREATE TABLE $results_table_name (
934
- result_id mediumint(9) NOT NULL AUTO_INCREMENT,
935
- quiz_id INT NOT NULL,
936
- quiz_name TEXT NOT NULL,
937
- quiz_system INT NOT NULL,
938
- point_score INT NOT NULL,
939
- correct_score INT NOT NULL,
940
- correct INT NOT NULL,
941
- total INT NOT NULL,
942
- name TEXT NOT NULL,
943
- business TEXT NOT NULL,
944
- email TEXT NOT NULL,
945
- phone TEXT NOT NULL,
946
- user INT NOT NULL,
947
- user_ip TEXT NOT NULL,
948
- time_taken TEXT NOT NULL,
949
- time_taken_real DATETIME NOT NULL,
950
- quiz_results TEXT NOT NULL,
951
- deleted INT NOT NULL,
952
- PRIMARY KEY (result_id)
953
- ) $charset_collate;";
954
-
955
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
956
- dbDelta( $sql );
957
- }
958
-
959
- if( $wpdb->get_var( "SHOW TABLES LIKE '$audit_table_name'" ) != $audit_table_name ) {
960
- $sql = "CREATE TABLE $audit_table_name (
961
- trail_id mediumint(9) NOT NULL AUTO_INCREMENT,
962
- action_user TEXT NOT NULL,
963
- action TEXT NOT NULL,
964
- time TEXT NOT NULL,
965
- PRIMARY KEY (trail_id)
966
- ) $charset_collate;";
967
-
968
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
969
- dbDelta( $sql );
970
- }
971
-
972
- global $mlwQuizMasterNext;
973
- $mlwQuizMasterNext->register_quiz_post_types();
974
- flush_rewrite_rules();
975
- }
976
-
977
- /**
978
- * Updates the plugin
979
- *
980
- * @since 4.7.1
981
- */
982
- public function update() {
983
- global $mlwQuizMasterNext;
984
- $data = $mlwQuizMasterNext->version;
985
- if ( ! get_option( 'qmn_original_version' ) ) {
986
- add_option( 'qmn_original_version', $data );
987
- }
988
- if ( get_option( 'mlw_quiz_master_version' ) != $data ) {
989
- global $wpdb;
990
- $table_name = $wpdb->prefix . "mlw_quizzes";
991
- //Update 0.5
992
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'comment_section'") != "comment_section")
993
- {
994
- $sql = "ALTER TABLE ".$table_name." ADD comment_field_text TEXT NOT NULL AFTER phone_field_text";
995
- $results = $wpdb->query( $sql );
996
- $sql = "ALTER TABLE ".$table_name." ADD comment_section INT NOT NULL AFTER admin_email";
997
- $results = $wpdb->query( $sql );
998
- $sql = "ALTER TABLE ".$table_name." ADD message_comment TEXT NOT NULL AFTER message_after";
999
- $results = $wpdb->query( $sql );
1000
- $update_sql = "UPDATE ".$table_name." SET comment_field_text='Comments', comment_section=1, message_comment='Enter You Text Here'";
1001
- $results = $wpdb->query( $update_sql );
1002
- }
1003
-
1004
- //Update 0.9.4
1005
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'randomness_order'") != "randomness_order")
1006
- {
1007
- $sql = "ALTER TABLE ".$table_name." ADD randomness_order INT NOT NULL AFTER system";
1008
- $results = $wpdb->query( $sql );
1009
- $update_sql = "UPDATE ".$table_name." SET randomness_order=0";
1010
- $results = $wpdb->query( $update_sql );
1011
- }
1012
-
1013
- //Update 0.9.5
1014
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_answer_template'") != "question_answer_template")
1015
- {
1016
- $sql = "ALTER TABLE ".$table_name." ADD question_answer_template TEXT NOT NULL AFTER comment_field_text";
1017
- $results = $wpdb->query( $sql );
1018
- $mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
1019
- $update_sql = "UPDATE ".$table_name." SET question_answer_template='".$mlw_question_answer_default."'";
1020
- $results = $wpdb->query( $update_sql );
1021
- }
1022
-
1023
- //Update 0.9.6
1024
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'contact_info_location'") != "contact_info_location")
1025
- {
1026
- $sql = "ALTER TABLE ".$table_name." ADD contact_info_location INT NOT NULL AFTER send_admin_email";
1027
- $results = $wpdb->query( $sql );
1028
- $update_sql = "UPDATE ".$table_name." SET contact_info_location=0";
1029
- $results = $wpdb->query( $update_sql );
1030
- }
1031
-
1032
- //Update 1.0
1033
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'email_from_text'") != "email_from_text")
1034
- {
1035
- $sql = "ALTER TABLE ".$table_name." ADD email_from_text TEXT NOT NULL AFTER comment_field_text";
1036
- $results = $wpdb->query( $sql );
1037
- $update_sql = "UPDATE ".$table_name." SET email_from_text='Wordpress'";
1038
- $results = $wpdb->query( $update_sql );
1039
- }
1040
-
1041
- //Update 1.3.1
1042
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'loggedin_user_contact'") != "loggedin_user_contact")
1043
- {
1044
- $sql = "ALTER TABLE ".$table_name." ADD loggedin_user_contact INT NOT NULL AFTER randomness_order";
1045
- $results = $wpdb->query( $sql );
1046
- $update_sql = "UPDATE ".$table_name." SET loggedin_user_contact=0";
1047
- $results = $wpdb->query( $update_sql );
1048
- }
1049
-
1050
- //Update 1.5.1
1051
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_from_total'") != "question_from_total")
1052
- {
1053
- $sql = "ALTER TABLE ".$table_name." ADD question_from_total INT NOT NULL AFTER comment_section";
1054
- $results = $wpdb->query( $sql );
1055
- $update_sql = "UPDATE ".$table_name." SET question_from_total=0";
1056
- $results = $wpdb->query( $update_sql );
1057
- }
1058
-
1059
- //Update 1.6.1
1060
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries'") != "total_user_tries")
1061
- {
1062
- $sql = "ALTER TABLE ".$table_name." ADD total_user_tries INT NOT NULL AFTER question_from_total";
1063
- $results = $wpdb->query( $sql );
1064
- $update_sql = "UPDATE ".$table_name." SET total_user_tries=0";
1065
- $results = $wpdb->query( $update_sql );
1066
- }
1067
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries_text'") != "total_user_tries_text")
1068
- {
1069
- $sql = "ALTER TABLE ".$table_name." ADD total_user_tries_text TEXT NOT NULL AFTER total_user_tries";
1070
- $results = $wpdb->query( $sql );
1071
- $update_sql = "UPDATE ".$table_name." SET total_user_tries_text='Enter Your Text Here'";
1072
- $results = $wpdb->query( $update_sql );
1073
- }
1074
-
1075
- //Update 1.8.1
1076
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'message_end_template'") != "message_end_template")
1077
- {
1078
- $sql = "ALTER TABLE ".$table_name." ADD message_end_template TEXT NOT NULL AFTER message_comment";
1079
- $results = $wpdb->query( $sql );
1080
- $update_sql = "UPDATE ".$table_name." SET message_end_template=''";
1081
- $results = $wpdb->query( $update_sql );
1082
- }
1083
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'certificate_template'") != "certificate_template")
1084
- {
1085
- $sql = "ALTER TABLE ".$table_name." ADD certificate_template TEXT NOT NULL AFTER total_user_tries_text";
1086
- $results = $wpdb->query( $sql );
1087
- $update_sql = "UPDATE ".$table_name." SET certificate_template='Enter your text here!'";
1088
- $results = $wpdb->query( $update_sql );
1089
- }
1090
-
1091
- //Update 1.9.1
1092
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'social_media'") != "social_media")
1093
- {
1094
- $sql = "ALTER TABLE ".$table_name." ADD social_media INT NOT NULL AFTER certificate_template";
1095
- $results = $wpdb->query( $sql );
1096
- $update_sql = "UPDATE ".$table_name." SET social_media='0'";
1097
- $results = $wpdb->query( $update_sql );
1098
- }
1099
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'social_media_text'") != "social_media_text")
1100
- {
1101
- $sql = "ALTER TABLE ".$table_name." ADD social_media_text TEXT NOT NULL AFTER social_media";
1102
- $results = $wpdb->query( $sql );
1103
- $update_sql = "UPDATE ".$table_name." SET social_media_text='I just score a %CORRECT_SCORE%% on %QUIZ_NAME%!'";
1104
- $results = $wpdb->query( $update_sql );
1105
- }
1106
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'pagination'") != "pagination")
1107
- {
1108
- $sql = "ALTER TABLE ".$table_name." ADD pagination INT NOT NULL AFTER social_media_text";
1109
- $results = $wpdb->query( $sql );
1110
- $update_sql = "UPDATE ".$table_name." SET pagination=0";
1111
- $results = $wpdb->query( $update_sql );
1112
- }
1113
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'pagination_text'") != "pagination_text")
1114
- {
1115
- $sql = "ALTER TABLE ".$table_name." ADD pagination_text TEXT NOT NULL AFTER pagination";
1116
- $results = $wpdb->query( $sql );
1117
- $update_sql = "UPDATE ".$table_name." SET pagination_text='Next'";
1118
- $results = $wpdb->query( $update_sql );
1119
- }
1120
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'timer_limit'") != "timer_limit")
1121
- {
1122
- $sql = "ALTER TABLE ".$table_name." ADD timer_limit INT NOT NULL AFTER pagination_text";
1123
- $results = $wpdb->query( $sql );
1124
- $update_sql = "UPDATE ".$table_name." SET timer_limit=0";
1125
- $results = $wpdb->query( $update_sql );
1126
- }
1127
-
1128
- //Update 2.1.1
1129
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'quiz_stye'") != "quiz_stye")
1130
- {
1131
- $sql = "ALTER TABLE ".$table_name." ADD quiz_stye TEXT NOT NULL AFTER timer_limit";
1132
- $results = $wpdb->query( $sql );
1133
- $mlw_style_default = "
1134
- div.mlw_qmn_quiz input[type=radio],
1135
- div.mlw_qmn_quiz input[type=submit],
1136
- div.mlw_qmn_quiz label {
1137
- cursor: pointer;
1138
- }
1139
- div.mlw_qmn_quiz input:not([type=submit]):focus,
1140
- div.mlw_qmn_quiz textarea:focus {
1141
- background: #eaeaea;
1142
- }
1143
- div.mlw_qmn_quiz {
1144
- text-align: left;
1145
- }
1146
- div.quiz_section {
1147
-
1148
- }
1149
- div.mlw_qmn_timer {
1150
- position:fixed;
1151
- top:200px;
1152
- right:0px;
1153
- width:130px;
1154
- color:#00CCFF;
1155
- border-radius: 15px;
1156
- background:#000000;
1157
- text-align: center;
1158
- padding: 15px 15px 15px 15px
1159
- }
1160
- div.mlw_qmn_quiz input[type=submit],
1161
- a.mlw_qmn_quiz_link
1162
- {
1163
- border-radius: 4px;
1164
- position: relative;
1165
- background-image: linear-gradient(#fff,#dedede);
1166
- background-color: #eee;
1167
- border: #ccc solid 1px;
1168
- color: #333;
1169
- text-shadow: 0 1px 0 rgba(255,255,255,.5);
1170
- box-sizing: border-box;
1171
- display: inline-block;
1172
- padding: 5px 5px 5px 5px;
1173
- margin: auto;
1174
- }";
1175
- $update_sql = "UPDATE ".$table_name." SET quiz_stye='".$mlw_style_default."'";
1176
- $results = $wpdb->query( $update_sql );
1177
- }
1178
-
1179
- //Update 2.2.1
1180
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_numbering'") != "question_numbering")
1181
- {
1182
- $sql = "ALTER TABLE ".$table_name." ADD question_numbering INT NOT NULL AFTER quiz_stye";
1183
- $results = $wpdb->query( $sql );
1184
- $update_sql = "UPDATE ".$table_name." SET question_numbering='0'";
1185
- $results = $wpdb->query( $update_sql );
1186
- }
1187
-
1188
- //Update 2.8.1
1189
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'quiz_settings'") != "quiz_settings")
1190
- {
1191
- $sql = "ALTER TABLE ".$table_name." ADD quiz_settings TEXT NOT NULL AFTER question_numbering";
1192
- $results = $wpdb->query( $sql );
1193
- $update_sql = "UPDATE ".$table_name." SET quiz_settings=''";
1194
- $results = $wpdb->query( $update_sql );
1195
- }
1196
-
1197
- //Update 3.0.1
1198
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'theme_selected'") != "theme_selected")
1199
- {
1200
- $sql = "ALTER TABLE ".$table_name." ADD theme_selected TEXT NOT NULL AFTER quiz_settings";
1201
- $results = $wpdb->query( $sql );
1202
- $update_sql = "UPDATE ".$table_name." SET theme_selected='default'";
1203
- $results = $wpdb->query( $update_sql );
1204
- }
1205
-
1206
- //Update 3.3.1
1207
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'last_activity'") != "last_activity")
1208
- {
1209
- $sql = "ALTER TABLE ".$table_name." ADD last_activity DATETIME NOT NULL AFTER theme_selected";
1210
- $results = $wpdb->query( $sql );
1211
- $update_sql = "UPDATE ".$table_name." SET last_activity='".date("Y-m-d H:i:s")."'";
1212
- $results = $wpdb->query( $update_sql );
1213
- }
1214
-
1215
- //Update 3.5.1
1216
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'require_log_in'") != "require_log_in")
1217
- {
1218
- $sql = "ALTER TABLE ".$table_name." ADD require_log_in INT NOT NULL AFTER last_activity";
1219
- $results = $wpdb->query( $sql );
1220
- $update_sql = "UPDATE ".$table_name." SET require_log_in='0'";
1221
- $results = $wpdb->query( $update_sql );
1222
- }
1223
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'require_log_in_text'") != "require_log_in_text")
1224
- {
1225
- $sql = "ALTER TABLE ".$table_name." ADD require_log_in_text TEXT NOT NULL AFTER require_log_in";
1226
- $results = $wpdb->query( $sql );
1227
- $update_sql = "UPDATE ".$table_name." SET require_log_in_text='Enter Text Here'";
1228
- $results = $wpdb->query( $update_sql );
1229
- }
1230
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries'") != "limit_total_entries")
1231
- {
1232
- $sql = "ALTER TABLE ".$table_name." ADD limit_total_entries INT NOT NULL AFTER require_log_in_text";
1233
- $results = $wpdb->query( $sql );
1234
- $update_sql = "UPDATE ".$table_name." SET limit_total_entries='0'";
1235
- $results = $wpdb->query( $update_sql );
1236
- }
1237
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'limit_total_entries_text'") != "limit_total_entries_text")
1238
- {
1239
- $sql = "ALTER TABLE ".$table_name." ADD limit_total_entries_text TEXT NOT NULL AFTER limit_total_entries";
1240
- $results = $wpdb->query( $sql );
1241
- $update_sql = "UPDATE ".$table_name." SET limit_total_entries_text='Enter Text Here'";
1242
- $results = $wpdb->query( $update_sql );
1243
- }
1244
-
1245
- //Update 3.7.1
1246
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe'") != "scheduled_timeframe")
1247
- {
1248
- $sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe TEXT NOT NULL AFTER limit_total_entries_text";
1249
- $results = $wpdb->query( $sql );
1250
- $update_sql = "UPDATE ".$table_name." SET scheduled_timeframe=''";
1251
- $results = $wpdb->query( $update_sql );
1252
- }
1253
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'scheduled_timeframe_text'") != "scheduled_timeframe_text")
1254
- {
1255
- $sql = "ALTER TABLE ".$table_name." ADD scheduled_timeframe_text TEXT NOT NULL AFTER scheduled_timeframe";
1256
- $results = $wpdb->query( $sql );
1257
- $update_sql = "UPDATE ".$table_name." SET scheduled_timeframe_text='Enter Text Here'";
1258
- $results = $wpdb->query( $update_sql );
1259
- }
1260
-
1261
- //Update 4.3.0
1262
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'disable_answer_onselect'") != "disable_answer_onselect")
1263
- {
1264
- $sql = "ALTER TABLE ".$table_name." ADD disable_answer_onselect INT NOT NULL AFTER scheduled_timeframe_text";
1265
- $results = $wpdb->query( $sql );
1266
- $update_sql = "UPDATE ".$table_name." SET disable_answer_onselect=0";
1267
- $results = $wpdb->query( $update_sql );
1268
- }
1269
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'ajax_show_correct'") != "ajax_show_correct")
1270
- {
1271
- $sql = "ALTER TABLE ".$table_name." ADD ajax_show_correct INT NOT NULL AFTER disable_answer_onselect";
1272
- $results = $wpdb->query( $sql );
1273
- $update_sql = "UPDATE ".$table_name." SET ajax_show_correct=0";
1274
- $results = $wpdb->query( $update_sql );
1275
- }
1276
-
1277
- global $wpdb;
1278
- $table_name = $wpdb->prefix . "mlw_questions";
1279
- //Update 0.5
1280
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'comments'") != "comments")
1281
- {
1282
- $sql = "ALTER TABLE ".$table_name." ADD comments INT NOT NULL AFTER correct_answer";
1283
- $results = $wpdb->query( $sql );
1284
- $sql = "ALTER TABLE ".$table_name." ADD hints TEXT NOT NULL AFTER comments";
1285
- $results = $wpdb->query( $sql );
1286
- $update_sql = "UPDATE ".$table_name." SET comments=1, hints=''";
1287
- $results = $wpdb->query( $update_sql );
1288
- }
1289
- //Update 0.8
1290
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_order'") != "question_order")
1291
- {
1292
- $sql = "ALTER TABLE ".$table_name." ADD question_order INT NOT NULL AFTER hints";
1293
- $results = $wpdb->query( $sql );
1294
- $update_sql = "UPDATE ".$table_name." SET question_order=0";
1295
- $results = $wpdb->query( $update_sql );
1296
- }
1297
-
1298
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_type'") != "question_type")
1299
- {
1300
- $sql = "ALTER TABLE ".$table_name." ADD question_type INT NOT NULL AFTER question_order";
1301
- $results = $wpdb->query( $sql );
1302
- $update_sql = "UPDATE ".$table_name." SET question_type=0";
1303
- $results = $wpdb->query( $update_sql );
1304
- }
1305
-
1306
- //Update 1.1.1
1307
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_answer_info'") != "question_answer_info")
1308
- {
1309
- $sql = "ALTER TABLE ".$table_name." ADD question_answer_info TEXT NOT NULL AFTER correct_answer";
1310
- $results = $wpdb->query( $sql );
1311
- $update_sql = "UPDATE ".$table_name." SET question_answer_info=''";
1312
- $results = $wpdb->query( $update_sql );
1313
- }
1314
-
1315
- //Update 2.5.1
1316
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'answer_array'") != "answer_array")
1317
- {
1318
- $sql = "ALTER TABLE ".$table_name." ADD answer_array TEXT NOT NULL AFTER question_name";
1319
- $results = $wpdb->query( $sql );
1320
- $update_sql = "UPDATE ".$table_name." SET answer_array=''";
1321
- $results = $wpdb->query( $update_sql );
1322
- }
1323
-
1324
- //Update 3.1.1
1325
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_settings'") != "question_settings")
1326
- {
1327
- $sql = "ALTER TABLE ".$table_name." ADD question_settings TEXT NOT NULL AFTER question_type";
1328
- $results = $wpdb->query( $sql );
1329
- $update_sql = "UPDATE ".$table_name." SET question_settings=''";
1330
- $results = $wpdb->query( $update_sql );
1331
- }
1332
-
1333
- //Update 4.0.0
1334
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'category'") != "category")
1335
- {
1336
- $sql = "ALTER TABLE ".$table_name." ADD category TEXT NOT NULL AFTER question_settings";
1337
- $results = $wpdb->query( $sql );
1338
- $update_sql = "UPDATE ".$table_name." SET category=''";
1339
- $results = $wpdb->query( $update_sql );
1340
- }
1341
-
1342
- //Update 4.0.0
1343
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'question_type_new'") != "question_type_new")
1344
- {
1345
- $sql = "ALTER TABLE ".$table_name." ADD question_type_new TEXT NOT NULL AFTER question_type";
1346
- $results = $wpdb->query( $sql );
1347
- $update_sql = "UPDATE ".$table_name." SET question_type_new=question_type";
1348
- $results = $wpdb->query( $update_sql );
1349
- }
1350
-
1351
- //Update 2.6.1
1352
- $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" );
1353
- $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_questions CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
1354
- $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_quizzes CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
1355
- $results = $wpdb->query( "ALTER TABLE ".$wpdb->prefix . "mlw_results CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" );
1356
-
1357
-
1358
- global $wpdb;
1359
- $table_name = $wpdb->prefix . "mlw_results";
1360
- //Update 2.6.4
1361
- if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'user'") != "user")
1362
- {
1363
- $sql = "ALTER TABLE ".$table_name." ADD user INT NOT NULL AFTER phone";
1364
- $results = $wpdb->query( $sql );
1365
- $update_sql = "UPDATE ".$table_name." SET user=0";
1366
- $results = $wpdb->query( $update_sql );
1367
- }
1368
-
1369
- // Update 4.7.0
1370
- if( $wpdb->get_var( "SHOW COLUMNS FROM $table_name LIKE 'user_ip'" ) != "user_ip" ) {
1371
- $sql = "ALTER TABLE $table_name ADD user_ip TEXT NOT NULL AFTER user";
1372
- $results = $wpdb->query( $sql );
1373
- $update_sql = "UPDATE $table_name SET user_ip='Unknown'";
1374
- $results = $wpdb->query( $update_sql );
1375
- }
1376
-
1377
- // Update 5.0.0
1378
- $settings = (array) get_option( 'qmn-settings', array() );
1379
- if ( ! isset( $settings['results_details_template'] ) ) {
1380
- $settings['results_details_template'] = "<h2>Quiz Results for %QUIZ_NAME%</h2>
1381
- <p>%CONTACT_ALL%</p>
1382
- <p>Name Provided: %USER_NAME%</p>
1383
- <p>Business Provided: %USER_BUSINESS%</p>
1384
- <p>Phone Provided: %USER_PHONE%</p>
1385
- <p>Email Provided: %USER_EMAIL%</p>
1386
- <p>Score Received: %AMOUNT_CORRECT%/%TOTAL_QUESTIONS% or %CORRECT_SCORE%% or %POINT_SCORE% points</p>
1387
- <h2>Answers Provided:</h2>
1388
- <p>The user took %TIMER% to complete quiz.</p>
1389
- <p>Comments entered were: %COMMENT_SECTION%</p>
1390
- <p>The answers were as follows:</p>
1391
- %QUESTIONS_ANSWERS%";
1392
- update_option( 'qmn-settings' , $settings );
1393
- }
1394
-
1395
- update_option('mlw_quiz_master_version' , $data);
1396
- }
1397
- if ( ! get_option('mlw_advert_shows') ) {
1398
- add_option( 'mlw_advert_shows' , 'true' );
1399
- }
1400
- }
1401
-
1402
- /**
1403
- * Adds new links to the plugin action links
1404
- *
1405
- * @since 4.7.1
1406
- */
1407
- public function plugin_action_links( $links ) {
1408
- $action_links = array(
1409
- 'settings' => '<a href="' . admin_url( 'admin.php?page=' . QSM_PLUGIN_BASENAME ) . '" title="' . esc_attr( __( 'Quizzes/Surveys', 'quiz-master-next' ) ) . '">' . __( 'Quizzes/Surveys', 'quiz-master-next' ) . '</a>',
1410
- );
1411
- return array_merge( $action_links, $links );
1412
- }
1413
-
1414
- /**
1415
- * Adds new links to the plugin row meta
1416
- *
1417
- * @since 4.7.1
1418
- */
1419
- public function plugin_row_meta( $links, $file ) {
1420
- if ( $file == QSM_PLUGIN_BASENAME ) {
1421
- $row_meta = array(
1422
- 'docs' => '<a href="' . esc_url( 'https://docs.quizandsurveymaster.com/' ) . '" title="' . esc_attr( __( 'View Documentation', 'quiz-master-next' ) ) . '">' . __( 'Documentation', 'quiz-master-next' ) . '</a>',
1423
- 'support' => '<a href="' . admin_url( 'admin.php?page=qsm_quiz_help' ) . '" title="' . esc_attr( __( 'Create Support Ticket', 'quiz-master-next' ) ) . '">' . __( 'Support', 'quiz-master-next' ) . '</a>',
1424
- );
1425
- return array_merge( $links, $row_meta );
1426
- }
1427
-
1428
- return (array) $links;
1429
-
1430
- }
1431
- }
1432
-
1433
- $qsm_install = new QSM_Install();
1434
-
1435
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-questions.php DELETED
@@ -1,318 +0,0 @@
1
- <?php
2
- /**
3
- * File that contains class for questions.
4
- *
5
- * @package QSM
6
- */
7
-
8
- /**
9
- * Class that handles all creating, saving, and deleting of questions.
10
- *
11
- * @since 5.2.0
12
- */
13
- class QSM_Questions {
14
-
15
- /**
16
- * Loads single question using question ID
17
- *
18
- * @since 5.2.0
19
- * @param int $question_id The ID of the question.
20
- * @return array The data for the question.
21
- */
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'] );
29
- if ( ! is_array( $answers ) ) {
30
- $answers = array();
31
- }
32
- $question['answers'] = $answers;
33
-
34
- $settings = maybe_unserialize( $question['question_settings'] );
35
- if ( ! is_array( $settings ) ) {
36
- $settings = array( 'required' => 1 );
37
- }
38
- $question['settings'] = $settings;
39
-
40
- return $question;
41
- }
42
- return array();
43
- }
44
-
45
- /**
46
- * Loads questions for a quiz using the new page system
47
- *
48
- * @since 5.2.0
49
- * @param int $quiz_id The ID of the quiz.
50
- * @return array The array of questions.
51
- */
52
- public static function load_questions_by_pages( $quiz_id ) {
53
-
54
- // Prepares our variables.
55
- global $wpdb;
56
- global $mlwQuizMasterNext;
57
- $quiz_id = intval( $quiz_id );
58
- $question_ids = array();
59
- $questions = array();
60
- $page_for_ids = array();
61
-
62
- // Gets the pages for the quiz.
63
- $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id );
64
- $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() );
65
-
66
- // Get all question IDs needed.
67
- $total_pages = count( $pages );
68
- for ( $i = 0; $i < $total_pages; $i++ ) {
69
- foreach ( $pages[ $i ] as $question ) {
70
- $question_id = intval( $question );
71
- $question_ids[] = $question_id;
72
- $page_for_ids[ $question_id ] = $i;
73
- }
74
- }
75
-
76
- // If we have any question IDs, get the questions.
77
- if ( count( $question_ids ) > 0 ) {
78
-
79
- $question_sql = implode( ', ', $question_ids );
80
-
81
- // Get all questions.
82
- $question_array = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id IN ($question_sql)", 'ARRAY_A' );
83
-
84
- // Loop through questions and prepare serialized data.
85
- foreach ( $question_array as $question ) {
86
-
87
- // Prepare answers.
88
- $answers = maybe_unserialize( $question['answer_array'] );
89
- if ( ! is_array( $answers ) ) {
90
- $answers = array();
91
- }
92
- $question['answers'] = $answers;
93
-
94
- // Prepares settings.
95
- $settings = maybe_unserialize( $question['question_settings'] );
96
- if ( ! is_array( $settings ) ) {
97
- $settings = array( 'required' => 1 );
98
- }
99
- $question['settings'] = $settings;
100
-
101
- // Get the page.
102
- $question_id = intval( $question['question_id'] );
103
- $question['page'] = intval( $page_for_ids[ $question_id ] );
104
-
105
- $questions[ $question_id ] = $question;
106
- }
107
- } else {
108
- // If we do not have pages on this quiz yet, use older load_questions and add page to them.
109
- $questions = self::load_questions( $quiz_id );
110
- foreach ( $questions as $key => $question ) {
111
- $questions[ $key ]['page'] = isset( $question['page'] ) ? $question['page'] : 0;
112
- }
113
- }
114
- return $questions;
115
- }
116
-
117
- /**
118
- * Loads questions for a quiz
119
- *
120
- * @since 5.2.0
121
- * @param int $quiz_id The ID of the quiz.
122
- * @return array The array of questions.
123
- */
124
- public static function load_questions( $quiz_id ) {
125
-
126
- global $wpdb;
127
- $question_array = array();
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' );
135
- }
136
-
137
- // Loop through questions and prepare serialized data.
138
- foreach ( $questions as $question ) {
139
-
140
- // Prepare answers.
141
- $answers = maybe_unserialize( $question['answer_array'] );
142
- if ( ! is_array( $answers ) ) {
143
- $answers = array();
144
- }
145
- $question['answers'] = $answers;
146
-
147
- $settings = maybe_unserialize( $question['question_settings'] );
148
- if ( ! is_array( $settings ) ) {
149
- $settings = array( 'required' => 1 );
150
- }
151
- $question['settings'] = $settings;
152
-
153
- $question_array[ $question['question_id'] ] = $question;
154
- }
155
- return $question_array;
156
- }
157
-
158
- /**
159
- * Creates a new question
160
- *
161
- * @since 5.2.0
162
- * @param array $data The question data.
163
- * @param array $answers The answers for the question.
164
- * @param array $settings Any settings for the question.
165
- * @throws Exception Throws exception if wpdb query results in error.
166
- * @return int The ID of the question that was created.
167
- */
168
- public static function create_question( $data, $answers = array(), $settings = array() ) {
169
- return self::create_save_question( $data, $answers, $settings );
170
- }
171
-
172
- /**
173
- * Saves a question
174
- *
175
- * @since 5.2.0
176
- * @param int $question_id The ID of the question to be saved.
177
- * @param array $data The question data.
178
- * @param array $answers The answers for the question.
179
- * @param array $settings Any settings for the question.
180
- * @throws Exception Throws exception if wpdb query results in error.
181
- * @return int The ID of the question that was saved.
182
- */
183
- public static function save_question( $question_id, $data, $answers = array(), $settings = array() ) {
184
- $data['ID'] = intval( $question_id );
185
- return self::create_save_question( $data, $answers, $settings, false );
186
- }
187
-
188
- /**
189
- * Deletes a question
190
- *
191
- * @since 5.2.0
192
- * @param int $question_id The ID for the question.
193
- * @throws Exception Throws exception if wpdb query results in error.
194
- * @return bool True if successful
195
- */
196
- public static function delete_question( $question_id ) {
197
- global $wpdb;
198
-
199
- $results = $wpdb->update(
200
- $wpdb->prefix . 'mlw_questions',
201
- array(
202
- 'deleted' => 1,
203
- ),
204
- array( 'question_id' => intval( $question_id ) ),
205
- array(
206
- '%d',
207
- ),
208
- array( '%d' )
209
- );
210
-
211
- if ( false === $results ) {
212
- $msg = $wpdb->last_error . ' from ' . $wpdb->last_query;
213
- $mlwQuizMasterNext->log_manager->add( 'Error when deleting question', $msg, 0, 'error' );
214
- throw new Exception( $msg );
215
- }
216
-
217
- return true;
218
- }
219
-
220
- /**
221
- * Creates or saves a question
222
- *
223
- * This is used internally. Use create_question or save_question instead.
224
- *
225
- * @since 5.2.0
226
- * @param array $data The question data.
227
- * @param array $answers The answers for the question.
228
- * @param array $settings Any settings for the question.
229
- * @param bool $is_creating True if question is being created, false if being saved.
230
- * @throws Exception Throws exception if wpdb query results in error.
231
- * @return int The ID of the question that was created/saved.
232
- */
233
- private static function create_save_question( $data, $answers, $settings, $is_creating = true ) {
234
- global $wpdb;
235
-
236
- // Prepare defaults and parse.
237
- $defaults = array(
238
- 'quiz_id' => 0,
239
- 'type' => '0',
240
- 'name' => '',
241
- 'answer_info' => '',
242
- 'comments' => '1',
243
- 'hint' => '',
244
- 'order' => 1,
245
- 'category' => '',
246
- );
247
- $data = wp_parse_args( $data, $defaults );
248
-
249
- $defaults = array(
250
- 'required' => 1,
251
- );
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(
263
- 'quiz_id' => intval( $data['quiz_id'] ),
264
- 'question_name' => trim( preg_replace( '/\s+/', ' ', htmlspecialchars( nl2br( wp_kses_post( $data['name'] ) ), ENT_QUOTES ) ) ),
265
- 'answer_array' => serialize( $answers ),
266
- 'question_answer_info' => htmlspecialchars( $data['answer_info'], ENT_QUOTES ),
267
- 'comments' => htmlspecialchars( $data['comments'], ENT_QUOTES ),
268
- 'hints' => htmlspecialchars( $data['hint'], ENT_QUOTES ),
269
- 'question_order' => intval( $data['order'] ),
270
- 'question_type_new' => sanitize_text_field( $data['type'] ),
271
- 'question_settings' => serialize( $settings ),
272
- 'category' => sanitize_text_field( $data['category'] ),
273
- 'deleted' => 0,
274
- );
275
-
276
- $types = array(
277
- '%d',
278
- '%s',
279
- '%s',
280
- '%s',
281
- '%d',
282
- '%s',
283
- '%d',
284
- '%s',
285
- '%s',
286
- '%s',
287
- '%d',
288
- );
289
-
290
- if ( $is_creating ) {
291
- $results = $wpdb->insert(
292
- $wpdb->prefix . 'mlw_questions',
293
- $values,
294
- $types
295
- );
296
- } else {
297
- $results = $wpdb->update(
298
- $wpdb->prefix . 'mlw_questions',
299
- $values,
300
- array( 'question_id' => intval( $data['ID'] ) ),
301
- $types,
302
- array( '%d' )
303
- );
304
- }
305
-
306
- if ( false === $results ) {
307
- $msg = $wpdb->last_error . ' from ' . $wpdb->last_query;
308
- $mlwQuizMasterNext->log_manager->add( 'Error when creating/saving question', $msg, 0, 'error' );
309
- throw new Exception( $msg );
310
- }
311
-
312
- if ( $is_creating ) {
313
- return $wpdb->insert_id;
314
- } else {
315
- return $data['ID'];
316
- }
317
- }
318
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-results-pages.php DELETED
@@ -1,350 +0,0 @@
1
- <?php
2
- /**
3
- * Handles relevant functions for results pages
4
- *
5
- * @package QSM
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- /**
13
- * This class contains functions for loading, saving, and generating results pages.
14
- *
15
- * @since 6.2.0
16
- */
17
- class QSM_Results_Pages {
18
-
19
- /**
20
- * Creates the HTML for the results page.
21
- *
22
- * @since 6.2.0
23
- * @param array $response_data The data for the user's submission.
24
- * @return string The HTML for the page to be displayed.
25
- */
26
- public static function generate_pages( $response_data ) {
27
- $pages = QSM_Results_Pages::load_pages( $response_data['quiz_id'] );
28
- $default = '%QUESTIONS_ANSWERS%';
29
- $redirect = false;
30
- $default_redirect = false;
31
- ob_start();
32
- ?>
33
- <div class="qsm-results-page">
34
- <?php
35
- do_action( 'qsm_before_results_page' );
36
-
37
- // Cycles through each possible page.
38
- foreach ( $pages as $page ) {
39
-
40
- // Checks if any conditions are present. Else, set it as the default.
41
- if ( ! empty( $page['conditions'] ) ) {
42
- /**
43
- * Since we have many conditions to test, we set this to true first.
44
- * Then, we test each condition to see if it fails.
45
- * If one condition fails, the value will be set to false.
46
- * If all conditions pass, this will still be true and the page will
47
- * be shown.
48
- */
49
- $show = true;
50
-
51
- // Cycle through each condition to see if we should show this page.
52
- foreach ( $page['conditions'] as $condition ) {
53
- $value = $condition['value'];
54
-
55
- // First, determine which value we need to test.
56
- switch ( $condition['criteria'] ) {
57
- case 'score':
58
- $test = $response_data['total_score'];
59
- break;
60
-
61
- case 'points':
62
- $test = $response_data['total_points'];
63
- break;
64
-
65
- default:
66
- $test = 0;
67
- break;
68
- }
69
-
70
- // Then, determine how to test the vaue.
71
- switch ( $condition['operator'] ) {
72
- case 'greater-equal':
73
- if ( $test < $value ) {
74
- $show = false;
75
- }
76
- break;
77
-
78
- case 'greater':
79
- if ( $test <= $value ) {
80
- $show = false;
81
- }
82
- break;
83
-
84
- case 'less-equal':
85
- if ( $test > $value ) {
86
- $show = false;
87
- }
88
- break;
89
-
90
- case 'less':
91
- if ( $test >= $value ) {
92
- $show = false;
93
- }
94
- break;
95
-
96
- case 'not-equal':
97
- if ( $test == $value ) {
98
- $show = false;
99
- }
100
- break;
101
-
102
- case 'equal':
103
- default:
104
- if ( $test != $value ) {
105
- $show = false;
106
- }
107
- break;
108
- }
109
-
110
- /**
111
- * Added custom criterias/operators to the results pages?
112
- * Use this filter to check if the condition passed.
113
- * If it fails your conditions, return false to prevent the
114
- * page from showing.
115
- * If it passes your condition or is not your custom criterias
116
- * or operators, then return the value as-is.
117
- * DO NOT RETURN TRUE IF IT PASSES THE CONDITION!!!
118
- * The value may have been set to false when failing a previous condition.
119
- */
120
- $show = apply_filters( 'qsm_results_page_condition_check', $show, $condition, $response_data );
121
- }
122
-
123
- // If we passed all conditions, show this page.
124
- if ( $show ) {
125
- $content = $page['page'];
126
- if ( $page['redirect'] ) {
127
- $redirect = $page['redirect'];
128
- }
129
- }
130
- } else {
131
- $default = $page['page'];
132
- if ( $page['redirect'] ) {
133
- $default_redirect = $page['redirect'];
134
- }
135
- }
136
- }
137
-
138
- // If no page was set to the content, set to the page that was a default page.
139
- if ( empty( $content ) ) {
140
- $content = $default;
141
- }
142
-
143
- // If no redirect was set, set to default redirect.
144
- if ( ! $redirect ) {
145
- $redirect = $default_redirect;
146
- }
147
-
148
- // Decodes special characters, runs through our template
149
- // variables, and then outputs the text.
150
- $page = htmlspecialchars_decode( $content, ENT_QUOTES );
151
- $page = apply_filters( 'mlw_qmn_template_variable_results_page', $page, $response_data );
152
- echo str_replace( "\n", '<br>', $page );
153
- do_action( 'qsm_after_results_page' );
154
- ?>
155
- </div>
156
- <?php
157
- return array(
158
- 'display' => do_shortcode( ob_get_clean() ),
159
- 'redirect' => $redirect,
160
- );
161
- }
162
-
163
- /**
164
- * Loads the results pages for a single quiz.
165
- *
166
- * @since 6.2.0
167
- * @param int $quiz_id The ID for the quiz.
168
- * @return bool|array The array of pages or false.
169
- */
170
- public static function load_pages( $quiz_id ) {
171
- $pages = array();
172
- $quiz_id = intval( $quiz_id );
173
-
174
- // If the parameter supplied turns to 0 after intval, returns false.
175
- if ( 0 === $quiz_id ) {
176
- return false;
177
- }
178
-
179
- global $wpdb;
180
- $results = $wpdb->get_var( $wpdb->prepare( "SELECT message_after FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $quiz_id ) );
181
-
182
- // Checks if the results is an array.
183
- if ( is_serialized( $results ) && is_array( maybe_unserialize( $results ) ) ) {
184
- $results = maybe_unserialize( $results );
185
-
186
- // Checks if the results array is not the newer version.
187
- if ( ! empty( $results ) && ! isset( $results[0]['conditions'] ) ) {
188
- $pages = QSM_Results_Pages::convert_to_new_system( $quiz_id );
189
- } else {
190
- $pages = $results;
191
- }
192
- } else {
193
- $pages = QSM_Results_Pages::convert_to_new_system( $quiz_id );
194
- }
195
-
196
- return $pages;
197
- }
198
-
199
- /**
200
- * Loads and converts results pages from the old system to new system
201
- *
202
- * @since 6.2.0
203
- * @param int $quiz_id The ID for the quiz.
204
- * @return array The combined newer versions of the pages.
205
- */
206
- public static function convert_to_new_system( $quiz_id ) {
207
- $pages = array();
208
- $quiz_id = intval( $quiz_id );
209
-
210
- // If the parameter supplied turns to 0 after intval, returns empty array.
211
- if ( 0 === $quiz_id ) {
212
- return $pages;
213
- }
214
-
215
- /**
216
- * Loads the old results pages and converts them.
217
- */
218
- global $wpdb;
219
- global $mlwQuizMasterNext;
220
- $data = $wpdb->get_row( $wpdb->prepare( "SELECT message_after FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d", $quiz_id ), ARRAY_A );
221
- $system = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'system', 0 );
222
- $old_pages = maybe_unserialize( $data['message_after'] );
223
-
224
- // If the value is an array, convert it.
225
- // If not, use it as the contents of the results page.
226
- if ( is_array( $old_pages ) ) {
227
-
228
- // Cycle through the older version of results pages.
229
- foreach ( $old_pages as $page ) {
230
- $new_page = array(
231
- 'conditions' => array(),
232
- 'page' => $page[2],
233
- 'redirect' => false,
234
- );
235
-
236
- // If the page used the older version of the redirect, add it.
237
- if ( ! empty( $page['redirect_url'] ) ) {
238
- $new_page['redirect'] = $page['redirect_url'];
239
- }
240
-
241
- // Checks to see if the page is not the older version's default page.
242
- if ( 0 !== intval( $page[0] ) || 0 !== intval( $page[1] ) ) {
243
-
244
- // Checks if the system is points.
245
- if ( 1 === intval( $system ) ) {
246
- $new_page['conditions'][] = array(
247
- 'criteria' => 'points',
248
- 'operator' => 'greater-equal',
249
- 'value' => $page[0],
250
- );
251
- $new_page['conditions'][] = array(
252
- 'criteria' => 'points',
253
- 'operator' => 'less-equal',
254
- 'value' => $page[1],
255
- );
256
- } else {
257
- $new_page['conditions'][] = array(
258
- 'criteria' => 'score',
259
- 'operator' => 'greater-equal',
260
- 'value' => $page[0],
261
- );
262
- $new_page['conditions'][] = array(
263
- 'criteria' => 'score',
264
- 'operator' => 'less-equal',
265
- 'value' => $page[1],
266
- );
267
- }
268
- }
269
-
270
- $pages[] = $new_page;
271
- }
272
- } else {
273
- $pages[] = array(
274
- 'conditions' => array(),
275
- 'page' => $old_pages,
276
- 'redirect' => false,
277
- );
278
- }
279
-
280
- // Updates the database with new array to prevent running this step next time.
281
- $wpdb->update(
282
- $wpdb->prefix . 'mlw_quizzes',
283
- array( 'message_after' => serialize( $pages ) ),
284
- array( 'quiz_id' => $quiz_id ),
285
- array( '%s' ),
286
- array( '%d' )
287
- );
288
-
289
- return $pages;
290
- }
291
-
292
- /**
293
- * Saves the results pages for a quiz.
294
- *
295
- * @since 6.2.0
296
- * @param int $quiz_id The ID for the quiz.
297
- * @param array $pages The results pages to be saved.
298
- * @return bool True or false depending on success.
299
- */
300
- public static function save_pages( $quiz_id, $pages ) {
301
- if ( ! is_array( $pages ) ) {
302
- return false;
303
- }
304
-
305
- $quiz_id = intval( $quiz_id );
306
- if ( 0 === $quiz_id ) {
307
- return false;
308
- }
309
-
310
- // Sanitizes data in pages.
311
- $total = count( $pages );
312
- for ( $i = 0; $i < $total; $i++ ) {
313
-
314
- // jQuery AJAX will send a string version of false.
315
- if ( 'false' === $pages[ $i ]['redirect'] ) {
316
- $pages[ $i ]['redirect'] = false;
317
- }
318
-
319
- /**
320
- * The jQuery AJAX function won't send the conditions key
321
- * if it's empty. So, check if it's set. If set, sanitize
322
- * data. If not set, set to empty array.
323
- */
324
- if ( isset( $pages[ $i ]['conditions'] ) ) {
325
- // Sanitizes the conditions.
326
- $total_conditions = count( $pages[ $i ]['conditions'] );
327
- for ( $j = 0; $j < $total_conditions; $j++ ) {
328
- $pages[ $i ]['conditions'][ $j ]['value'] = sanitize_text_field( $pages[ $i ]['conditions'][ $j ]['value'] );
329
- }
330
- } else {
331
- $pages[ $i ]['conditions'] = array();
332
- }
333
- }
334
-
335
- global $wpdb;
336
- $results = $wpdb->update(
337
- $wpdb->prefix . 'mlw_quizzes',
338
- array( 'message_after' => serialize( $pages ) ),
339
- array( 'quiz_id' => $quiz_id ),
340
- array( '%s' ),
341
- array( '%d' )
342
- );
343
- if ( false !== $results ) {
344
- return true;
345
- } else {
346
- return false;
347
- }
348
- }
349
- }
350
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-settings.php DELETED
@@ -1,434 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit;
4
-
5
- /**
6
- * This handles all of the settings data for each individual quiz.
7
- *
8
- * @since 5.0.0
9
- */
10
- class QSM_Quiz_Settings {
11
-
12
- /**
13
- * ID of the quiz
14
- *
15
- * @var int
16
- * @since 5.0.0
17
- */
18
- private $quiz_id;
19
-
20
- /**
21
- * The settings for the quiz
22
- *
23
- * @var array
24
- * @since 5.0.0
25
- */
26
- private $settings;
27
-
28
- /**
29
- * The fields that have been registered
30
- *
31
- * @var array
32
- * @since 5.0.0
33
- */
34
- private $registered_fields;
35
-
36
- /**
37
- * Prepares the settings for the supplied quiz
38
- *
39
- * @since 5.0.0
40
- * @param int $quiz_id the ID of the quiz that we are handling the settings data for
41
- */
42
- public function prepare_quiz( $quiz_id ) {
43
- $this->quiz_id = intval( $quiz_id );
44
- $this->load_settings();
45
- }
46
-
47
-
48
- /**
49
- * Registers a setting be shown on the Options or Text tab
50
- *
51
- * @since 5.0.0
52
- * @param array $field_array An array of the components for the settings field
53
- */
54
- public function register_setting( $field_array, $section = 'quiz_options' ) {
55
-
56
- /*
57
- Example field array
58
- $field_array = array(
59
- 'id' => 'system',
60
- 'label' => 'Which system is this quiz graded on?',
61
- 'type' => 'text',
62
- 'options' => array(
63
- array(
64
- 'label' => '',
65
- 'value' => ''
66
- )
67
- ),
68
- 'variables' => array(
69
- ''
70
- ),
71
- 'default' => ''
72
- );
73
- */
74
-
75
- // Adds field to registered fields
76
- $this->registered_fields[ $section ][] = $field_array;
77
-
78
- }
79
-
80
- /**
81
- * Retrieves the registered setting fields
82
- *
83
- * @since 5.0.0
84
- * @param string $section The section whose fields that are being retrieved
85
- * @return array All the fields registered the the section provided
86
- */
87
- public function load_setting_fields( $section = 'quiz_options' ) {
88
-
89
- // Checks if section exists in registered fields and returns it if it does
90
- if ( isset( $this->registered_fields[ $section ] ) ) {
91
- return $this->registered_fields[ $section ];
92
- } else {
93
- return false;
94
- }
95
- }
96
-
97
- /**
98
- * Retrieves a setting value from a section based on name of section and setting
99
- *
100
- * @since 5.0.0
101
- * @param string $section The name of the section the setting is registered in
102
- * @param string $setting The name of the setting whose value we need to retrieve
103
- * @param mixed $default What we need to return if no setting exists with given $setting
104
- * @return $mixed Value set for $setting or $default if setting does not exist
105
- */
106
- public function get_section_setting( $section, $setting, $default = false ) {
107
-
108
- // Return if section or setting is empty
109
- if ( empty( $section ) || empty( $setting ) ) {
110
- return $default;
111
- }
112
-
113
- // Get settings in section
114
- $section_settings = $this->get_setting( $section );
115
-
116
- // Return default if section not found
117
- if ( ! $section_settings ) {
118
- return $default;
119
- }
120
-
121
- // Maybe unserailize
122
- $section_settings = maybe_unserialize( $section_settings );
123
-
124
- // Check if setting exists
125
- if ( isset( $section_settings[ $setting ] ) ) {
126
-
127
- // Try to unserialize it and then return it
128
- return maybe_unserialize( $section_settings[ $setting ] );
129
- } else {
130
-
131
- // Return the default if no setting exists
132
- return $default;
133
- }
134
- }
135
-
136
- /**
137
- * Retrieves setting value based on name of setting
138
- *
139
- * @since 5.0.0
140
- * @param string $setting The name of the setting whose value we need to retrieve
141
- * @param mixed $default What we need to return if no setting exists with given $setting
142
- * @return $mixed Value set for $setting or $default if setting does not exist
143
- */
144
- public function get_setting( $setting, $default = false ) {
145
-
146
- global $mlwQuizMasterNext;
147
-
148
- // Return if empty
149
- if ( empty( $setting ) ) {
150
- return false;
151
- }
152
-
153
- // Check if ID is not set, for backwards compatibility
154
- if ( ! $this->quiz_id ) {
155
- $quiz_id = $mlwQuizMasterNext->quizCreator->get_id();
156
-
157
- // If get_id doesn't work, return false
158
- if ( ! $quiz_id ) {
159
- return false;
160
- } else {
161
- $this->prepare_quiz( $quiz_id );
162
- }
163
- }
164
-
165
- // Check if setting exists
166
- if ( isset( $this->settings[ $setting ] ) ) {
167
-
168
- // Try to unserialize it and then return it
169
- return maybe_unserialize( $this->settings[ $setting ] );
170
- } else {
171
-
172
- // Return the default if no setting exists
173
- return $default;
174
- }
175
- }
176
-
177
- /**
178
- * Updates a settings value, adding it if it didn't already exist
179
- *
180
- * @since 5.0.0
181
- * @param string $setting The name of the setting whose value we need to retrieve.
182
- * @param mixed $value The value that needs to be stored for the setting.
183
- * @return bool True if successful or false if fails
184
- */
185
- public function update_setting( $setting, $value ) {
186
-
187
- global $mlwQuizMasterNext;
188
-
189
- // Return if empty.
190
- if ( empty( $setting ) ) {
191
- $mlwQuizMasterNext->log_manager->add( 'Error when updating setting', 'Setting was empty with value equal to ' . print_r( $value, true ), 0, 'error' );
192
- return false;
193
- }
194
-
195
- // Check if ID is not set, for backwards compatibility.
196
- if ( ! $this->quiz_id ) {
197
- $quiz_id = $mlwQuizMasterNext->quizCreator->get_id();
198
-
199
- // If get_id doesn't work, return false.
200
- if ( ! $quiz_id ) {
201
- $mlwQuizMasterNext->log_manager->add( 'Error when updating setting', 'Quiz ID was not found', 0, 'error' );
202
- return false;
203
- } else {
204
- $this->prepare_quiz( $quiz_id );
205
- }
206
- }
207
-
208
- $old_value = $this->get_setting( $setting );
209
-
210
- // If the old value and new value are the same, return false.
211
- if ( $value === $old_value ) {
212
- return true;
213
- }
214
-
215
- // Try to serialize the value.
216
- $serialized_value = maybe_serialize( $value );
217
-
218
- // Set the new value.
219
- $this->settings[ $setting ] = $serialized_value;
220
-
221
- // Update the database.
222
- global $wpdb;
223
- $serialized_settings = serialize( $this->settings );
224
- $results = $wpdb->update(
225
- $wpdb->prefix . 'mlw_quizzes',
226
- array( 'quiz_settings' => $serialized_settings ),
227
- array( 'quiz_id' => $this->quiz_id ),
228
- array( '%s' ),
229
- array( '%d' )
230
- );
231
-
232
- if ( false === $results ) {
233
- $mlwQuizMasterNext->log_manager->add( 'Error when updating setting', $wpdb->last_error . ' from ' . $wpdb->last_query, 0, 'error' );
234
- return false;
235
- } else {
236
- return true;
237
- }
238
- }
239
-
240
- /**
241
- * Loads the settings for the quiz
242
- *
243
- * @since 5.0.0
244
- */
245
- private function load_settings() {
246
-
247
- global $wpdb;
248
- $settings_array = array();
249
-
250
- // Loads the settings from the database
251
- $settings = $wpdb->get_var( $wpdb->prepare( "SELECT quiz_settings FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d", $this->quiz_id ) );
252
-
253
- // Unserializes array
254
- if ( is_serialized( $settings ) && is_array( @unserialize( $settings ) ) ) {
255
- $settings_array = @unserialize( $settings );
256
- }
257
-
258
- // If the value is not an array, create an empty array
259
- if ( ! is_array( $settings_array ) ) {
260
- $settings_array = array();
261
- }
262
-
263
- // If some options are missing
264
- if ( ! isset( $settings_array['quiz_options'] ) || ! isset( $settings_array["quiz_text"] ) || ! isset( $settings_array["quiz_leaderboards"] ) ) {
265
-
266
- // Load the old options system
267
- $quiz_options = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $this->quiz_id ) );
268
-
269
- // If no leadboard is present
270
- if ( ! isset( $settings_array["quiz_leaderboards"] ) ) {
271
-
272
- $settings_array["quiz_leaderboards"] = serialize( array(
273
- 'template' => $quiz_options->leaderboard_template
274
- ) );
275
- }
276
-
277
- // If no options are present
278
- if ( ! isset( $settings_array['quiz_options'] ) ) {
279
-
280
- // Sets up older scheduled timeframe settings
281
- if ( is_serialized( $quiz_options->scheduled_timeframe) && is_array( @unserialize( $quiz_options->scheduled_timeframe ) ) ) {
282
- $scheduled_timeframe = @unserialize( $quiz_options->scheduled_timeframe );
283
- } else {
284
- $scheduled_timeframe = array(
285
- 'start' => '',
286
- 'end' => ''
287
- );
288
- }
289
-
290
- // Prepares new quiz_options section's settings
291
- $settings_array['quiz_options'] = serialize( array(
292
- 'system' => $quiz_options->system,
293
- 'loggedin_user_contact' => $quiz_options->loggedin_user_contact,
294
- 'contact_info_location' => $quiz_options->contact_info_location,
295
- 'user_name' => $quiz_options->user_name,
296
- 'user_comp' => $quiz_options->user_comp,
297
- 'user_email' => $quiz_options->user_email,
298
- 'user_phone' => $quiz_options->user_phone,
299
- 'comment_section' => $quiz_options->comment_section,
300
- 'randomness_order' => $quiz_options->randomness_order,
301
- 'question_from_total' => $quiz_options->question_from_total,
302
- 'total_user_tries' => $quiz_options->total_user_tries,
303
- 'social_media' => $quiz_options->social_media,
304
- 'pagination' => $quiz_options->pagination,
305
- 'timer_limit' => $quiz_options->timer_limit,
306
- 'question_numbering' => $quiz_options->question_numbering,
307
- 'require_log_in' => $quiz_options->require_log_in,
308
- 'limit_total_entries' => $quiz_options->limit_total_entries,
309
- 'scheduled_time_start'=> $scheduled_timeframe["start"],
310
- 'scheduled_time_end' => $scheduled_timeframe["end"],
311
- 'disable_answer_onselect' => $quiz_options->disable_answer_onselect,
312
- 'ajax_show_correct' => $quiz_options->ajax_show_correct
313
- ) );
314
- }
315
-
316
- // If no text is present
317
- if ( ! isset( $settings_array["quiz_text"] ) ) {
318
-
319
- // Sets up older pagination text
320
- if ( is_serialized( $quiz_options->pagination_text) && is_array( @unserialize( $quiz_options->pagination_text ) ) ) {
321
- $pagination_text = @unserialize( $quiz_options->pagination_text );
322
- } else {
323
- $pagination_text = array(
324
- __( 'Previous', 'quiz-master-next' ),
325
- __( 'Next', 'quiz-master-next' )
326
- );
327
- }
328
-
329
- // Sets up older social sharing text
330
- if ( is_serialized( $quiz_options->social_media_text) && is_array( @unserialize( $quiz_options->social_media_text ) ) ) {
331
- $social_media_text = @unserialize( $quiz_options->social_media_text );
332
- } else {
333
- $social_media_text = array(
334
- 'twitter' => $quiz_options->social_media_text,
335
- 'facebook' => $quiz_options->social_media_text
336
-
337
- );
338
- }
339
-
340
- // Prepares new quiz_text section's settings
341
- $settings_array["quiz_text"] = serialize( array(
342
- 'message_before' => $quiz_options->message_before,
343
- 'message_comment' => $quiz_options->message_comment,
344
- 'message_end_template' => $quiz_options->message_end_template,
345
- 'comment_field_text' => $quiz_options->comment_field_text,
346
- 'question_answer_template' => $quiz_options->question_answer_template,
347
- 'submit_button_text' => $quiz_options->submit_button_text,
348
- 'name_field_text' => $quiz_options->name_field_text,
349
- 'business_field_text' => $quiz_options->business_field_text,
350
- 'email_field_text' => $quiz_options->email_field_text,
351
- 'phone_field_text' => $quiz_options->phone_field_text,
352
- 'total_user_tries_text' => $quiz_options->total_user_tries_text,
353
- 'twitter_sharing_text' => $social_media_text["twitter"],
354
- 'facebook_sharing_text' => $social_media_text["facebook"],
355
- 'previous_button_text' => $pagination_text[0],
356
- 'next_button_text' => $pagination_text[1],
357
- 'require_log_in_text' => $quiz_options->require_log_in_text,
358
- 'limit_total_entries_text' => $quiz_options->limit_total_entries_text,
359
- 'scheduled_timeframe_text' => $quiz_options->scheduled_timeframe_text
360
- ) );
361
- }
362
-
363
- // Update new settings system
364
- $serialized_array = serialize( $settings_array );
365
- $results = $wpdb->update(
366
- $wpdb->prefix . "mlw_quizzes",
367
- array( 'quiz_settings' => $serialized_array ),
368
- array( 'quiz_id' => $this->quiz_id ),
369
- array( '%s' ),
370
- array( '%d' )
371
- );
372
- }
373
-
374
- // Cycle through registered settings
375
- $registered_fields = $this->registered_fields;
376
- foreach ( $registered_fields as $section => $fields ) {
377
-
378
- // Check if section exists in settings and, if not, set it to empty array
379
- if ( ! isset( $settings_array[ $section ] ) ) {
380
- $settings_array[ $section ] = array();
381
- }
382
-
383
- $unserialized_section = unserialize( $settings_array[ $section ] );
384
-
385
- // Cycle through each setting in section
386
- foreach ( $fields as $field ) {
387
-
388
- // Check if setting exists in section settings and, if not, set it to the default
389
- if ( ! isset( $unserialized_section[ $field["id"] ] ) ) {
390
- $unserialized_section[ $field["id"] ] = $field["default"];
391
- }
392
- }
393
-
394
- $settings_array[ $section ] = serialize( $unserialized_section );
395
- }
396
-
397
- $this->settings = $settings_array;
398
- }
399
-
400
- /**
401
- * Loads the old object model of options for backwards compatibility
402
- *
403
- * @since 5.0.0
404
- */
405
- public function get_quiz_options() {
406
- global $wpdb;
407
-
408
- // Load the old options system
409
- $quiz_options = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id=%d LIMIT 1", $this->quiz_id ), ARRAY_A );
410
-
411
- /**
412
- * Merges all options and settings
413
- */
414
- $leaderboards = $this->get_setting( 'quiz_leaderboards' );
415
- if ( is_array( $leaderboards ) ) {
416
- $quiz_options = array_merge( $quiz_options, $leaderboards );
417
- }
418
-
419
- $options = $this->get_setting( 'quiz_options' );
420
- if ( is_array( $options ) ) {
421
- $quiz_options = array_merge( $quiz_options, $options );
422
- }
423
-
424
- $text = $this->get_setting( 'quiz_text' );
425
- if ( is_array( $text ) ) {
426
- $quiz_options = array_merge( $quiz_options, $text );
427
- }
428
-
429
- // Return as old object model
430
- return (object) $quiz_options;
431
- }
432
- }
433
-
434
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/class-qsm-tracking.php DELETED
@@ -1,232 +0,0 @@
1
- <?php
2
- // Exit if accessed directly
3
- if ( ! defined( 'ABSPATH' ) ) exit;
4
-
5
- /**
6
- * Class To Send Tracking Information Back To My Website
7
- *
8
- * @since 4.1.0
9
- */
10
- class QSM_Tracking {
11
-
12
- /**
13
- * Date To Send Home
14
- *
15
- * @var array
16
- * @since 4.1.0
17
- */
18
- private $data;
19
-
20
- /**
21
- * Main Construct Function
22
- *
23
- * Call functions within class
24
- *
25
- * @since 4.1.0
26
- * @uses QSM_Tracking::add_hooks() Adds actions to hooks and filters
27
- * @return void
28
- */
29
- function __construct() {
30
- $this->add_hooks();
31
- }
32
-
33
- /**
34
- * Add Hooks
35
- *
36
- * Adds functions to relavent hooks and filters
37
- *
38
- * @since 4.1.0
39
- * @return void
40
- */
41
- private function add_hooks() {
42
- add_action( 'admin_notices', array( $this, 'admin_notice' ) );
43
- add_action( 'admin_init', array( $this, 'admin_notice_check' ) );
44
- add_action( 'plugins_loaded', array( $this, 'track_check' ) );
45
- }
46
-
47
- /**
48
- * Determines If Ready To Send Data Home
49
- *
50
- * Determines if the plugin has been authorized to send the data home in the settings page. Then checks if it has been at least a week since the last send.
51
- *
52
- * @since 4.1.0
53
- * @uses QSM_Tracking::load_data()
54
- * @uses QSM_Tracking::send_data()
55
- * @return void
56
- */
57
- public function track_check() {
58
- $settings = (array) get_option( 'qmn-settings' );
59
- $tracking_allowed = '0';
60
- if ( isset( $settings['tracking_allowed'] ) ) {
61
- $tracking_allowed = $settings['tracking_allowed'];
62
- }
63
- $last_time = get_option( 'qmn_tracker_last_time' );
64
-
65
- // We only send data if opted in. Opt-in designated by a value of 1 or 2.
66
- // We send data once a week.
67
- if ( ( $tracking_allowed == '1' || $tracking_allowed == '2' ) && ( ( $last_time && $last_time < strtotime( '-1 week' ) ) || !$last_time ) ) {
68
- $this->load_data( $tracking_allowed );
69
- $this->send_data();
70
- update_option( 'qmn_tracker_last_time', time() );
71
- }
72
- }
73
-
74
- /**
75
- * Sends The Data Home
76
- *
77
- * @since 4.1.0
78
- * @return void
79
- */
80
- private function send_data() {
81
- $response = wp_remote_post( 'https://data.quizandsurveymaster.com/?usage_track=confirmation', array(
82
- 'method' => 'POST',
83
- 'timeout' => 45,
84
- 'redirection' => 5,
85
- 'httpversion' => '1.0',
86
- 'blocking' => true,
87
- 'body' => $this->data,
88
- 'user-agent' => 'QSM Usage Tracker'
89
- ) );
90
- if ( is_wp_error( $response ) ) {
91
- global $mlwQuizMasterNext;
92
- $error_message = $response->get_error_message();
93
- $mlwQuizMasterNext->log_manager->add( "Error 0024", "Usage tracker failed due to following reason: $error_message", 0, 'error' );
94
- }
95
- }
96
-
97
- /**
98
- * Prepares The Data To Be Sent
99
- *
100
- * @since 4.1.0
101
- * @return void
102
- */
103
- private function load_data( $tracking ) {
104
- global $wpdb;
105
- global $mlwQuizMasterNext;
106
- $data = array();
107
- $data["plugin"] = "QSM";
108
-
109
- $data['url'] = home_url();
110
- $data["wp_version"] = get_bloginfo( 'version' );
111
- $data["php_version"] = PHP_VERSION;
112
- $data["mysql_version"] = $wpdb->db_version();
113
- $data["server_app"] = $_SERVER['SERVER_SOFTWARE'];
114
-
115
- // Retrieve current plugin information
116
- if( ! function_exists( 'get_plugins' ) ) {
117
- include ABSPATH . '/wp-admin/includes/plugin.php';
118
- }
119
- $plugins = array_keys( get_plugins() );
120
- $active_plugins = get_option( 'active_plugins', array() );
121
- foreach ( $plugins as $key => $plugin ) {
122
- if ( in_array( $plugin, $active_plugins ) ) {
123
- // Remove active plugins from list so we can show active and inactive separately
124
- unset( $plugins[ $key ] );
125
- }
126
- }
127
- $data['active_plugins'] = $active_plugins;
128
- $data['inactive_plugins'] = $plugins;
129
-
130
- // Active theme information
131
- $theme_data = wp_get_theme();
132
- $data['theme'] = $theme_data->Name;
133
- $data['theme_version'] = $theme_data->Version;
134
-
135
- // Aggregate information on number of quizzes, questions, and results
136
- $data["total_quizzes"] = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_quizzes" );
137
- $data["total_active_quizzes"] = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0" );
138
- $data["total_questions"] = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_questions" );
139
- $data["total_active_questions"] = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_questions WHERE deleted=0" );
140
- $data["total_results"] = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_results" );
141
- $data["total_active_results"] = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}mlw_results WHERE deleted=0" );
142
-
143
- $data['original_version'] = get_option('qmn_original_version');
144
- $data['current_version'] = get_option('mlw_quiz_master_version');
145
-
146
- // Configurations of quizzes and surveys
147
- $data['quiz_options'] = $wpdb->get_results( "SELECT quiz_name, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, comment_section, question_from_total, total_user_tries, certificate_template, pagination, timer_limit, question_numbering, theme_selected, last_activity, require_log_in, limit_total_entries, disable_answer_onselect, ajax_show_correct, quiz_views, quiz_taken FROM {$wpdb->prefix}mlw_quizzes WHERE deleted = 0" );
148
-
149
- // All error logs from QSM
150
- $data['error_logs'] = $mlwQuizMasterNext->log_manager->get_logs();
151
-
152
- // Some meta info about the site
153
- $data['site_title'] = get_bloginfo( 'name' );
154
- $data['site_desc'] = get_bloginfo( 'description' );
155
- $data['site_charset'] = get_bloginfo( 'charset' );
156
- $data['lang'] = get_bloginfo( 'language' );
157
-
158
- $this->data = $data;
159
- }
160
-
161
- /**
162
- * Adds Admin Notice To Dashboard
163
- *
164
- * Adds an admin notice asking for authorization to send data home
165
- *
166
- * @since 4.1.0
167
- * @return void
168
- */
169
- public function admin_notice() {
170
- $show_notice = get_option( 'qmn-tracking-notice' );
171
- $settings = (array) get_option( 'qmn-settings' );
172
-
173
- // If the notice has already been shown, return.
174
- if ( $show_notice ) {
175
- return;
176
- }
177
-
178
- // If the tracking variable has already been set, return.
179
- if ( isset( $settings['tracking_allowed'] ) && $settings['tracking_allowed'] == '1' ) {
180
- return;
181
- }
182
-
183
- // If the user does not have the required permissions, return.
184
- if( ! current_user_can( 'manage_options' ) ) {
185
- return;
186
- }
187
-
188
- // If the site is on a dev or staging site, we do not need the data.
189
- if( stristr( network_site_url( '/' ), 'dev' ) !== false || stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false ) {
190
- update_option( 'qmn-tracking-notice', '1' );
191
- } else {
192
- $optin_url = esc_url( add_query_arg( 'qmn_track_check', 'opt_into_tracking' ) );
193
- $optout_url = esc_url( add_query_arg( 'qmn_track_check', 'opt_out_of_tracking' ) );
194
- echo '<div class="updated">';
195
- echo '<p>' . __( "Allow Quiz And Survey Master to track this plugin's usage and help us make this plugin better?", 'quiz-master-next' ) . '<p>';
196
- echo '<p>' . __( "No sensitive data is tracked. Only feature usage and data about quizzes, surveys, and questions are collected. No questions or user responses is ever collected.", 'quiz-master-next' ) . '<p>';
197
- echo '<p><a href="http://bit.ly/2w6f34x" target="_blank">' . __( 'Click here to learn more about why we need this data and what we collect', 'quiz-master-next' ) . '</a></p>';
198
- echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Allow', 'quiz-master-next' ) . '</a>';
199
- echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow', 'quiz-master-next' ) . '</a>';
200
- echo '</div>';
201
- }
202
- }
203
-
204
- /**
205
- * Checks If User Has Clicked On Notice
206
- *
207
- * @since 4.1.0
208
- * @return void
209
- */
210
- public function admin_notice_check() {
211
- // Checks if the notice has been clicked on.
212
- if ( isset( $_GET["qmn_track_check"] ) ) {
213
-
214
- // Checks if user opted into tracking.
215
- if ( $_GET["qmn_track_check"] == 'opt_into_tracking' ) {
216
- $settings = (array) get_option( 'qmn-settings' );
217
- $settings['tracking_allowed'] = '2';
218
- update_option( 'qmn-settings', $settings );
219
- } else {
220
- $settings = (array) get_option( 'qmn-settings' );
221
- $settings['tracking_allowed'] = '0';
222
- update_option( 'qmn-settings', $settings );
223
- }
224
-
225
- // Prevents notice from being shown again.
226
- update_option( 'qmn-tracking-notice', '1' );
227
- }
228
- }
229
- }
230
-
231
- $qsm_tracking = new QSM_Tracking();
232
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/classes/index.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- // Silence is golden...
3
- ?>
 
 
 
trunk/php/default-templates.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- function qmn_register_default_templates() {
3
- global $mlwQuizMasterNext;
4
- $mlwQuizMasterNext->pluginHelper->register_quiz_template( 'Primary', 'qmn_primary.css');
5
- $mlwQuizMasterNext->pluginHelper->register_quiz_template( 'Amethyst', 'qmn_amethyst.css');
6
- $mlwQuizMasterNext->pluginHelper->register_quiz_template( 'Emerald', 'qmn_emerald.css');
7
- $mlwQuizMasterNext->pluginHelper->register_quiz_template( 'Turquoise', 'qmn_turquoise.css');
8
- $mlwQuizMasterNext->pluginHelper->register_quiz_template( 'Gray', 'qmn_gray.css');
9
- }
10
- add_action( 'plugins_loaded', 'qmn_register_default_templates' );
11
- ?>
 
 
 
 
 
 
 
 
 
 
 
trunk/php/gdpr.php DELETED
@@ -1,291 +0,0 @@
1
- <?php
2
- /**
3
- * This file handles elements needed for GDPR. This requires WordPress 4.9.6 or later. This includes:
4
- *
5
- * 1. Privacy Policy
6
- * 2. Data Exporter
7
- * 3. Data Eraser
8
- *
9
- * @since 5.3.1
10
- * @package QSM
11
- */
12
-
13
- // Add our actions and filters to functions below.
14
- add_action( 'admin_init', 'qsm_register_suggested_privacy_content', 20 );
15
- add_filter( 'wp_privacy_personal_data_exporters', 'qsm_register_data_exporters' );
16
- add_filter( 'wp_privacy_personal_data_erasers', 'qsm_register_data_erasers' );
17
-
18
- /**
19
- * 1. Privacy Policy
20
- */
21
-
22
- /**
23
- * Gets the suggested privacy policy content for this plugin
24
- *
25
- * @since 5.3.1
26
- * @return string The HTML contect for the policy
27
- */
28
- function qsm_get_our_suggested_privacy_content() {
29
- $content = '<p>' . __( 'Many of our quizzes, surveys, and forms are created using Quiz And Survey Master.', 'quiz-master-next' ) . '</p>';
30
- $content .= '<h2>' . __( 'The data the software collects', 'quiz-master-next' ) . '</h2>';
31
- $content .= '<p>' . __( 'In order to distinguish individual users, IP addresses are collected and stored with the responses.', 'quiz-master-next' ) . '</p>';
32
- $content .= '<p>' . __( 'Each individual form may have fields for a variety of other personal information, such as name and email. This data is needed to identify and possibly communicate with the user. There may be other fields asking for personal information and this data may be for different purposes for each quiz, survey, or form. If any data is to be used for purposes other than grading or survey purposes, this will be disclosed on the form itself.', 'quiz-master-next' ) . '</p>';
33
- $content .= '<h2>' . __( 'How long we retain your data', 'quiz-master-next' ) . '</h2>';
34
- $content .= '<p>' . __( 'The responses and data attached to the responses are stored indefinitely until an administrator of this site deletes the responses.', 'quiz-master-next' ) . '</p>';
35
- $content .= '<p>' . __( 'Change This! If you are using an addon or custom software to sync data with a 3rd party (such as MailChimp), data is retained there which should be mentioned here.', 'quiz-master-next' ) . '</p>';
36
- $content .= '<h2>' . __( 'Where we send your data', 'quiz-master-next' ) . '</h2>';
37
- $content .= '<p>' . __( 'Quiz And Survey Master does not send any of your data to anywhere outside of this site by default.', 'quiz-master-next' ) . '</p>';
38
- $content .= '<p>' . __( 'Change This! If you are sharing the responses with anyone and do not list it anywhere else in your privacy policy, enter information about that here. ', 'quiz-master-next' ) . '</p>';
39
- return $content;
40
- }
41
-
42
- /**
43
- * Registers the suggested privacy policy content
44
- *
45
- * @since 5.3.1
46
- */
47
- function qsm_register_suggested_privacy_content() {
48
- if ( function_exists( 'wp_add_privacy_policy_content' ) ) {
49
- $content = qsm_get_our_suggested_privacy_content();
50
- wp_add_privacy_policy_content( 'Quiz And Survey Master', $content );
51
- }
52
- }
53
-
54
- /**
55
- * 2. Data Exporter
56
- */
57
-
58
- /**
59
- * Register the plugin's data exporter
60
- *
61
- * @since 5.3.1
62
- * @param array $exporters The exporters registered for WordPress.
63
- * @return array The exporters with ours appended.
64
- */
65
- function qsm_register_data_exporters( $exporters ) {
66
- $exporters['quiz-master-next'] = array(
67
- 'exporter_friendly_name' => 'Quiz And Survey Master',
68
- 'callback' => 'qsm_data_exporter',
69
- );
70
- return $exporters;
71
- }
72
-
73
- /**
74
- * Creates an array of all data for the user
75
- *
76
- * @see https://developer.wordpress.org/plugins/privacy/adding-the-personal-data-exporter-to-your-plugin/
77
- *
78
- * @since 5.3.1
79
- * @param string $email The email of the user who wants to export his or her data.
80
- * @param int $page The page we are on in the exporting.
81
- * @return array The data for the export
82
- */
83
- function qsm_data_exporter( $email, $page = 1 ) {
84
-
85
- // Sets up variables.
86
- global $wpdb;
87
- $export_items = array();
88
- $done = false;
89
- $user = get_user_by( 'email', $email );
90
- $group_id = 'qsm-form-response';
91
- $group_label = __( 'Form Responses', 'quiz-master-next' );
92
-
93
- // Prepare SQL for finding by user.
94
- $user_sql = '';
95
- if ( $user && isset( $user->ID ) && 0 !== $user->ID ) {
96
- $user_sql = "user = {$user->ID} OR ";
97
- }
98
-
99
- // Calculate query range.
100
- $total = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(result_id) FROM {$wpdb->prefix}mlw_results WHERE $user_sql email = '%s'", $email ) );
101
- $per_page = 25;
102
- $begin = $per_page * ( $page - 1 );
103
- $remaining = $total - ( $page * $per_page );
104
-
105
- // Get the results.
106
- $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE $user_sql email = '%s' ORDER BY result_id DESC LIMIT %d, %d", $email, $begin, $per_page ) );
107
-
108
- // Cycle through adding to array.
109
- foreach ( $results as $result ) {
110
- // Set the ID.
111
- $item_id = 'qsm-form-response-' . $result->result_id;
112
-
113
- // Prepares our results array.
114
- if ( is_serialized( $result->quiz_results ) ) {
115
- $results_array = @unserialize( $result->quiz_results );
116
- if ( is_array( $results_array ) ) {
117
- if ( ! isset( $results['contact'] ) ) {
118
- $results['contact'] = array();
119
- }
120
- }
121
- }
122
- if ( ! is_array( $results_array ) ) {
123
- $results_array = array(
124
- 0,
125
- array(),
126
- '',
127
- 'contact' => array(),
128
- );
129
- }
130
-
131
- // Create the data array.
132
- $data = array(
133
- array(
134
- 'name' => __( 'Form Name', 'quiz-master-next' ),
135
- 'value' => $result->quiz_name,
136
- ),
137
- array(
138
- 'name' => __( 'Time Submitted', 'quiz-master-next' ),
139
- 'value' => $result->time_taken,
140
- ),
141
- array(
142
- 'name' => __( 'Points Earned', 'quiz-master-next' ),
143
- 'value' => $result->point_score,
144
- ),
145
- array(
146
- 'name' => __( 'Score Earned', 'quiz-master-next' ),
147
- 'value' => $result->correct_score,
148
- ),
149
- array(
150
- 'name' => __( 'Questions Answered Correctly', 'quiz-master-next' ),
151
- 'value' => $result->correct,
152
- ),
153
- array(
154
- 'name' => __( 'Total Questions', 'quiz-master-next' ),
155
- 'value' => $result->total,
156
- ),
157
- array(
158
- 'name' => __( 'Name Field', 'quiz-master-next' ),
159
- 'value' => $result->name,
160
- ),
161
- array(
162
- 'name' => __( 'Business Field', 'quiz-master-next' ),
163
- 'value' => $result->business,
164
- ),
165
- array(
166
- 'name' => __( 'Email Field', 'quiz-master-next' ),
167
- 'value' => $result->email,
168
- ),
169
- array(
170
- 'name' => __( 'Phone Field', 'quiz-master-next' ),
171
- 'value' => $result->phone,
172
- ),
173
- array(
174
- 'name' => __( 'User ID', 'quiz-master-next' ),
175
- 'value' => $result->user,
176
- ),
177
- array(
178
- 'name' => __( 'IP Address', 'quiz-master-next' ),
179
- 'value' => $result->user_ip,
180
- ),
181
- array(
182
- 'name' => __( 'Time to complete form', 'quiz-master-next' ),
183
- 'value' => $results_array[0] . ' seconds',
184
- ),
185
- array(
186
- 'name' => __( 'Form comments', 'quiz-master-next' ),
187
- 'value' => $results_array[2],
188
- ),
189
- );
190
-
191
- // Adds contact fields.
192
- $contact_count = count( $results_array['contact'] );
193
- for ( $i = 0; $i < $contact_count; $i++ ) {
194
- $data[] = array(
195
- 'name' => $results_array['contact'][ $i ]['label'],
196
- 'value' => $results_array['contact'][ $i ]['value'],
197
- );
198
- }
199
-
200
- // Adds all answer data.
201
- foreach ( $results_array[1] as $question ) {
202
- $data[] = array(
203
- 'name' => $question[0],
204
- 'value' => "Answer: {$question[1]}. Comments: {$question[3]}",
205
- );
206
- }
207
-
208
- // Add to export array.
209
- $export_items[] = array(
210
- 'group_id' => $group_id,
211
- 'group_label' => $group_label,
212
- 'item_id' => $item_id,
213
- 'data' => $data,
214
- );
215
- }
216
-
217
- if ( 0 >= $remaining ) {
218
- $done = true;
219
- }
220
-
221
- return array(
222
- 'data' => $export_items,
223
- 'done' => $done,
224
- );
225
- }
226
-
227
- /**
228
- * 3. Data Eraser
229
- */
230
-
231
- /**
232
- * Register the plugin's data eraser
233
- *
234
- * @since 5.3.1
235
- * @param array $erasers The erasers registered for WordPress.
236
- * @return array The erasers with ours appended.
237
- */
238
- function qsm_register_data_erasers( $erasers ) {
239
- $erasers['quiz-master-next'] = array(
240
- 'eraser_friendly_name' => 'Quiz And Survey Master',
241
- 'callback' => 'qsm_data_eraser',
242
- );
243
- return $erasers;
244
- }
245
-
246
- /**
247
- * Erases all data for the user
248
- *
249
- * @see https://developer.wordpress.org/plugins/privacy/adding-the-personal-data-eraser-to-your-plugin/
250
- *
251
- * @since 5.3.1
252
- * @param string $email The email of the user who wants to erase his or her data.
253
- * @param int $page The page we are on in the erasing.
254
- * @return array The status of erasing the data
255
- */
256
- function qsm_data_eraser( $email, $page = 1 ) {
257
-
258
- // Sets up variables.
259
- global $wpdb;
260
- $items_removed = false;
261
- $user = get_user_by( 'email', $email );
262
-
263
- // Deletes all results attached to user.
264
- $user_sql = '';
265
- if ( $user && isset( $user->ID ) && 0 !== $user->ID ) {
266
- $user_count = $wpdb->delete(
267
- "{$wpdb->prefix}mlw_results",
268
- array( 'user' => $user->ID )
269
- );
270
- }
271
-
272
- // Deletes all results attached email address not attached to user.
273
- $email_count = $wpdb->delete(
274
- "{$wpdb->prefix}mlw_results",
275
- array( 'email' => $email )
276
- );
277
-
278
- // If we deleted any, then set removed to true.
279
- $total = intval( $user_count ) + intval( $email_count );
280
- if ( 0 < $total ) {
281
- $items_removed = true;
282
- }
283
-
284
- // Needed array to be returned.
285
- return array(
286
- 'items_removed' => $items_removed,
287
- 'items_retained' => false,
288
- 'messages' => array(),
289
- 'done' => true,
290
- );
291
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/images/green_triangle.png DELETED
Binary file
trunk/php/images/index.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- die("Error: Unauthorized Access");
4
- ?>
 
 
 
 
trunk/php/images/red_triangle.png DELETED
Binary file
trunk/php/index.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- die("Error: Unauthorized Access");
4
- ?>
 
 
 
 
trunk/php/question-types.php DELETED
@@ -1,950 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
3
- add_action("plugins_loaded", 'qmn_question_type_multiple_choice');
4
-
5
- /**
6
- * Registers the multiple choice type
7
- *
8
- * @return void
9
- * @since 4.4.0
10
- */
11
- function qmn_question_type_multiple_choice()
12
- {
13
- global $mlwQuizMasterNext;
14
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Multiple Choice", 'quiz-master-next'), 'qmn_multiple_choice_display', true, 'qmn_multiple_choice_review', null, null, 0);
15
- }
16
-
17
- /**
18
- * This function shows the content of the multiple choice question.
19
- *
20
- * @params $id The ID of the multiple choice question
21
- * @params $question The question that is being edited.
22
- * @params @answers The array that contains the answers to the question.
23
- * @return $question_display Contains all the content of the question
24
- * @since 4.4.0
25
- */
26
- function qmn_multiple_choice_display($id, $question, $answers)
27
- {
28
- $question_display = '';
29
- global $mlwQuizMasterNext;
30
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
31
- if ($required == 0) {$mlw_requireClass = "mlwRequiredRadio";} else {$mlw_requireClass = "";}
32
- $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
33
- $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
34
- if (is_array($answers))
35
- {
36
- $mlw_answer_total = 0;
37
- foreach($answers as $answer)
38
- {
39
- $mlw_answer_total++;
40
- if ($answer[0] != "")
41
- {
42
- $question_display .= "<div class='qmn_mc_answer_wrap' id='question".$id."-".esc_attr($answer[0])."'>";
43
- $question_display .= "<input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='".htmlentities(esc_attr($answer[0]))."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label>";
44
- $question_display .= "</div>";
45
- }
46
- }
47
- $question_display .= "<input type='radio' style='display: none;' name='question".$id."' id='question".$id."_none' checked='checked' value='No Answer Provided' />";
48
- }
49
- $question_display .= "</div>";
50
- return $question_display;
51
- }
52
-
53
- /**
54
- * This function determines how the multiple choice question is graded.
55
- *
56
- * @params $id The ID of the multiple choice question
57
- * @params $question The question that is being edited.
58
- * @params @answers The array that contains the answers to the question.
59
- * @return $return_array Returns the graded question to the results page
60
- * @since 4.4.0
61
- */
62
- function qmn_multiple_choice_review($id, $question, $answers)
63
- {
64
- $return_array = array(
65
- 'points' => 0,
66
- 'correct' => 'incorrect',
67
- 'user_text' => '',
68
- 'correct_text' => ''
69
- );
70
- if ( isset( $_POST["question".$id] ) ) {
71
- $mlw_user_answer = stripslashes( $_POST["question".$id] );
72
- } else {
73
- $mlw_user_answer = " ";
74
- }
75
- foreach($answers as $answer)
76
- {
77
- if ( $mlw_user_answer == esc_attr( $answer[0] ) )
78
- {
79
- $return_array["points"] = $answer[1];
80
- $return_array["user_text"] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
81
- if ($answer[2] == 1)
82
- {
83
- $return_array["correct"] = "correct";
84
- }
85
- }
86
- if ($answer[2] == 1)
87
- {
88
- $return_array["correct_text"] = htmlspecialchars_decode($answer[0], ENT_QUOTES);
89
- }
90
- }
91
- return $return_array;
92
- }
93
-
94
- add_action("plugins_loaded", 'qmn_question_type_horizontal_multiple_choice');
95
-
96
- /**
97
- * This function registers the horizontal multiple choice type.
98
- *
99
- * @return void
100
- * @since 4.4.0
101
- */
102
- function qmn_question_type_horizontal_multiple_choice()
103
- {
104
- global $mlwQuizMasterNext;
105
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Horizontal Multiple Choice", 'quiz-master-next'), 'qmn_horizontal_multiple_choice_display', true, 'qmn_horizontal_multiple_choice_review', null, null, 1);
106
- }
107
-
108
- /**
109
- * This function shows the content of the horizontal multiple choice question.
110
- *
111
- * @params $id The ID of the multiple choice question
112
- * @params $question The question that is being edited.
113
- * @params @answers The array that contains the answers to the question.
114
- * @return $question_display Contains all the content of the question
115
- * @since 4.4.0
116
- */
117
- function qmn_horizontal_multiple_choice_display($id, $question, $answers)
118
- {
119
- $question_display = '';
120
- global $mlwQuizMasterNext;
121
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
122
- if ($required == 0) {$mlw_requireClass = "mlwRequiredRadio";} else {$mlw_requireClass = "";}
123
- $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
124
- $question_display .= "<div class='qmn_radio_answers $mlw_requireClass'>";
125
- if (is_array($answers))
126
- {
127
- $mlw_answer_total = 0;
128
- foreach($answers as $answer)
129
- {
130
- $mlw_answer_total++;
131
- if ($answer[0] != "")
132
- {
133
- $question_display .= "<span class='mlw_horizontal_choice'><input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /><label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label></span>";
134
- }
135
- }
136
- $question_display .= "<input type='radio' style='display: none;' name='question".$id."' id='question".$id."_none' checked='checked' value='No Answer Provided' />";
137
- }
138
- $question_display .= "</div>";
139
- return $question_display;
140
- }
141
-
142
- /**
143
- * This function determines how the question is graded.
144
- *
145
- * @params $id The ID of the multiple choice question
146
- * @params $question The question that is being edited.
147
- * @params @answers The array that contains the answers to the question.
148
- * @return $return_array Returns the graded question to the results page
149
- * @since 4.4.0
150
- */
151
- function qmn_horizontal_multiple_choice_review($id, $question, $answers)
152
- {
153
- $return_array = array(
154
- 'points' => 0,
155
- 'correct' => 'incorrect',
156
- 'user_text' => '',
157
- 'correct_text' => ''
158
- );
159
- if ( isset( $_POST["question".$id] ) ) {
160
- $mlw_user_answer = htmlspecialchars( stripslashes( $_POST["question".$id] ), ENT_QUOTES );
161
- } else {
162
- $mlw_user_answer = " ";
163
- }
164
- foreach($answers as $answer)
165
- {
166
- if ( $mlw_user_answer == esc_attr( $answer[0] ) )
167
- {
168
- $return_array["points"] = $answer[1];
169
- $return_array["user_text"] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
170
- if ($answer[2] == 1)
171
- {
172
- $return_array["correct"] = "correct";
173
- }
174
- }
175
- if ($answer[2] == 1)
176
- {
177
- $return_array["correct_text"] = htmlspecialchars_decode($answer[0], ENT_QUOTES);
178
- }
179
- }
180
- return $return_array;
181
- }
182
-
183
- add_action("plugins_loaded", 'qmn_question_type_drop_down');
184
-
185
- /**
186
- * This function registers the drop down question type
187
- *
188
- * @return void
189
- * @since 4.4.0
190
- */
191
- function qmn_question_type_drop_down()
192
- {
193
- global $mlwQuizMasterNext;
194
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Drop Down", 'quiz-master-next'), 'qmn_drop_down_display', true, 'qmn_drop_down_review', null, null, 2);
195
- }
196
-
197
- /**
198
- * This function shows the content of the multiple choice question.
199
- *
200
- * @params $id The ID of the multiple choice question
201
- * @params $question The question that is being edited.
202
- * @params @answers The array that contains the answers to the question.
203
- * @return $question_display Contains all the content of the question
204
- * @since 4.4.0
205
- */
206
- function qmn_drop_down_display($id, $question, $answers)
207
- {
208
- $question_display = '';
209
- global $mlwQuizMasterNext;
210
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' );
211
- if ( 0 == $required ) {
212
- $require_class = "qsmRequiredSelect";
213
- } else {
214
- $require_class = "";
215
- }
216
- $question_display .= "<span class='mlw_qmn_question'>" . do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) ) . "</span>";
217
- $question_display .= "<select class='qsm_select $require_class' name='question".$id."'>";
218
- $question_display .= "<option value='No Answer Provided' selected='selected'>&nbsp;</option>";
219
- if (is_array($answers))
220
- {
221
- $mlw_answer_total = 0;
222
- foreach($answers as $answer)
223
- {
224
- $mlw_answer_total++;
225
- if ($answer[0] != "")
226
- {
227
- $question_display .= "<option value='".esc_attr($answer[0])."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</option>";
228
- }
229
- }
230
- }
231
- $question_display .= "</select>";
232
- return $question_display;
233
- }
234
-
235
- /**
236
- * This function determines how the question is graded
237
- *
238
- * @params $id The ID of the multiple choice question
239
- * @params $question The question that is being edited.
240
- * @params @answers The array that contains the answers to the question.
241
- * @return $return_array Returns the graded question to the results page
242
- * @since 4.4.0
243
- */
244
- function qmn_drop_down_review($id, $question, $answers)
245
- {
246
- $return_array = array(
247
- 'points' => 0,
248
- 'correct' => 'incorrect',
249
- 'user_text' => '',
250
- 'correct_text' => ''
251
- );
252
- if (isset($_POST["question".$id])) {
253
- $mlw_user_answer = htmlspecialchars( stripslashes( $_POST["question".$id] ), ENT_QUOTES );
254
- } else {
255
- $mlw_user_answer = " ";
256
- }
257
- foreach($answers as $answer)
258
- {
259
- if ( $mlw_user_answer == esc_attr( $answer[0] ) )
260
- {
261
- $return_array["points"] = $answer[1];
262
- $return_array["user_text"] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
263
- if ($answer[2] == 1)
264
- {
265
- $return_array["correct"] = "correct";
266
- }
267
- }
268
- if ($answer[2] == 1)
269
- {
270
- $return_array["correct_text"] = htmlspecialchars_decode($answer[0], ENT_QUOTES);
271
- }
272
- }
273
- return $return_array;
274
- }
275
-
276
- add_action("plugins_loaded", 'qmn_question_type_small_open');
277
-
278
- /**
279
- * This function registers the small open question type
280
- *
281
- * @return void
282
- * @since 4.4.0
283
- */
284
- function qmn_question_type_small_open()
285
- {
286
- global $mlwQuizMasterNext;
287
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Small Open Answer", 'quiz-master-next'), 'qmn_small_open_display', true, 'qmn_small_open_review', null, null, 3);
288
- }
289
-
290
- /**
291
- * This function shows the content of the small open answer question.
292
- *
293
- * @params $id The ID of the multiple choice question
294
- * @params $question The question that is being edited.
295
- * @params @answers The array that contains the answers to the question.
296
- * @return $question_display Contains all the content of the question
297
- * @since 4.4.0
298
- */
299
- function qmn_small_open_display($id, $question, $answers)
300
- {
301
- $question_display = '';
302
- global $mlwQuizMasterNext;
303
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
304
- $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
305
- $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_text');
306
- $autofill_att = $autofill ? "autocomplete='off' " : '';
307
- $limit_text_att = $limit_text ? "maxlength='". $limit_text ."' " : '';
308
- if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
309
- $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
310
- $question_display .= "<input ". $autofill_att . $limit_text_att . " type='text' class='mlw_answer_open_text $mlw_requireClass' name='question".$id."' />";
311
- return $question_display;
312
- }
313
-
314
- /**
315
- * This function reviews the small open answer.
316
- *
317
- * @params $id The ID of the multiple choice question
318
- * @params $question The question that is being edited.
319
- * @params @answers The array that contains the answers to the question.
320
- * @return $return_array Returns the graded question to the results page
321
- * @since 4.4.0
322
- */
323
- function qmn_small_open_review($id, $question, $answers)
324
- {
325
- $return_array = array(
326
- 'points' => 0,
327
- 'correct' => 'incorrect',
328
- 'user_text' => '',
329
- 'correct_text' => ''
330
- );
331
- if ( isset( $_POST["question".$id] ) ) {
332
- $decode_user_answer = strval( stripslashes( htmlspecialchars_decode( $_POST["question".$id], ENT_QUOTES ) ) );
333
- $mlw_user_answer = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_user_answer ) ) );
334
- } else {
335
- $mlw_user_answer = " ";
336
- }
337
- $return_array['user_text'] = $mlw_user_answer;
338
- foreach($answers as $answer)
339
- {
340
- $decode_correct_text = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
341
- $return_array['correct_text'] = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_correct_text ) ) );
342
- if (mb_strtoupper($return_array['user_text']) == mb_strtoupper($return_array['correct_text']))
343
- {
344
- $return_array['correct'] = "correct";
345
- $return_array['points'] = $answer[1];
346
- break;
347
- }
348
- }
349
- return $return_array;
350
- }
351
-
352
- add_action("plugins_loaded", 'qmn_question_type_multiple_response');
353
-
354
- /**
355
- * This function registers the multiple response question type
356
- *
357
- * @return void
358
- * @since 4.4.0
359
- */
360
- function qmn_question_type_multiple_response()
361
- {
362
- global $mlwQuizMasterNext;
363
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Multiple Response", 'quiz-master-next'), 'qmn_multiple_response_display', true, 'qmn_multiple_response_review', null, null, 4);
364
- }
365
-
366
- /**
367
- * This function shows the content of the multiple response question
368
- *
369
- * @params $id The ID of the multiple choice question
370
- * @params $question The question that is being edited.
371
- * @params @answers The array that contains the answers to the question.
372
- * @return $question_display Contains all the content of the question
373
- * @since 4.4.0
374
- */
375
- function qmn_multiple_response_display($id, $question, $answers)
376
- {
377
- $question_display = '';
378
- global $mlwQuizMasterNext;
379
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
380
- if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
381
- $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
382
- $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
383
- if (is_array($answers))
384
- {
385
- $mlw_answer_total = 0;
386
- foreach($answers as $answer)
387
- {
388
- $mlw_answer_total++;
389
- if ($answer[0] != "")
390
- {
391
- $question_display .= '<div class="qsm_check_answer">';
392
- $question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
393
- $question_display .= "<input type='checkbox' name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label>";
394
- $question_display .= '</div>';
395
- }
396
- }
397
- }
398
- $question_display .= "</div>";
399
- return $question_display;
400
- }
401
-
402
- /**
403
- * This function determines how the multiple response is graded,
404
- *
405
- * @params $id The ID of the multiple choice question
406
- * @params $question The question that is being edited.
407
- * @params @answers The array that contains the answers to the question.
408
- * @return $return_array Returns the graded question to the results page
409
- * @since 4.4.0
410
- */
411
- function qmn_multiple_response_review($id, $question, $answers)
412
- {
413
- $return_array = array(
414
- 'points' => 0,
415
- 'correct' => 'incorrect',
416
- 'user_text' => '',
417
- 'correct_text' => ''
418
- );
419
- $user_correct = 0;
420
- $total_correct = 0;
421
- $total_answers = count($answers);
422
- foreach($answers as $answer)
423
- {
424
- for ($i = 1; $i <= $total_answers; $i++)
425
- {
426
- if (isset($_POST["question".$id."_".$i]) && htmlspecialchars(stripslashes($_POST["question".$id."_".$i]), ENT_QUOTES) == esc_attr($answer[0]))
427
- {
428
- $return_array["points"] += $answer[1];
429
- $return_array["user_text"] .= strval(htmlspecialchars_decode($answer[0], ENT_QUOTES)).".";
430
- if ($answer[2] == 1)
431
- {
432
- $user_correct += 1;
433
- }
434
- else
435
- {
436
- $user_correct = -1;
437
- }
438
- }
439
- }
440
- if ($answer[2] == 1)
441
- {
442
- $return_array["correct_text"] .= htmlspecialchars_decode($answer[0], ENT_QUOTES).".";
443
- $total_correct++;
444
- }
445
- }
446
- if ($user_correct == $total_correct)
447
- {
448
- $return_array["correct"] = "correct";
449
- }
450
- return $return_array;
451
- }
452
-
453
- add_action("plugins_loaded", 'qmn_question_type_large_open');
454
-
455
- /**
456
- * This function registers the large open question type.
457
- *
458
- * @since 4.4.0
459
- */
460
- function qmn_question_type_large_open()
461
- {
462
- global $mlwQuizMasterNext;
463
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Large Open Answer", 'quiz-master-next'), 'qmn_large_open_display', true, 'qmn_large_open_review', null, null, 5);
464
- }
465
-
466
- /**
467
- * This function displays the content of the large open question.
468
- *
469
- * @params $id The ID of the multiple choice question
470
- * @params $question The question that is being edited.
471
- * @params @answers The array that contains the answers to the question.
472
- * @return $question_display Contains all the content of the question
473
- * @since 4.4.0
474
- */
475
- function qmn_large_open_display($id, $question, $answers)
476
- {
477
- $question_display = '';
478
- global $mlwQuizMasterNext;
479
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
480
- if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
481
- $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
482
- $question_display .= "<textarea class='mlw_answer_open_text $mlw_requireClass' cols='70' rows='5' name='question".$id."' /></textarea>";
483
- return $question_display;
484
- }
485
-
486
- /**
487
- * This function determines how the large open question is graded
488
- *
489
- * @params $id The ID of the multiple choice question
490
- * @params $question The question that is being edited.
491
- * @params @answers The array that contains the answers to the question.
492
- * @return $return_array Returns the graded question to the results page
493
- * @since 4.4.0
494
- */
495
- function qmn_large_open_review($id, $question, $answers)
496
- {
497
- $return_array = array(
498
- 'points' => 0,
499
- 'correct' => 'incorrect',
500
- 'user_text' => '',
501
- 'correct_text' => ''
502
- );
503
- if ( isset( $_POST["question".$id] ) ) {
504
- $decode_user_answer = strval( stripslashes( htmlspecialchars_decode( $_POST["question".$id], ENT_QUOTES ) ) );
505
- $mlw_user_answer = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_user_answer ) ) );
506
- } else {
507
- $mlw_user_answer = " ";
508
- }
509
- $return_array['user_text'] = $mlw_user_answer;
510
- foreach($answers as $answer)
511
- {
512
- $decode_correct_text = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
513
- $return_array['correct_text'] = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_correct_text ) ) );
514
- if (mb_strtoupper($return_array['user_text']) == mb_strtoupper($return_array['correct_text']))
515
- {
516
- $return_array['correct'] = "correct";
517
- $return_array['points'] = $answer[1];
518
- break;
519
- }
520
- }
521
- return $return_array;
522
- }
523
-
524
- add_action("plugins_loaded", 'qmn_question_type_text_block');
525
-
526
- /**
527
- * This function registers the text block question type
528
- *
529
- * @return void
530
- * @since 4.4.0
531
- */
532
- function qmn_question_type_text_block()
533
- {
534
- global $mlwQuizMasterNext;
535
- $edit_args = array(
536
- 'inputs' => array(
537
- 'question'
538
- ),
539
- 'information' => '',
540
- 'extra_inputs' => array(),
541
- 'function' => ''
542
- );
543
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Text/HTML Section", 'quiz-master-next'), 'qmn_text_block_display', false, null, $edit_args, null, 6);
544
- }
545
-
546
-
547
- /**
548
- * This function displays the contents of the text block question type.
549
- *
550
- * @params $id The ID of the multiple choice question
551
- * @params $question The question that is being edited.
552
- * @params @answers The array that contains the answers to the question.
553
- * @return $question_display Contains all the content of the question
554
- * @since 4.4.0
555
- */
556
- function qmn_text_block_display($id, $question, $answers)
557
- {
558
- $question_display = '';
559
- $question_display .= do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES));
560
- return $question_display;
561
- }
562
-
563
- add_action("plugins_loaded", 'qmn_question_type_number');
564
-
565
- /**
566
- * This function registers the number question type
567
- *
568
- * @params $id The ID of the multiple choice question
569
- * @params $question The question that is being edited.
570
- * @params @answers The array that contains the answers to the question.
571
- * @return void
572
- * @since 4.4.0
573
- */
574
- function qmn_question_type_number()
575
- {
576
- global $mlwQuizMasterNext;
577
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Number", 'quiz-master-next'), 'qmn_number_display', true, 'qmn_number_review', null, null, 7);
578
- }
579
-
580
-
581
- /**
582
- * This function shows the content of the multiple choice question.
583
- *
584
- * @params $id The ID of the multiple choice question
585
- * @params $question The question that is being edited.
586
- * @params @answers The array that contains the answers to the question.
587
- * @return $question_display Contains all the content of the question
588
- * @since 4.4.0
589
- */
590
- function qmn_number_display($id, $question, $answers)
591
- {
592
- $question_display = '';
593
- global $mlwQuizMasterNext;
594
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
595
- if ($required == 0) {$mlw_requireClass = "mlwRequiredNumber";} else {$mlw_requireClass = "";}
596
- $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
597
- $question_display .= "<input type='number' class='mlw_answer_number $mlw_requireClass' name='question".$id."' />";
598
- return $question_display;
599
- }
600
-
601
-
602
- /**
603
- * This function determines how the number question type is graded.
604
- *
605
- * @params $id The ID of the multiple choice question
606
- * @params $question The question that is being edited.
607
- * @params @answers The array that contains the answers to the question.
608
- * @return $return_array Returns the graded question to the results page
609
- * @since 4.4.0
610
- */
611
- function qmn_number_review($id, $question, $answers)
612
- {
613
- $return_array = array(
614
- 'points' => 0,
615
- 'correct' => 'incorrect',
616
- 'user_text' => '',
617
- 'correct_text' => ''
618
- );
619
- if ( isset( $_POST["question".$id] ) ) {
620
- $mlw_user_answer = strval( stripslashes( htmlspecialchars_decode( $_POST["question".$id], ENT_QUOTES ) ) );
621
- } else {
622
- $mlw_user_answer = " ";
623
- }
624
- $return_array['user_text'] = $mlw_user_answer;
625
- foreach($answers as $answer)
626
- {
627
- $return_array['correct_text'] = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
628
- if (strtoupper($return_array['user_text']) == strtoupper($return_array['correct_text']))
629
- {
630
- $return_array['correct'] = "correct";
631
- $return_array['points'] = $answer[1];
632
- break;
633
- }
634
- }
635
- return $return_array;
636
- }
637
-
638
- add_action("plugins_loaded", 'qmn_question_type_accept');
639
-
640
- /**
641
- * This function registers the accept question type.
642
- *
643
- * @return void Description
644
- * @since 4.4.0
645
- */
646
- function qmn_question_type_accept()
647
- {
648
- global $mlwQuizMasterNext;
649
- $edit_args = array(
650
- 'inputs' => array(
651
- 'question',
652
- 'required'
653
- ),
654
- 'information' => '',
655
- 'extra_inputs' => array(),
656
- 'function' => ''
657
- );
658
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Accept", 'quiz-master-next'), 'qmn_accept_display', false, null, $edit_args, null, 8);
659
- }
660
-
661
- /**
662
- * This function displays the accept question
663
- *
664
- * @params $id The ID of the multiple choice question
665
- * @params $question The question that is being edited.
666
- * @params @answers The array that contains the answers to the question.
667
- * @return $question_display Contains all the content of the question
668
- * @since 4.4.0
669
- */
670
- function qmn_accept_display($id, $question, $answers)
671
- {
672
- $question_display = '';
673
- global $mlwQuizMasterNext;
674
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
675
- if ($required == 0) {$mlw_requireClass = "mlwRequiredAccept";} else {$mlw_requireClass = "";}
676
- $question_display .= "<div class='qmn_accept_answers'>";
677
- $question_display .= "<input type='checkbox' id='mlwAcceptance' class='$mlw_requireClass ' />";
678
- $question_display .= "<label for='mlwAcceptance'><span class='qmn_accept_text'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span></label>";
679
- $question_display .= "</div>";
680
- return $question_display;
681
- }
682
-
683
- add_action("plugins_loaded", 'qmn_question_type_captcha');
684
-
685
- /**
686
- * This function registers the captcha question
687
- *
688
- *
689
- * @since 4.4.0
690
- */
691
- function qmn_question_type_captcha()
692
- {
693
- global $mlwQuizMasterNext;
694
- $edit_args = array(
695
- 'inputs' => array(
696
- 'question',
697
- 'required'
698
- ),
699
- 'information' => '',
700
- 'extra_inputs' => array(),
701
- 'function' => ''
702
- );
703
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Captcha", 'quiz-master-next'), 'qmn_captcha_display', false, null, $edit_args, null, 9);
704
- }
705
-
706
-
707
- /**
708
- * This function displays the captcha question
709
- *
710
- * @params $id The ID of the multiple choice question
711
- * @params $question The question that is being edited.
712
- * @params @answers The array that contains the answers to the question.
713
- * @return $question_display Contains all the content of the question
714
- * @since 4.4.0
715
- */
716
- function qmn_captcha_display($id, $question, $answers)
717
- {
718
- $question_display = '';
719
- global $mlwQuizMasterNext;
720
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
721
- if ($required == 0) {$mlw_requireClass = "mlwRequiredCaptcha";} else {$mlw_requireClass = "";}
722
- $question_display .= "<div class='mlw_captchaWrap'>";
723
- $question_display .= "<canvas alt='' id='mlw_captcha' class='mlw_captcha' width='100' height='50'></canvas>";
724
- $question_display .= "</div>";
725
- $question_display .= "<span class='mlw_qmn_question'>";
726
- $question_display .= do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
727
- $question_display .= "<input type='text' class='mlw_answer_open_text $mlw_requireClass' id='mlw_captcha_text' name='mlw_user_captcha'/>";
728
- $question_display .= "<input type='hidden' name='mlw_code_captcha' id='mlw_code_captcha' value='none' />";
729
- $question_display .= "<script>
730
- var mlw_code = '';
731
- var mlw_chars = '0123456789ABCDEFGHIJKL!@#$%^&*()MNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
732
- var mlw_code_length = 5;
733
- for (var i=0; i<mlw_code_length; i++) {
734
- var rnum = Math.floor(Math.random() * mlw_chars.length);
735
- mlw_code += mlw_chars.substring(rnum,rnum+1);
736
- }
737
- var mlw_captchaCTX = document.getElementById('mlw_captcha').getContext('2d');
738
- mlw_captchaCTX.font = 'normal 24px Verdana';
739
- mlw_captchaCTX.strokeStyle = '#000000';
740
- mlw_captchaCTX.clearRect(0,0,100,50);
741
- mlw_captchaCTX.strokeText(mlw_code,10,30,70);
742
- mlw_captchaCTX.textBaseline = 'middle';
743
- document.getElementById('mlw_code_captcha').value = mlw_code;
744
- </script>
745
- ";
746
- return $question_display;
747
- }
748
-
749
- add_action("plugins_loaded", 'qmn_question_type_horizontal_multiple_response');
750
-
751
- /**
752
- * This function registers the horizontal multiple response question
753
- *
754
- * @return void
755
- * @since 4.4.0
756
- */
757
- function qmn_question_type_horizontal_multiple_response()
758
- {
759
- global $mlwQuizMasterNext;
760
- $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);
761
- }
762
-
763
-
764
- /**
765
- * This function displays the content of the multiple response question type
766
- *
767
- * @params $id The ID of the multiple choice question
768
- * @params $question The question that is being edited.
769
- * @params @answers The array that contains the answers to the question.
770
- * @return $question_display Contains all the content of the question
771
- * @since 4.4.0
772
- */
773
- function qmn_horizontal_multiple_response_display($id, $question, $answers)
774
- {
775
- $question_display = '';
776
- global $mlwQuizMasterNext;
777
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
778
- if ($required == 0) {$mlw_requireClass = "mlwRequiredCheck";} else {$mlw_requireClass = "";}
779
- $question_display .= "<span class='mlw_qmn_question'>".do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES))."</span>";
780
- $question_display .= "<div class='qmn_check_answers $mlw_requireClass'>";
781
- if (is_array($answers))
782
- {
783
- $mlw_answer_total = 0;
784
- foreach($answers as $answer)
785
- {
786
- $mlw_answer_total++;
787
- if ($answer[0] != "")
788
- {
789
- $question_display .= "<input type='hidden' name='question".$id."' value='This value does not matter' />";
790
- $question_display .= "<span class='mlw_horizontal_multiple'><input type='checkbox' name='question".$id."_".$mlw_answer_total."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."&nbsp;</label></span>";
791
- }
792
- }
793
- }
794
- $question_display .= "</div>";
795
- return $question_display;
796
- }
797
-
798
-
799
- /**
800
- * This function determines how the multiple response is graded.
801
- *
802
- * @params $id The ID of the multiple choice question
803
- * @params $question The question that is being edited.
804
- * @params @answers The array that contains the answers to the question.
805
- * @return $return_array Returns the graded question to the Results page
806
- * @since 4.4.0
807
- */
808
- function qmn_horizontal_multiple_response_review($id, $question, $answers)
809
- {
810
- $return_array = array(
811
- 'points' => 0,
812
- 'correct' => 'incorrect',
813
- 'user_text' => '',
814
- 'correct_text' => ''
815
- );
816
- $user_correct = 0;
817
- $total_correct = 0;
818
- $total_answers = count($answers);
819
- foreach($answers as $answer)
820
- {
821
- for ($i = 1; $i <= $total_answers; $i++)
822
- {
823
- if (isset($_POST["question".$id."_".$i]) && htmlspecialchars(stripslashes($_POST["question".$id."_".$i]), ENT_QUOTES) == esc_attr($answer[0]))
824
- {
825
- $return_array["points"] += $answer[1];
826
- $return_array["user_text"] .= strval(htmlspecialchars_decode($answer[0], ENT_QUOTES)).".";
827
- if ($answer[2] == 1)
828
- {
829
- $user_correct += 1;
830
- }
831
- else
832
- {
833
- $user_correct = -1;
834
- }
835
- }
836
- }
837
- if ($answer[2] == 1)
838
- {
839
- $return_array["correct_text"] .= htmlspecialchars_decode($answer[0], ENT_QUOTES).".";
840
- $total_correct++;
841
- }
842
- }
843
- if ($user_correct == $total_correct)
844
- {
845
- $return_array["correct"] = "correct";
846
- }
847
- return $return_array;
848
- }
849
-
850
- add_action("plugins_loaded", 'qmn_question_type_fill_blank');
851
-
852
- /**
853
- * This function registers the fill in the blank question type
854
- *
855
- * @return void
856
- * @since 4.4.0
857
- */
858
- function qmn_question_type_fill_blank()
859
- {
860
- global $mlwQuizMasterNext;
861
- $edit_args = array(
862
- 'inputs' => array(
863
- 'question',
864
- 'answer',
865
- 'hint',
866
- 'correct_info',
867
- 'comments',
868
- 'category',
869
- 'required'
870
- ),
871
- 'information' => __('For fill in the blank types, use %BLANK% to represent where to put the text box in your text.', 'quiz-master-next'),
872
- 'extra_inputs' => array(),
873
- 'function' => ''
874
- );
875
- $mlwQuizMasterNext->pluginHelper->register_question_type(__("Fill In The Blank", 'quiz-master-next'), 'qmn_fill_blank_display', true, 'qmn_fill_blank_review', $edit_args );
876
- }
877
-
878
-
879
- /**
880
- * This function displays the fill in the blank question
881
- *
882
- * @params $id The ID of the multiple choice question
883
- * @params $question The question that is being edited.
884
- * @params @answers The array that contains the answers to the question.
885
- * @return $question_display Returns the content of the question
886
- * @since 4.4.0
887
- */
888
- function qmn_fill_blank_display($id, $question, $answers)
889
- {
890
- $question_display = '';
891
- global $mlwQuizMasterNext;
892
- $required = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'required');
893
- $autofill = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'autofill');
894
- $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting($id, 'limit_text');
895
- $autofill_att = $autofill ? "autocomplete='off' " : '';
896
- $limit_text_att = $limit_text ? "maxlength='". $limit_text ."' " : '';
897
- if ($required == 0) {$mlw_requireClass = "mlwRequiredText";} else {$mlw_requireClass = "";}
898
- $input_text = "<input ". $autofill_att . $limit_text_att . " type='text' class='qmn_fill_blank $mlw_requireClass' name='question".$id."' />";
899
- if (strpos($question, '%BLANK%') !== false)
900
- {
901
- $question = str_replace( "%BLANK%", $input_text, do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
902
- }
903
- $question_display = "<span class='mlw_qmn_question'>$question</span>";
904
-
905
- return $question_display;
906
- }
907
-
908
-
909
- /**
910
- * This function determines how the fill in the blank question is graded.
911
- *
912
- * @params $id The ID of the multiple choice question
913
- * @params $question The question that is being edited.
914
- * @params @answers The array that contains the answers to the question.
915
- * @return $return_array Returns the graded question to the results page
916
- * @since 4.4.0
917
- */
918
- function qmn_fill_blank_review($id, $question, $answers)
919
- {
920
- $return_array = array(
921
- 'points' => 0,
922
- 'correct' => 'incorrect',
923
- 'user_text' => '',
924
- 'correct_text' => ''
925
- );
926
- if (strpos($question, '%BLANK%') !== false)
927
- {
928
- $return_array['question_text'] = str_replace( "%BLANK%", "__________", do_shortcode(htmlspecialchars_decode($question, ENT_QUOTES)));
929
- }
930
- if ( isset( $_POST["question".$id] ) ) {
931
- $decode_user_answer = strval( stripslashes( htmlspecialchars_decode( $_POST["question".$id], ENT_QUOTES ) ) );
932
- $mlw_user_answer = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_user_answer ) ) );
933
- } else {
934
- $mlw_user_answer = " ";
935
- }
936
- $return_array['user_text'] = $mlw_user_answer;
937
- foreach($answers as $answer)
938
- {
939
- $decode_correct_text = strval(htmlspecialchars_decode($answer[0], ENT_QUOTES));
940
- $return_array['correct_text'] = trim( preg_replace( '/\s\s+/', ' ', str_replace( "\n", " ", $decode_correct_text ) ) );
941
- if (mb_strtoupper($return_array['user_text']) == mb_strtoupper($return_array['correct_text']))
942
- {
943
- $return_array['correct'] = "correct";
944
- $return_array['points'] = $answer[1];
945
- break;
946
- }
947
- }
948
- return $return_array;
949
- }
950
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/rest-api.php DELETED
@@ -1,350 +0,0 @@
1
- <?php
2
- /**
3
- * This file handles all of the current REST API endpoints
4
- *
5
- * @since 5.2.0
6
- * @package QSM
7
- */
8
-
9
- add_action( 'rest_api_init', 'qsm_register_rest_routes' );
10
-
11
- /**
12
- * Registers REST API endpoints
13
- *
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
- ) );
21
- register_rest_route( 'quiz-survey-master/v1', '/questions/', array(
22
- 'methods' => WP_REST_Server::CREATABLE,
23
- 'callback' => 'qsm_rest_create_question',
24
- ) );
25
- register_rest_route( 'quiz-survey-master/v1', '/questions/(?P<id>\d+)', array(
26
- 'methods' => WP_REST_Server::EDITABLE,
27
- 'callback' => 'qsm_rest_save_question',
28
- ) );
29
- register_rest_route( 'quiz-survey-master/v1', '/questions/(?P<id>\d+)', array(
30
- 'methods' => WP_REST_Server::READABLE,
31
- 'callback' => 'qsm_rest_get_question',
32
- ) );
33
- register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/results', array(
34
- 'methods' => WP_REST_Server::READABLE,
35
- 'callback' => 'qsm_rest_get_results',
36
- ) );
37
- register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/results', array(
38
- 'methods' => WP_REST_Server::EDITABLE,
39
- 'callback' => 'qsm_rest_save_results',
40
- ) );
41
- register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/emails', array(
42
- 'methods' => WP_REST_Server::READABLE,
43
- 'callback' => 'qsm_rest_get_emails',
44
- ) );
45
- register_rest_route( 'quiz-survey-master/v1', '/quizzes/(?P<id>\d+)/emails', array(
46
- 'methods' => WP_REST_Server::EDITABLE,
47
- 'callback' => 'qsm_rest_save_emails',
48
- ) );
49
- }
50
-
51
- /**
52
- * Gets emails for a quiz.
53
- *
54
- * @since 6.2.0
55
- * @param WP_REST_Request $request The request sent from WP REST API.
56
- * @return array The emails for the quiz.
57
- */
58
- function qsm_rest_get_emails( WP_REST_Request $request ) {
59
- // Makes sure user is logged in.
60
- if ( is_user_logged_in() ) {
61
- $current_user = wp_get_current_user();
62
- if ( 0 !== $current_user ) {
63
- $emails = QSM_Emails::load_emails( $request['id'] );
64
- if ( false === $emails || ! is_array( $emails ) ) {
65
- $emails = array();
66
- }
67
- return $emails;
68
- }
69
- }
70
- return array(
71
- 'status' => 'error',
72
- 'msg' => 'User not logged in',
73
- );
74
- }
75
-
76
- /**
77
- * Saves emails for a quiz.
78
- *
79
- * @since 6.2.0
80
- * @param WP_REST_Request $request The request sent from WP REST API.
81
- * @return array The status of saving the emails.
82
- */
83
- function qsm_rest_save_emails( WP_REST_Request $request ) {
84
- // Makes sure user is logged in.
85
- if ( is_user_logged_in() ) {
86
- $current_user = wp_get_current_user();
87
- if ( 0 !== $current_user ) {
88
- if ( ! isset( $request['emails'] ) || ! is_array( $request['emails'] ) ) {
89
- $request['emails'] = array();
90
- }
91
- $result = QSM_Emails::save_emails( $request['id'], $request['emails'] );
92
- return array(
93
- 'status' => $result,
94
- );
95
- }
96
- }
97
- return array(
98
- 'status' => 'error',
99
- 'msg' => 'User not logged in',
100
- );
101
- }
102
-
103
- /**
104
- * Gets results pages for a quiz.
105
- *
106
- * @since 6.2.0
107
- * @param WP_REST_Request $request The request sent from WP REST API.
108
- * @return array The pages for the quiz.
109
- */
110
- function qsm_rest_get_results( WP_REST_Request $request ) {
111
- // Makes sure user is logged in.
112
- if ( is_user_logged_in() ) {
113
- $current_user = wp_get_current_user();
114
- if ( 0 !== $current_user ) {
115
- $pages = QSM_Results_Pages::load_pages( $request['id'] );
116
- if ( false === $pages || ! is_array( $pages ) ) {
117
- $pages = array();
118
- }
119
- return $pages;
120
- }
121
- }
122
- return array(
123
- 'status' => 'error',
124
- 'msg' => 'User not logged in',
125
- );
126
- }
127
-
128
- /**
129
- * Gets results pages for a quiz.
130
- *
131
- * @since 6.2.0
132
- * @param WP_REST_Request $request The request sent from WP REST API.
133
- * @return array The results from saving the pages.
134
- */
135
- function qsm_rest_save_results( WP_REST_Request $request ) {
136
- // Makes sure user is logged in.
137
- if ( is_user_logged_in() ) {
138
- $current_user = wp_get_current_user();
139
- if ( 0 !== $current_user ) {
140
- if ( ! isset( $request['pages'] ) || ! is_array( $request['pages'] ) ) {
141
- $request['pages'] = array();
142
- }
143
- $result = QSM_Results_Pages::save_pages( $request['id'], $request['pages'] );
144
- return array(
145
- 'status' => $result,
146
- );
147
- }
148
- }
149
- return array(
150
- 'status' => 'error',
151
- 'msg' => 'User not logged in',
152
- );
153
- }
154
-
155
- /**
156
- * Gets a single questions
157
- *
158
- * @since 5.2.0
159
- * @param WP_REST_Request $request The request sent from WP REST API.
160
- * @return array Something.
161
- */
162
- function qsm_rest_get_question( WP_REST_Request $request ) {
163
- // Makes sure user is logged in.
164
- if ( is_user_logged_in() ) {
165
- $current_user = wp_get_current_user();
166
- if ( 0 !== $current_user ) {
167
- $question = QSM_Questions::load_question( $request['id'] );
168
- if ( ! empty( $question ) ) {
169
- $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
170
- $question = array(
171
- 'id' => $question['question_id'],
172
- 'quizID' => $question['quiz_id'],
173
- 'type' => $question['question_type_new'],
174
- 'name' => $question['question_name'],
175
- 'answerInfo' => $question['question_answer_info'],
176
- 'comments' => $question['comments'],
177
- 'hint' => $question['hints'],
178
- 'category' => $question['category'],
179
- 'required' => $question['settings']['required'],
180
- 'answers' => $question['answers'],
181
- 'page' => $question['page'],
182
- );
183
- }
184
- return $question;
185
- }
186
- }
187
- return array(
188
- 'status' => 'error',
189
- 'msg' => 'User not logged in',
190
- );
191
- }
192
-
193
- /**
194
- * Gets all questions
195
- *
196
- * @since 5.2.0
197
- * @param WP_REST_Request $request The request sent from WP REST API.
198
- * @return array Something.
199
- */
200
- function qsm_rest_get_questions( WP_REST_Request $request ) {
201
- // Makes sure user is logged in.
202
- if ( is_user_logged_in() ) {
203
- $current_user = wp_get_current_user();
204
- if ( 0 !== $current_user ) {
205
- $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0;
206
- if ( 0 !== $quiz_id ) {
207
- $questions = QSM_Questions::load_questions_by_pages( $quiz_id );
208
- } else {
209
- $questions = QSM_Questions::load_questions( 0 );
210
- }
211
- global $wpdb;
212
- $quiz_table = $wpdb->prefix . 'mlw_quizzes';
213
- $question_array = array();
214
- foreach ( $questions as $question ) {
215
- $quiz_name = $wpdb->get_row('SELECT quiz_name FROM '. $quiz_table . ' WHERE quiz_id = ' . $question['quiz_id'], ARRAY_A );
216
- $question['page'] = isset( $question['page'] ) ? $question['page'] : 0;
217
- $question_array[] = array(
218
- 'id' => $question['question_id'],
219
- 'quizID' => $question['quiz_id'],
220
- 'type' => $question['question_type_new'],
221
- 'name' => $question['question_name'],
222
- 'answerInfo' => $question['question_answer_info'],
223
- 'comments' => $question['comments'],
224
- 'hint' => $question['hints'],
225
- 'category' => $question['category'],
226
- 'required' => $question['settings']['required'],
227
- 'answers' => $question['answers'],
228
- 'page' => $question['page'],
229
- 'answerEditor' => isset($question['settings']['answerEditor']) ? $question['settings']['answerEditor'] : 'text',
230
- 'autofill' => isset($question['settings']['autofill']) ? $question['settings']['autofill'] : 0,
231
- 'limit_text' => isset($question['settings']['limit_text']) ? $question['settings']['limit_text'] : 0,
232
- 'quiz_name' => isset($quiz_name['quiz_name']) ? $quiz_name['quiz_name'] : '',
233
- );
234
- }
235
- return $question_array;
236
- }
237
- }
238
- return array(
239
- 'status' => 'error',
240
- 'msg' => 'User not logged in',
241
- );
242
- }
243
-
244
- /**
245
- * REST API endpoint function for creating questions
246
- *
247
- * @since 5.2.0
248
- * @param WP_REST_Request $request The request sent from WP REST API.
249
- * @return array An array that contains the key 'id' for the new question.
250
- */
251
- function qsm_rest_create_question( WP_REST_Request $request ) {
252
-
253
- // Makes sure user is logged in.
254
- if ( is_user_logged_in() ) {
255
- $current_user = wp_get_current_user();
256
- if ( 0 !== $current_user ) {
257
- try {
258
- $data = array(
259
- 'quiz_id' => $request['quizID'],
260
- 'type' => $request['type'],
261
- 'name' => $request['name'],
262
- 'answer_info' => $request['answerInfo'],
263
- 'comments' => $request['comments'],
264
- 'hint' => $request['hint'],
265
- 'order' => 1,
266
- 'category' => $request['category'],
267
- );
268
- $settings = array(
269
- 'required' => $request['required'],
270
- 'answerEditor' => 'text'
271
- );
272
- $intial_answers = $request['answers'];
273
- $answers = array();
274
- if ( is_array( $intial_answers ) ) {
275
- $answers = $intial_answers;
276
- }
277
- $question_id = QSM_Questions::create_question( $data, $answers, $settings );
278
- return array(
279
- 'status' => 'success',
280
- 'id' => $question_id,
281
- );
282
- } catch ( Exception $e ) {
283
- $msg = $e->getMessage();
284
- return array(
285
- 'status' => 'error',
286
- 'msg' => "There was an error when creating your question. Please try again. Error from WordPress: $msg",
287
- );
288
- }
289
- }
290
- }
291
- return array(
292
- 'status' => 'error',
293
- 'msg' => 'User not logged in',
294
- );
295
- }
296
-
297
- /**
298
- * REST API endpoint function for saving questions
299
- *
300
- * @since 5.2.0
301
- * @param WP_REST_Request $request The request sent from WP REST API.
302
- * @return array An array that contains the key 'id' for the new question.
303
- */
304
- function qsm_rest_save_question( WP_REST_Request $request ) {
305
-
306
- // Makes sure user is logged in.
307
- if ( is_user_logged_in() ) {
308
- $current_user = wp_get_current_user();
309
- if ( 0 !== $current_user ) {
310
- try {
311
- $id = intval( $request['id'] );
312
- $data = array(
313
- 'quiz_id' => $request['quizID'],
314
- 'type' => $request['type'],
315
- 'name' => $request['name'],
316
- 'answer_info' => $request['answerInfo'],
317
- 'comments' => $request['comments'],
318
- 'hint' => $request['hint'],
319
- 'order' => 1,
320
- 'category' => $request['category'],
321
- );
322
- $settings = array(
323
- 'required' => $request['required'],
324
- 'answerEditor' => $request['answer_editor'],
325
- 'autofill' => $request['autofill'],
326
- 'limit_text' => $request['limit_text'],
327
- );
328
- $intial_answers = $request['answers'];
329
- $answers = array();
330
- if ( is_array( $intial_answers ) ) {
331
- $answers = $intial_answers;
332
- }
333
- $question_id = QSM_Questions::save_question( $id, $data, $answers, $settings );
334
- return array(
335
- 'status' => 'success',
336
- );
337
- } catch ( Exception $e ) {
338
- $msg = $e->getMessage();
339
- return array(
340
- 'status' => 'error',
341
- 'msg' => "There was an error when creating your question. Please try again. Error from WordPress: $msg",
342
- );
343
- }
344
- }
345
- }
346
- return array(
347
- 'status' => 'error',
348
- 'msg' => 'User not logged in',
349
- );
350
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/shortcodes.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- /**
3
- * Displays a link to a quiz using ID. Used [qsm_link id=1]Click Here[/qsm_link]
4
- *
5
- * @since 5.1.0
6
- * @param array $atts Attributes from add_shortcode function
7
- * @param string $content The text to be used for the link
8
- * @return string The HTML the shortcode will be replaced with
9
- */
10
- function qsm_quiz_link_shortcode( $atts, $content = '' ) {
11
- extract(shortcode_atts(array(
12
- 'id' => 0,
13
- 'class' => '',
14
- 'target' => ''
15
- ), $atts));
16
- $id = intval( $id );
17
-
18
- // Find the permalink by finding the post with the meta_key 'quiz_id' of supplied quiz
19
- $permalink = '';
20
- $my_query = new WP_Query( array( 'post_type' => 'quiz', 'meta_key' => 'quiz_id', 'meta_value' => $id, 'posts_per_page' => 1, 'post_status' => 'publish' ) );
21
- if ( $my_query->have_posts() ) {
22
- while ( $my_query->have_posts() ) {
23
- $my_query->the_post();
24
- $permalink = get_permalink();
25
- }
26
- }
27
- wp_reset_postdata();
28
-
29
- // Craft the target attribute if one is passed to shortcode
30
- $target_html = '';
31
- if ( ! empty( $target ) ) {
32
- $target_html = "target='" . esc_attr( $target ) . "'";
33
- }
34
- return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "' $target_html>" . esc_html( $content ) . "</a>";
35
- }
36
- add_shortcode( 'qsm_link', 'qsm_quiz_link_shortcode' );
37
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/php/template-variables.php DELETED
@@ -1,588 +0,0 @@
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_total_questions',10,2);
46
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_correct_score',10,2);
47
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_quiz_name',10,2);
48
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_name',10,2);
49
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_business',10,2);
50
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_phone',10,2);
51
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_user_email',10,2);
52
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_question_answers',10,2);
53
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_comments',10,2);
54
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer',10,2);
55
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_timer_minutes',10,2);
56
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date',10,2);
57
- add_filter('mlw_qmn_template_variable_results_page', 'mlw_qmn_variable_date_taken',10,2);
58
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_facebook_share',10,2);
59
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_twitter_share',10,2);
60
- add_filter('mlw_qmn_template_variable_results_page', 'qsm_variable_result_id',10,2);
61
- add_filter('qmn_end_results', 'qsm_variable_poll_result',10,3);
62
-
63
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_quiz_name',10,2);
64
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_date',10,2);
65
- add_filter('mlw_qmn_template_variable_quiz_page', 'mlw_qmn_variable_current_user',10,2);
66
-
67
- /**
68
- * Show poll result
69
- * @param str $content
70
- * @param arr $mlw_quiz_array
71
- */
72
- function qsm_variable_poll_result($content, $mlw_quiz_array, $variables){
73
- $quiz_id = is_object($mlw_quiz_array) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
74
- while ( false !== strpos($content, '%POLL_RESULTS_') ) {
75
- $question_id = mlw_qmn_get_string_between($content, '%POLL_RESULTS_', '%');
76
- global $wpdb;
77
- $table_name = $wpdb->prefix . 'mlw_results';
78
- $table_question = $wpdb->prefix . 'mlw_questions';
79
- $total_query = $wpdb->get_row('SELECT count(*) AS total_count FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
80
- $total_result = $total_query['total_count'];
81
- $ser_answer = $wpdb->get_row('SELECT answer_array FROM ' . $table_question . ' WHERE question_id = ' . $question_id,ARRAY_A);
82
- $ser_answer_arry = unserialize($ser_answer['answer_array']);
83
- $ser_answer_arry_change = array_filter(array_merge(array(0), $ser_answer_arry));
84
- $total_quiz_results = $wpdb->get_results('SELECT quiz_results FROM ' . $table_name . ' WHERE quiz_id = ' . $quiz_id,ARRAY_A);
85
- $answer_array = array();
86
- if($total_quiz_results){
87
- foreach ($total_quiz_results as $key => $value) {
88
- $userdb = unserialize($value['quiz_results']);
89
- if(!empty($userdb)){
90
- $key = array_search($question_id, array_column($userdb[1], 'id'));
91
- $answer_array[] = isset($userdb[1][$key]) ? $userdb[1][$key][1] : '';
92
- }
93
- }
94
- }
95
- $vals = array_count_values($answer_array);
96
- $str = '';
97
- if($vals){
98
- $str .= '<h4>Poll Result:</h4>';
99
- foreach ($vals as $answer_str => $answer_count) {
100
- if($answer_str != '' && qsm_find_key_from_array($answer_str, $ser_answer_arry_change)){
101
- $percentage = number_format($answer_count / $total_result * 100,2) ;
102
- $str .= $answer_str . ' : ' . $percentage .'%<br/>';
103
- $str .= '<progress value="'. $percentage .'" max="100">'. $percentage .' %</progress><br/>';
104
- }
105
- }
106
- }
107
- $content = str_replace( "%POLL_RESULTS_". $question_id ."%" , $str, $content);
108
- }
109
- return $content;
110
- }
111
-
112
- function mlw_qmn_get_string_between($string, $start, $end){
113
- $string = ' ' . $string;
114
- $ini = strpos($string, $start);
115
- if ($ini == 0) return '';
116
- $ini += strlen($start);
117
- $len = strpos($string, $end, $ini) - $ini;
118
- return substr($string, $ini, $len);
119
- }
120
-
121
- function qsm_find_key_from_array($search_value,$array){
122
- if($array){
123
- foreach ($array as $key => $value) {
124
- if($value[0] == $search_value){
125
- return true;
126
- }
127
- }
128
- }
129
- return false;
130
- }
131
-
132
- /**
133
- * Adds Facebook sharing link using the %FACEBOOK_SHARE% variable
134
- */
135
- function qsm_variable_facebook_share( $content, $mlw_quiz_array ) {
136
- while ( false !== strpos($content, '%FACEBOOK_SHARE%') ) {
137
- wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( '../../js/qmn_social_share.js' , __FILE__ ) );
138
- $settings = (array) get_option( 'qmn-settings' );
139
- $facebook_app_id = '483815031724529';
140
- if ( isset( $settings['facebook_app_id'] ) ) {
141
- $facebook_app_id = esc_js( $settings['facebook_app_id'] );
142
- }
143
-
144
- global $mlwQuizMasterNext;
145
- $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '' );
146
-
147
- $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
148
- $fb_image = plugins_url('', dirname(__FILE__) ) . '/assets/facebook.png';
149
- $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('facebook', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."', '$facebook_app_id');\"><img src='". $fb_image ."' alt='Facebbok Share' /></a>";
150
- $content = str_replace( "%FACEBOOK_SHARE%" , $social_display, $content);
151
- }
152
- return $content;
153
- }
154
-
155
- /**
156
- * Adds Twitter sharing link using the %TWITTER_SHARE% variable
157
- */
158
- function qsm_variable_twitter_share( $content, $mlw_quiz_array ) {
159
- while ( false !== strpos($content, '%TWITTER_SHARE%') ) {
160
- wp_enqueue_script( 'qmn_quiz_social_share', plugins_url( '../../js/qmn_social_share.js' , __FILE__ ) );
161
-
162
- global $mlwQuizMasterNext;
163
- $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'twitter_sharing_text', '' );
164
- $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $mlw_quiz_array);
165
- $tw_image = plugins_url('', dirname(__FILE__) ) . '/assets/twitter.png';
166
- $social_display = "<a class=\"mlw_qmn_quiz_link\" onclick=\"qmnSocialShare('twitter', '".esc_js( $sharing )."', '".esc_js($mlw_quiz_array["quiz_name"])."');\"><img src='". $tw_image ."' alt='Twitter Share' /></a>";
167
- $content = str_replace( "%TWITTER_SHARE%" , $social_display, $content);
168
- }
169
- return $content;
170
- }
171
-
172
- /**
173
- * Adds result id using the %RESULT_ID% variable
174
- */
175
- function qsm_variable_result_id( $content, $mlw_quiz_array ) {
176
- while ( false !== strpos($content, '%RESULT_ID%') ) {
177
- global $wpdb;
178
- $table_name = $wpdb->prefix . 'mlw_results';
179
- $get_last_id = $wpdb->get_row("SELECT result_id FROM $table_name ORDER BY result_id DESC",ARRAY_A);
180
- $content = str_replace( "%RESULT_ID%" , $get_last_id['result_id'], $content);
181
- }
182
- return $content;
183
- }
184
-
185
- function mlw_qmn_variable_point_score($content, $mlw_quiz_array)
186
- {
187
- $content = str_replace( "%POINT_SCORE%" , $mlw_quiz_array["total_points"], $content);
188
- return $content;
189
- }
190
- function mlw_qmn_variable_average_point($content, $mlw_quiz_array)
191
- {
192
- if ($mlw_quiz_array["total_questions"] != 0)
193
- {
194
- $mlw_average_points = round($mlw_quiz_array["total_points"]/$mlw_quiz_array["total_questions"], 2);
195
- }
196
- else
197
- {
198
- $mlw_average_points = 0;
199
- }
200
- $content = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $content);
201
- return $content;
202
- }
203
- function mlw_qmn_variable_amount_correct($content, $mlw_quiz_array)
204
- {
205
- $content = str_replace( "%AMOUNT_CORRECT%" , $mlw_quiz_array["total_correct"], $content);
206
- return $content;
207
- }
208
- function mlw_qmn_variable_total_questions($content, $mlw_quiz_array)
209
- {
210
- $content = str_replace( "%TOTAL_QUESTIONS%" , $mlw_quiz_array["total_questions"], $content);
211
- return $content;
212
- }
213
- function mlw_qmn_variable_correct_score($content, $mlw_quiz_array)
214
- {
215
- $content = str_replace( "%CORRECT_SCORE%" , $mlw_quiz_array["total_score"], $content);
216
- return $content;
217
- }
218
- function mlw_qmn_variable_quiz_name($content, $mlw_quiz_array)
219
- {
220
- $content = str_replace( "%QUIZ_NAME%" , $mlw_quiz_array["quiz_name"], $content);
221
- return $content;
222
- }
223
- function mlw_qmn_variable_user_name($content, $mlw_quiz_array)
224
- {
225
- $content = str_replace( "%USER_NAME%" , $mlw_quiz_array["user_name"], $content);
226
- return $content;
227
- }
228
- function mlw_qmn_variable_current_user($content, $mlw_quiz_array)
229
- {
230
- $current_user = wp_get_current_user();
231
- $content = str_replace( "%USER_NAME%" , $current_user->display_name, $content);
232
- return $content;
233
- }
234
- function mlw_qmn_variable_user_business($content, $mlw_quiz_array)
235
- {
236
- $content = str_replace( "%USER_BUSINESS%" , $mlw_quiz_array["user_business"], $content);
237
- return $content;
238
- }
239
- function mlw_qmn_variable_user_phone($content, $mlw_quiz_array)
240
- {
241
- $content = str_replace( "%USER_PHONE%" , $mlw_quiz_array["user_phone"], $content);
242
- return $content;
243
- }
244
- function mlw_qmn_variable_user_email($content, $mlw_quiz_array)
245
- {
246
- $content = str_replace( "%USER_EMAIL%" , $mlw_quiz_array["user_email"], $content);
247
- return $content;
248
- }
249
-
250
- /**
251
- * Returns user value for supplied contact field
252
- *
253
- * @since 5.0.0
254
- * @return string The HTML for the content
255
- */
256
- function qsm_contact_field_variable( $content, $results_array ) {
257
- preg_match_all( "~%CONTACT_(.*?)%~i", $content, $matches );
258
- for ( $i = 0; $i < count( $matches[0] ); $i++ ) {
259
- $content = str_replace( "%CONTACT_" . $matches[1][ $i ] . "%" , $results_array["contact"][ $matches[1][ $i ] - 1 ]["value"], $content);
260
- }
261
- return $content;
262
- }
263
-
264
- /**
265
- * Returns user values for all contact fields
266
- *
267
- * @since 5.0.0
268
- * @return string The HTML for the content
269
- */
270
- function qsm_all_contact_fields_variable( $content, $results ) {
271
- $return = '';
272
- for ( $i = 0; $i < count( $results["contact"] ); $i++ ) {
273
- $return .= $results["contact"][ $i ]["label"] . ": " . $results["contact"][ $i ]["value"] . "<br>";
274
- }
275
- $content = str_replace( "%CONTACT_ALL%" , $return, $content );
276
- return $content;
277
- }
278
-
279
- /**
280
- * Converts the %QUESTIONS_ANSWERS% into the template
281
- *
282
- * @param string $content The content to be checked for the template
283
- * @param array $mlw_quiz_array The array for the response data
284
- */
285
- function mlw_qmn_variable_question_answers( $content, $mlw_quiz_array ) {
286
-
287
- // Checks if the variable is present in the content.
288
- while ( strpos( $content, '%QUESTIONS_ANSWERS%' ) !== false ) {
289
- global $mlwQuizMasterNext;
290
- global $wpdb;
291
- $display = '';
292
- $qmn_question_answer_template = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'question_answer_template', '%QUESTION%<br>%USER_ANSWER%' );
293
- $questions = QSM_Questions::load_questions_by_pages( $mlw_quiz_array['quiz_id'] );
294
- $qmn_questions = array();
295
- foreach ( $questions as $question ) {
296
- $qmn_questions[ $question['question_id'] ] = $question['question_answer_info'];
297
- }
298
-
299
- // Cycles through each answer in the responses.
300
- foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
301
- if ( $answer["correct"] === "correct" ){
302
- $user_answer_class = "qmn_user_correct_answer";
303
- $question_answer_class = "qmn_question_answer_correct";
304
- } else {
305
- $user_answer_class = "qmn_user_incorrect_answer";
306
- $question_answer_class = "qmn_question_answer_incorrect";
307
- }
308
- $mlw_question_answer_display = htmlspecialchars_decode($qmn_question_answer_template, ENT_QUOTES);
309
- $mlw_question_answer_display = str_replace( "%QUESTION%" , '<b>' . htmlspecialchars_decode($answer[0], ENT_QUOTES) . '</b>', $mlw_question_answer_display);
310
- $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , "<span class='$user_answer_class'>".htmlspecialchars_decode($answer[1], ENT_QUOTES).'</span>', $mlw_question_answer_display);
311
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , htmlspecialchars_decode($answer[2], ENT_QUOTES), $mlw_question_answer_display);
312
- $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $answer[3], $mlw_question_answer_display);
313
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , htmlspecialchars_decode($qmn_questions[$answer['id']], ENT_QUOTES), $mlw_question_answer_display);
314
- $display .= "<div class='qmn_question_answer $question_answer_class'>".apply_filters('qmn_variable_question_answers', $mlw_question_answer_display, $mlw_quiz_array).'</div>';
315
- }
316
- $content = str_replace( "%QUESTIONS_ANSWERS%" , $display, $content);
317
- }
318
- return $content;
319
- }
320
-
321
- function mlw_qmn_variable_comments($content, $mlw_quiz_array)
322
- {
323
- $content = str_replace( "%COMMENT_SECTION%" , $mlw_quiz_array["comments"], $content);
324
- return $content;
325
- }
326
- function mlw_qmn_variable_timer($content, $mlw_quiz_array)
327
- {
328
- $content = str_replace( "%TIMER%" , $mlw_quiz_array["timer"], $content);
329
- return $content;
330
- }
331
- function mlw_qmn_variable_timer_minutes($content, $mlw_quiz_array)
332
- {
333
- $mlw_minutes = round($mlw_quiz_array["timer"]/60,2);
334
- $content = str_replace( "%TIMER_MINUTES%" , $mlw_minutes, $content);
335
- return $content;
336
- }
337
-
338
- /**
339
- * Replaces the variable %CURRENT_DATE% and displays the current date
340
- *
341
- * @param string $content The contents of the results page
342
- * @param array $results The array of all the results from user taking the quiz
343
- * @return string Returns the contents for the results page
344
- */
345
- function mlw_qmn_variable_date( $content, $results ) {
346
- $date = date_i18n( get_option( 'date_format' ), time() );
347
- $content = str_replace( "%CURRENT_DATE%" , $date, $content);
348
- return $content;
349
- }
350
-
351
- /**
352
- * Replaces the variable %DATE_TAKEN% and returns the date the user submitted his or her responses
353
- *
354
- * @param string $content The contents of the results page
355
- * @param array $results The array of all the results from user taking the quiz
356
- * @return string Returns the contents for the results page
357
- */
358
- function mlw_qmn_variable_date_taken( $content, $results ) {
359
- $date = date_i18n( get_option( 'date_format' ), strtotime( $results["time_taken"] ) );
360
- $content = str_replace( "%DATE_TAKEN%" , $date, $content);
361
- return $content;
362
- }
363
-
364
- /*
365
- * Replaces variable %CATEGORY_POINTS% with the points for that category
366
- *
367
- * 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%
368
- *
369
- * @since 4.0.0
370
- * @param string $content The contents of the results page
371
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
372
- * @return string Returns the contents for the results page
373
- */
374
- function qmn_variable_category_points($content, $mlw_quiz_array)
375
- {
376
- $return_points = 0;
377
- while (strpos($content, '%CATEGORY_POINTS%') !== false || false !== strpos($content, '%CATEGORY_POINTS_'))
378
- {
379
- $return_points = 0;
380
- preg_match("~%CATEGORY_POINTS%(.*?)%/CATEGORY_POINTS%~i",$content,$answer_text);
381
- if(empty($answer_text)){
382
- $category_name = mlw_qmn_get_string_between($content, '%CATEGORY_POINTS_', '%');
383
- }else{
384
- $category_name = $answer_text[1];
385
- }
386
-
387
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
388
- {
389
- if ($answer["category"] == $category_name)
390
- {
391
- $return_points += $answer["points"];
392
- }
393
- }
394
- if(empty($answer_text)){
395
- $content = str_replace( '%CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
396
- }else{
397
- $content = str_replace( $answer_text[0] , $return_points, $content);
398
- }
399
- }
400
- return $content;
401
- }
402
-
403
- /*
404
- * Replaces variable %CATEGORY_POINTS% with the average points for that category
405
- *
406
- * 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%
407
- *
408
- * @since 4.0.0
409
- * @param string $content The contents of the results page
410
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
411
- * @return string Returns the contents for the results page
412
- */
413
- function qmn_variable_average_category_points( $content, $mlw_quiz_array ) {
414
- $return_points = 0;
415
- while ( strpos( $content, '%AVERAGE_CATEGORY_POINTS%' ) !== false || false !== strpos($content, '%AVERAGE_CATEGORY_POINTS_') ) {
416
- $return_points = 0;
417
- $total_questions = 0;
418
- preg_match( "~%AVERAGE_CATEGORY_POINTS%(.*?)%/AVERAGE_CATEGORY_POINTS%~i", $content, $answer_text );
419
- if(empty($answer_text)){
420
- $category_name = mlw_qmn_get_string_between($content, '%AVERAGE_CATEGORY_POINTS_', '%');
421
- }else{
422
- $category_name = $answer_text[1];
423
- }
424
- foreach ( $mlw_quiz_array['question_answers_array'] as $answer ) {
425
- if ( $answer["category"] == $category_name ) {
426
- $total_questions += 1;
427
- $return_points += $answer["points"];
428
- }
429
- }
430
- if ( $total_questions !== 0 ) {
431
- $return_points = round( $return_points / $total_questions, 2 );
432
- } else {
433
- $return_points = 0;
434
- }
435
- if(empty($answer_text)){
436
- $content = str_replace( '%AVERAGE_CATEGORY_POINTS_'.$category_name.'%' , $return_points, $content);
437
- }else{
438
- $content = str_replace( $answer_text[0] , $return_points, $content);
439
- }
440
- }
441
- return $content;
442
- }
443
-
444
- /*
445
- * Replaces variable %CATEGORY_SCORE% with the score for that category
446
- *
447
- * 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%
448
- *
449
- * @since 4.0.0
450
- * @param string $content The contents of the results page
451
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
452
- * @return string Returns the contents for the results page
453
- */
454
- function qmn_variable_category_score($content, $mlw_quiz_array)
455
- {
456
- $return_score = 0;
457
- $total_questions = 0;
458
- $amount_correct = 0;
459
- while (strpos($content, '%CATEGORY_SCORE%') !== false || false !== strpos($content, '%CATEGORY_SCORE_'))
460
- {
461
- $return_score = 0;
462
- $total_questions = 0;
463
- $amount_correct = 0;
464
- preg_match("~%CATEGORY_SCORE%(.*?)%/CATEGORY_SCORE%~i",$content,$answer_text);
465
- if(empty($answer_text)){
466
- $category_name = mlw_qmn_get_string_between($content, '%CATEGORY_SCORE_', '%');
467
- }else{
468
- $category_name = $answer_text[1];
469
- }
470
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
471
- {
472
- if ($answer["category"] == $category_name)
473
- {
474
- $total_questions += 1;
475
- if ($answer["correct"] == 'correct')
476
- {
477
- $amount_correct += 1;
478
- }
479
- }
480
- }
481
- if ($total_questions != 0)
482
- {
483
- $return_score = round((($amount_correct/$total_questions)*100), 2);
484
- }
485
- else
486
- {
487
- $return_score = 0;
488
- }
489
-
490
- if(empty($answer_text)){
491
- $content = str_replace( '%CATEGORY_SCORE_'.$category_name.'%' , $return_score, $content);
492
- }else{
493
- $content = str_replace( $answer_text[0] , $return_score, $content);
494
- }
495
-
496
- }
497
- return $content;
498
- }
499
-
500
- /*
501
- * Replaces variable %CATEGORY_AVERAGE_SCORE% with the average score for all categories
502
- *
503
- * Filter function that replaces variable %CATEGORY_AVERAGE_SCORE% with the score from all categories.
504
- *
505
- * @since 4.0.0
506
- * @param string $content The contents of the results page
507
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
508
- * @return string Returns the contents for the results page
509
- */
510
- function qmn_variable_category_average_score($content, $mlw_quiz_array)
511
- {
512
- $return_score = 0;
513
- $total_categories = 0;
514
- $total_score = 0;
515
- $category_scores = array();
516
- while (strpos($content, '%CATEGORY_AVERAGE_SCORE%') !== false)
517
- {
518
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
519
- {
520
- if (!isset($category_scores[$answer["category"]]['total_questions']))
521
- {
522
- $category_scores[$answer["category"]]['total_questions'] = 0;
523
- }
524
- if (!isset($category_scores[$answer["category"]]['amount_correct']))
525
- {
526
- $category_scores[$answer["category"]]['amount_correct'] = 0;
527
- }
528
- $category_scores[$answer["category"]]['total_questions'] += 1;
529
- if ($answer["correct"] == 'correct')
530
- {
531
- $category_scores[$answer["category"]]['amount_correct'] += 1;
532
- }
533
- }
534
- foreach($category_scores as $category)
535
- {
536
- $total_score += $category["amount_correct"]/$category["total_questions"];
537
- $total_categories += 1;
538
- }
539
- if ($total_categories != 0)
540
- {
541
- $return_score = round((($total_score/$total_categories)*100), 2);
542
- }
543
- else
544
- {
545
- $return_score = 0;
546
- }
547
- $content = str_replace( "%CATEGORY_AVERAGE_SCORE%" , $return_score, $content);
548
- }
549
- return $content;
550
- }
551
-
552
- /*
553
- * Replaces variable %CATEGORY_AVERAGE_POINTS% with the average points for all categories
554
- *
555
- * Filter function that replaces variable %CATEGORY_AVERAGE_POINTS% with the points from all categories.
556
- *
557
- * @since 4.0.0
558
- * @param string $content The contents of the results page
559
- * @param array $mlw_quiz_array The array of all the results from user taking the quiz
560
- * @return string Returns the contents for the results page
561
- */
562
- function qmn_variable_category_average_points($content, $mlw_quiz_array)
563
- {
564
- $return_score = 0;
565
- $total_categories = 0;
566
- $total_points = 0;
567
- $category_scores = array();
568
- while (strpos($content, '%CATEGORY_AVERAGE_POINTS%') !== false)
569
- {
570
- foreach ($mlw_quiz_array['question_answers_array'] as $answer)
571
- {
572
- if (!isset($category_scores[$answer["category"]]['points']))
573
- {
574
- $category_scores[$answer["category"]]['points'] = 0;
575
- }
576
- $category_scores[$answer["category"]]['points'] += $answer["points"];
577
- }
578
- foreach($category_scores as $category)
579
- {
580
- $total_points += $category["points"];
581
- $total_categories += 1;
582
- }
583
- $return_score = $total_points/$total_categories;
584
- $content = str_replace( '%CATEGORY_AVERAGE_POINTS%' , $return_score, $content);
585
- }
586
- return $content;
587
- }
588
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/readme.txt DELETED
@@ -1,168 +0,0 @@
1
- === Quiz And Survey Master - Best Quiz Plugin for WordPress ===
2
- Contributors: quizsurvey
3
- Tags: quiz, survey, lead, test, score, exam, questionnaire, question
4
- Requires at least: 4.9
5
- Tested up to: 5.2
6
- Requires PHP: 5.4
7
- Stable tag: 6.3.3
8
- License: GPLv2
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Native quiz and surveys for your WordPress site. Easily and quickly add unlimited quizzes and surveys to your website. Customizable and professional quizzes are now at your finger tips.
12
-
13
- == Description ==
14
-
15
- = Demoes! =
16
- Looking for demoes? Check out [Sample Quiz](https://quizandsurveymaster.com/quiz/sample-quiz/?utm_source=readme&utm_medium=plugin&utm_content=sample-quiz&utm_campaign=qsm_plugin) and [Sample Survey](https://quizandsurveymaster.com/quiz/sample-survey/?utm_source=readme&utm_medium=plugin&utm_content=sample-survey&utm_campaign=qsm_plugin)!
17
-
18
- = Easily Create Surveys For Your Users =
19
- You can easily create surveys for your users. Everything from customer satisfaction surveys to employee surveys.
20
-
21
- = Customize Your Text =
22
- All the text your users see can be **customized**. Everything from the text blocks throughout the quiz or survey to the submit button.
23
-
24
- = Different Types Of Questions =
25
- You can have **multiple choice** (radio buttons), **true and false**, **open answer** question, **drop down**, **multiple response** (checkboxes), **fill in the blank**, **number**, **captcha**, and **accept**. More types are being supported in future updates!
26
-
27
- = Multiple Results Pages For Each Quiz =
28
- Each quiz or survey can have **unlimited** results pages that can be customized with your text. Show different results pages based on the users score!
29
-
30
- = Emails After Completion Of Quiz And Survey =
31
- After the user takes a quiz or survey, you can have the plugin email you and the user with results. This too can be customized with your own text.
32
-
33
- = Very Flexible =
34
- Your quiz or survey can be graded with an incorrect/correct system or a points-based system. Or not at all. You ask for contact information at the beginning or the end and you decide which contact fields are required. You can decide to use all the questions or only a select few chosen at random. You can also set the number of questions per page or have all the questions on one page.
35
-
36
- = Categories =
37
- You can assign categories to your questions. You can then show the user their score in a **particular** category or an average score of the categories.
38
-
39
- = Other Useful Features =
40
-
41
- * Allow the user to share the results on *social networks*
42
- * Show all questions on one page or have only a set number of questions per page
43
- * Require user to be logged in
44
- * Schedule when the quiz or survey should be active
45
- * **Require** certain or all questions to be answered
46
- * Limit amount of total entries to quiz or survey
47
- * Can set amount of tries a user has to take the quiz or survey
48
- * Can enable **comment boxes** for each question and/or comment section at the end of the quiz or survey
49
- * Can enable **hints** for questions
50
- * Can show user why the answer is the correct answer
51
- * Questions can be in predetermined order or random
52
- * Keep track how long a user takes on the quiz or survey
53
- * Able to set up time limits on the quiz or survey
54
- * Create and display math formulas
55
- * And **Much** More...
56
-
57
- = Make Suggestions Or Contribute =
58
- Quiz And Survey Master is on [GitHub](https://github.com/QuizandSurveyMaster/quiz_master_next/)!
59
-
60
- = Quiz And Survey Master Add-ons =
61
- While Quiz And Survey Master is fully functional and is packed full of features that will meet the needs of most, we do offer various extra features including:
62
-
63
- **Free Add-ons**
64
-
65
- * [Certificates](https://quizandsurveymaster.com/downloads/certificate/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=certificate)
66
- * [Leaderboards](https://quizandsurveymaster.com/downloads/leaderboards/?utm_source=readme&utm_medium=plugin&utm_campaign=qsm_plugin&utm_content=leaderboads)
67
-
68
- **Premium Add-ons**
69
-
70
- * [URL Parameters](http://bit.ly/2I1ZM6g)
71
- * [Google Analytics Tracking](http://bit.ly/2AAgABs)
72
- * [Landing Page](https://quizandsurveymaster.com/downloads/landing-page/?utm_source=readme&utm_medium=plugin&utm_content=landing-page&utm_campaign=qsm_plugin)
73
- * [Export Results](https://quizandsurveymaster.com/downloads/export-results/?utm_source=readme&utm_medium=plugin&utm_content=export-results&utm_campaign=qsm_plugin)
74
- * [Reporting & Analysis](https://quizandsurveymaster.com/downloads/results-analysis/?utm_source=readme&utm_medium=plugin&utm_content=reporting-analysis&utm_campaign=qsm_plugin)
75
- * [MailChimp Integration](https://quizandsurveymaster.com/downloads/mailchimp-integration/?utm_source=readme&utm_medium=plugin&utm_content=mailchimp-integration&utm_campaign=qsm_plugin)
76
- * And **many** more available in our [Quiz And Survey Master Addon Store](https://quizandsurveymaster.com/addons/?utm_source=readme&utm_medium=plugin&utm_content=all-addons&utm_campaign=qsm_plugin)
77
-
78
- == Installation ==
79
-
80
- * Navigate to Add New Plugin page within your WordPress
81
- * Search for Quiz And Survey Master
82
- * Click Install Now link on the plugin and follow the prompts
83
- * Activate the plugin through the 'Plugins' menu in WordPress
84
-
85
- == Frequently Asked Questions ==
86
-
87
- = How do you use that feature? =
88
- We have extensive documentation and videos for the plugin. You can view the documentation here: [Documentation](https://docs.quizandsurveymaster.com). If you still need assistance, feel free to reach out to us!
89
-
90
- = I want to edit the output for %QUESTIONS_ANSWERS%. Can I do that? =
91
-
92
- Yes, it is possible to edit the output of the variable %QUESTIONS_ANSWERS%. When editing your quiz, go to the “Text” tab. Once on the “Text” tab scroll almost all the way down the page and you will see a text area that allows you to edit the contents of %QUESTIONS_ANSWERS%.
93
-
94
- = I want to remove the "Correct Answer" part of my results page, or I want to display the "Correct Answer Info" part on my results page. How can I do that? =
95
-
96
- To make these changes, you will edit the %QUESTIONS_ANSWERS% variable. To do that, simply look at the answer to the previous question.
97
-
98
- = My preview looks different than my quiz. What can I do? =
99
-
100
- This is usually a theme conflict. You can [checkout out our common conflict solutions](https://docs.quizandsurveymaster.com/article/21-common-theme-conflict-fixes) or feel free to contact us.
101
-
102
- == Screenshots ==
103
-
104
- 1. Quiz/Survey Admin Page (With Advertisement Be Gone Add-On)
105
- 2. Quiz/Survey Settings Page (With Advertisement Be Gone Add-On)
106
- 3. Quiz/Survey Statistics Page (With Advertisement Be Gone Add-On)
107
- 4. Example Quiz
108
- 5. Example Survey
109
- 6. Quiz/Survey Results Page
110
- 8. Example Quiz With Styling
111
-
112
- == Changelog ==
113
-
114
- = 6.3.3 (Oct 04, 2019) =
115
- * Option to disable "retake" quiz option.
116
- * Mouse pointer over the FB / TW buttons
117
- * Translate for "Retake Quiz" ([Issue #773] https://github.com/QuizandSurveyMaster/quiz_master_next/issues/773)
118
- * Radio buttons hard to select ([WP Issue] (https://wordpress.org/support/topic/radio-buttons-are-hard-to-select-on-mobile-devices/))
119
- * Results page enhancements
120
- * Skipped 6.3.2, by mistake.
121
-
122
- = 6.3.2 (July 06, 2019) =
123
- * UI Changes
124
- * Addons Pricing Page Update
125
- * Free Addon Page Added
126
- * Show results of quiz in realtime - #646
127
- * Timer Enhacements - Auto submit at expiry and show message on expiry
128
- * Personality Quiz Enhancements - Show category on frontend and Show results per category
129
- * Retake Quiz - #661
130
- * Question Bank Enhacements - #39
131
- * Facebook Button Icons
132
-
133
- = 6.3.1 (May 19, 2019) =
134
- * Closed Bug: Duplicate post issue ([Issue #758](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/758))
135
- * Closed Enhancement: Option to turn off autofill ([WP Issue](https://wordpress.org/support/topic/can-you-add-an-option-to-turn-off-autofill-on-galaxy-phones-and-other-devices/))
136
- * Added Feature: Preview quiz within the quiz edit page.
137
- * Added Feature: Auto save quiz and questions
138
- * Closed Enhancement: Disable autofill for contact fields ([Issue #718](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/718))
139
- * Closed Enhancement: Added %POLL_RESULTS_X% tag for results page to show poll results ([Issue #458](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/458))
140
- * Closed Bug: Facebook Share not working properly ([WP Issue](https://wordpress.org/support/topic/facebook-share-40/))
141
-
142
-
143
- = 6.3.0 (April 20, 2019) =
144
- * Massive UI update
145
- * Closed Enhancement: Support for Image and Rich answers
146
- ([Issue #146](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/146))
147
-
148
- = 6.2.2 (March 14, 2019) =
149
- * Security update as suggested by WordPress team.
150
-
151
- = 6.2.1 (February 20, 2019) =
152
- * Fixes cut off submit button on mobile phone issue
153
- * Switches "Frank Corso" with "QSM Team" in relevant places
154
-
155
- = 6.2.0 (January 31, 2019) =
156
- * Closed Enhancement: Create new alert system on quiz options page ([Issue #754](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/754))
157
- * Closed Bug: No access allowed when clicking "Support" from plugins page ([Issue #753](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/753))
158
- * Closed Bug: To many redirects ([Issue #745](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/745))
159
- * Closed User Request: Allow default email to be deleted or turned off ([Issue #735](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/735))
160
- * Closed Enhancement: Rewrite emails to allow for different conditions ([Issue #379](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/379))
161
- * Closed Enhancement: Rewrite results pages to allow for different conditions ([Issue #378](https://github.com/QuizandSurveyMaster/quiz_master_next/issues/378))
162
-
163
- ([Read Full Changelog](https://github.com/QuizandSurveyMaster/quiz_master_next/blob/master/CHANGELOG.md))
164
-
165
- == Upgrade Notice ==
166
-
167
- = 6.2.1 =
168
- Upgrade to fix cut submit button on mobile issue
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/templates/qmn_amethyst.css DELETED
@@ -1,427 +0,0 @@
1
- #qsm-progress-bar {
2
- position: relative;
3
- flex-grow: 2;
4
- padding: 0 10px;
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 {
19
- 0% {
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);
36
- }
37
- }
38
-
39
- @keyframes spinner-loader {
40
- 0% {
41
- -moz-transform: rotate(0deg);
42
- -ms-transform: rotate(0deg);
43
- -webkit-transform: rotate(0deg);
44
- transform: rotate(0deg);
45
- }
46
- 100% {
47
- -moz-transform: rotate(360deg);
48
- -ms-transform: rotate(360deg);
49
- -webkit-transform: rotate(360deg);
50
- transform: rotate(360deg);
51
- }
52
- }
53
-
54
- /* :not(:required) hides this rule from IE9 and below */
55
- .qsm-spinner-loader:not(:required) {
56
- -moz-animation: spinner-loader 1500ms infinite linear;
57
- -webkit-animation: spinner-loader 1500ms infinite linear;
58
- animation: spinner-loader 1500ms infinite linear;
59
- -moz-border-radius: 0.5em;
60
- -webkit-border-radius: 0.5em;
61
- border-radius: 0.5em;
62
- -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;
63
- -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;
64
- 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;
65
- display: inline-block;
66
- font-size: 10px;
67
- width: 1em;
68
- height: 1em;
69
- margin: 1.5em;
70
- overflow: hidden;
71
- text-indent: 100%;
72
- }
73
-
74
-
75
- .mlw_qmn_message_before {
76
- color: #666;
77
- font-size: 18px;
78
- display: block;
79
- margin-bottom: 20px;
80
- padding-bottom: 10px;
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;
88
- border: 0;
89
- margin: 0;
90
- padding: 15px 0 15px 0;
91
- font-size: 16px;
92
- }
93
-
94
- .quiz_section.border {
95
- border-top: 1px solid #f3f3f3;
96
- }
97
-
98
- .quiz_section label,
99
- .quiz_section .mlw_qmn_question {
100
- display: block;
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
- .qsm_contact_div {
109
- margin: 10px 0;
110
- }
111
-
112
- .quiz_section .qsm-contact-type-checkbox label,
113
- .quiz_section .qsm-contact-type-checkbox input {
114
- display: inline;
115
- }
116
-
117
- label.inline,
118
- label.inline .mlw_qmn_question,
119
- .quiz_section.inline .mlw_horizontal_multiple {
120
- display: inline-block;
121
- }
122
-
123
- .quiz_section p.form-help {
124
- margin: 5px 0 0 0;
125
- font-size: 12px;
126
- color: #999;
127
- }
128
-
129
- .quiz_section iframe { margin-bottom: 10px; }
130
-
131
- .qmn_mc_answer_wrap {
132
- display: block;
133
- margin: 5px 0 5px 0;
134
- }
135
-
136
- .quiz_section .qmn_radio_answers label,
137
- .quiz_section .qmn_check_answers label,
138
- .quiz_section .qmn_accept_answers label {
139
- display: inline;
140
- margin: 0 10px 0 5px;
141
- font-weight: normal;
142
- font-size: 14px;
143
- cursor: pointer;
144
- }
145
-
146
- .quiz_section.text-block h2 {
147
- display: block;
148
- margin: 0 0 10px 0;
149
- }
150
-
151
- .quiz_section select,
152
- .quiz_section textarea,
153
- .quiz_section input[type="text"],
154
- .quiz_section input[type="email"],
155
- .quiz_section input[type="number"] {
156
- width: 70%;
157
- min-height: 35px;
158
- display: inline-block;
159
- padding: 10px 8px 10px 8px;
160
- font-size: 14px;
161
- color: #555;
162
- background: #fff;
163
- border: 1px solid #e3e3e3;
164
- -webkit-border-radius: 3px;
165
- -moz-border-radius: 3px;
166
- border-radius: 3px;
167
- -webkit-box-sizing: border-box;
168
- -moz-box-sizing: border-box;
169
- box-sizing: border-box;
170
- -webkit-transition: all .5s ease-in-out;
171
- -moz-transition: all .5s ease-in-out;
172
- transition: all .5s ease-in-out;
173
- }
174
-
175
- .quiz_section select { height: 38px; }
176
-
177
- .quiz_section select:hover,
178
- .quiz_section textarea:hover,
179
- .quiz_section input[type="text"]:hover,
180
- .quiz_section input[type="email"]:hover,
181
- .quiz_section input[type="number"]:hover,
182
- .quiz_section select:focus,
183
- .quiz_section textarea:focus,
184
- .quiz_section input[type="text"]:focus,
185
- .quiz_section input[type="email"]:focus,
186
- .quiz_section input[type="number"]:focus {
187
- outline: 0;
188
- background: #f7f7f7;
189
- border: 1px solid #bdc3c7;
190
- -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.15);
191
- -moz-box-shadow: 0 0 10px rgba(0,0,0,0.15);
192
- box-shadow: 0 0 10px rgba(0,0,0,0.15);
193
- }
194
-
195
- .qmn_fill_blank {
196
- margin: 0 5px 0 5px;
197
- width: 100px !important;
198
- }
199
-
200
- .qmn_fill_blank.small { width: 50px; }
201
- .qmn_fill_blank.medium { width: 100px; }
202
- .qmn_fill_blank.large { width: 150px; }
203
-
204
-
205
- /* Alerts and error state */
206
-
207
- .qmn_error_message {
208
- color: #da4f49;
209
- border: 1px solid #da4f49;
210
- background: #F2DEDE;
211
- display: block;
212
- padding: 10px;
213
- margin: 10px 0 10px 0;
214
- -webkit-border-radius: 3px;
215
- -moz-border-radius: 3px;
216
- border-radius: 3px;
217
- }
218
-
219
- .quiz_section.qmn_error select,
220
- .quiz_section.qmn_error textarea,
221
- .quiz_section.qmn_error input[type="text"],
222
- .quiz_section.qmn_error input[type="number"],
223
- .quiz_section.qmn_error input[type="email"],
224
- .quiz_section.qmn_error input[type="checkbox"],
225
- .quiz_section.qmn_error select:hover,
226
- .quiz_section.qmn_error textarea:hover,
227
- .quiz_section.qmn_error input[type="text"]:hover,
228
- .quiz_section.qmn_error input[type="number"]:hover,
229
- .quiz_section.qmn_error input[type="email"]:hover,
230
- .quiz_section.qmn_error input[type="checkbox"]:hover,
231
- .quiz_section.qmn_error select:focus,
232
- .quiz_section.qmn_error textarea:focus,
233
- .quiz_section.qmn_error input[type="text"]:focus,
234
- .quiz_section.qmn_error input[type="number"]:focus,
235
- .quiz_section.qmn_error input[type="email"]:focus,
236
- .quiz_section.qmn_error input[type="checkbox"]:focus {
237
- position: relative;
238
- border: 1px solid #da4f49;
239
- background: #F2DEDE;
240
- -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
241
- -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
242
- box-shadow: 0 0 10px rgba(218, 79, 73, .35);
243
- }
244
-
245
- .quiz_section.qmn_error { position: relative; }
246
-
247
- .quiz_section.qmn_error:after {
248
- content: '-';
249
- color: #fff;
250
- font-size: 20px;
251
- font-family: 'Helvetica', Arial, sans-serif;
252
- background: #da4f49;
253
- text-align: center;
254
- display: inline-block;
255
- height: 20px;
256
- line-height: 20px;
257
- width: 20px;
258
- position: absolute;
259
- right: 0;
260
- top: 12px;
261
- -webkit-border-radius: 20px;
262
- -moz-border-radius: 20px;
263
- border-radius: 20px;
264
-
265
- }
266
-
267
- .quiz_section.qmn_error .qmn_radio_answers,
268
- .quiz_section.qmn_error .qmn_check_answers,
269
- .quiz_section.qmn_error .qmn_accept_answers {
270
- border: 1px solid #da4f49;
271
- background: #F2DEDE;
272
- padding: 5px;
273
- -webkit-border-radius: 3px;
274
- -moz-border-radius: 3px;
275
- border-radius: 3px;
276
- }
277
-
278
- .qmn_btn, .qmn_quiz_container .btn {
279
- display: relative;
280
- display: inline-block;
281
- color: #666 !important;
282
- background: #ccc !important;
283
- font-size: 16px !important;
284
- padding: 10px 20px 10px 20px !important;
285
- text-decoration: none !important;
286
- -webkit-border-radius: 3px;
287
- -moz-border-radius: 3px;
288
- border-radius: 3px;
289
- -webkit-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
290
- -moz-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
291
- box-shadow: 0px 0px 6px rgba(0,0,0,.05);
292
- -webkit-transition: background .25s ease-out;
293
- -moz-transition: background .25s ease-out;
294
- transition: background .25s ease-out;
295
- }
296
-
297
- .qmn_btn:hover, .qmn_quiz_container .btn:hover {
298
- color: #fff;
299
- background: #666;
300
- }
301
-
302
- .qmn_pagination {
303
- position: relative;
304
- display: flex;
305
- align-items: stretch;
306
- flex-direction: column;
307
- padding: 15px 0 15px 0;
308
- border-top: 1px solid #f3f3f3;
309
- }
310
-
311
- @media screen and (min-width: 500px) {
312
- .qmn_pagination {
313
- justify-content: space-between;
314
- align-items: center;
315
- flex-direction: row;
316
- }
317
- }
318
-
319
- /* .qmn_page_counter_message {
320
- font-size: 14px;
321
- color: #999;
322
- width: 100px;
323
- padding: 10px 20px 10px 20px;
324
- margin: 0 auto;
325
- text-align: center;
326
- } */
327
-
328
- .mlw_qmn_timer {
329
- z-index: 999;
330
- display: inline-block;
331
- position: fixed;
332
- bottom: 20px;
333
- right: 20px;
334
- height: 50px;
335
- line-height: 50px;
336
- padding: 0 20px;
337
- background: #34495e;
338
- color: #fff;
339
- -webkit-border-radius: 50px;
340
- -moz-border-radius: 50px;
341
- border-radius: 50px;
342
- -webkit-box-shadow: 0 4px 8px rgba(0,0,0,.10);
343
- -moz-box-shadow: 0 4px 8px rgba(0,0,0,.10);
344
- box-shadow: 0 4px 8px rgba(0,0,0,.10);
345
- }
346
-
347
- .qmn_quiz_container select,
348
- .qmn_quiz_container textarea,
349
- .qmn_quiz_container input[type="text"],
350
- .qmn_quiz_container input[type="email"],
351
- .qmn_quiz_container input[type="number"] {
352
- background: #fff;
353
- border: 1px solid #9b59b6;
354
- }
355
-
356
- .qmn_quiz_container select:hover,
357
- .qmn_quiz_container textarea:hover,
358
- .qmn_quiz_container input[type="text"]:hover,
359
- .qmn_quiz_container input[type="email"]:hover,
360
- .qmn_quiz_container input[type="number"]:hover,
361
- .qmn_quiz_container select:focus,
362
- .qmn_quiz_container textarea:focus,
363
- .qmn_quiz_container input[type="text"]:focus,
364
- .qmn_quiz_container input[type="email"]:focus,
365
- .qmn_quiz_container input[type="number"]:focus{
366
- outline: 0;
367
- background: #fff;
368
- border: 1px solid #9b59b6;
369
- -webkit-box-shadow: 0 0 10px rgba(155, 89, 182, .35);
370
- -moz-box-shadow: 0 0 10px rgba(155, 89, 182, .35);
371
- box-shadow: 0 0 10px rgba(155, 89, 182, .35);
372
- }
373
-
374
- .qmn_quiz_container .qmn_btn, .qmn_quiz_container .btn {
375
- color: #fff !important;
376
- background: #9b59b6 !important;
377
- }
378
-
379
- .qmn_quiz_container .qmn_btn:hover, .qmn_quiz_container .btn:hover { background: #8e44ad !important; }
380
-
381
- .quiz_section.quiz_end .qsm-submit-btn {
382
- display: block;
383
- margin: 10px 0;
384
- }
385
-
386
- /* Helper classes */
387
-
388
- .border-none { border: 0; }
389
- .margin-bottom { margin-bottom: 20px; }
390
-
391
-
392
- @media (max-width: 768px) {
393
-
394
- .quiz_section label,
395
- .quiz_section .mlw_qmn_question {
396
- font-size: 18px;
397
- }
398
-
399
- .quiz_section.radio .qmn_mc_answer_wrap label {
400
- font-size: 18px;
401
- }
402
-
403
- .quiz_section p.form-help { font-size: 14px; }
404
-
405
- .quiz_section select,
406
- .quiz_section textarea,
407
- .quiz_section input[type="text"] {
408
- display: block;
409
- width: 100%;
410
- padding: 12px 10px 12px 10px;
411
- font-size: 16px;
412
- }
413
-
414
- .mlw_previous,
415
- .mlw_next,
416
- .qmn_page_counter_message {
417
- display: inline-block;
418
- text-align: center;
419
- position: relative;
420
- top: 0;
421
- left: 0;
422
- right: 0;
423
- }
424
-
425
- .mlw_qmn_timer { top: 20px; }
426
-
427
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/templates/qmn_base.css DELETED
@@ -1,574 +0,0 @@
1
- #qsm-progress-bar {
2
- position: relative;
3
- flex-grow: 2;
4
- padding: 0 10px;
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 {
19
- 0% {
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);
36
- }
37
- }
38
-
39
- @keyframes spinner-loader {
40
- 0% {
41
- -moz-transform: rotate(0deg);
42
- -ms-transform: rotate(0deg);
43
- -webkit-transform: rotate(0deg);
44
- transform: rotate(0deg);
45
- }
46
- 100% {
47
- -moz-transform: rotate(360deg);
48
- -ms-transform: rotate(360deg);
49
- -webkit-transform: rotate(360deg);
50
- transform: rotate(360deg);
51
- }
52
- }
53
-
54
- /* :not(:required) hides this rule from IE9 and below */
55
- .qsm-spinner-loader:not(:required) {
56
- -moz-animation: spinner-loader 1500ms infinite linear;
57
- -webkit-animation: spinner-loader 1500ms infinite linear;
58
- animation: spinner-loader 1500ms infinite linear;
59
- -moz-border-radius: 0.5em;
60
- -webkit-border-radius: 0.5em;
61
- border-radius: 0.5em;
62
- -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;
63
- -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;
64
- 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;
65
- display: inline-block;
66
- font-size: 10px;
67
- width: 1em;
68
- height: 1em;
69
- margin: 1.5em;
70
- overflow: hidden;
71
- text-indent: 100%;
72
- }
73
-
74
-
75
- .mlw_qmn_message_before {
76
- color: #666;
77
- font-size: 18px;
78
- display: block;
79
- margin-bottom: 20px;
80
- padding-bottom: 10px;
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;
88
- border: 0;
89
- margin: 0;
90
- padding: 15px 0 15px 0;
91
- font-size: 16px;
92
- }
93
-
94
- .quiz_section.border {
95
- border-top: 1px solid #f3f3f3;
96
- }
97
-
98
- .quiz_section label,
99
- .quiz_section .mlw_qmn_question {
100
- display: block;
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
- .qsm_contact_div {
109
- margin: 10px 0;
110
- }
111
-
112
- .quiz_section .qsm-contact-type-checkbox label,
113
- .quiz_section .qsm-contact-type-checkbox input {
114
- display: inline;
115
- }
116
-
117
- label.inline,
118
- label.inline .mlw_qmn_question,
119
- .quiz_section.inline .mlw_horizontal_multiple {
120
- display: inline-block;
121
- }
122
-
123
- .quiz_section p.form-help {
124
- margin: 5px 0 0 0;
125
- font-size: 12px;
126
- color: #999;
127
- }
128
-
129
- .quiz_section iframe { margin-bottom: 10px; }
130
-
131
- .qmn_mc_answer_wrap {
132
- display: block;
133
- margin: 5px 0 5px 0;
134
- }
135
-
136
- .quiz_section .qmn_radio_answers label,
137
- .quiz_section .qmn_check_answers label,
138
- .quiz_section .qmn_accept_answers label {
139
- display: inline;
140
- margin: 0 10px 0 5px;
141
- font-weight: normal;
142
- font-size: 14px;
143
- cursor: pointer;
144
- }
145
-
146
- .quiz_section.text-block h2 {
147
- display: block;
148
- margin: 0 0 10px 0;
149
- }
150
-
151
- .quiz_section select,
152
- .quiz_section textarea,
153
- .quiz_section input[type="text"],
154
- .quiz_section input[type="email"],
155
- .quiz_section input[type="number"] {
156
- width: 70%;
157
- display: inline-block;
158
- padding: 10px 8px 10px 8px;
159
- font-size: 14px;
160
- color: #555;
161
- background: #fff;
162
- border: 1px solid #e3e3e3;
163
- -webkit-border-radius: 3px;
164
- -moz-border-radius: 3px;
165
- border-radius: 3px;
166
- -webkit-box-sizing: border-box;
167
- -moz-box-sizing: border-box;
168
- box-sizing: border-box;
169
- -webkit-transition: all .5s ease-in-out;
170
- -moz-transition: all .5s ease-in-out;
171
- transition: all .5s ease-in-out;
172
- }
173
-
174
- .quiz_section select { height: 38px; }
175
-
176
- .quiz_section select:hover,
177
- .quiz_section textarea:hover,
178
- .quiz_section input[type="text"]:hover,
179
- .quiz_section input[type="email"]:hover,
180
- .quiz_section input[type="number"]:hover,
181
- .quiz_section select:focus,
182
- .quiz_section textarea:focus,
183
- .quiz_section input[type="text"]:focus,
184
- .quiz_section input[type="email"]:focus,
185
- .quiz_section input[type="number"]:focus {
186
- outline: 0;
187
- background: #f7f7f7;
188
- border: 1px solid #bdc3c7;
189
- -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.15);
190
- -moz-box-shadow: 0 0 10px rgba(0,0,0,0.15);
191
- box-shadow: 0 0 10px rgba(0,0,0,0.15);
192
- }
193
-
194
- .qmn_fill_blank {
195
- margin: 0 5px 0 5px;
196
- width: 100px !important;
197
- }
198
-
199
- .qmn_fill_blank.small { width: 50px; }
200
- .qmn_fill_blank.medium { width: 100px; }
201
- .qmn_fill_blank.large { width: 150px; }
202
-
203
-
204
- /* Alerts and error state */
205
-
206
- .qmn_error_message {
207
- color: #da4f49;
208
- border: 1px solid #da4f49;
209
- background: #F2DEDE;
210
- display: block;
211
- padding: 10px;
212
- margin: 10px 0 10px 0;
213
- -webkit-border-radius: 3px;
214
- -moz-border-radius: 3px;
215
- border-radius: 3px;
216
- }
217
-
218
- .quiz_section.qmn_error select,
219
- .quiz_section.qmn_error textarea,
220
- .quiz_section.qmn_error input[type="text"],
221
- .quiz_section.qmn_error input[type="number"],
222
- .quiz_section.qmn_error input[type="email"],
223
- .quiz_section.qmn_error input[type="checkbox"],
224
- .quiz_section.qmn_error select:hover,
225
- .quiz_section.qmn_error textarea:hover,
226
- .quiz_section.qmn_error input[type="text"]:hover,
227
- .quiz_section.qmn_error input[type="number"]:hover,
228
- .quiz_section.qmn_error input[type="email"]:hover,
229
- .quiz_section.qmn_error input[type="checkbox"]:hover,
230
- .quiz_section.qmn_error select:focus,
231
- .quiz_section.qmn_error textarea:focus,
232
- .quiz_section.qmn_error input[type="text"]:focus,
233
- .quiz_section.qmn_error input[type="number"]:focus,
234
- .quiz_section.qmn_error input[type="email"]:focus,
235
- .quiz_section.qmn_error input[type="checkbox"]:focus {
236
- position: relative;
237
- border: 1px solid #da4f49;
238
- background: #F2DEDE;
239
- -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
240
- -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
241
- box-shadow: 0 0 10px rgba(218, 79, 73, .35);
242
- }
243
-
244
- .quiz_section.qmn_error { position: relative; }
245
-
246
- .quiz_section.qmn_error:after {
247
- content: '-';
248
- color: #fff;
249
- font-size: 20px;
250
- font-family: 'Helvetica', Arial, sans-serif;
251
- background: #da4f49;
252
- text-align: center;
253
- display: inline-block;
254
- height: 20px;
255
- line-height: 20px;
256
- width: 20px;
257
- position: absolute;
258
- right: 0;
259
- top: 12px;
260
- -webkit-border-radius: 20px;
261
- -moz-border-radius: 20px;
262
- border-radius: 20px;
263
-
264
- }
265
-
266
- .quiz_section.qmn_error .qmn_radio_answers,
267
- .quiz_section.qmn_error .qmn_check_answers,
268
- .quiz_section.qmn_error .qmn_accept_answers {
269
- border: 1px solid #da4f49;
270
- background: #F2DEDE;
271
- padding: 5px;
272
- -webkit-border-radius: 3px;
273
- -moz-border-radius: 3px;
274
- border-radius: 3px;
275
- }
276
-
277
- .qmn_btn, .qmn_quiz_container .btn {
278
- display: relative;
279
- display: inline-block;
280
- color: #666 !important;
281
- background: #ccc !important;
282
- font-size: 16px !important;
283
- padding: 10px 20px 10px 20px !important;
284
- text-decoration: none !important;
285
- -webkit-border-radius: 3px;
286
- -moz-border-radius: 3px;
287
- border-radius: 3px;
288
- -webkit-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
289
- -moz-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
290
- box-shadow: 0px 0px 6px rgba(0,0,0,.05);
291
- -webkit-transition: background .25s ease-out;
292
- -moz-transition: background .25s ease-out;
293
- transition: background .25s ease-out;
294
- }
295
-
296
- .qmn_btn:hover, .qmn_quiz_container .btn:hover {
297
- color: #fff;
298
- background: #666;
299
- }
300
-
301
- .qmn_pagination {
302
- position: relative;
303
- display: flex;
304
- align-items: stretch;
305
- flex-direction: column;
306
- padding: 15px 0 15px 0;
307
- border-top: 1px solid #f3f3f3;
308
- }
309
-
310
- @media screen and (min-width: 500px) {
311
- .qmn_pagination {
312
- justify-content: space-between;
313
- align-items: center;
314
- flex-direction: row;
315
- }
316
- }
317
-
318
- /* .qmn_page_counter_message {
319
- font-size: 14px;
320
- color: #999;
321
- width: 100px;
322
- padding: 10px 20px 10px 20px;
323
- margin: 0 auto;
324
- text-align: center;
325
- } */
326
-
327
- .mlw_qmn_timer {
328
- z-index: 999;
329
- display: inline-block;
330
- position: fixed;
331
- bottom: 20px;
332
- right: 20px;
333
- height: 50px;
334
- line-height: 50px;
335
- padding: 0 20px;
336
- background: #34495e;
337
- color: #fff;
338
- -webkit-border-radius: 50px;
339
- -moz-border-radius: 50px;
340
- border-radius: 50px;
341
- -webkit-box-shadow: 0 4px 8px rgba(0,0,0,.10);
342
- -moz-box-shadow: 0 4px 8px rgba(0,0,0,.10);
343
- box-shadow: 0 4px 8px rgba(0,0,0,.10);
344
- }
345
-
346
- /* Amethyst */
347
-
348
- .amethyst .select,
349
- .amethyst textarea,
350
- .amethyst input[type="text"],
351
- .amethyst input[type="email"],
352
- .amethyst input[type="number"] {
353
- background: #fff;
354
- border: 1px solid #9b59b6;
355
- }
356
-
357
- .amethyst select:hover,
358
- .amethyst textarea:hover,
359
- .amethyst input[type="text"]:hover,
360
- .amethyst input[type="email"]:hover,
361
- .amethyst input[type="number"]:hover,
362
- .amethyst select:focus,
363
- .amethyst textarea:focus,
364
- .amethyst input[type="text"]:focus,
365
- .amethyst input[type="email"]:focus,
366
- .amethyst input[type="number"]:focus {
367
- outline: 0;
368
- background: #fff;
369
- border: 1px solid #9b59b6;
370
- -webkit-box-shadow: 0 0 10px rgba(155, 89, 182, .35);
371
- -moz-box-shadow: 0 0 10px rgba(155, 89, 182, .35);
372
- box-shadow: 0 0 10px rgba(155, 89, 182, .35);
373
- }
374
-
375
- .amethyst .qmn_quiz_container .btn {
376
- color: #fff;
377
- background: #9b59b6;
378
- }
379
-
380
- .amethyst .qmn_quiz_container .btn:hover { background: #8e44ad; }
381
-
382
-
383
- /* emerald */
384
-
385
- .emerald .select,
386
- .emerald textarea,
387
- .emerald input[type="text"],
388
- .emerald input[type="email"],
389
- .emerald input[type="number"] {
390
- background: #fff;
391
- border: 1px solid #2ecc71;
392
- }
393
-
394
- .emerald select:hover,
395
- .emerald textarea:hover,
396
- .emerald input[type="text"]:hover,
397
- .emerald input[type="email"]:hover,
398
- .emerald input[type="number"]:hover,
399
- .emerald select:focus,
400
- .emerald textarea:focus,
401
- .emerald input[type="text"]:focus,
402
- .emerald input[type="email"]:focus,
403
- .emerald input[type="number"]:focus{
404
- outline: 0;
405
- background: #fff;
406
- border: 1px solid #2ecc71;
407
- -webkit-box-shadow: 0 0 10px rgba(46, 204, 113, .35);
408
- -moz-box-shadow: 0 0 10px rgba(46, 204, 113, .35);
409
- box-shadow: 0 0 10px rgba(46, 204, 113, .35);
410
- }
411
-
412
- .emerald .btn {
413
- color: #fff;
414
- background: #2ecc71;
415
- }
416
-
417
- .emerald .btn:hover { background: #27ae60; }
418
-
419
- /* turquoise */
420
-
421
- .turquoise .select,
422
- .turquoise textarea,
423
- .turquoise input[type="text"],
424
- .turquoise input[type="email"],
425
- .turquoise input[type="number"] {
426
- background: #fff;
427
- border: 1px solid #1abc9c;
428
- }
429
-
430
- .turquoise select:hover,
431
- .turquoise textarea:hover,
432
- .turquoise input[type="text"]:hover,
433
- .turquoise input[type="email"]:hover,
434
- .turquoise input[type="number"]:hover,
435
- .turquoise select:focus,
436
- .turquoise textarea:focus,
437
- .turquoise input[type="text"]:focus,
438
- .turquoise input[type="email"]:focus,
439
- .turquoise input[type="number"]:focus{
440
- outline: 0;
441
- background: #fff;
442
- border: 1px solid #1abc9c;
443
- -webkit-box-shadow: 0 0 10px rgba(26, 188, 156, .35);
444
- -moz-box-shadow: 0 0 10px rgba(26, 188, 156, .35);
445
- box-shadow: 0 0 10px rgba(26, 188, 156, .35);
446
- }
447
-
448
- .turquoise .btn {
449
- color: #fff;
450
- background: #1abc9c;
451
- }
452
-
453
- .turquoise .btn:hover { background: #16a085; }
454
-
455
- /* turquoise */
456
-
457
- .turquoise .select,
458
- .turquoise textarea,
459
- .turquoise input[type="text"],
460
- .turquoise input[type="email"],
461
- .turquoise input[type="number"] {
462
- background: #fff;
463
- border: 1px solid #1abc9c;
464
- }
465
-
466
- .turquoise select:hover,
467
- .turquoise textarea:hover,
468
- .turquoise input[type="text"]:hover,
469
- .turquoise input[type="email"]:hover,
470
- .turquoise input[type="number"]:hover,
471
- .turquoise select:focus,
472
- .turquoise textarea:focus,
473
- .turquoise input[type="text"]:focus,
474
- .turquoise input[type="email"]:focus,
475
- .turquoise input[type="number"]:focus{
476
- outline: 0;
477
- background: #fff;
478
- border: 1px solid #1abc9c;
479
- -webkit-box-shadow: 0 0 10px rgba(26, 188, 156, .35);
480
- -moz-box-shadow: 0 0 10px rgba(26, 188, 156, .35);
481
- box-shadow: 0 0 10px rgba(26, 188, 156, .35);
482
- }
483
-
484
- .turquoise .btn {
485
- color: #fff;
486
- background: #1abc9c;
487
- }
488
-
489
- .turquoise .btn:hover { background: #16a085; }
490
-
491
-
492
- /* blue */
493
-
494
- .blue .select,
495
- .blue textarea,
496
- .blue input[type="text"],
497
- .blue input[type="email"],
498
- .blue input[type="number"] {
499
- background: #fff;
500
- border: 1px solid #3498db;
501
- }
502
-
503
- .blue select:hover,
504
- .blue textarea:hover,
505
- .blue input[type="text"]:hover,
506
- .blue input[type="email"]:hover,
507
- .blue input[type="number"]:hover,
508
- .blue select:focus,
509
- .blue textarea:focus,
510
- .blue input[type="text"]:focus,
511
- .blue input[type="email"]:focus,
512
- .blue input[type="number"]:focus{
513
- outline: 0;
514
- background: #fff;
515
- border: 1px solid #3498db;
516
- -webkit-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
517
- -moz-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
518
- box-shadow: 0 0 10px rgba(52, 152, 219, .35);
519
- }
520
-
521
- .blue .btn {
522
- color: #fff;
523
- background: #3498db;
524
- }
525
-
526
- .blue .btn:hover { background: #2980b9; }
527
-
528
- .quiz_section.quiz_end .qsm-submit-btn {
529
- display: block;
530
- margin: 10px 0;
531
- }
532
-
533
- /* Helper classes */
534
-
535
- .border-none { border: 0; }
536
- .margin-bottom { margin-bottom: 20px; }
537
-
538
-
539
- @media (max-width: 768px) {
540
-
541
- .quiz_section label,
542
- .quiz_section .mlw_qmn_question {
543
- font-size: 18px;
544
- }
545
-
546
- .quiz_section.radio .qmn_mc_answer_wrap label {
547
- font-size: 18px;
548
- }
549
-
550
- .quiz_section p.form-help { font-size: 14px; }
551
-
552
- .quiz_section select,
553
- .quiz_section textarea,
554
- .quiz_section input[type="text"] {
555
- display: block;
556
- width: 100%;
557
- padding: 12px 10px 12px 10px;
558
- font-size: 16px;
559
- }
560
-
561
- .mlw_previous,
562
- .mlw_next,
563
- .qmn_page_counter_message {
564
- display: inline-block;
565
- text-align: center;
566
- position: relative;
567
- top: 0;
568
- left: 0;
569
- right: 0;
570
- }
571
-
572
- .mlw_qmn_timer { top: 20px; }
573
-
574
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/templates/qmn_emerald.css DELETED
@@ -1,426 +0,0 @@
1
- #qsm-progress-bar {
2
- position: relative;
3
- flex-grow: 2;
4
- padding: 0 10px;
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 {
19
- 0% {
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);
36
- }
37
- }
38
-
39
- @keyframes spinner-loader {
40
- 0% {
41
- -moz-transform: rotate(0deg);
42
- -ms-transform: rotate(0deg);
43
- -webkit-transform: rotate(0deg);
44
- transform: rotate(0deg);
45
- }
46
- 100% {
47
- -moz-transform: rotate(360deg);
48
- -ms-transform: rotate(360deg);
49
- -webkit-transform: rotate(360deg);
50
- transform: rotate(360deg);
51
- }
52
- }
53
-
54
- /* :not(:required) hides this rule from IE9 and below */
55
- .qsm-spinner-loader:not(:required) {
56
- -moz-animation: spinner-loader 1500ms infinite linear;
57
- -webkit-animation: spinner-loader 1500ms infinite linear;
58
- animation: spinner-loader 1500ms infinite linear;
59
- -moz-border-radius: 0.5em;
60
- -webkit-border-radius: 0.5em;
61
- border-radius: 0.5em;
62
- -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;
63
- -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;
64
- 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;
65
- display: inline-block;
66
- font-size: 10px;
67
- width: 1em;
68
- height: 1em;
69
- margin: 1.5em;
70
- overflow: hidden;
71
- text-indent: 100%;
72
- }
73
-
74
- .mlw_qmn_message_before {
75
- color: #666;
76
- font-size: 18px;
77
- display: block;
78
- margin-bottom: 20px;
79
- padding-bottom: 10px;
80
- border-bottom: 1px solid #f3f3f3;
81
- }
82
-
83
- .mlw_qmn_message_before p { margin: 0 0 10px 0; }
84
-
85
- .quiz_section {
86
- display: block;
87
- border: 0;
88
- margin: 0;
89
- padding: 15px 0 15px 0;
90
- font-size: 16px;
91
- }
92
-
93
- .quiz_section.border {
94
- border-top: 1px solid #f3f3f3;
95
- }
96
-
97
- .quiz_section label,
98
- .quiz_section .mlw_qmn_question {
99
- display: block;
100
- margin: 0 0 5px 0;
101
- font-weight: bold;
102
- -webkit-box-sizing: border-box;
103
- -moz-box-sizing: border-box;
104
- box-sizing: border-box;
105
- }
106
-
107
- .qsm_contact_div {
108
- margin: 10px 0;
109
- }
110
-
111
- .quiz_section .qsm-contact-type-checkbox label,
112
- .quiz_section .qsm-contact-type-checkbox input {
113
- display: inline;
114
- }
115
-
116
- label.inline,
117
- label.inline .mlw_qmn_question,
118
- .quiz_section.inline .mlw_horizontal_multiple {
119
- display: inline-block;
120
- }
121
-
122
- .quiz_section p.form-help {
123
- margin: 5px 0 0 0;
124
- font-size: 12px;
125
- color: #999;
126
- }
127
-
128
- .quiz_section iframe { margin-bottom: 10px; }
129
-
130
- .qmn_mc_answer_wrap {
131
- display: block;
132
- margin: 5px 0 5px 0;
133
- }
134
-
135
- .quiz_section .qmn_radio_answers label,
136
- .quiz_section .qmn_check_answers label,
137
- .quiz_section .qmn_accept_answers label {
138
- display: inline;
139
- margin: 0 10px 0 5px;
140
- font-weight: normal;
141
- font-size: 14px;
142
- cursor: pointer;
143
- }
144
-
145
- .quiz_section.text-block h2 {
146
- display: block;
147
- margin: 0 0 10px 0;
148
- }
149
-
150
- .quiz_section select,
151
- .quiz_section textarea,
152
- .quiz_section input[type="text"],
153
- .quiz_section input[type="email"],
154
- .quiz_section input[type="number"] {
155
- width: 70%;
156
- min-height: 35px;
157
- display: inline-block;
158
- padding: 10px 8px 10px 8px;
159
- font-size: 14px;
160
- color: #555;
161
- background: #fff;
162
- border: 1px solid #e3e3e3;
163
- -webkit-border-radius: 3px;
164
- -moz-border-radius: 3px;
165
- border-radius: 3px;
166
- -webkit-box-sizing: border-box;
167
- -moz-box-sizing: border-box;
168
- box-sizing: border-box;
169
- -webkit-transition: all .5s ease-in-out;
170
- -moz-transition: all .5s ease-in-out;
171
- transition: all .5s ease-in-out;
172
- }
173
-
174
- .quiz_section select { height: 38px; }
175
-
176
- .quiz_section select:hover,
177
- .quiz_section textarea:hover,
178
- .quiz_section input[type="text"]:hover,
179
- .quiz_section input[type="email"]:hover,
180
- .quiz_section input[type="number"]:hover,
181
- .quiz_section select:focus,
182
- .quiz_section textarea:focus,
183
- .quiz_section input[type="text"]:focus,
184
- .quiz_section input[type="email"]:focus,
185
- .quiz_section input[type="number"]:focus {
186
- outline: 0;
187
- background: #f7f7f7;
188
- border: 1px solid #bdc3c7;
189
- -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.15);
190
- -moz-box-shadow: 0 0 10px rgba(0,0,0,0.15);
191
- box-shadow: 0 0 10px rgba(0,0,0,0.15);
192
- }
193
-
194
- .qmn_fill_blank {
195
- margin: 0 5px 0 5px;
196
- width: 100px !important;
197
- }
198
-
199
- .qmn_fill_blank.small { width: 50px; }
200
- .qmn_fill_blank.medium { width: 100px; }
201
- .qmn_fill_blank.large { width: 150px; }
202
-
203
-
204
- /* Alerts and error state */
205
-
206
- .qmn_error_message {
207
- color: #da4f49;
208
- border: 1px solid #da4f49;
209
- background: #F2DEDE;
210
- display: block;
211
- padding: 10px;
212
- margin: 10px 0 10px 0;
213
- -webkit-border-radius: 3px;
214
- -moz-border-radius: 3px;
215
- border-radius: 3px;
216
- }
217
-
218
- .quiz_section.qmn_error select,
219
- .quiz_section.qmn_error textarea,
220
- .quiz_section.qmn_error input[type="text"],
221
- .quiz_section.qmn_error input[type="number"],
222
- .quiz_section.qmn_error input[type="email"],
223
- .quiz_section.qmn_error input[type="checkbox"],
224
- .quiz_section.qmn_error select:hover,
225
- .quiz_section.qmn_error textarea:hover,
226
- .quiz_section.qmn_error input[type="text"]:hover,
227
- .quiz_section.qmn_error input[type="number"]:hover,
228
- .quiz_section.qmn_error input[type="email"]:hover,
229
- .quiz_section.qmn_error input[type="checkbox"]:hover,
230
- .quiz_section.qmn_error select:focus,
231
- .quiz_section.qmn_error textarea:focus,
232
- .quiz_section.qmn_error input[type="text"]:focus,
233
- .quiz_section.qmn_error input[type="number"]:focus,
234
- .quiz_section.qmn_error input[type="email"]:focus,
235
- .quiz_section.qmn_error input[type="checkbox"]:focus {
236
- position: relative;
237
- border: 1px solid #da4f49;
238
- background: #F2DEDE;
239
- -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
240
- -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
241
- box-shadow: 0 0 10px rgba(218, 79, 73, .35);
242
- }
243
-
244
- .quiz_section.qmn_error { position: relative; }
245
-
246
- .quiz_section.qmn_error:after {
247
- content: '-';
248
- color: #fff;
249
- font-size: 20px;
250
- font-family: 'Helvetica', Arial, sans-serif;
251
- background: #da4f49;
252
- text-align: center;
253
- display: inline-block;
254
- height: 20px;
255
- line-height: 20px;
256
- width: 20px;
257
- position: absolute;
258
- right: 0;
259
- top: 12px;
260
- -webkit-border-radius: 20px;
261
- -moz-border-radius: 20px;
262
- border-radius: 20px;
263
-
264
- }
265
-
266
- .quiz_section.qmn_error .qmn_radio_answers,
267
- .quiz_section.qmn_error .qmn_check_answers,
268
- .quiz_section.qmn_error .qmn_accept_answers {
269
- border: 1px solid #da4f49;
270
- background: #F2DEDE;
271
- padding: 5px;
272
- -webkit-border-radius: 3px;
273
- -moz-border-radius: 3px;
274
- border-radius: 3px;
275
- }
276
-
277
- .qmn_btn, .qmn_quiz_container .btn {
278
- display: relative;
279
- display: inline-block;
280
- color: #666 !important;
281
- background: #ccc !important;
282
- font-size: 16px !important;
283
- padding: 10px 20px 10px 20px !important;
284
- text-decoration: none !important;
285
- -webkit-border-radius: 3px;
286
- -moz-border-radius: 3px;
287
- border-radius: 3px;
288
- -webkit-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
289
- -moz-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
290
- box-shadow: 0px 0px 6px rgba(0,0,0,.05);
291
- -webkit-transition: background .25s ease-out;
292
- -moz-transition: background .25s ease-out;
293
- transition: background .25s ease-out;
294
- }
295
-
296
- .qmn_btn:hover, .qmn_quiz_container .btn:hover {
297
- color: #fff;
298
- background: #666;
299
- }
300
-
301
- .qmn_pagination {
302
- position: relative;
303
- display: flex;
304
- align-items: stretch;
305
- flex-direction: column;
306
- padding: 15px 0 15px 0;
307
- border-top: 1px solid #f3f3f3;
308
- }
309
-
310
- @media screen and (min-width: 500px) {
311
- .qmn_pagination {
312
- justify-content: space-between;
313
- align-items: center;
314
- flex-direction: row;
315
- }
316
- }
317
-
318
- /* .qmn_page_counter_message {
319
- font-size: 14px;
320
- color: #999;
321
- width: 100px;
322
- padding: 10px 20px 10px 20px;
323
- margin: 0 auto;
324
- text-align: center;
325
- } */
326
-
327
- .mlw_qmn_timer {
328
- z-index: 999;
329
- display: inline-block;
330
- position: fixed;
331
- bottom: 20px;
332
- right: 20px;
333
- height: 50px;
334
- line-height: 50px;
335
- padding: 0 20px;
336
- background: #34495e;
337
- color: #fff;
338
- -webkit-border-radius: 50px;
339
- -moz-border-radius: 50px;
340
- border-radius: 50px;
341
- -webkit-box-shadow: 0 4px 8px rgba(0,0,0,.10);
342
- -moz-box-shadow: 0 4px 8px rgba(0,0,0,.10);
343
- box-shadow: 0 4px 8px rgba(0,0,0,.10);
344
- }
345
-
346
- .qmn_quiz_container select,
347
- .qmn_quiz_container textarea,
348
- .qmn_quiz_container input[type="text"],
349
- .qmn_quiz_container input[type="email"],
350
- .qmn_quiz_container input[type="number"] {
351
- background: #fff;
352
- border: 1px solid #2ecc71;
353
- }
354
-
355
- .qmn_quiz_container select:hover,
356
- .qmn_quiz_container textarea:hover,
357
- .qmn_quiz_container input[type="text"]:hover,
358
- .qmn_quiz_container input[type="email"]:hover,
359
- .qmn_quiz_container input[type="number"]:hover,
360
- .qmn_quiz_container select:focus,
361
- .qmn_quiz_container textarea:focus,
362
- .qmn_quiz_container input[type="text"]:focus,
363
- .qmn_quiz_container input[type="email"]:focus,
364
- .qmn_quiz_container input[type="number"]:focus{
365
- outline: 0;
366
- background: #fff;
367
- border: 1px solid #2ecc71;
368
- -webkit-box-shadow: 0 0 10px rgba(46, 204, 113, .35);
369
- -moz-box-shadow: 0 0 10px rgba(46, 204, 113, .35);
370
- box-shadow: 0 0 10px rgba(46, 204, 113, .35);
371
- }
372
-
373
- .qmn_quiz_container .qmn_btn, .qmn_quiz_container .btn {
374
- color: #fff !important;
375
- background: #2ecc71 !important;
376
- }
377
-
378
- .qmn_quiz_container .qmn_btn:hover, .qmn_quiz_container .btn:hover { background: #27ae60 !important; }
379
-
380
- .quiz_section.quiz_end .qsm-submit-btn {
381
- display: block;
382
- margin: 10px 0;
383
- }
384
-
385
- /* Helper classes */
386
-
387
- .border-none { border: 0; }
388
- .margin-bottom { margin-bottom: 20px; }
389
-
390
-
391
- @media (max-width: 768px) {
392
-
393
- .quiz_section label,
394
- .quiz_section .mlw_qmn_question {
395
- font-size: 18px;
396
- }
397
-
398
- .quiz_section.radio .qmn_mc_answer_wrap label {
399
- font-size: 18px;
400
- }
401
-
402
- .quiz_section p.form-help { font-size: 14px; }
403
-
404
- .quiz_section select,
405
- .quiz_section textarea,
406
- .quiz_section input[type="text"] {
407
- display: block;
408
- width: 100%;
409
- padding: 12px 10px 12px 10px;
410
- font-size: 16px;
411
- }
412
-
413
- .mlw_previous,
414
- .mlw_next,
415
- .qmn_page_counter_message {
416
- display: inline-block;
417
- text-align: center;
418
- position: relative;
419
- top: 0;
420
- left: 0;
421
- right: 0;
422
- }
423
-
424
- .mlw_qmn_timer { top: 20px; }
425
-
426
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/templates/qmn_gray.css DELETED
@@ -1,393 +0,0 @@
1
- #qsm-progress-bar {
2
- position: relative;
3
- flex-grow: 2;
4
- padding: 0 10px;
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 {
19
- 0% {
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);
36
- }
37
- }
38
-
39
- @keyframes spinner-loader {
40
- 0% {
41
- -moz-transform: rotate(0deg);
42
- -ms-transform: rotate(0deg);
43
- -webkit-transform: rotate(0deg);
44
- transform: rotate(0deg);
45
- }
46
- 100% {
47
- -moz-transform: rotate(360deg);
48
- -ms-transform: rotate(360deg);
49
- -webkit-transform: rotate(360deg);
50
- transform: rotate(360deg);
51
- }
52
- }
53
-
54
- /* :not(:required) hides this rule from IE9 and below */
55
- .qsm-spinner-loader:not(:required) {
56
- -moz-animation: spinner-loader 1500ms infinite linear;
57
- -webkit-animation: spinner-loader 1500ms infinite linear;
58
- animation: spinner-loader 1500ms infinite linear;
59
- -moz-border-radius: 0.5em;
60
- -webkit-border-radius: 0.5em;
61
- border-radius: 0.5em;
62
- -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;
63
- -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;
64
- 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;
65
- display: inline-block;
66
- font-size: 10px;
67
- width: 1em;
68
- height: 1em;
69
- margin: 1.5em;
70
- overflow: hidden;
71
- text-indent: 100%;
72
- }
73
-
74
-
75
- .mlw_qmn_message_before {
76
- color: #666;
77
- font-size: 18px;
78
- display: block;
79
- margin-bottom: 20px;
80
- padding-bottom: 10px;
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;
88
- border: 0;
89
- margin: 0;
90
- padding: 15px 0 15px 0;
91
- font-size: 16px;
92
- }
93
-
94
- .quiz_section.border {
95
- border-top: 1px solid #f3f3f3;
96
- }
97
-
98
- .quiz_section label,
99
- .quiz_section .mlw_qmn_question {
100
- display: block;
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
- .qsm_contact_div {
109
- margin: 10px 0;
110
- }
111
-
112
- .quiz_section .qsm-contact-type-checkbox label,
113
- .quiz_section .qsm-contact-type-checkbox input {
114
- display: inline;
115
- }
116
-
117
- label.inline,
118
- label.inline .mlw_qmn_question,
119
- .quiz_section.inline .mlw_horizontal_multiple {
120
- display: inline-block;
121
- }
122
-
123
- .quiz_section p.form-help {
124
- margin: 5px 0 0 0;
125
- font-size: 12px;
126
- color: #999;
127
- }
128
-
129
- .quiz_section iframe { margin-bottom: 10px; }
130
-
131
- .qmn_mc_answer_wrap {
132
- display: block;
133
- margin: 5px 0 5px 0;
134
- }
135
-
136
- .quiz_section .qmn_radio_answers label,
137
- .quiz_section .qmn_check_answers label,
138
- .quiz_section .qmn_accept_answers label {
139
- display: inline;
140
- margin: 0 10px 0 5px;
141
- font-weight: normal;
142
- font-size: 14px;
143
- cursor: pointer;
144
- }
145
-
146
- .quiz_section.text-block h2 {
147
- display: block;
148
- margin: 0 0 10px 0;
149
- }
150
-
151
- .quiz_section select,
152
- .quiz_section textarea,
153
- .quiz_section input[type="text"],
154
- .quiz_section input[type="email"],
155
- .quiz_section input[type="number"] {
156
- width: 70%;
157
- min-height: 35px;
158
- display: inline-block;
159
- padding: 10px 8px 10px 8px;
160
- font-size: 14px;
161
- color: #555;
162
- background: #fff;
163
- border: 1px solid #e3e3e3;
164
- -webkit-border-radius: 3px;
165
- -moz-border-radius: 3px;
166
- border-radius: 3px;
167
- -webkit-box-sizing: border-box;
168
- -moz-box-sizing: border-box;
169
- box-sizing: border-box;
170
- -webkit-transition: all .5s ease-in-out;
171
- -moz-transition: all .5s ease-in-out;
172
- transition: all .5s ease-in-out;
173
- }
174
-
175
- .quiz_section select { height: 38px; }
176
-
177
- .quiz_section select:hover,
178
- .quiz_section textarea:hover,
179
- .quiz_section input[type="text"]:hover,
180
- .quiz_section input[type="email"]:hover,
181
- .quiz_section input[type="number"]:hover,
182
- .quiz_section select:focus,
183
- .quiz_section textarea:focus,
184
- .quiz_section input[type="text"]:focus,
185
- .quiz_section input[type="email"]:focus,
186
- .quiz_section input[type="number"]:focus {
187
- outline: 0;
188
- background: #f7f7f7;
189
- border: 1px solid #bdc3c7;
190
- -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.15);
191
- -moz-box-shadow: 0 0 10px rgba(0,0,0,0.15);
192
- box-shadow: 0 0 10px rgba(0,0,0,0.15);
193
- }
194
-
195
- .qmn_fill_blank {
196
- margin: 0 5px 0 5px;
197
- width: 100px !important;
198
- }
199
-
200
- .qmn_fill_blank.small { width: 50px; }
201
- .qmn_fill_blank.medium { width: 100px; }
202
- .qmn_fill_blank.large { width: 150px; }
203
-
204
-
205
- /* Alerts and error state */
206
-
207
- .qmn_error_message {
208
- color: #da4f49;
209
- border: 1px solid #da4f49;
210
- background: #F2DEDE;
211
- display: block;
212
- padding: 10px;
213
- margin: 10px 0 10px 0;
214
- -webkit-border-radius: 3px;
215
- -moz-border-radius: 3px;
216
- border-radius: 3px;
217
- }
218
-
219
- .quiz_section.qmn_error select,
220
- .quiz_section.qmn_error textarea,
221
- .quiz_section.qmn_error input[type="text"],
222
- .quiz_section.qmn_error input[type="number"],
223
- .quiz_section.qmn_error input[type="email"],
224
- .quiz_section.qmn_error input[type="checkbox"],
225
- .quiz_section.qmn_error select:hover,
226
- .quiz_section.qmn_error textarea:hover,
227
- .quiz_section.qmn_error input[type="text"]:hover,
228
- .quiz_section.qmn_error input[type="number"]:hover,
229
- .quiz_section.qmn_error input[type="email"]:hover,
230
- .quiz_section.qmn_error input[type="checkbox"]:hover,
231
- .quiz_section.qmn_error select:focus,
232
- .quiz_section.qmn_error textarea:focus,
233
- .quiz_section.qmn_error input[type="text"]:focus,
234
- .quiz_section.qmn_error input[type="number"]:focus,
235
- .quiz_section.qmn_error input[type="email"]:focus,
236
- .quiz_section.qmn_error input[type="checkbox"]:focus {
237
- position: relative;
238
- border: 1px solid #da4f49;
239
- background: #F2DEDE;
240
- -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
241
- -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
242
- box-shadow: 0 0 10px rgba(218, 79, 73, .35);
243
- }
244
-
245
- .quiz_section.qmn_error { position: relative; }
246
-
247
- .quiz_section.qmn_error:after {
248
- content: '-';
249
- color: #fff;
250
- font-size: 20px;
251
- font-family: 'Helvetica', Arial, sans-serif;
252
- background: #da4f49;
253
- text-align: center;
254
- display: inline-block;
255
- height: 20px;
256
- line-height: 20px;
257
- width: 20px;
258
- position: absolute;
259
- right: 0;
260
- top: 12px;
261
- -webkit-border-radius: 20px;
262
- -moz-border-radius: 20px;
263
- border-radius: 20px;
264
-
265
- }
266
-
267
- .quiz_section.qmn_error .qmn_radio_answers,
268
- .quiz_section.qmn_error .qmn_check_answers,
269
- .quiz_section.qmn_error .qmn_accept_answers {
270
- border: 1px solid #da4f49;
271
- background: #F2DEDE;
272
- padding: 5px;
273
- -webkit-border-radius: 3px;
274
- -moz-border-radius: 3px;
275
- border-radius: 3px;
276
- }
277
-
278
- .qmn_btn, .qmn_quiz_container .btn {
279
- display: relative;
280
- display: inline-block;
281
- color: #666 !important;
282
- background: #ccc !important;
283
- font-size: 16px !important;
284
- padding: 10px 20px 10px 20px !important;
285
- text-decoration: none !important;
286
- -webkit-border-radius: 3px;
287
- -moz-border-radius: 3px;
288
- border-radius: 3px;
289
- -webkit-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
290
- -moz-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
291
- box-shadow: 0px 0px 6px rgba(0,0,0,.05);
292
- -webkit-transition: background .25s ease-out;
293
- -moz-transition: background .25s ease-out;
294
- transition: background .25s ease-out;
295
- }
296
-
297
- .qmn_btn:hover, .qmn_quiz_container .btn:hover {
298
- color: #fff;
299
- background: #666;
300
- }
301
-
302
- .qmn_pagination {
303
- position: relative;
304
- display: flex;
305
- align-items: stretch;
306
- flex-direction: column;
307
- padding: 15px 0 15px 0;
308
- border-top: 1px solid #f3f3f3;
309
- }
310
-
311
- @media screen and (min-width: 500px) {
312
- .qmn_pagination {
313
- justify-content: space-between;
314
- align-items: center;
315
- flex-direction: row;
316
- }
317
- }
318
-
319
- /* .qmn_page_counter_message {
320
- font-size: 14px;
321
- color: #999;
322
- width: 100px;
323
- padding: 10px 20px 10px 20px;
324
- margin: 0 auto;
325
- text-align: center;
326
- } */
327
-
328
- .mlw_qmn_timer {
329
- z-index: 999;
330
- display: inline-block;
331
- position: fixed;
332
- bottom: 20px;
333
- right: 20px;
334
- height: 50px;
335
- line-height: 50px;
336
- padding: 0 20px;
337
- background: #34495e;
338
- color: #fff;
339
- -webkit-border-radius: 50px;
340
- -moz-border-radius: 50px;
341
- border-radius: 50px;
342
- -webkit-box-shadow: 0 4px 8px rgba(0,0,0,.10);
343
- -moz-box-shadow: 0 4px 8px rgba(0,0,0,.10);
344
- box-shadow: 0 4px 8px rgba(0,0,0,.10);
345
- }
346
-
347
- .quiz_section.quiz_end .qsm-submit-btn {
348
- display: block;
349
- margin: 10px 0;
350
- }
351
-
352
- /* Helper classes */
353
-
354
- .border-none { border: 0; }
355
- .margin-bottom { margin-bottom: 20px; }
356
-
357
-
358
- @media (max-width: 768px) {
359
-
360
- .quiz_section label,
361
- .quiz_section .mlw_qmn_question {
362
- font-size: 18px;
363
- }
364
-
365
- .quiz_section.radio .qmn_mc_answer_wrap label {
366
- font-size: 18px;
367
- }
368
-
369
- .quiz_section p.form-help { font-size: 14px; }
370
-
371
- .quiz_section select,
372
- .quiz_section textarea,
373
- .quiz_section input[type="text"] {
374
- display: block;
375
- width: 100%;
376
- padding: 12px 10px 12px 10px;
377
- font-size: 16px;
378
- }
379
-
380
- .mlw_previous,
381
- .mlw_next,
382
- .qmn_page_counter_message {
383
- display: inline-block;
384
- text-align: center;
385
- position: relative;
386
- top: 0;
387
- left: 0;
388
- right: 0;
389
- }
390
-
391
- .mlw_qmn_timer { top: 20px; }
392
-
393
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/templates/qmn_primary.css DELETED
@@ -1,458 +0,0 @@
1
- #qsm-progress-bar {
2
- position: relative;
3
- flex-grow: 2;
4
- padding: 0 10px;
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 {
19
- 0% {
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);
36
- }
37
- }
38
-
39
- @keyframes spinner-loader {
40
- 0% {
41
- -moz-transform: rotate(0deg);
42
- -ms-transform: rotate(0deg);
43
- -webkit-transform: rotate(0deg);
44
- transform: rotate(0deg);
45
- }
46
- 100% {
47
- -moz-transform: rotate(360deg);
48
- -ms-transform: rotate(360deg);
49
- -webkit-transform: rotate(360deg);
50
- transform: rotate(360deg);
51
- }
52
- }
53
-
54
- /* :not(:required) hides this rule from IE9 and below */
55
- .qsm-spinner-loader:not(:required) {
56
- -moz-animation: spinner-loader 1500ms infinite linear;
57
- -webkit-animation: spinner-loader 1500ms infinite linear;
58
- animation: spinner-loader 1500ms infinite linear;
59
- -moz-border-radius: 0.5em;
60
- -webkit-border-radius: 0.5em;
61
- border-radius: 0.5em;
62
- -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;
63
- -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;
64
- 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;
65
- display: inline-block;
66
- font-size: 10px;
67
- width: 1em;
68
- height: 1em;
69
- margin: 1.5em;
70
- overflow: hidden;
71
- text-indent: 100%;
72
- }
73
-
74
-
75
- .mlw_qmn_message_before {
76
- color: #666;
77
- font-size: 18px;
78
- display: block;
79
- margin-bottom: 20px;
80
- padding-bottom: 10px;
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;
88
- border: 0;
89
- margin: 0;
90
- padding: 15px 0 15px 0;
91
- font-size: 16px;
92
- }
93
-
94
- .quiz_section.border {
95
- border-top: 1px solid #f3f3f3;
96
- }
97
-
98
- .quiz_section label,
99
- .quiz_section .mlw_qmn_question {
100
- display: block;
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,
109
- .quiz_section > .quiz-cat{
110
- display: inline-block;
111
- }*/
112
-
113
- .quiz_section > .quiz-cat{
114
- margin-left: 15px;
115
- font-size: 14px;
116
- font-weight: bold;
117
- float: right;
118
- }
119
-
120
- .qsm_contact_div {
121
- margin: 10px 0;
122
- }
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,
130
- label.inline .mlw_qmn_question,
131
- .quiz_section.inline .mlw_horizontal_multiple {
132
- display: inline-block;
133
- }
134
-
135
- .quiz_section p.form-help {
136
- margin: 5px 0 0 0;
137
- font-size: 12px;
138
- color: #999;
139
- }
140
-
141
- .quiz_section iframe { margin-bottom: 10px; }
142
-
143
- .qmn_mc_answer_wrap {
144
- display: block;
145
- margin: 5px 0 5px 0;
146
- }
147
-
148
- .qmn_radio_answers .qmn_mc_answer_wrap {
149
- cursor: pointer;
150
- }
151
-
152
- .quiz_section .qmn_radio_answers label,
153
- .quiz_section .qmn_check_answers label,
154
- .quiz_section .qmn_accept_answers label {
155
- display: inline;
156
- margin: 0 10px 0 5px;
157
- font-weight: normal;
158
- font-size: 14px;
159
- cursor: pointer;
160
- }
161
-
162
- .quiz_section.text-block h2 {
163
- display: block;
164
- margin: 0 0 10px 0;
165
- }
166
-
167
- .quiz_section select,
168
- .quiz_section textarea,
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,
195
- .quiz_section input[type="text"]:hover,
196
- .quiz_section input[type="email"]:hover,
197
- .quiz_section input[type="number"]:hover,
198
- .quiz_section select:focus,
199
- .quiz_section textarea:focus,
200
- .quiz_section input[type="text"]:focus,
201
- .quiz_section input[type="email"]:focus,
202
- .quiz_section input[type="number"]:focus {
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 {
212
- margin: 0 5px 0 5px;
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 */
222
-
223
- .qmn_error_message {
224
- color: #da4f49;
225
- border: 1px solid #da4f49;
226
- background: #F2DEDE;
227
- display: block;
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,
236
- .quiz_section.qmn_error textarea,
237
- .quiz_section.qmn_error input[type="text"],
238
- .quiz_section.qmn_error input[type="number"],
239
- .quiz_section.qmn_error input[type="email"],
240
- .quiz_section.qmn_error input[type="checkbox"],
241
- .quiz_section.qmn_error select:hover,
242
- .quiz_section.qmn_error textarea:hover,
243
- .quiz_section.qmn_error input[type="text"]:hover,
244
- .quiz_section.qmn_error input[type="number"]:hover,
245
- .quiz_section.qmn_error input[type="email"]:hover,
246
- .quiz_section.qmn_error input[type="checkbox"]:hover,
247
- .quiz_section.qmn_error select:focus,
248
- .quiz_section.qmn_error textarea:focus,
249
- .quiz_section.qmn_error input[type="text"]:focus,
250
- .quiz_section.qmn_error input[type="number"]:focus,
251
- .quiz_section.qmn_error input[type="email"]:focus,
252
- .quiz_section.qmn_error input[type="checkbox"]:focus {
253
- position: relative;
254
- border: 1px solid #da4f49;
255
- background: #F2DEDE;
256
- -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
257
- -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
258
- box-shadow: 0 0 10px rgba(218, 79, 73, .35);
259
- }
260
-
261
- .quiz_section.qmn_error { position: relative; }
262
-
263
- .quiz_section.qmn_error:after {
264
- content: '-';
265
- color: #fff;
266
- font-size: 20px;
267
- font-family: 'Helvetica', Arial, sans-serif;
268
- background: #da4f49;
269
- text-align: center;
270
- display: inline-block;
271
- height: 20px;
272
- line-height: 20px;
273
- width: 20px;
274
- position: absolute;
275
- right: 0;
276
- top: 12px;
277
- -webkit-border-radius: 20px;
278
- -moz-border-radius: 20px;
279
- border-radius: 20px;
280
-
281
- }
282
-
283
- .quiz_section.qmn_error .qmn_radio_answers,
284
- .quiz_section.qmn_error .qmn_check_answers,
285
- .quiz_section.qmn_error .qmn_accept_answers {
286
- border: 1px solid #da4f49;
287
- background: #F2DEDE;
288
- padding: 5px;
289
- -webkit-border-radius: 3px;
290
- -moz-border-radius: 3px;
291
- border-radius: 3px;
292
- }
293
-
294
- .qmn_btn, .qmn_quiz_container .btn {
295
- display: relative;
296
- display: inline-block;
297
- color: #666 !important;
298
- background: #ccc !important;
299
- font-size: 16px !important;
300
- padding: 10px 20px 10px 20px !important;
301
- text-decoration: none !important;
302
- -webkit-border-radius: 3px;
303
- -moz-border-radius: 3px;
304
- border-radius: 3px;
305
- -webkit-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
306
- -moz-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
307
- box-shadow: 0px 0px 6px rgba(0,0,0,.05);
308
- -webkit-transition: background .25s ease-out;
309
- -moz-transition: background .25s ease-out;
310
- transition: background .25s ease-out;
311
- }
312
-
313
- .qmn_btn:hover, .qmn_quiz_container .btn:hover {
314
- color: #fff;
315
- background: #666;
316
- }
317
-
318
- .qmn_pagination {
319
- position: relative;
320
- display: flex;
321
- align-items: stretch;
322
- flex-direction: column;
323
- padding: 15px 0 15px 0;
324
- border-top: 1px solid #f3f3f3;
325
- }
326
-
327
- @media screen and (min-width: 500px) {
328
- .qmn_pagination {
329
- justify-content: space-between;
330
- align-items: center;
331
- flex-direction: row;
332
- }
333
- }
334
-
335
- /* .qmn_page_counter_message {
336
- font-size: 14px;
337
- color: #999;
338
- width: 100px;
339
- padding: 10px 20px 10px 20px;
340
- margin: 0 auto;
341
- text-align: center;
342
- } */
343
-
344
- .mlw_qmn_timer {
345
- z-index: 999;
346
- display: inline-block;
347
- position: fixed;
348
- bottom: 20px;
349
- right: 20px;
350
- height: 50px;
351
- line-height: 50px;
352
- padding: 0 20px;
353
- background: #34495e;
354
- color: #fff;
355
- -webkit-border-radius: 50px;
356
- -moz-border-radius: 50px;
357
- border-radius: 50px;
358
- -webkit-box-shadow: 0 4px 8px rgba(0,0,0,.10);
359
- -moz-box-shadow: 0 4px 8px rgba(0,0,0,.10);
360
- box-shadow: 0 4px 8px rgba(0,0,0,.10);
361
- }
362
-
363
- .qmn_quiz_container select,
364
- .qmn_quiz_container textarea,
365
- .qmn_quiz_container input[type="text"],
366
- .qmn_quiz_container input[type="email"],
367
- .qmn_quiz_container input[type="number"] {
368
- background: #fff;
369
- border: 1px solid #3498db;
370
- }
371
-
372
- .qmn_quiz_container select:hover,
373
- .qmn_quiz_container textarea:hover,
374
- .qmn_quiz_container input[type="text"]:hover,
375
- .qmn_quiz_container input[type="email"]:hover,
376
- .qmn_quiz_container input[type="number"]:hover,
377
- .qmn_quiz_container select:focus,
378
- .qmn_quiz_container textarea:focus,
379
- .qmn_quiz_container input[type="text"]:focus,
380
- .qmn_quiz_container input[type="email"]:focus,
381
- .qmn_quiz_container input[type="number"]:focus{
382
- outline: 0;
383
- background: #fff;
384
- border: 1px solid #3498db;
385
- -webkit-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
386
- -moz-box-shadow: 0 0 10px rgba(52, 152, 219, .35);
387
- box-shadow: 0 0 10px rgba(52, 152, 219, .35);
388
- }
389
-
390
- .qmn_quiz_container .qmn_btn, .qmn_quiz_container .btn {
391
- color: #fff !important;
392
- background: #3498db !important;
393
- }
394
-
395
- .qmn_quiz_container .qmn_btn:hover, .qmn_quiz_container .btn:hover { background: #2980b9 !important; }
396
-
397
- .quiz_section.quiz_end .qsm-submit-btn {
398
- display: block;
399
- margin: 10px 0;
400
- }
401
-
402
- /* Helper classes */
403
-
404
- .border-none { border: 0; }
405
- .margin-bottom { margin-bottom: 20px; }
406
-
407
-
408
- @media (max-width: 768px) {
409
-
410
- .quiz_section label,
411
- .quiz_section .mlw_qmn_question {
412
- font-size: 18px;
413
- }
414
-
415
- .quiz_section .qmn_radio_answers .qmn_mc_answer_wrap label {
416
- font-size: 18px;
417
- }
418
-
419
- .quiz_section p.form-help { font-size: 14px; }
420
-
421
- .quiz_section select,
422
- .quiz_section textarea,
423
- .quiz_section input[type="text"] {
424
- display: block;
425
- width: 100%;
426
- padding: 12px 10px 12px 10px;
427
- font-size: 16px;
428
- }
429
-
430
- .mlw_previous,
431
- .mlw_next,
432
- .qmn_page_counter_message {
433
- display: inline-block;
434
- text-align: center;
435
- position: relative;
436
- top: 0;
437
- left: 0;
438
- right: 0;
439
- }
440
-
441
- .mlw_qmn_timer { top: 20px; }
442
-
443
- }
444
-
445
- .quick-question-res-p {
446
- border: 2px solid;
447
- padding: 5px 10px;
448
- margin: 0;
449
- border-radius: 5px;
450
- }
451
-
452
- .mlw_qmn_quiz_link{
453
- cursor: pointer;
454
- }
455
-
456
- .qsm-results-page .qmn_question_answer{
457
- margin-bottom: 30px;
458
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/templates/qmn_turquoise.css DELETED
@@ -1,427 +0,0 @@
1
- #qsm-progress-bar {
2
- position: relative;
3
- flex-grow: 2;
4
- padding: 0 10px;
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 {
19
- 0% {
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);
36
- }
37
- }
38
-
39
- @keyframes spinner-loader {
40
- 0% {
41
- -moz-transform: rotate(0deg);
42
- -ms-transform: rotate(0deg);
43
- -webkit-transform: rotate(0deg);
44
- transform: rotate(0deg);
45
- }
46
- 100% {
47
- -moz-transform: rotate(360deg);
48
- -ms-transform: rotate(360deg);
49
- -webkit-transform: rotate(360deg);
50
- transform: rotate(360deg);
51
- }
52
- }
53
-
54
- /* :not(:required) hides this rule from IE9 and below */
55
- .qsm-spinner-loader:not(:required) {
56
- -moz-animation: spinner-loader 1500ms infinite linear;
57
- -webkit-animation: spinner-loader 1500ms infinite linear;
58
- animation: spinner-loader 1500ms infinite linear;
59
- -moz-border-radius: 0.5em;
60
- -webkit-border-radius: 0.5em;
61
- border-radius: 0.5em;
62
- -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;
63
- -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;
64
- 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;
65
- display: inline-block;
66
- font-size: 10px;
67
- width: 1em;
68
- height: 1em;
69
- margin: 1.5em;
70
- overflow: hidden;
71
- text-indent: 100%;
72
- }
73
-
74
-
75
- .mlw_qmn_message_before {
76
- color: #666;
77
- font-size: 18px;
78
- display: block;
79
- margin-bottom: 20px;
80
- padding-bottom: 10px;
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;
88
- border: 0;
89
- margin: 0;
90
- padding: 15px 0 15px 0;
91
- font-size: 16px;
92
- }
93
-
94
- .quiz_section.border {
95
- border-top: 1px solid #f3f3f3;
96
- }
97
-
98
- .quiz_section label,
99
- .quiz_section .mlw_qmn_question {
100
- display: block;
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
- .qsm_contact_div {
109
- margin: 10px 0;
110
- }
111
-
112
- .quiz_section .qsm-contact-type-checkbox label,
113
- .quiz_section .qsm-contact-type-checkbox input {
114
- display: inline;
115
- }
116
-
117
- label.inline,
118
- label.inline .mlw_qmn_question,
119
- .quiz_section.inline .mlw_horizontal_multiple {
120
- display: inline-block;
121
- }
122
-
123
- .quiz_section p.form-help {
124
- margin: 5px 0 0 0;
125
- font-size: 12px;
126
- color: #999;
127
- }
128
-
129
- .quiz_section iframe { margin-bottom: 10px; }
130
-
131
- .qmn_mc_answer_wrap {
132
- display: block;
133
- margin: 5px 0 5px 0;
134
- }
135
-
136
- .quiz_section .qmn_radio_answers label,
137
- .quiz_section .qmn_check_answers label,
138
- .quiz_section .qmn_accept_answers label {
139
- display: inline;
140
- margin: 0 10px 0 5px;
141
- font-weight: normal;
142
- font-size: 14px;
143
- cursor: pointer;
144
- }
145
-
146
- .quiz_section.text-block h2 {
147
- display: block;
148
- margin: 0 0 10px 0;
149
- }
150
-
151
- .quiz_section select,
152
- .quiz_section textarea,
153
- .quiz_section input[type="text"],
154
- .quiz_section input[type="email"],
155
- .quiz_section input[type="number"] {
156
- width: 70%;
157
- min-height: 35px;
158
- display: inline-block;
159
- padding: 10px 8px 10px 8px;
160
- font-size: 14px;
161
- color: #555;
162
- background: #fff;
163
- border: 1px solid #e3e3e3;
164
- -webkit-border-radius: 3px;
165
- -moz-border-radius: 3px;
166
- border-radius: 3px;
167
- -webkit-box-sizing: border-box;
168
- -moz-box-sizing: border-box;
169
- box-sizing: border-box;
170
- -webkit-transition: all .5s ease-in-out;
171
- -moz-transition: all .5s ease-in-out;
172
- transition: all .5s ease-in-out;
173
- }
174
-
175
- .quiz_section select { height: 38px; }
176
-
177
- .quiz_section select:hover,
178
- .quiz_section textarea:hover,
179
- .quiz_section input[type="text"]:hover,
180
- .quiz_section input[type="email"]:hover,
181
- .quiz_section input[type="number"]:hover,
182
- .quiz_section select:focus,
183
- .quiz_section textarea:focus,
184
- .quiz_section input[type="text"]:focus,
185
- .quiz_section input[type="email"]:focus,
186
- .quiz_section input[type="number"]:focus {
187
- outline: 0;
188
- background: #f7f7f7;
189
- border: 1px solid #bdc3c7;
190
- -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.15);
191
- -moz-box-shadow: 0 0 10px rgba(0,0,0,0.15);
192
- box-shadow: 0 0 10px rgba(0,0,0,0.15);
193
- }
194
-
195
- .qmn_fill_blank {
196
- margin: 0 5px 0 5px;
197
- width: 100px !important;
198
- }
199
-
200
- .qmn_fill_blank.small { width: 50px; }
201
- .qmn_fill_blank.medium { width: 100px; }
202
- .qmn_fill_blank.large { width: 150px; }
203
-
204
-
205
- /* Alerts and error state */
206
-
207
- .qmn_error_message {
208
- color: #da4f49;
209
- border: 1px solid #da4f49;
210
- background: #F2DEDE;
211
- display: block;
212
- padding: 10px;
213
- margin: 10px 0 10px 0;
214
- -webkit-border-radius: 3px;
215
- -moz-border-radius: 3px;
216
- border-radius: 3px;
217
- }
218
-
219
- .quiz_section.qmn_error select,
220
- .quiz_section.qmn_error textarea,
221
- .quiz_section.qmn_error input[type="text"],
222
- .quiz_section.qmn_error input[type="number"],
223
- .quiz_section.qmn_error input[type="email"],
224
- .quiz_section.qmn_error input[type="checkbox"],
225
- .quiz_section.qmn_error select:hover,
226
- .quiz_section.qmn_error textarea:hover,
227
- .quiz_section.qmn_error input[type="text"]:hover,
228
- .quiz_section.qmn_error input[type="number"]:hover,
229
- .quiz_section.qmn_error input[type="email"]:hover,
230
- .quiz_section.qmn_error input[type="checkbox"]:hover,
231
- .quiz_section.qmn_error select:focus,
232
- .quiz_section.qmn_error textarea:focus,
233
- .quiz_section.qmn_error input[type="text"]:focus,
234
- .quiz_section.qmn_error input[type="number"]:focus,
235
- .quiz_section.qmn_error input[type="email"]:focus,
236
- .quiz_section.qmn_error input[type="checkbox"]:focus {
237
- position: relative;
238
- border: 1px solid #da4f49;
239
- background: #F2DEDE;
240
- -webkit-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
241
- -moz-box-shadow: 0 0 10px rgba(218, 79, 73, .35);
242
- box-shadow: 0 0 10px rgba(218, 79, 73, .35);
243
- }
244
-
245
- .quiz_section.qmn_error { position: relative; }
246
-
247
- .quiz_section.qmn_error:after {
248
- content: '-';
249
- color: #fff;
250
- font-size: 20px;
251
- font-family: 'Helvetica', Arial, sans-serif;
252
- background: #da4f49;
253
- text-align: center;
254
- display: inline-block;
255
- height: 20px;
256
- line-height: 20px;
257
- width: 20px;
258
- position: absolute;
259
- right: 0;
260
- top: 12px;
261
- -webkit-border-radius: 20px;
262
- -moz-border-radius: 20px;
263
- border-radius: 20px;
264
-
265
- }
266
-
267
- .quiz_section.qmn_error .qmn_radio_answers,
268
- .quiz_section.qmn_error .qmn_check_answers,
269
- .quiz_section.qmn_error .qmn_accept_answers {
270
- border: 1px solid #da4f49;
271
- background: #F2DEDE;
272
- padding: 5px;
273
- -webkit-border-radius: 3px;
274
- -moz-border-radius: 3px;
275
- border-radius: 3px;
276
- }
277
-
278
- .qmn_btn, .qmn_quiz_container .btn {
279
- display: relative;
280
- display: inline-block;
281
- color: #666 !important;
282
- background: #ccc !important;
283
- font-size: 16px !important;
284
- padding: 10px 20px 10px 20px !important;
285
- text-decoration: none !important;
286
- -webkit-border-radius: 3px;
287
- -moz-border-radius: 3px;
288
- border-radius: 3px;
289
- -webkit-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
290
- -moz-box-shadow: 0px 0px 6px rgba(0,0,0,.05);
291
- box-shadow: 0px 0px 6px rgba(0,0,0,.05);
292
- -webkit-transition: background .25s ease-out;
293
- -moz-transition: background .25s ease-out;
294
- transition: background .25s ease-out;
295
- }
296
-
297
- .qmn_btn:hover, .qmn_quiz_container .btn:hover {
298
- color: #fff;
299
- background: #666;
300
- }
301
-
302
- .qmn_pagination {
303
- position: relative;
304
- display: flex;
305
- align-items: stretch;
306
- flex-direction: column;
307
- padding: 15px 0 15px 0;
308
- border-top: 1px solid #f3f3f3;
309
- }
310
-
311
- @media screen and (min-width: 500px) {
312
- .qmn_pagination {
313
- justify-content: space-between;
314
- align-items: center;
315
- flex-direction: row;
316
- }
317
- }
318
-
319
- /* .qmn_page_counter_message {
320
- font-size: 14px;
321
- color: #999;
322
- width: 100px;
323
- padding: 10px 20px 10px 20px;
324
- margin: 0 auto;
325
- text-align: center;
326
- } */
327
-
328
- .mlw_qmn_timer {
329
- z-index: 999;
330
- display: inline-block;
331
- position: fixed;
332
- bottom: 20px;
333
- right: 20px;
334
- height: 50px;
335
- line-height: 50px;
336
- padding: 0 20px;
337
- background: #34495e;
338
- color: #fff;
339
- -webkit-border-radius: 50px;
340
- -moz-border-radius: 50px;
341
- border-radius: 50px;
342
- -webkit-box-shadow: 0 4px 8px rgba(0,0,0,.10);
343
- -moz-box-shadow: 0 4px 8px rgba(0,0,0,.10);
344
- box-shadow: 0 4px 8px rgba(0,0,0,.10);
345
- }
346
-
347
- .qmn_quiz_container select,
348
- .qmn_quiz_container textarea,
349
- .qmn_quiz_container input[type="text"],
350
- .qmn_quiz_container input[type="email"],
351
- .qmn_quiz_container input[type="number"] {
352
- background: #fff;
353
- border: 1px solid #1abc9c;
354
- }
355
-
356
- .qmn_quiz_container select:hover,
357
- .qmn_quiz_container textarea:hover,
358
- .qmn_quiz_container input[type="text"]:hover,
359
- .qmn_quiz_container input[type="email"]:hover,
360
- .qmn_quiz_container input[type="number"]:hover,
361
- .qmn_quiz_container select:focus,
362
- .qmn_quiz_container textarea:focus,
363
- .qmn_quiz_container input[type="text"]:focus,
364
- .qmn_quiz_container input[type="email"]:focus,
365
- .qmn_quiz_container input[type="number"]:focus{
366
- outline: 0;
367
- background: #fff;
368
- border: 1px solid #1abc9c;
369
- -webkit-box-shadow: 0 0 10px rgba(26, 188, 156, .35);
370
- -moz-box-shadow: 0 0 10px rgba(26, 188, 156, .35);
371
- box-shadow: 0 0 10px rgba(26, 188, 156, .35);
372
- }
373
-
374
- .qmn_quiz_container .qmn_btn, .qmn_quiz_container .btn {
375
- color: #fff !important;
376
- background: #1abc9c !important;
377
- }
378
-
379
- .qmn_quiz_container .qmn_btn:hover, .qmn_quiz_container .btn:hover { background: #16a085 !important; }
380
-
381
- .quiz_section.quiz_end .qsm-submit-btn {
382
- display: block;
383
- margin: 10px 0;
384
- }
385
-
386
- /* Helper classes */
387
-
388
- .border-none { border: 0; }
389
- .margin-bottom { margin-bottom: 20px; }
390
-
391
-
392
- @media (max-width: 768px) {
393
-
394
- .quiz_section label,
395
- .quiz_section .mlw_qmn_question {
396
- font-size: 18px;
397
- }
398
-
399
- .quiz_section.radio .qmn_mc_answer_wrap label {
400
- font-size: 18px;
401
- }
402
-
403
- .quiz_section p.form-help { font-size: 14px; }
404
-
405
- .quiz_section select,
406
- .quiz_section textarea,
407
- .quiz_section input[type="text"] {
408
- display: block;
409
- width: 100%;
410
- padding: 12px 10px 12px 10px;
411
- font-size: 16px;
412
- }
413
-
414
- .mlw_previous,
415
- .mlw_next,
416
- .qmn_page_counter_message {
417
- display: inline-block;
418
- text-align: center;
419
- position: relative;
420
- top: 0;
421
- left: 0;
422
- right: 0;
423
- }
424
-
425
- .mlw_qmn_timer { top: 20px; }
426
-
427
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/uninstall.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
- // If uninstall not called from WordPress, then exit
3
- if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
4
- exit();
5
- }
6
-
7
- global $wpdb;
8
- $table_name = $wpdb->prefix . "mlw_results";
9
- $results = $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
10
-
11
- $table_name = $wpdb->prefix . "mlw_quizzes";
12
- $results = $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
13
-
14
- $table_name = $wpdb->prefix . "mlw_questions";
15
- $results = $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
16
-
17
- $table_name = $wpdb->prefix . "mlw_qm_audit_trail";
18
- $results = $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
19
-
20
- // Taken from Easy Digital Downloads. Much better way of doing it than I was doing :)
21
- // Cycle through custom post type array, retreive all posts, delete each one
22
- $qsm_post_types = array( 'quiz', 'qmn_log' );
23
- foreach ( $qsm_post_types as $post_type ) {
24
- $items = get_posts( array( 'post_type' => $post_type, 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids' ) );
25
- if ( $items ) {
26
- foreach ( $items as $item ) {
27
- wp_delete_post( $item, true);
28
- }
29
- }
30
- }
31
-
32
-
33
- delete_option( 'mlw_quiz_master_version' );
34
- delete_option( 'mlw_qmn_review_notice' );
35
- delete_option( 'mlw_advert_shows' );
36
- delete_option( 'qmn-settings' );
37
- delete_option( 'qmn-tracking-notice' );
38
- ?>