Skip to content

Commit

Permalink
Merge pull request #2736 from QuizandSurveyMaster/pre-release
Browse files Browse the repository at this point in the history
Release QSM 9.2.3
  • Loading branch information
etvarun authored Dec 13, 2024
2 parents 103b318 + dd191e9 commit 3dac444
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 42 deletions.
15 changes: 6 additions & 9 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,6 @@ var import_button;
import_button.attr("onclick", "return confirm('" + qsm_admin_messages.confirm_message + " " + qsm_admin_messages.import_question_again + "');");
}
QSMQuestion.openEditPopup(model.id, $('.question[data-question-id=' + model.id + ']').find('.edit-question-button'));
// $('#save-popup-button').trigger('click');
},
addNewQuestion: function (model) {
var default_answers = parseInt(qsmQuestionSettings.default_answers);
Expand Down Expand Up @@ -2498,13 +2497,13 @@ var import_button;
}
var category = [];
var multicategories = model.get('multicategories');
if (multicategories === null || typeof multicategories === "undefined") {
//No Action Require
} else {
$.each(multicategories, function (i, val) {
category.push($(".qsm-popup__content #qsm_category-" + val + " label:first-child")[0].textContent);
if (multicategories) {
multicategories.forEach(val => {
const categoryLabel = $(".qsm-popup__content #in-qsm_category-" + val + "-1 > label").text();
if (categoryLabel) {
category.push(categoryLabel);
}
});
category = category.filter(item => item);
}
$('.question[data-question-id=' + model.id + ']').replaceWith(template({
id: model.id,
Expand Down Expand Up @@ -2770,7 +2769,6 @@ var import_button;
}
CurrentElement.parents('.question').next('.questionElements').slideDown('slow');
$('#modal-1-content').html(questionElements);
//MicroModal.show( 'modal-1' );
$('.questions').sortable('disable');
$('.page').sortable('disable');

Expand Down Expand Up @@ -3786,7 +3784,6 @@ var import_button;
.fail(QSMAdmin.displayjQueryError);
},
loadResults: function () {
//QSMAdmin.displayAlert( 'Loading results pages...', 'info' );
$.ajax({
url: wpApiSettings.root + 'quiz-survey-master/v1/quizzes/' + qsmResultsObject.quizID + '/results',
headers: { 'X-WP-Nonce': qsmResultsObject.nonce },
Expand Down
31 changes: 20 additions & 11 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ var qsmTimerInterval = [];
if (quiz.hasOwnProperty('timer_limit') && 0 != quiz.timer_limit) {
QSM.initTimer(quizID);
quizType = 'timer';
} else if (jQuery('.qsm-quiz-container-' + quizID + ' #timer').val() == 0) {
qsmTimerInterval[quizID] = setInterval(function () { qmnTimeTakenTimer(quizID) }, 1000);
}
if (jQuery('.qsm-quiz-container-' + quizID + ' .qsm-submit-btn').is(':visible') && !jQuery('.qsm-quiz-container-' + quizID).hasClass('qsm_auto_pagination_enabled') ) {
jQuery('.qsm-quiz-container-' + quizID + ' .qsm-quiz-comment-section').fadeIn();
Expand Down Expand Up @@ -1862,19 +1864,26 @@ jQuery(document).ready(function () {
let captchaElement = jQuery('#mlw_code_captcha');
if (captchaElement.length !== 0) {
mlw_code = '';
var mlw_chars = '0123456789ABCDEFGHIJKL!@#$%^&*()MNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
var mlw_code_length = 5;
for (var i = 0; i < mlw_code_length; i++) {
var rnum = Math.floor(Math.random() * mlw_chars.length);
let mlw_chars = '0123456789ABCDEFGHIJKL!@#$%^&*()MNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
let mlw_code_length = 5;
for (let i = 0; i < mlw_code_length; i++) {
let rnum = Math.floor(Math.random() * mlw_chars.length);
mlw_code += mlw_chars.substring(rnum, rnum + 1);
}
var mlw_captchaCTX = document.getElementById('mlw_captcha').getContext('2d');
mlw_captchaCTX.font = 'normal 24px Verdana';
mlw_captchaCTX.strokeStyle = '#000000';
mlw_captchaCTX.clearRect(0, 0, 100, 50);
mlw_captchaCTX.strokeText(mlw_code, 10, 30, 70);
mlw_captchaCTX.textBaseline = 'middle';
document.getElementById('mlw_code_captcha').value = mlw_code;
let captchaCanvas = document.getElementById('mlw_captcha');
let mlw_captchaCTX = captchaCanvas.getContext('2d');
let 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);
} else {
mlw_captchaCTX.textAlign = 'left';
mlw_captchaCTX.strokeText(mlw_code, 10, captchaCanvas.height / 2);
}
document.getElementById('mlw_code_captcha').value = mlw_code;
}
});

Expand Down
10 changes: 2 additions & 8 deletions mlw_quizmaster2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Quiz And Survey Master
* Description: Easily and quickly add quizzes and surveys to your website.
* Version: 9.2.2
* Version: 9.2.3
* Author: ExpressTech
* Author URI: https://quizandsurveymaster.com/
* Plugin URI: https://expresstech.io/
Expand Down Expand Up @@ -43,7 +43,7 @@ class MLWQuizMasterNext {
* @var string
* @since 4.0.0
*/
public $version = '9.2.2';
public $version = '9.2.3';

/**
* QSM Alert Manager Object
Expand Down Expand Up @@ -765,12 +765,6 @@ public function qsm_add_user_capabilities() {
if ( ! $role ) {
return;
}
// Remove all capabilities first.
foreach ( $administrator_capabilities as $cap ) {
if ( $role->has_cap( $cap ) ) {
$role->remove_cap( $cap );
}
}

// Dynamically determine the capabilities to add based on the current user role.
$capabilities_to_add = isset(${$rolename . '_capabilities'}) ? ${$rolename . '_capabilities'} : array();
Expand Down
2 changes: 1 addition & 1 deletion php/admin/options-page-text-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function qsm_get_question_text_message() {
exit;
} else {
$settings = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', $text_id );
$settings = ! empty( $settings ) ? $settings : '';
$settings = ! empty( $settings ) ? $settings : '';
$quiz_text_arr = $mlwQuizMasterNext->quiz_settings->load_setting_fields( 'quiz_text' );
$key = array_search( $text_id, array_column( $quiz_text_arr, 'id' ), true );
$allowed_text = '';
Expand Down
6 changes: 0 additions & 6 deletions php/classes/class-qsm-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -1966,12 +1966,6 @@ public function update() {
$results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
}

// Update 2.6.1
$results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' );
$results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_questions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
$results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_quizzes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
$results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_results CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );

global $wpdb;
$table_name = $wpdb->prefix . 'mlw_results';
$audit_table = $wpdb->prefix . 'mlw_qm_audit_trail';
Expand Down
10 changes: 5 additions & 5 deletions php/classes/class-qsm-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,17 @@ public function get_quiz_options() {
$quiz_options = array_merge( $quiz_options, $leaderboards );
}

$text = $this->get_setting('quiz_text');
if ( is_array($text) ) {
$quiz_options = array_merge( $quiz_options, $text );
}

$options = $this->get_setting( 'quiz_options' );
if ( is_array( $options ) ) {
unset( $options['quiz_name'] );
$quiz_options = array_merge( $quiz_options, $options );
}

$text = $this->get_setting('quiz_text');
if ( is_array($text) ) {
$quiz_options = array_merge( $quiz_options, $text );
}

// Return as old object model
return (object) $quiz_options;
}
Expand Down
13 changes: 12 additions & 1 deletion php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,18 @@ function mlw_qmn_variable_user_email( $content, $mlw_quiz_array ) {
function qsm_contact_field_variable( $content, $results_array ) {
preg_match_all( '~%CONTACT_(.*?)%~i', $content, $matches );
for ( $i = 0; $i < count( $matches[0] ); $i++ ) {
$content = str_replace( '%CONTACT_' . $matches[1][ $i ] . '%', $results_array['contact'][ $matches[1][ $i ] - 1 ]['value'], $content );
$contact_key = $matches[1][ $i ];
if ( is_numeric( $contact_key ) && intval( $contact_key ) > 0 ) {
$contact_index = intval( $contact_key ) - 1;

if ( isset( $results_array['contact'][ $contact_index ]['value'] ) ) {
$content = str_replace( '%CONTACT_' . $contact_key . '%', $results_array['contact'][ $contact_index ]['value'], $content );
} else {
$content = str_replace( '%CONTACT_' . $contact_key . '%', '', $content );
}
} else {
$content = str_replace( '%CONTACT_' . $contact_key . '%', '', $content );
}
}
return $content;
}
Expand Down
9 changes: 8 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: quiz, survey, test, exam, online assessment
Requires at least: 4.9
Tested up to: 6.7
Requires PHP: 5.4
Stable tag: 9.2.2
Stable tag: 9.2.3
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -222,6 +222,13 @@ As a WordPress quiz maker, QSM is designed to be compatible with most other plug
18. Database

== Changelog ==
= 9.2.3 ( December 13, 2024 ) =
* Bug: Resolved issue where contact form not showing at quiz end
* Bug: Resolved quiz timer issue for single-page quizzes
* Bug: Fixed PHP warning related to the CONTACT_X variable
* Enhancement: Enhanced the Captcha question type canvas for RTL websites
* Enhancement: Refined user role permissions for improved access control

= 9.2.2 ( November 06, 2024 ) =
* Bug: Fixed issue with text displaying before quiz options
* Bug: Resolved issue with left/right arrow keys in the quiz input box
Expand Down

0 comments on commit 3dac444

Please sign in to comment.