Skip to content

Commit

Permalink
Merge pull request #2051 from QuizandSurveyMaster/dev
Browse files Browse the repository at this point in the history
Release 8.0.8
  • Loading branch information
etvarun authored Dec 15, 2022
2 parents b896f1b + 9fd30a4 commit dcd26c4
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 26 deletions.
20 changes: 12 additions & 8 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ var QSMAdmin;
jQuery('.qsm-custom-label-left-menu').removeClass('currentli_general');
jQuery(this).addClass('current_general');
jQuery(this).parent().addClass('currentli_general');
jQuery('#' + text_id).show();
jQuery('#' + text_id).show();
jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
jQuery.post(ajaxurl, { text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message' }, function (response) {
var data = jQuery.parseJSON(response);
Expand All @@ -213,7 +213,7 @@ var QSMAdmin;
jQuery('.qsm-custom-label-left-menu').removeClass('currentli_variable');
jQuery(this).addClass('current_variable');
jQuery(this).parent().addClass('currentli_variable');
jQuery('#' + text_id).show();
jQuery('#' + text_id).show();
jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
jQuery.post(ajaxurl, { text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message' }, function (response) {
var data = jQuery.parseJSON(response);
Expand All @@ -234,9 +234,10 @@ var QSMAdmin;
jQuery(document).on('click', '#qsm_save_text_message', function () {
var $this = jQuery(this);
$this.siblings('.spinner').addClass('is-active');
var nonce = jQuery('#qsm_save_text_message_nonce').val();
var text_id = jQuery(".currentli_general .current_general").data('id');
var message = wp.editor.getContent('qsm_question_text_message');
jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message' }, function (response) {
jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message', nonce: nonce }, function (response) {
var data = jQuery.parseJSON(response);
if (data.success === true) {
//Do nothing
Expand All @@ -248,9 +249,10 @@ var QSMAdmin;
jQuery(document).on('click', '#qsm_save_text_message_variable', function () {
var $this = jQuery(this);
$this.siblings('.spinner').addClass('is-active');
var nonce = jQuery('#qsm_save_text_message_nonce').val();
var text_id = jQuery(".currentli_variable .current_variable").data('id');
var message = wp.editor.getContent('qsm_question_text_message_variable');
jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message' }, function (response) {
jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message', nonce: nonce }, function (response) {
var data = jQuery.parseJSON(response);
if (data.success === true) {
//Do nothing
Expand Down Expand Up @@ -1990,7 +1992,7 @@ var import_button;
if ($answer.find('.answer-correct').prop('checked')) {
correct = 1;
}

var ansData = [answer, points, correct];
if (answerType == 'image') {
ansData.push(caption);
Expand All @@ -2000,7 +2002,7 @@ var import_button;
intcnt++
});
model.set('answers', answers);

$('.questionElements .advanced-content > .qsm-row:not(.core-option)').each(function () {
if ($(this).find('input[type="text"]').length > 0) {
$($(this).find('input[type="text"]')).each(function () {
Expand All @@ -2022,7 +2024,7 @@ var import_button;
advanced_option[element_id] = multi_value;
}
});

model.save({
quizID: quizID,
type: type,
Expand Down Expand Up @@ -2744,7 +2746,9 @@ var import_button;
if (13 == question_val) {
QSMQuestion.prepareEditPolarQuestion(question_val);
}
jQuery(document).trigger('qsm-change-answer-editor-after');
if (18 == question_val) {
jQuery(document).trigger('qsm-change-answer-editor-after');
}
});

// Adds event handlers for searching questions
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: 8.0.7
* Version: 8.0.8
* 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.7';
public $version = '8.0.8';

/**
* QSM Alert Manager Object
Expand Down
39 changes: 24 additions & 15 deletions php/admin/options-page-text-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function mlw_options_text_tab_content() {
<?php
if ( $editor_text_arr ) {
foreach ( $editor_text_arr as $key => $single_editor_arr ) {
if ( ! str_contains( $single_editor_arr['label'], '%' ) ) {
if ( ! strpos( $single_editor_arr['label'], '%', 1 ) ) {
$class_current_li = "";
$class = "";
if ( 0 == $key ) {
Expand Down Expand Up @@ -100,6 +100,7 @@ function mlw_options_text_tab_content() {
?>
</div>
<div class="save-text-changes">
<?php wp_nonce_field( 'qsm_save_text_message_nonce', 'qsm_save_text_message_nonce' ); ?>
<button id="qsm_save_text_message" class="button button-primary"><?php esc_html_e( 'Save Text Message', 'quiz-master-next' ); ?></button>
<span class="spinner" ></span>
</div>
Expand All @@ -121,7 +122,7 @@ function mlw_options_text_tab_content() {
<?php
if ( $editor_text_arr ) {
foreach ( $editor_text_arr as $key => $single_editor_arr ) {
if ( str_contains( $single_editor_arr['label'], '%' ) ) {
if ( strpos( $single_editor_arr['label'], '%', 1 ) ) {
$class_current_li = "";
$class = "";
if ( 7 == $key ) {
Expand Down Expand Up @@ -151,6 +152,7 @@ function mlw_options_text_tab_content() {
?>
</div>
<div class="save-text-changes">
<?php wp_nonce_field( 'qsm_save_text_message_nonce', 'qsm_save_text_message_nonce' ); ?>
<button id="qsm_save_text_message_variable" class="button button-primary">
<?php esc_html_e( 'Save Text Message', 'quiz-master-next' ); ?></button>
<span class="spinner" ></span>
Expand Down Expand Up @@ -254,21 +256,28 @@ function qsm_get_question_text_message() {
*/
function qsm_update_text_message() {
global $mlwQuizMasterNext;
$quiz_id = isset( $_POST['quiz_id'] ) ? intval( $_POST['quiz_id'] ) : 0;
$text_id = isset( $_POST['text_id'] ) ? sanitize_text_field( wp_unslash( $_POST['text_id'] ) ) : '';
$message = isset( $_POST['message'] ) ? wp_kses_post( wp_unslash( $_POST['message'] ) ) : '';
$settings = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'quiz_text' );
$settings[ $text_id ] = $message;
$results = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'quiz_text', $settings );
if ( false !== $results ) {
do_action( 'qsm_saved_text_message', $quiz_id, $text_id, $message );
$results = array(
'success' => true,
);
} else {
if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'qsm_save_text_message_nonce' ) ) {
$quiz_id = isset( $_POST['quiz_id'] ) ? intval( $_POST['quiz_id'] ) : 0;
$text_id = isset( $_POST['text_id'] ) ? sanitize_text_field( wp_unslash( $_POST['text_id'] ) ) : '';
$message = isset( $_POST['message'] ) ? wp_kses_post( wp_unslash( $_POST['message'] ) ) : '';
$settings = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'quiz_text' );
$settings[ $text_id ] = $message;
$results = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'quiz_text', $settings );
if ( false !== $results ) {
do_action( 'qsm_saved_text_message', $quiz_id, $text_id, $message );
$results = array(
'success' => true,
);
} else {
$results = array(
'success' => false,
'message' => __( 'There has been an error in this action. Please share this with the developer', 'quiz-master-next' ),
);
}
}else {
$results = array(
'success' => false,
'message' => __( 'There has been an error in this action. Please share this with the developer', 'quiz-master-next' ),
'message' => __( 'Invalid request', 'quiz-master-next' ),
);
}
echo wp_json_encode( $results );
Expand Down
2 changes: 2 additions & 0 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -1063,12 +1063,14 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
if ( 'correct' === $answer['correct'] ) {
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . $user_given_answer . '</span>';
$do_show_wrong = false;
break;
}
}
} else {
if ( isset( $single_answer[2] ) && 'correct' === $answer['correct'] ) {
$question_with_answer_text .= '<span class="qsm-text-correct-option">' . $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ) . '</span>';
$do_show_wrong = false;
break;
}
}
}
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.7
Stable tag: 8.0.8
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.8 (Dec 15, 2022) =
* Bug: Fixed issue with short answer question type
* Bug: Fixed security issues.
* Bug: Fixed compatibility issues with php v7 or older

= 8.0.7 (Dec 05, 2022) =
* Feature: Added option to show and hide Text/HTML question type on result page
* Bug: Fixed block.js warnings
Expand Down

0 comments on commit dcd26c4

Please sign in to comment.