Skip to content

Commit

Permalink
Merge pull request #2488 from QuizandSurveyMaster/dev2
Browse files Browse the repository at this point in the history
Release QSM 8.2.3
  • Loading branch information
etvarun authored Mar 12, 2024
2 parents d5d6fa7 + 241577b commit c6b37f5
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
9 changes: 8 additions & 1 deletion js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,13 @@ function qsm_question_quick_result_js(question_id, answer, answer_type = '', sho
got_ans = true;
}

return { "correct_index": correct_index, "success": correct_answer ? 'correct' : 'incorrect', "message": show_correct_info && got_ans ? correct_info_text : "" };
let returnObject = {
"correct_index": correct_index,
"success": correct_answer ? 'correct' : 'incorrect',
"message": show_correct_info && got_ans ? correct_info_text : ""
};

jQuery(document).trigger('qsm_question_quick_result_js_after', [returnObject, correct_answer, answer, answer_array, answer_type, settings, decrypt, question_id]);
return returnObject;
}
}
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: 8.2.2
* Version: 8.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 = '8.2.2';
public $version = '8.2.3';

/**
* QSM Alert Manager Object
Expand Down
3 changes: 3 additions & 0 deletions php/classes/class-qmn-quiz-creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions
// Update quiz settings
$update_quiz_settings = maybe_unserialize( $mlw_qmn_duplicate_data->quiz_settings );
$update_pages = maybe_unserialize( $update_quiz_settings['pages'] );
$update_q_pages = maybe_unserialize( $update_quiz_settings['qpages'] );
// get logic data from logic table first or else from quiz_settings
if ( ! is_null( $logic_table_exists ) ) {
$query = $wpdb->prepare( "SELECT * FROM $logic_table WHERE quiz_id = %d", $quiz_id );
Expand Down Expand Up @@ -633,6 +634,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions
foreach ( $pages_value as $pages_k_q => $page_q_id ) {
if ( intval($page_q_id) === intval($mlw_question->question_id) ) {
$update_pages[ $pages_key ][ $pages_k_q ] = $wpdb->insert_id;
$update_q_pages[ $pages_key ]['questions'][ $pages_k_q ] = $wpdb->insert_id;
}
}
}
Expand Down Expand Up @@ -681,6 +683,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions
}
}
$update_quiz_settings['pages'] = maybe_serialize( $update_pages );
$update_quiz_settings['qpages'] = maybe_serialize( $update_q_pages );
// saves data in logic table first or else in quiz_settings.
$value_array = array();
if ( is_array( $logic_rules ) && ! empty( $logic_rules ) ) {
Expand Down
11 changes: 6 additions & 5 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ public function load_questions( $quiz_id, $quiz_options, $is_quiz_page, $questio
if ( 1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order ) {
$category_order_sql = 'ORDER BY rand()';
}
$tq_ids[] = $wpdb->get_results( "SELECT DISTINCT `question_id` FROM `{$wpdb->prefix}mlw_question_terms` WHERE `quiz_id` = $quiz_id AND `term_id` = $category AND `taxonomy`='qsm_category' AND question_id NOT IN ($exclude_ids) ".esc_sql( $category_order_sql )." LIMIT $limit", ARRAY_A );
$tq_ids[] = $wpdb->get_results( "SELECT DISTINCT `question_id` FROM `{$wpdb->prefix}mlw_question_terms` WHERE `quiz_id` = $quiz_id AND `term_id` = $category AND `taxonomy`='qsm_category' AND question_id NOT IN ($exclude_ids) ".esc_sql( $category_order_sql )." LIMIT $limit", ARRAY_A );
}
$final_result = array_column(array_merge(...array_map('array_merge', $tq_ids)),'question_id');
if ( 1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order ) {
Expand Down Expand Up @@ -903,6 +903,7 @@ public function display_quiz( $options, $quiz_data, $question_amount, $shortcode
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-tooltip' );
wp_enqueue_style( 'jquery-redmond-theme', QSM_PLUGIN_CSS_URL . '/jquery-ui.css', array(), $mlwQuizMasterNext->version );
wp_enqueue_style( 'qsm_quiz_common_style', $this->common_css, array(), $mlwQuizMasterNext->version );

global $qmn_json_data;
$qmn_json_data['error_messages'] = array(
Expand Down Expand Up @@ -1549,7 +1550,7 @@ public function display_results( $options, $data ) {
if ( ! isset( $_REQUEST['qsm_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['qsm_nonce'] ) ), 'qsm_submit_quiz_' . intval( $quiz_id ) ) ) {
echo wp_json_encode(
array(
'display' => htmlspecialchars_decode( 'Nonce Validation failed!' ),
'display' => __( 'Nonce Validation failed!', 'quiz-master-next' ),
'redirect' => false,
'result_status' => array(
'save_response' => false,
Expand Down Expand Up @@ -1636,7 +1637,7 @@ public function ajax_submit_results() {
if ( isset($qsm_option['quiz_options']['not_allow_after_expired_time']) && '1' === $qsm_option['quiz_options']['not_allow_after_expired_time'] && isset( $_POST['currentuserTime'] ) && sanitize_text_field( wp_unslash( $_POST['currentuserTime'] ) ) > $dtUtcDate && ! empty($dateStr) ) {
echo wp_json_encode(
array(
'display' => htmlspecialchars_decode( 'Quiz Expired!' ),
'display' => __( 'Quiz Expired!', 'quiz-master-next' ),
'redirect' => false,
'result_status' => array(
'save_response' => false,
Expand Down Expand Up @@ -1910,7 +1911,7 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) {
if ( 1 === intval( $qmn_quiz_options->store_responses ) && ! $qmn_array_for_variables['response_saved'] ) {
$result_display .= '<div class="qsm-result-page-warning">' . __('Your responses are not being saved in the database due to a technical issue. Please contact the website administrator for assistance.', 'quiz-master-next') . '</div>';
}
$result_display .= $results_pages['display'];
$result_display .= wp_kses_post( htmlspecialchars_decode( $results_pages['display'], ENT_QUOTES) );
$result_display = apply_filters( 'qmn_after_results_text', $result_display, $qmn_quiz_options, $qmn_array_for_variables );

$result_display .= $this->display_social( $qmn_quiz_options, $qmn_array_for_variables );
Expand Down Expand Up @@ -1985,7 +1986,7 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) {
// Prepares data to be sent back to front-end.
$return_array = array(
'quizExpired' => false,
'display' => htmlspecialchars_decode( $result_display ),
'display' => $result_display,
'redirect' => apply_filters( 'mlw_qmn_template_variable_results_page', $results_pages['redirect'], $qmn_array_for_variables ),
'result_status' => array(
'save_response' => $qmn_array_for_variables['response_saved'],
Expand Down
2 changes: 1 addition & 1 deletion php/classes/class-qsm-results-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static function generate_pages( $response_data ) {

// Decodes special characters, runs through our template
// variables, and then outputs the text.
$page = htmlspecialchars_decode( $content, ENT_QUOTES );
$page = wp_kses_post($content);

//last chance to filter $page
$page = apply_filters( 'qsm_template_variable_results_page', $page, $response_data );
Expand Down
2 changes: 1 addition & 1 deletion php/question-types/qsm-question-type-dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function qmn_drop_down_display( $id, $question, $answers ) {
$require_class = '';
}
$new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' );
$question = apply_filters( 'qsm_question_title_func_before', $question, $answers, $id );
$question = apply_filters( 'qsm_question_title_function_before', $question, $answers, $id );
qsm_question_title_func( $question, '', $new_question_title, $id );
$show = true;
$show = apply_filters( 'qsm_check_show_answer_drop_down', $show, $id, $question, $answers );
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress q
Requires at least: 4.9
Tested up to: 6.4
Requires PHP: 5.4
Stable tag: 8.2.2
Stable tag: 8.2.3
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -163,6 +163,11 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
18. Database

== Changelog ==
= 8.2.3 (March 12, 2024) =
Bug: Fixed issue with inline result while duplicating quizzes
Bug: Patched a vulnerability related to the result page
Enhancement: Improve contact fields UI

= 8.2.2 (January 18, 2024) =
* Feature: Added an option to mark texts as code snippets in the question description
* Bug: Fixed the issue of skipping question validation after the quiz timer ends
Expand Down

0 comments on commit c6b37f5

Please sign in to comment.