Skip to content

Commit

Permalink
update code for qsm gamify
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairraeen committed Dec 30, 2024
1 parent 2cde4f2 commit 7e81465
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@ function qmnUpdatePageNumber(amount, quiz_form_id) {
}

function qmnInitPagination(quiz_id) {
jQuery(document).trigger('qsm_init_pagination_before', [quiz_id, qmn_quiz_data]);
var qmn_section_total = +qmn_quiz_data[quiz_id].pagination.total_questions;
var qmn_total_questions = jQuery('#quizForm' + quiz_id).find('#qmn_all_questions_count').val();
var qmn_total_pages = Math.ceil(qmn_total_questions / +qmn_quiz_data[quiz_id].pagination.amount);
Expand Down Expand Up @@ -1883,16 +1884,16 @@ jQuery(document).ready(function () {
}
var captchaCanvas = document.getElementById('mlw_captcha');
var mlw_captchaCTX = captchaCanvas.getContext('2d');
var containerDirection = window.getComputedStyle(captchaCanvas).direction || 'ltr';
var containerDirection = window.getComputedStyle(captchaCanvas).direction || 'ltr';
mlw_captchaCTX.font = 'normal 24px Verdana';
mlw_captchaCTX.strokeStyle = '#000000';
mlw_captchaCTX.clearRect(0, 0, captchaCanvas.width, captchaCanvas.height);
if (containerDirection === 'rtl') {
mlw_captchaCTX.textAlign = 'right';
mlw_captchaCTX.strokeText(mlw_code, captchaCanvas.width - 10, captchaCanvas.height / 2);
mlw_captchaCTX.strokeText(mlw_code, captchaCanvas.width - 10, captchaCanvas.height / 2);
} else {
mlw_captchaCTX.textAlign = 'left';
mlw_captchaCTX.strokeText(mlw_code, 10, captchaCanvas.height / 2);
mlw_captchaCTX.strokeText(mlw_code, 10, captchaCanvas.height / 2);
}
document.getElementById('mlw_code_captcha').value = mlw_code;
}
Expand Down
10 changes: 9 additions & 1 deletion php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,15 @@ public function display_begin_section( $qmn_quiz_options, $qmn_array_for_variabl
?>
<div class='mlw_qmn_message_before'>
<?php
echo wp_kses_post( do_shortcode( $editor_text ) );
$allowed_html = wp_kses_allowed_html('post');
$allowed_html['input'] = array(
'type' => array(),
'name' => array(),
'value' => array(),
'class' => array(), // Optional: Allow the class attribute
'id' => array(), // Optional: Allow the id attribute
);
echo wp_kses( do_shortcode( $editor_text ), $allowed_html );
?>
</div>
<?php
Expand Down

0 comments on commit 7e81465

Please sign in to comment.