Skip to content

Commit

Permalink
Merge pull request #2628 from QuizandSurveyMaster/pre-release
Browse files Browse the repository at this point in the history
Release 9.1.2
  • Loading branch information
etvarun authored Aug 22, 2024
2 parents b16b424 + 90cffcf commit 6a16211
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 96 deletions.
11 changes: 9 additions & 2 deletions css/qsm-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -3350,8 +3350,7 @@ body .qsm_tab_content .qsm-small-input-field input[type="text"] {
padding-top: 4px;
}
fieldset#enable_quick_correct_answer_info {
margin-left: 25px;
margin-top: 4px;
margin-top: 8px;
}
.qsm-mb-1, .qsm_tab_content fieldset{
margin-bottom: .25rem;
Expand Down Expand Up @@ -3454,4 +3453,12 @@ input#preferred-date-format-custom {
#qmn-failed-submission-table-message {
padding-right: 38px;
position: relative;
}
#toplevel_page_qsm_dashboard li:nth-last-child(3) a:after {
border-bottom: 1px solid hsla(0, 0%, 100%, .2);
display: block;
float: left;
margin: 13px -15px 8px;
content: "";
width: calc(100% + 26px);
}
11 changes: 0 additions & 11 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,6 @@ var QSMAdmin;
jQuery('.category_selection_random').parents("tr").hide();
}
});
show_hide_show_correct_answer();
$(document).on('change', '#enable_quick_result_mc-1', function (event) {
show_hide_show_correct_answer();
});
function show_hide_show_correct_answer() {
if (jQuery('#enable_quick_result_mc-1:checked').length > 0) {
jQuery('#enable_quick_correct_answer_info').css('opacity', '1');
} else {
jQuery('#enable_quick_correct_answer_info').css('opacity', '0.5');
}
}
jQuery(document).on('change', '#preferred-date-format-custom', function() {
let customValue = jQuery(this).val();
jQuery('#preferred_date_format label.qsm-option-label:last input[type="radio"]').val(customValue);
Expand Down
116 changes: 60 additions & 56 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,34 +310,7 @@ var qsmTimerInterval = [];
if ('1' == qmn_quiz_data[quizID].progress_bar) {
jQuery(document).trigger('qsm_init_progressbar_before', [quizID, qmn_quiz_data]);
$('#quizForm' + quizID).find('.qsm-progress-bar').show();
qmn_quiz_data[quizID].bar = new ProgressBar.Line('#quizForm' + quizID + ' .qsm-progress-bar', {
strokeWidth: 2,
easing: 'easeInOut',
duration: 1400,
color: '#3498db',
trailColor: '#eee',
trailWidth: 1,
svgStyle: { width: '100%', height: '100%' },
text: {
style: {
// color: '#999',
position: 'absolute',
padding: 0,
margin: 0,
top: 0,
right: '10px',
'font-size': '13px',
'font-weight': 'bold',
transform: null
},
autoStyleContainer: false
},
from: { color: '#3498db' },
to: { color: '#ED6A5A' },
step: function (state, bar) {
//bar.setText(Math.round(bar.value() * 100) + ' %');
}
});
qmn_quiz_data[quizID].bar = createQSMProgressBar(quizID, '#quizForm' + quizID + ' .qsm-progress-bar');
jQuery(document).trigger('qsm_init_progressbar_after', [quizID, qmn_quiz_data]);
}
QSM.goToPage(quizID, 1);
Expand Down Expand Up @@ -444,6 +417,10 @@ var qsmTimerInterval = [];
}
var animate_value = current_page / total_page_length;
if (animate_value <= 1) {
if (!qmn_quiz_data[quizID].bar) {
jQuery( '#quizForm' + quizID + ' .qsm-progress-bar svg' ).remove();
qmn_quiz_data[quizID].bar = createQSMProgressBar(quizID, '#quizForm' + quizID + ' .qsm-progress-bar');
}
qmn_quiz_data[quizID].bar.animate(animate_value);
var old_text = jQuery('#quizForm' + quizID).find('.progressbar-text').text().replace(' %', '');
var new_text = Math.round(animate_value * 100);
Expand Down Expand Up @@ -628,6 +605,33 @@ function isUrlValid(url) {
return /^(http|https|ftp):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test(url);
}

/**
* Create QSM progress bar
* @returns
*/
function createQSMProgressBar(quizID, elementID) {
return new ProgressBar.Line(elementID, {
strokeWidth: 2,
easing: 'easeInOut',
duration: 1400,
color: '#3498db',
trailColor: '#eee',
trailWidth: 1,
svgStyle: { width: '100%', height: '100%' },
text: {
style: {
'position': 'absolute',
'right': '10px',
'font-size': '13px',
'font-weight': 'bold'
},
autoStyleContainer: false
},
from: { color: '#3498db' },
to: { color: '#ED6A5A' }
});
}

/**
* Limit multiple response based on question limit
* @returns
Expand Down Expand Up @@ -1300,33 +1304,7 @@ function qmnInitPagination(quiz_id) {
if ('1' == qmn_quiz_data[quiz_id].progress_bar) {
jQuery(document).trigger('qsm_init_progressbar_before', [quiz_id, qmn_quiz_data]);
jQuery('#quizForm' + quiz_id).closest('.qmn_quiz_container').find('.qsm-progress-bar').show();
qmn_quiz_data[quiz_id].bar = new ProgressBar.Line('#qsm_progress_bar_' + quiz_id, {
strokeWidth: 2,
easing: 'easeInOut',
duration: 500,
color: '#3498db',
trailColor: '#eee',
trailWidth: 1,
svgStyle: { width: '100%', height: '100%' },
text: {
style: {
// color: '#999',
position: 'absolute',
padding: 0,
margin: 0,
top: 0,
right: '10px',
'font-size': '13px',
'font-weight': 'bold',
transform: null
},
autoStyleContainer: false
},
from: { color: '#3498db' },
to: { color: '#ED6A5A' },
step: function (state, bar) {
}
});
qmn_quiz_data[quiz_id].bar = createQSMProgressBar(quiz_id, '#qsm_progress_bar_' + quiz_id);
jQuery(document).trigger('qsm_init_progressbar_after', [quiz_id, qmn_quiz_data]);
}

Expand Down Expand Up @@ -1508,6 +1486,12 @@ jQuery(function () {
let question_id = $i_this.attr('name').split('question')[1];
if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) {
qsm_show_inline_result(quizID, question_id, value, $this, 'radio', $i_this)
} else if (qmn_quiz_data[quizID].enable_quick_correct_answer_info != 0) {
let data = qsm_question_quick_result_js(question_id, value, 'radio', qmn_quiz_data[quizID].enable_quick_correct_answer_info, quizID);
$this.find('.quick-question-res-p, .qsm-inline-correct-info').remove();
if (0 < value.length && data.success != '') {
$this.append('<div class="qsm-inline-correct-info">' + qsm_check_shortcode(data.message) + '</div>');
}
}
jQuery(document).trigger('qsm_after_select_answer', [quizID, question_id, value, $this, 'radio']);
if (qmn_quiz_data[quizID].end_quiz_if_wrong > 0 && !jQuery(this).parents('.qsm-quiz-container').find('.mlw_next:visible').length ) {
Expand All @@ -1521,10 +1505,24 @@ jQuery(function () {
let question_id = $i_this.attr('name').split('question')[1];
let value = $i_this.val();
let $this = $i_this.parents('.quiz_section');
let sendValue;
if (typeof value === 'string') {
sendValue = value.trim();
} else if (value.length) {
sendValue = value[value.length - 1];
} else {
sendValue = '';
}
clearTimeout(qsm_inline_result_timer);
qsm_inline_result_timer = setTimeout(() => {
if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) {
qsm_show_inline_result(quizID, question_id, value, $this, 'input', $i_this, $this.find('.qmn_fill_blank').index($i_this));
qsm_show_inline_result(quizID, question_id, sendValue, $this, 'input', $i_this, $this.find('.qmn_fill_blank').index($i_this));
} else if (qmn_quiz_data[quizID].enable_quick_correct_answer_info != 0) {
let data = qsm_question_quick_result_js(question_id, sendValue, 'input', qmn_quiz_data[quizID].enable_quick_correct_answer_info, quizID);
$this.find('.quick-question-res-p, .qsm-inline-correct-info').remove();
if (0 < value.length && data.success != '') {
$this.append('<div class="qsm-inline-correct-info">' + qsm_check_shortcode(data.message) + '</div>');
}
}
jQuery(document).trigger('qsm_after_select_answer', [quizID, question_id, value, $this, 'input', $this.find('.qmn_fill_blank').index($i_this)]);
}, 2000);
Expand Down Expand Up @@ -1555,6 +1553,12 @@ jQuery(function () {
}
if (qmn_quiz_data[quizID].enable_quick_result_mc == 1) {
qsm_show_inline_result(quizID, question_id, checkedValues, $this, 'checkbox', $i_this)
}else if (qmn_quiz_data[quizID].enable_quick_correct_answer_info != 0) {
let data = qsm_question_quick_result_js(question_id, checkedValues, 'checkbox', qmn_quiz_data[quizID].enable_quick_correct_answer_info,quizID);
$this.find('.quick-question-res-p, .qsm-inline-correct-info').remove();
if ( 0 < checkedValues.length && data.success != '') {
$this.append('<div class="qsm-inline-correct-info">' + qsm_check_shortcode(data.message) + '</div>');
}
}
jQuery(document).trigger('qsm_after_select_answer', [quizID, question_id, checkedValues, $this, 'checkbox']);
});
Expand Down
26 changes: 13 additions & 13 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.1.1
* Version: 9.1.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 = '9.1.1';
public $version = '9.1.2';

/**
* QSM Alert Manager Object
Expand Down Expand Up @@ -485,15 +485,14 @@ public function qsm_admin_scripts_style( $hook ) {
$qsm_variables_name = array();
foreach ( $qsm_variables as $key => $value ) {
// Iterate over each key of the nested object
if( is_array( $value ) && !empty($value)) {
if ( is_array( $value ) && ! empty($value) ) {

foreach ( $value as $nestedKey => $nestedValue ) {
// Add the nested key to the array
$qsm_variables_name[] = $nestedKey;
}
}
}

}
}
$qsm_admin_messages = array(
'error' => __('Error', 'quiz-master-next'),
'success' => __('Success', 'quiz-master-next'),
Expand Down Expand Up @@ -746,27 +745,28 @@ public function setup_admin_menu() {
if ( $enabled && 'cancelled' !== $enabled ) {
$qsm_taxonomy_menu_hook = add_submenu_page( 'qsm_dashboard', __( 'Question Categories', 'quiz-master-next' ), __( 'Question Categories', 'quiz-master-next' ), 'edit_posts', 'edit-tags.php?taxonomy=qsm_category' );
}
if ( ! class_exists( 'QSM_Advanced_Assessment' ) ) {
add_submenu_page( 'qsm_dashboard', __( 'Answer Labels', 'quiz-master-next' ), __( 'Answer Labels', 'quiz-master-next' ), 'manage_options', 'qsm-answer-label', 'qsm_advanced_assessment_quiz_page_content', 3 );
}
add_submenu_page( 'options.php', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'edit_posts', 'mlw_quiz_options', 'qsm_generate_quiz_options' );
add_submenu_page( 'qsm_dashboard', __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );

// Failed Submission.
if ( ! empty( $settings['enable_qsm_log'] ) && $settings['enable_qsm_log'] ) {
add_submenu_page( 'qsm_dashboard', __( 'Failed Submission', 'quiz-master-next' ), __( 'Failed Submission', 'quiz-master-next' ), 'moderate_comments', 'qsm-quiz-failed-submission', array( $this, 'admin_failed_submission_page' ) );
}
// Failed DB Query.
// Failed DB Query
if ( ! empty( $settings['enable_qsm_log'] ) && $settings['enable_qsm_log'] && $this->get_failed_alter_table_queries() ) {
add_submenu_page( 'qsm_dashboard', __( 'Failed DB Queries', 'quiz-master-next' ), __( 'Failed Database Queries', 'quiz-master-next' ), 'moderate_comments', 'qsm-database-failed-queries', array( $this, 'qsm_database_failed_queries' ) );
}
add_submenu_page( 'options.php', __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_result_details', 'qsm_generate_result_details' );
add_submenu_page( 'qsm_dashboard', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
add_submenu_page( 'qsm_dashboard', __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'qsm_quiz_tools', 'qsm_generate_quiz_tools' );
add_submenu_page( 'qsm_dashboard', __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
add_submenu_page( 'qsm_dashboard', __( 'Addon Settings', 'quiz-master-next' ), '<span style="color:#f39c12;">' . __( 'Addons', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qmn_addons', 'qmn_addons_page' );
add_submenu_page( 'qsm_dashboard', __( 'Get a Free Addon', 'quiz-master-next' ), '<span style="color:#f39c12;">' . esc_html__( 'Get a Free Addon!', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qsm-free-addon', 'qsm_display_optin_page' );
add_submenu_page( 'qsm_dashboard', __( 'About', 'quiz-master-next' ), __( 'About', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_about', 'qsm_generate_about_page' );
if ( ! class_exists( 'QSM_Advanced_Assessment' ) ) {
add_submenu_page( 'qsm_dashboard', __( 'Answer Labels', 'quiz-master-next' ), __( 'Answer Labels', 'quiz-master-next' ), 'manage_options', 'qsm-answer-label', 'qsm_advanced_assessment_quiz_page_content', 3 );
}

add_submenu_page( 'qsm_dashboard', __( 'Extensions Settings', 'quiz-master-next' ), '<span style="color:#f39c12;">' . __( 'Extensions', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qmn_addons', 'qmn_addons_page', 34 );
add_submenu_page( 'qsm_dashboard', __( 'Free Add-ons', 'quiz-master-next' ), '<span style="color:#f39c12;">' . esc_html__( 'Free Add-ons', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qsm-free-addon', 'qsm_display_optin_page', 90 );
// Register screen option for dashboard page
add_action( 'screen_settings', 'qsm_dashboard_screen_options', 10, 2 );
}
Expand Down
2 changes: 1 addition & 1 deletion php/admin/addons-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function qsm_display_optin_page() {
?>
<div class="wrap about-wrap">

<h1><?php esc_html_e( 'Get Your Free Addon!', 'quiz-master-next' ); ?></h1>
<h1><?php esc_html_e( 'Get Your Free Extension!', 'quiz-master-next' ); ?></h1>

<div class="about-text">
<?php esc_html_e( 'Wanna get more out of Quiz and Survey Master, but not yet ready to spend the cash? Get one free addon today!', 'quiz-master-next' ); ?>
Expand Down
5 changes: 5 additions & 0 deletions php/admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,11 @@ function qsm_quiz_theme_settings( $type, $label, $name, $value, $default_value,
<tr valign="top">
<th scope="row" class="qsm-opt-tr">
<label for="form_type"><?php echo esc_attr( $label ); ?></label>
<?php if ( isset( $options['helper_text'] ) && '' !== $options['helper_text'] ) { ?>
<span class="dashicons dashicons-editor-help qsm-tooltips-icon">
<span class="qsm-tooltips"><?php esc_html( $options['helper_text'] ); ?></span>
</span>
<?php } ?>
</th>
<td align ="right">
<?php
Expand Down
8 changes: 5 additions & 3 deletions php/admin/settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ public function qsm_global_quiz_type() {
?>
<fieldset class="buttonset buttonset-hide" data-hide="1" id="form-type">
<label class="qsm-option-label" for="qsm-form-type-0">
<input type="radio" id="qsm-form-type-0" name="qsm-quiz-settings[form_type]" checked="checked" value="0" <?php checked( $qsm_form_type, 0 ); ?>>
<input type="radio" id="qsm-form-type-0" name="qsm-quiz-settings[form_type]" value="0" <?php checked( $qsm_form_type, 0 ); ?>>
<?php esc_html_e( 'Quiz', 'quiz-master-next' ); ?>
</label>
<label class="qsm-option-label" for="qsm-form-type-1">
Expand Down Expand Up @@ -1057,7 +1057,7 @@ public function qsm_global_limit_attempts() {
global $globalQuizsetting;
$qsm_total_user_tries = ( isset( $globalQuizsetting['total_user_tries'] ) && '' !== $globalQuizsetting['total_user_tries'] ? $globalQuizsetting['total_user_tries'] : 0 );
$qsm_limit_total_entries = ( isset( $globalQuizsetting['limit_total_entries'] ) && '' !== $globalQuizsetting['limit_total_entries'] ? $globalQuizsetting['limit_total_entries'] : 0 );
$qsm_enable_retake_quiz_button = ( isset( $globalQuizsetting['enable_retake_quiz_button'] ) && '' !== $globalQuizsetting['enable_retake_quiz_button'] ? $globalQuizsetting['enable_retake_quiz_button'] : '0' );
$qsm_enable_retake_quiz_button = ( isset( $globalQuizsetting['enable_retake_quiz_button'] ) && '' !== $globalQuizsetting['enable_retake_quiz_button'] ? $globalQuizsetting['enable_retake_quiz_button'] : 0 );
?>
<fieldset class="buttonset buttonset-hide">
<input class="small-text" id="qsm-global-setting-total-user-tries" type="number" placeholder="Set Limit" step="1" min="0" name="qsm-quiz-settings[total_user_tries]" value="<?php echo esc_attr( $qsm_total_user_tries ); ?>">
Expand All @@ -1070,8 +1070,9 @@ public function qsm_global_limit_attempts() {
<label class="qsm-opt-desc" for="qsm-global-setting-total-limit-entries"><?php esc_html_e( 'Set the limit to 0 or leave it blank to remove the limit on entries.', 'quiz-master-next'); ?></label>
</fieldset>
<fieldset class="buttonset buttonset-hide">
<input type="hidden" name="qsm-quiz-settings[enable_retake_quiz_button]" value="0">
<label class="qsm-option-label" for="qsm-enable-retake-quiz-button">
<input type="checkbox" id="qsm-enable-retake-quiz-button" name="qsm-quiz-settings[enable_retake_quiz_button]" checked="checked" value="1" <?php checked( $qsm_enable_retake_quiz_button, 1 ); ?>>
<input type="checkbox" id="qsm-enable-retake-quiz-button" name="qsm-quiz-settings[enable_retake_quiz_button]" value="1" <?php checked( $qsm_enable_retake_quiz_button, 1 ); ?>>
<?php esc_html_e( 'Allow users to retake the quiz', 'quiz-master-next'); ?>
</label>
</fieldset>
Expand All @@ -1090,6 +1091,7 @@ public function qsm_global_save_responses() {
?>
<fieldset class="buttonset buttonset-hide">
<label for="store_responses">
<input type="hidden" name="qsm-quiz-settings[store_responses]" value="0">
<input type="checkbox" id="store_responses" name="qsm-quiz-settings[store_responses]" value="1" <?php checked( $qsm_store_responses, 1 ); ?>>
<?php esc_html_e('Store results permanently in database', 'quiz-master-next'); ?>
</label>
Expand Down
6 changes: 3 additions & 3 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public function display_shortcode( $atts ) {
$return_display = do_shortcode( '[qsm_result id="' . $result_id . '"]' );
$return_display = str_replace( '%FB_RESULT_ID%', $result_unique_id, $return_display );
} else {
$return_display = 'Result id is wrong!';
$return_display = esc_html__( 'Result id is wrong!', 'quiz-master-next' );
}
$return_display .= ob_get_clean();
} else {
Expand Down Expand Up @@ -657,7 +657,7 @@ public function display_shortcode( $atts ) {
$encryption[ $question['question_id'] ]['correct_info_text'] = isset( $question['question_answer_info'] ) ? html_entity_decode( $question['question_answer_info'] ) : '';
$encryption[ $question['question_id'] ]['correct_info_text'] = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $encryption[ $question['question_id'] ]['correct_info_text'], "correctanswerinfo-{$question['question_id']}" );
}
if ( ( isset($qmn_json_data['end_quiz_if_wrong']) && 0 < $qmn_json_data['end_quiz_if_wrong'] ) || ( ! empty( $qmn_json_data['enable_quick_result_mc'] ) && 1 == $qmn_json_data['enable_quick_result_mc'] ) || ( ! empty( $qmn_json_data['ajax_show_correct'] ) && 1 == $qmn_json_data['ajax_show_correct'] ) ) {
if ( ( isset($qmn_json_data['end_quiz_if_wrong']) && 0 < $qmn_json_data['end_quiz_if_wrong'] ) || ( ! empty( $qmn_json_data['enable_quick_result_mc'] ) && 1 == $qmn_json_data['enable_quick_result_mc'] ) || ( ! empty( $qmn_json_data['enable_quick_correct_answer_info'] ) && 0 != $qmn_json_data['enable_quick_correct_answer_info'] ) || ( ! empty( $qmn_json_data['ajax_show_correct'] ) && 1 == $qmn_json_data['ajax_show_correct'] ) ) {
$quiz_id = $qmn_json_data['quiz_id'];
$qsm_inline_encrypt_js = '
if (encryptionKey === undefined) {
Expand Down Expand Up @@ -742,7 +742,7 @@ public function shortcode_display_result( $atts ) {
'result_id' => $id,
);
$data = QSM_Results_Pages::generate_pages( $response_data );
echo wp_kses_post( htmlspecialchars_decode( $data['display'] ) );
return $data['display'];
} else {
esc_html_e( 'Invalid result id!', 'quiz-master-next' );
}
Expand Down
Loading

0 comments on commit 6a16211

Please sign in to comment.