Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cu 86cuhj0h3 wpml issue fill in the blank #2458

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public function set_user_answer() {
}

public function set_correct_answer() {
global $mlwQuizMasterNext;
foreach ( $this->answer_array as $answer_key => $answer_value ) {
$this->correct_answer[ $answer_key ] = $this->sanitize_answer_from_db( $answer_value[0] );
$this->correct_answer[ $answer_key ] = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $this->sanitize_answer_from_db( $answer_value[0] ), "answer-{$this->question_id}-{$answer_key}", "QSM Answers" );
}
}

Expand Down
3 changes: 3 additions & 0 deletions php/question-types/qsm-question-type-fill-in-the-blanks.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ function qmn_fill_blank_display( $id, $question, $answers ) {
*/
function qmn_fill_blank_review( $id, $question, $answers ) {
global $mlwQuizMasterNext;
if ( ! empty( $question ) ) {
$question = $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( html_entity_decode( $question, ENT_HTML5 ), ENT_QUOTES ), "question-description-{$id}", "QSM Questions" );
}
$case_sensitive = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'case_sensitive' );
$current_question = new QSM_Question_Review_Fill_In_Blanks( $id, $question, $answers );
$user_text_array = $current_question->get_user_answer();
Expand Down
14 changes: 8 additions & 6 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,9 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
$question_settings = isset( $questions[ $answer['id'] ]['settings'] ) ? $questions[ $answer['id'] ]['settings'] : array();
$question_title = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer['question_title'], "Question-{$answer['id']}", 'QSM Questions' );
$question_description = '';
if ( ! empty( $answer[0] ) ) {
if ( 14 == $answer['question_type'] ) {
$question_description = ! empty($answer[0]) ? $answer[0] : '';
} elseif ( ! empty( $answer[0] ) ) {
$question_description = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer[0], "question-description-{$answer['id']}", 'QSM Questions' );
}
$question_description = ! empty( $question_description ) ? '<span class="qsm-result-question-description">' . $question_description . '</span>' : $question_description;
Expand Down Expand Up @@ -1129,10 +1131,10 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
$is_answer_correct = 0;
if ( isset($answer['case_sensitive']) && 1 === intval( $answer['case_sensitive'] ) ) {
$decode_show_user_answer = htmlspecialchars_decode( $show_user_answer, ENT_QUOTES );
$decode_single_user_answer = htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ), ENT_QUOTES );
$decode_single_user_answer = htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES );
} else {
$decode_show_user_answer = htmlspecialchars_decode( mb_strtoupper( $show_user_answer ), ENT_QUOTES );
$decode_single_user_answer = mb_strtoupper( htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ), ENT_QUOTES ) );
$decode_single_user_answer = mb_strtoupper( htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES ) );
}

if ( $decode_show_user_answer == $decode_single_user_answer ) {
Expand All @@ -1147,16 +1149,16 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
}

$question_with_answer_text .= '<span class="qsm-text-wrong-option">(' . $index . ') ' . $show_user_answer . '</span>';
$question_with_answer_text .= '<span class="qsm-text-correct-option">(' . $index . ') ' . strval( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ) ) . '</span>';
$question_with_answer_text .= '<span class="qsm-text-correct-option">(' . $index . ') ' . strval( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ) ) . '</span>';
}
}
} else {
$options = array();
foreach ( $total_answers as $key => $single_answer ) {
if ( isset($answer['case_sensitive']) && 1 === intval( $answer['case_sensitive'] ) ) {
$options[] = htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ), ENT_QUOTES );
$options[] = htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES );
} else {
$options[] = mb_strtoupper( htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ), ENT_QUOTES ) );
$options[] = mb_strtoupper( htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES ) );
}
}

Expand Down