Skip to content

Commit

Permalink
Merge pull request #2747 from QuizandSurveyMaster/pre-release
Browse files Browse the repository at this point in the history
Release 9.2.4
  • Loading branch information
etvarun authored Dec 30, 2024
2 parents 3dac444 + a5213f4 commit a3e9b02
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 32 deletions.
2 changes: 2 additions & 0 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ var qsmTimerInterval = [];
$('.qsm-quiz-container-' + quizID).find('.stoptimer-p').hide();
MicroModal.show('modal-3');
}
jQuery(document).trigger('qsm_timer_ended', [quizID, qmn_quiz_data, qsm_timer_consumed_obj]);
return;
}
},
Expand Down Expand Up @@ -1288,6 +1289,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
4 changes: 2 additions & 2 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.3
* Version: 9.2.4
* 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.3';
public $version = '9.2.4';

/**
* QSM Alert Manager Object
Expand Down
4 changes: 3 additions & 1 deletion php/admin/admin-results-details-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ function qsm_generate_results_details_tab() {

//Timer design
$template .= '<div class="overview-inner-wrap">';
$template .= '<div id="submitdiv" class="postbox "><h2 class="hndle ui-sortable-handle"><span>'.__('Time Taken','quiz-master-next').'</span></h2>';
$template .= '<div id="submitdiv" class="postbox "><h2 class="hndle ui-sortable-handle"><span>'.__('Time Taken','quiz-master-next').'</span>';
$template .= apply_filters( 'qsm_admin_results_details_timer_after', '', $mlw_qmn_results_array );
$template .= '</h2>';
$template .= '<div class="inside">';
$template .= '<div class="timer-div-wrapper">';

Expand Down
57 changes: 34 additions & 23 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,27 +720,30 @@ public function shortcode_display_result( $atts ) {
wp_add_inline_script( 'math_jax', self::$default_MathJax_script, 'before' );
$quiz_result = maybe_unserialize( $result_data['quiz_results'] );
$response_data = array(
'quiz_id' => $result_data['quiz_id'],
'quiz_name' => $result_data['quiz_name'],
'quiz_system' => $result_data['quiz_system'],
'form_type' => $result_data['form_type'],
'quiz_payment_id' => '',
'user_ip' => $result_data['user_ip'],
'user_name' => $result_data['name'],
'user_business' => $result_data['business'],
'user_email' => $result_data['email'],
'user_phone' => $result_data['phone'],
'user_id' => $result_data['user'],
'timer' => 0,
'time_taken' => $result_data['time_taken'],
'contact' => $quiz_result['contact'],
'total_points' => $result_data['point_score'],
'total_score' => $result_data['correct_score'],
'total_correct' => $result_data['correct'],
'total_questions' => $result_data['total'],
'question_answers_array' => $quiz_result[1],
'comments' => '',
'result_id' => $id,
'quiz_id' => $result_data['quiz_id'],
'quiz_name' => $result_data['quiz_name'],
'quiz_system' => $result_data['quiz_system'],
'form_type' => $result_data['form_type'],
'quiz_payment_id' => '',
'user_ip' => $result_data['user_ip'],
'user_name' => $result_data['name'],
'user_business' => $result_data['business'],
'user_email' => $result_data['email'],
'user_phone' => $result_data['phone'],
'user_id' => $result_data['user'],
'timer' => 0,
'time_taken' => $result_data['time_taken'],
'contact' => $quiz_result['contact'],
'total_points' => $result_data['point_score'],
'total_score' => $result_data['correct_score'],
'total_correct' => $result_data['correct'],
'total_questions' => $result_data['total'],
'question_answers_array' => $quiz_result[1],
'comments' => '',
'result_id' => $id,
'total_possible_points' => $quiz_result['total_possible_points'],
'minimum_possible_points' => $quiz_result['minimum_possible_points'],
'total_attempted_questions' => $quiz_result['total_attempted_questions'],
);
$data = QSM_Results_Pages::generate_pages( $response_data );
return $data['display'];
Expand Down Expand Up @@ -926,7 +929,6 @@ public function load_questions( $quiz_id, $quiz_options, $is_quiz_page, $questio
$question_sql = implode( ',', $question_ids );
}
}else {
$question_ids = apply_filters( 'qsm_load_questions_ids', $question_ids, $quiz_id, $quiz_options );
$question_ids = QMNPluginHelper::qsm_shuffle_assoc( $question_ids );
$question_sql = implode( ',', $question_ids );
}
Expand Down Expand Up @@ -1502,13 +1504,22 @@ 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
if ( 0 == $qmn_quiz_options->contact_info_location ) {
echo QSM_Contact_Manager::display_fields( $qmn_quiz_options );
}
do_action( 'qsm_after_begin_message', $qmn_quiz_options, $qmn_array_for_variables );
?>
</div>
<?php
Expand Down
6 changes: 3 additions & 3 deletions php/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ function qsm_quiz_link_shortcode( $atts, $content = '' ) {
// Craft the target attribute if one is passed to shortcode
$target_html = '';
if ( ! empty( $target ) ) {
return "<a href='" . esc_url( $permalink ) . "' target='" . esc_attr( $target ) . "' class='" . esc_attr( $class ) . "'>" . esc_html( $content ) . '</a>';
return "<a href='" . esc_url( $permalink ) . "' target='" . esc_attr( $target ) . "' class='" . esc_attr( $class ) . "'>" . wp_kses_post( do_shortcode( $content ) ) . '</a>';
} else {
return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "'>" . esc_html( $content ) . '</a>';
return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "'>" . wp_kses_post( do_shortcode( $content ) ). '</a>';
}
}

Expand Down Expand Up @@ -250,7 +250,7 @@ function qsm_display_popup_div( $return_display, $qmn_quiz_options ) {
$return_display .= '<img src="' . QSM_PLUGIN_URL . 'assets/clock.png' . '" alt="clock.png"/>';
$return_display .= '<p class="qsm-time-up-text">'. esc_html__( 'Time is Up!', 'quiz-master-next' ) .'</p>';
$return_display .= '</div>';
$return_display .= '<footer class="qsm-popup__footer"><button class="qsm-popup-secondary-button qmn_btn" data-micromodal-close="" aria-label="Close this dialog window">'. __( 'Cancel', 'quiz-master-next' ).'</button><button data-quiz_id="' . $qmn_quiz_options->quiz_id . '" class="submit-the-form qmn_btn">'.__( 'Submit Quiz', 'quiz-master-next' ).'</button></footer>'; $return_display .= '</div>';
$return_display .= '<footer class="qsm-popup__footer"><button class="qsm-popup-secondary-button qmn_btn" data-micromodal-close="" aria-label="'. __( 'Close this dialog window', 'quiz-master-next' ) .'">'. apply_filters( 'qsm_timer_up_cancel_button_text_after', __( 'Cancel', 'quiz-master-next' ) ).'</button><button data-quiz_id="' . $qmn_quiz_options->quiz_id . '" class="submit-the-form qmn_btn">'. apply_filters( 'qsm_timer_up_submit_button_text_after', __( 'Submit Quiz', 'quiz-master-next' ) ).'</button></footer>';
$return_display .= '</div>';
$return_display .= '</div>';
}
Expand Down
11 changes: 9 additions & 2 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,20 @@ function mlw_qmn_variable_amount_incorrect( $content, $mlw_quiz_array ) {

function mlw_qmn_variable_total_questions( $content, $mlw_quiz_array ) {
global $wp_current_filter;
if ( ! empty( $wp_current_filter[1] ) && 'mlw_qmn_template_variable_quiz_page' == $wp_current_filter[1] ) {
if ( is_array( $wp_current_filter ) && ! empty( $wp_current_filter ) && in_array( 'mlw_qmn_template_variable_quiz_page', $wp_current_filter, true ) ) {
global $wpdb;
$table_name = $wpdb->prefix . 'mlw_quizzes';
$quiz_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE quiz_id=%d", $mlw_quiz_array['quiz_id'] ) );
$quiz_settings = maybe_unserialize($quiz_data->quiz_settings);
$quiz_questions = ! empty( $quiz_settings['pages'] ) ? maybe_unserialize( $quiz_settings['pages'] ) : array();
$total_questions = isset( $quiz_questions[0] ) ? count( $quiz_questions[0] ) : 0;
$total_questions = 0;
if ( ! empty( $quiz_questions ) && isset( $quiz_questions[0] ) ) {
foreach ( $quiz_questions as $sub_questions ) {
if ( is_array( $sub_questions ) ) {
$total_questions += count( $sub_questions );
}
}
}
$content = str_replace( '%TOTAL_QUESTIONS%', $total_questions, $content );
return $content;
}
Expand Down
6 changes: 5 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.3
Stable tag: 9.2.4
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

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

== Changelog ==
= 9.2.4 ( December 30, 2024 ) =
* Bug: Resolved issue with %TOTAL_QUESTIONS% variable
* Bug: Resolved issue with %MAXIMUM_POINTS% variable

= 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
Expand Down

0 comments on commit a3e9b02

Please sign in to comment.