Skip to content

Commit

Permalink
fixed date formate with %ANSWER_X% variable
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairraeen committed Apr 8, 2024
1 parent 774784c commit 0e3bd10
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
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.0.0
* Version: 9.0.1
* 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.0.0';
public $version = '9.0.1';

/**
* QSM Alert Manager Object
Expand Down
13 changes: 9 additions & 4 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ) {

function qsm_variable_single_answer( $content, $mlw_quiz_array ) {
global $mlwQuizMasterNext,$wpdb;
$quiz_options = $mlwQuizMasterNext->quiz_settings->get_quiz_options();
$quiz_id = is_object( $mlw_quiz_array ) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id'];
while ( false !== strpos( $content, '%ANSWER_' ) ) {
$question_id = mlw_qmn_get_string_between( $content, '%ANSWER_', '%' );
Expand All @@ -136,14 +137,18 @@ function qsm_variable_single_answer( $content, $mlw_quiz_array ) {
if ( isset($answers['user_answer']) ) {
if ( 13 === intval( $answers['question_type'] ) ) {
$answerstr .= $answers['points'];
}elseif ( 12 === intval( $answers['question_type'] ) ) {
$preferred_date_format = isset($quiz_options->preferred_date_format) ? $quiz_options->preferred_date_format : get_option('date_format');
foreach ( $answers['user_answer'] as $answer ) {
$answerstr = date_i18n( $preferred_date_format, strtotime( $answer ) );
}
}elseif ( 'rich' === $question_settings['answerEditor'] ) {
foreach ( $answers['user_answer'] as $answer ) {
$answerstr .= htmlspecialchars_decode($answer);
$answerstr .= htmlspecialchars_decode($answer);
}
}
elseif ( 'image' === $question_settings['answerEditor'] ) {
}elseif ( 'image' === $question_settings['answerEditor'] ) {
foreach ( $answers['user_answer'] as $answer ) {
$answerstr .= '<span class="qmn_image_option" ><img src="' . htmlspecialchars_decode($answer, ENT_QUOTES ) . '"/></span>';
$answerstr .= '<span class="qmn_image_option" ><img src="' . htmlspecialchars_decode($answer, ENT_QUOTES ) . '"/></span>';
}
}else {
$answerstr .= implode(", ",$answers['user_answer']);
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.5
Requires PHP: 5.4
Stable tag: 9.0.0
Stable tag: 9.0.1
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 ==
= 9.0.1 (April 08, 2024) =
* Bug: Fixed date formate with %ANSWER_X% variable
* Bug: Fixed PHP warning with Quiz Block editor
* Enhancement: Checked compatibility with WordPress 6.5

= 9.0.0 (March 27, 2024) =
* Feature: Implemented a minimum length requirement for text-based question types
* Feature: Introduced a placeholder option for contact fields
Expand Down

0 comments on commit 0e3bd10

Please sign in to comment.