Skip to content

Commit

Permalink
merged with dev
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-pranav committed Oct 18, 2024
2 parents c095ba7 + ff2981a commit 4cdb6b6
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 60 deletions.
1 change: 1 addition & 0 deletions css/qsm-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,7 @@ tr .qsm-opt-desc {
#quiz_settings_wrapper .qsm-opt-desc {
display: none !important;
}
.qsm_page_qmn_global_settings .form-table td fieldset label,
.qsm_tab_content .form-table td fieldset label {
margin-right: 20px !important;
width: 100%;
Expand Down
5 changes: 4 additions & 1 deletion js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,12 @@ var qsmTimerInterval = [];
}
var secondsRemaining = qmn_quiz_data[quizID].timerRemaning;
var secondsConsumed = qmn_quiz_data[quizID].timerConsumed;
jQuery(document).trigger('qmn_timer_consumed_seconds', [quizID, qmn_quiz_data, qsm_timer_consumed_obj]);
if (localStorage.getItem('mlw_time_quiz' + quizID) != null ) {
secondsRemaining = (parseFloat(qmn_quiz_data[quizID].timer_limit) * 60) - secondsConsumed + 1;
if(qsm_timer_consumed_obj.qmn_count_upward_status){
secondsConsumed = qmn_quiz_data[quizID].timerConsumed - 1;
secondsRemaining = (parseFloat(qmn_quiz_data[quizID].timer_limit) * 60) - secondsConsumed;
}
if(secondsRemaining < 0) {
secondsRemaining = 0;
}
Expand Down
12 changes: 8 additions & 4 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.2.0
* Version: 9.2.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.2.0';
public $version = '9.2.1';

/**
* QSM Alert Manager Object
Expand Down Expand Up @@ -756,11 +756,15 @@ public function qsm_add_user_capabilities() {
);

$user = wp_get_current_user();
if ( empty( $user->roles ) || ! is_array( $user->roles ) ) {
return;
}
$roles = (array) $user->roles;
$rolename = $roles[0];

$role = get_role( $rolename );

if ( ! $role ) {
return;
}
// Remove all capabilities first.
foreach ( $administrator_capabilities as $cap ) {
if ( $role->has_cap( $cap ) ) {
Expand Down
3 changes: 3 additions & 0 deletions php/classes/class-qsm-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public static function generate_section( $fields, $section ) {
case 'number':
$sanitized_value = isset( $_POST[ $key ] ) ? intval( $_POST[ $key ] ) : "";
break;
case 'image':
$sanitized_value = isset( $_POST[ $key ] ) ? esc_url_raw( wp_unslash( $_POST[ $key ] ) ) : "";
break;
default:
$sanitized_value = isset( $_POST[ $key ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ] ) ) : "";
break;
Expand Down
1 change: 1 addition & 0 deletions php/classes/class-qsm-results-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public static function generate_pages( $response_data ) {
// variables, and then outputs the text.
$page = wp_kses_post( htmlspecialchars_decode( $content, ENT_QUOTES) );

$response_data['result_page_index'] = $index;
//last chance to filter $page
$page = apply_filters( 'qsm_template_variable_results_page', $page, $response_data );

Expand Down
11 changes: 5 additions & 6 deletions php/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,11 @@ function qsm_generate_fb_header_metadata() {
$sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '' );
$sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $results_array );
$default_fb_image = QSM_PLUGIN_URL . 'assets/icon-200x200.png';
$get_fb_sharing_image = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'result_page_fb_image', '' );
if ( empty( $get_fb_sharing_image ) ) {
$get_fb_sharing_image = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'result_page_fb_image', '' );
}
if ( '' !== $get_fb_sharing_image && filter_var( $get_fb_sharing_image, FILTER_VALIDATE_URL ) ) {
$default_fb_image = $get_fb_sharing_image;
$fb_sharing_image_quiz_options = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'result_page_fb_image', '' );
$fb_sharing_image_quiz_text = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'result_page_fb_image', '' );
$get_fb_sharing_image = ! empty($fb_sharing_image_quiz_options) ? $fb_sharing_image_quiz_options : $fb_sharing_image_quiz_text;
if ( ! empty($get_fb_sharing_image) && filter_var($get_fb_sharing_image, FILTER_VALIDATE_URL) ) {
$default_fb_image = esc_url($get_fb_sharing_image);
}
$post = $wp_query->get_queried_object();
$pagename = $post->post_title;
Expand Down
8 changes: 6 additions & 2 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -1194,14 +1194,16 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
}
} else {
$options = array();
$question_correct_fill_answer_text = '';
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-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES );
} else {
$options[] = mb_strtoupper( htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES ) );
}
$question_correct_fill_answer_text .= '<span class="qsm-text-correct-option">(' . $key + 1 . ') ' . strval( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ) ) . '</span>';
}

$is_any_incorrect = false;
if ( sizeof( $new_array_user_answer ) < sizeof( $total_answers ) ) {
foreach ( $new_array_user_answer as $show_user_answer ) {
if ( isset($answer['case_sensitive']) && 1 === intval( $answer['case_sensitive'] ) ) {
Expand All @@ -1212,6 +1214,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
if ( false !== $key ) {
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . htmlspecialchars_decode( $show_user_answer, ENT_QUOTES ) . '</span>';
} else {
$is_any_incorrect = true;
if ( '' === $show_user_answer ) {
$show_user_answer = $quiz_options->no_answer_text;
}
Expand All @@ -1229,14 +1232,15 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
if ( false !== $key ) {
$question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . $show_user_answer . '</span>';
} else {

$is_any_incorrect = true;
if ( '' === $show_user_answer ) {
$show_user_answer = $quiz_options->no_answer_text;
}
$question_with_answer_text .= '<span class="qsm-text-wrong-option">' . $show_user_answer . '</span>';
}
}
}
$question_with_answer_text = $is_any_incorrect ? $question_with_answer_text . $question_correct_fill_answer_text : $question_with_answer_text;
}
} else {
if ( 0 == $form_type && ( 0 == $quiz_system || 3 == $quiz_system ) ) {
Expand Down
Loading

0 comments on commit 4cdb6b6

Please sign in to comment.