Skip to content

Commit

Permalink
Merge pull request #1892 from QuizandSurveyMaster/dev
Browse files Browse the repository at this point in the history
Release 8.0.2
  • Loading branch information
etvarun authored Jun 24, 2022
2 parents c2c26ae + d561b67 commit c6c8b14
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 39 deletions.
16 changes: 6 additions & 10 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,6 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
var comments = $("#comments").val();
advanced_option['required'] = $(".questionElements input[name='required']").is(":checked") ? 0 : 1;
var category = $(".category-radio:checked").val();
var autofill = $("#hide_autofill").val();
var limit_text = $("#limit_text").val();
var limit_multiple_response = $("#limit_multiple_response").val();
var file_upload_limit = $("#file_upload_limit").val();
Expand Down Expand Up @@ -1833,7 +1832,7 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
}

});
$('.questionElements .advanced-content > .qsm-row ').each(function () {
$('.questionElements .advanced-content > .qsm-row:not(.core-option)').each(function () {
if ($(this).find('input[type="text"]').length > 0) {
var element_id = $(this).find('input[type="text"]').attr('id');
advanced_option[element_id] = $(this).find('input[type="text"]').val();
Expand Down Expand Up @@ -2033,11 +2032,6 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
if (answerEditor === null || typeof answerEditor === "undefined") {
answerEditor = 'text';
}
//Check autofill setting
var disableAutofill = question.get('autofill');
if (disableAutofill === null || typeof disableAutofill === "undefined") {
disableAutofill = '0';
}
//Get text limit value
var get_limit_text = question.get('limit_text');
if (get_limit_text === null || typeof get_limit_text === "undefined") {
Expand Down Expand Up @@ -2105,7 +2099,6 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
//Changed checked logic based on new structure for required.
$("input#required[value='" + question.get('required') + "']").prop('checked', true);

$("#hide_autofill").val(disableAutofill);
$("#limit_text").val(get_limit_text);
$("#limit_multiple_response").val(get_limit_mr);
$("#file_upload_limit").val(get_limit_fu);
Expand All @@ -2129,14 +2122,17 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
if (all_setting === null || typeof all_setting === "undefined") {} else {
$.each(all_setting, function (index, value) {
if ($('#' + index + '_area').length > 0) {
if ($('#' + index + '_area').find('input[type="checkbox"]').length > 1) {
if (1 == $('#' + index + '_area').find('input[type=checkbox]').length) {
$(".questionElements input[name='" + index + "'][value='" + value + "']").attr("checked", "true").prop('checked', true);
} else if ($('#' + index + '_area').find('input[type=checkbox]').length > 1) {
var fut_arr = value.split(",");
$.each(fut_arr, function (i) {
$(".questionElements input[name='" + index + "[]']:checkbox[value='" + fut_arr[i] + "']").attr("checked", "true").prop('checked', true);
});
} else {
if (value != null)
if (value != null) {
$('#' + index).val(value);
}
}
}
if (index == 'matchAnswer') {
Expand Down
5 changes: 3 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.0.1
* Version: 8.0.2
* 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.0.1';
public $version = '8.0.2';

/**
* QSM Alert Manager Object
Expand Down Expand Up @@ -334,6 +334,7 @@ public function qsm_admin_scripts_style( $hook ) {
break;
case 'style':
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker');
wp_enqueue_media();
break;
case 'options':
Expand Down
15 changes: 9 additions & 6 deletions php/admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,14 @@ function qsm_generate_question_option( $key, $single_option ) {
$type = isset( $single_option['type'] ) ? $single_option['type'] : 'text';
$show = isset( $single_option['show'] ) ? explode( ',', $single_option['show'] ) : array();
$show_class = '';
if ( in_array( $key, array( 'correct_answer_info', 'comments', 'hint' ), true ) ) {
$show_class .= 'core-option ';
}
if ( $show ) {
$show_class .= 'qsm_hide_for_other ';
foreach ( $show as $show_value ) {
$show_class .= 'qsm_show_question_type_' . trim( $show_value ) . ' ';
}
$show_class .= ' qsm_hide_for_other';
}
$tooltip = '';
if ( isset( $single_option['tooltip'] ) && '' !== $single_option['tooltip'] ) {
Expand Down Expand Up @@ -998,7 +1001,7 @@ function qsm_get_installed_theme( $saved_quiz_theme, $wizard_theme_list = '' ) {
<?php checked( $saved_quiz_theme, $theme_id, true ); ?>>
<div class="theme-screenshot" id="qsm-theme-screenshot">
<?php if ( in_array( $theme_name, $pro_themes , true) ) { ?>
<span class="qsm-badge"><?php echo __('Pro', 'quiz-master-next'); ?></span>
<span class="qsm-badge"><?php esc_html_e('Pro', 'quiz-master-next'); ?></span>
<?php } ?>
<img alt="" src="<?php echo esc_url( $folder_slug . $theme_name . '/screenshot.png' ); ?>" />
<div class="downloaded-theme-button">
Expand Down Expand Up @@ -1081,15 +1084,15 @@ function qsm_get_default_wizard_themes() {
<div class="theme-wrapper theme market-theme">
<div class="theme-screenshot" id="qsm-theme-screenshot">
<?php if ( in_array( $theme_name, $pro_themes , true) ) { ?>
<span class="qsm-badge"><?php echo __('Pro', 'quiz-master-next'); ?></span>
<span class="qsm-badge"><?php esc_html_e('Pro', 'quiz-master-next'); ?></span>
<?php } ?>
<img alt="" src="<?php echo esc_url( $theme_screenshot ); ?>" />
<div class="market-theme-url">
<a class="button button-primary" target="_blank" rel="noopener"
href="<?php echo esc_url( $theme_demo ); ?>?utm_source=plugin&utm_medium=wizard"><?php esc_html_e( 'Live Preview', 'quiz-master-next' ); ?></a>
<a class="button" target="_blank" rel="noopener"
href="<?php echo esc_url( $theme_url ); ?>?utm_source=plugin&utm_medium=wizard">
<?php echo in_array( $theme_name, $pro_themes , true) ? __( 'Buy Now', 'quiz-master-next' ) : __( 'Download', 'quiz-master-next' ) ; ?>
<?php echo in_array( $theme_name, $pro_themes , true) ? esc_html__( 'Buy Now', 'quiz-master-next' ) : esc_html__( 'Download', 'quiz-master-next' ) ; ?>
</a>
</div>
</div>
Expand All @@ -1115,13 +1118,13 @@ function qsm_get_market_themes() {
<div class="theme-wrapper theme market-theme">
<div class="theme-screenshot" id="qsm-theme-screenshot">
<?php if ( in_array( $theme_name, $pro_themes , true) ) { ?>
<span class="qsm-badge"><?php echo __('Pro', 'quiz-master-next'); ?></span>
<span class="qsm-badge"><?php esc_html_e('Pro', 'quiz-master-next'); ?></span>
<?php } ?>
<img alt="" src="<?php echo esc_url( $theme_screenshot ); ?>" />
<div class="market-theme-url">
<a class="button button-primary" target="_blank" rel="noopener" href="<?php echo esc_url( $theme_demo ); ?>?utm_source=plugin&utm_medium=wizard"><?php esc_html_e( 'Live Preview', 'quiz-master-next' ); ?></a>
<a class="button" target="_blank" rel="noopener" href="<?php echo esc_url( $theme_url ); ?>?utm_source=plugin&utm_medium=wizard">
<?php echo in_array( $theme_name, $pro_themes , true) ? __( 'Buy Now', 'quiz-master-next' ) : __( 'Download', 'quiz-master-next' ) ; ?>
<?php echo in_array( $theme_name, $pro_themes , true) ? esc_html__( 'Buy Now', 'quiz-master-next' ) : esc_html__( 'Download', 'quiz-master-next' ) ; ?>
</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion php/admin/options-page-questions-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class="save-page-button button button-primary"><?php esc_html_e( 'Save Questions
</div>
<?php do_action('qsm_after_options'); ?>
</div>
<div class="qsm-question-misc-options">
<div class="qsm-question-misc-options advanced-content">
<?php
$show_correct_answer_info = '';
$show_autofill = '';
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 @@ -114,6 +114,7 @@ public function qsm_upload_image_fd_question() {
} elseif ( 'excel' === $value ) {
$mimes[] = 'application/excel, application/vnd.ms-excel, application/x-excel, application/x-msexcel';
$mimes[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
$mimes[] = 'text/csv';
} elseif ( empty( $value ) ) {
// don't add blank mime type
} else {
Expand Down Expand Up @@ -661,15 +662,15 @@ public function load_questions( $quiz_id, $quiz_options, $is_quiz_page, $questio
}
}
$question_ids = apply_filters( 'qsm_load_questions_ids', $question_ids, $quiz_id, $quiz_options );
$question_sql = implode( ', ', $question_ids );
$question_sql = implode( ',', $question_ids );

if ( 1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order ) {
if ( isset($_COOKIE[ 'question_ids_'.$quiz_id ]) ) {
$question_sql = sanitize_text_field( wp_unslash( $_COOKIE[ 'question_ids_'.$quiz_id ] ) );
}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 );
$question_sql = implode( ',', $question_ids );
?>
<script>
const d = new Date();
Expand Down Expand Up @@ -1308,7 +1309,7 @@ public function display_comment_section( $qmn_quiz_options, $qmn_array_for_varia
$message_comments = $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( $qmn_quiz_options->message_comment, ENT_QUOTES ), "quiz_message_comment-{$qmn_quiz_options->quiz_id}" );
$message_comments = apply_filters( 'mlw_qmn_template_variable_quiz_page', wpautop( $message_comments ), $qmn_array_for_variables );
?>
<label for="mlwQuizComments" class="mlw_qmn_comment_section_text"><?php echo wp_kses_post( $message_comments ); ?></label><br />
<label for="mlwQuizComments" class="mlw_qmn_comment_section_text"><?php echo do_shortcode( wp_kses_post( $message_comments ) ); ?></label><br />
<textarea cols="60" rows="10" id="mlwQuizComments" name="mlwQuizComments" class="qmn_comment_section"></textarea>
</div>
<?php
Expand Down Expand Up @@ -1747,13 +1748,13 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) {
public static function check_answers( $options, $quiz_data ) {

global $mlwQuizMasterNext;

$new_questions = array();
// Load the pages and questions
$pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() );
$questions = QSM_Questions::load_questions_by_pages( $options->quiz_id );
if ( ( 1 == $options->randomness_order || 2 == $options->randomness_order ) && isset($_COOKIE[ 'question_ids_'.$options->quiz_id ]) ) {
$question_sql = sanitize_text_field( wp_unslash( $_COOKIE[ 'question_ids_'.$options->quiz_id ] ) );
$question_array = explode(", ",$question_sql);
$question_array = explode(",",$question_sql);
foreach ( $question_array as $key ) {
if ( isset( $questions[ $key ] ) ) {
$new_questions[ $key ] = $questions[ $key ];
Expand Down
4 changes: 2 additions & 2 deletions php/question-types/qsm-question-title.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ function qsm_question_title_func( $question, $question_type = '', $new_question_
$polar_extra_class .= ' qsm_remove_bold';
}
if ( ! empty( $question_title ) ) {
$question_title = do_shortcode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( $question_title, ENT_QUOTES ), "question-description-{$question_id}", "QSM Questions" ) );
$question_title = $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( $question_title, ENT_QUOTES ), "question-description-{$question_id}", "QSM Questions" );
}
?>
<div class='mlw_qmn_question <?php echo esc_attr( $polar_extra_class ); ?>' >
<?php do_action('qsm_before_question_title',$question, $question_type, $new_question_title, $question_id ); ?>
<?php echo wp_kses_post( $question_title . $deselect_answer ); ?>
<?php echo do_shortcode( wp_kses_post( $question_title . $deselect_answer ) ); ?>
</div>
<?php
}
1 change: 1 addition & 0 deletions php/question-types/qsm-question-type-file-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function qmn_file_upload_display( $id, $question, $answers ) {
<input class="mlw_file_upload_hidden_value" type="hidden" name="question<?php echo esc_attr( $id ); ?>" value="" />
<span style="display: none;" class='mlw-file-upload-error-msg'></span>
<input class="mlw_file_upload_hidden_path" type="hidden" value="" />
<input class="mlw_file_upload_media_id" type="hidden" value="" />
<?php
echo apply_filters( 'qmn_file_upload_display_front', '', $id, $question, $answers );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function qmn_horizontal_multiple_choice_display( $id, $question, $answers ) {
} else {
$answer_text = trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
$answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' );
echo wp_kses_post( do_shortcode( $answer_text ) );
echo do_shortcode( wp_kses_post( $answer_text ) );
}
?>
</label>
Expand Down
2 changes: 1 addition & 1 deletion php/question-types/qsm-question-type-multiple-choice.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function qmn_multiple_choice_display( $id, $question, $answers ) {
} else {
$answer_text = trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
$answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' );
echo wp_kses_post( do_shortcode( $answer_text ) );
echo do_shortcode( wp_kses_post( $answer_text ) );
}
?>
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function qmn_horizontal_multiple_response_display( $id, $question, $answers ) {
} else {
$answer_text = trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
$answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' );
echo wp_kses_post( do_shortcode( $answer_text ) );
echo do_shortcode( wp_kses_post( $answer_text ) );
}
?>
</label>
Expand Down
2 changes: 1 addition & 1 deletion php/question-types/qsm-question-type-multiple-response.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function qmn_multiple_response_display( $id, $question, $answers ) {
} else {
$answer_text = trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) );
$answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' );
echo wp_kses_post( do_shortcode( $answer_text ) );
echo do_shortcode( wp_kses_post( $answer_text ) );
}
?>
</label>
Expand Down
5 changes: 2 additions & 3 deletions php/question-types/qsm-question-type-opt-in.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ function qmn_accept_display( $id, $question, $answers ) {
<label class="qsm-input-label" for="mlwAcceptance">
<span class="qmn_accept_text">
<?php
$question = do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) );
$question = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $question, "question-description-{$id}", 'QSM Questions' );
echo wp_kses_post( $question );
$question = $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( $question, ENT_QUOTES ), "question-description-{$id}", 'QSM Questions' );
echo do_shortcode( wp_kses_post( $question ) );
?>
</span>
</label>
Expand Down
5 changes: 2 additions & 3 deletions php/question-types/qsm-question-type-text-or-html.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
*/
function qmn_text_block_display( $id, $question, $answers ) {
global $mlwQuizMasterNext;
$question = do_shortcode( htmlspecialchars_decode( $question, ENT_QUOTES ) );
$question = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $question, "question-description-{$id}", "QSM Questions" );
$question = $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( $question, ENT_QUOTES ), "question-description-{$id}", "QSM Questions" );
$question = apply_filters( 'qmn_text_block_display_front', $question, $id, $answers);
echo wp_kses_post( $question );
echo do_shortcode( wp_kses_post( $question ) );
}
4 changes: 2 additions & 2 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
$question_title = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer['question_title'], "Question-{$answer['id']}", "QSM Questions");
$question_description = '';
if ( ! empty( $answer[0] ) ) {
$question_description = do_shortcode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer[0], "question-description-{$answer['id']}", "QSM Questions" ) );
$question_description = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer[0], "question-description-{$answer['id']}", "QSM Questions" );
}
if ( isset( $answer['question_title'] ) && '' !== $answer['question_title'] ) {
$add_br = '';
Expand Down Expand Up @@ -1194,7 +1194,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
$question_max_point = ( isset( $questions[ $answer['id'] ] ) ? qsm_get_question_maximum_points( $questions[ $answer['id'] ] ) : 0 );
$mlw_question_answer_display = str_replace( '%QUESTION_MAX_POINTS%', $question_max_point, $mlw_question_answer_display );

$mlw_question_answer_display = wp_kses_post( $mlw_question_answer_display );
$mlw_question_answer_display = do_shortcode( wp_kses_post( $mlw_question_answer_display ) );

if ( $total_question_cnt == $qsm_question_cnt && false == $remove_border ) {
$extra_border_bottom_class = 'qsm-remove-border-bottom';
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.0
Requires PHP: 5.4
Stable tag: 8.0.1
Stable tag: 8.0.2
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.0.2 (June 23, 2022) =
* Bug: Fixed scoring issue while using random questions
* Bug: Fixed issue with file question type validation settings
* Bug: Fixed issue with video player in rich text answer type

= 8.0.1 (June 17, 2022) =
* Hotfix: Fixed issues while using random questions with question limit

Expand Down

0 comments on commit c6c8b14

Please sign in to comment.