diff --git a/js/qsm-admin.js b/js/qsm-admin.js index d99d27498..8a46d48e8 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -1571,7 +1571,8 @@ var QSMContact; mediaButtons: true, tinymce: { forced_root_block: '', - toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo' + toolbar1: 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,fullscreen,wp_adv', + toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help' }, quicktags: true, }; @@ -2286,7 +2287,8 @@ var import_button; mediaButtons: true, tinymce: { forced_root_block: '', - toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo' + toolbar1: 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv', + toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help' }, quicktags: true, }; @@ -2469,10 +2471,8 @@ var import_button; $.each(fut_arr, function (i) { $(".questionElements input[name='" + index + "[]']:checkbox[value='" + fut_arr[i] + "']").attr("checked", "true").prop('checked', true); }); - } else { - if (value != null) { - $('#' + index).val(value); - } + } else if (value != null) { + $('#' + index).val(value); } } if (index == 'matchAnswer') { @@ -2522,7 +2522,8 @@ var import_button; mediaButtons: true, tinymce: { forced_root_block: '', - toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo' + toolbar1: 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv', + toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help' }, quicktags: true, }; @@ -2628,12 +2629,10 @@ var import_button; current_element = current_page_section.find(".question").eq($("#current_question_position").val() - 1); if ( 0 == new_element.length ) { new_page_section.append(current_element.clone()); - } else { - if ( 1 == $("#current_question_position").val() && $("#changed_question_page_no").val() == $("#current_question_page_no").val() ) { + } else if ( 1 == $("#current_question_position").val() && $("#changed_question_page_no").val() == $("#current_question_page_no").val() ) { new_element.after(current_element.clone()); - } else { - new_element.before(current_element.clone()); - } + } else { + new_element.before(current_element.clone()); } current_element.remove(); let question_id = $("#current_question_id").val(); @@ -2793,15 +2792,11 @@ var import_button; MicroModal.show('modal-8'); return false; } - } else { - if (blanks == null || options_length === 0) { - $('.modal-8-table').html(qsm_admin_messages.blank_required_validation); - MicroModal.show('modal-8'); - return false; - } + } else if (blanks == null || options_length === 0) { + $('.modal-8-table').html(qsm_admin_messages.blank_required_validation); + MicroModal.show('modal-8'); + return false; } - - } $('#save-edit-question-spinner').addClass('is-active'); var model_html = $('#modal-1-content').html(); @@ -3397,7 +3392,8 @@ var import_button; mediaButtons: true, tinymce: { forced_root_block: '', - toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,strikethrough,hr,forecolor,pastetext,removeformat,codeformat,charmap,undo,redo' + toolbar1: 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,fullscreen,wp_adv', + toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help' }, quicktags: true, }; diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index a5bb4ef51..29e9a804a 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -34,7 +34,8 @@ var qsmTimerInterval = []; }, type: 'POST', success: function (response) { - jQuery('.qsm-quiz-container-' + quizID + '').prepend(''); + jQuery('.qsm-quiz-container-' + quizID + '').prepend(''); + jQuery('.qsm-quiz-container-' + quizID + '').prepend(''); } }); QSM.initPagination(quizID); @@ -83,27 +84,23 @@ var qsmTimerInterval = []; $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); } // ...else, we must be using the questions per page option. - } else { - if (qmn_quiz_data[quizID].hasOwnProperty('pagination') && qmn_quiz_data[quizID].first_page) { - $(document).on('click', '.qsm-quiz-container-' + quizID + ' .mlw_next', function (event) { - event.preventDefault(); - if ( qmn_quiz_data[quizID].hasOwnProperty('advanced_timer') && qmn_quiz_data[quizID].advanced_timer.hasOwnProperty('show_stop_timer') ) { - var start_timer = parseInt(qmn_quiz_data[quizID].advanced_timer.start_timer_page); - if ($('.qsm-quiz-container-' + quizID).find('.qmn_pagination > .slide_number_hidden').val() == start_timer) { - QSM.activateTimer(quizID); - $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); - } - } else { - if (!qmn_quiz_data[quizID].timerStatus && (0 == $('.quiz_begin:visible').length || (1 == $('.quiz_begin:visible').length && qmnValidatePage('quizForm' + quizID)))) { - QSM.activateTimer(quizID); - $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); - } + } else if (qmn_quiz_data[quizID].hasOwnProperty('pagination') && qmn_quiz_data[quizID].first_page) { + $(document).on('click', '.qsm-quiz-container-' + quizID + ' .mlw_next', function (event) { + event.preventDefault(); + if ( qmn_quiz_data[quizID].hasOwnProperty('advanced_timer') && qmn_quiz_data[quizID].advanced_timer.hasOwnProperty('show_stop_timer') ) { + var start_timer = parseInt(qmn_quiz_data[quizID].advanced_timer.start_timer_page); + if ($('.qsm-quiz-container-' + quizID).find('.qmn_pagination > .slide_number_hidden').val() == start_timer) { + QSM.activateTimer(quizID); + $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); } - }); - } else { - QSM.activateTimer(quizID); - $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); - } + } else if (!qmn_quiz_data[quizID].timerStatus && (0 == $('.quiz_begin:visible').length || (1 == $('.quiz_begin:visible').length && qmnValidatePage('quizForm' + quizID)))) { + QSM.activateTimer(quizID); + $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); + } + }); + } else { + QSM.activateTimer(quizID); + $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); } jQuery(document).trigger('qsm_init_timer_after', [quizID]); }, @@ -180,7 +177,9 @@ var qsmTimerInterval = []; // Updates timer element and title on browser tab. var $timer = QSM.getTimer(quizID); $timer.text(display); - document.title = display + ' ' + qsmTitleText; + if (0 < qmn_quiz_data[quizID].timer_limit) { + document.title = display + ' ' + qsmTitleText; + } /*CUSTOM TIMER*/ if (qmn_quiz_data[quizID].hasOwnProperty('advanced_timer') && qmn_quiz_data[quizID].advanced_timer.hasOwnProperty('show_stop_timer') && qmn_quiz_data[quizID].advanced_timer.timer_design == 'big_timer') { @@ -204,7 +203,7 @@ var qsmTimerInterval = []; } // If timer is run out, disable fields. - if (0 >= secondsRemaining) { + if (0 >= secondsRemaining && 0 < qmn_quiz_data[quizID].timer_limit) { clearInterval(qmn_quiz_data[quizID].timerInterval); $(".mlw_qmn_quiz input:radio").attr('disabled', true); $(".mlw_qmn_quiz input:checkbox").attr('disabled', true); @@ -481,11 +480,9 @@ var qsmTimerInterval = []; QSM.activateTimer(quizID); $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); } - } else { - if (!qmn_quiz_data[quizID].timerStatus) { - QSM.activateTimer(quizID); - $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); - } + } else if (!qmn_quiz_data[quizID].timerStatus) { + QSM.activateTimer(quizID); + $('.qsm-quiz-container-' + quizID).find('.stoptimer-p').show(); } } @@ -584,14 +581,12 @@ var qsmTimerInterval = []; var timerRemaning = localStorage.getItem('mlw_time_q' + quizID + '_page' + pid); if (timerStoped != 'undefined' && timerStoped > 0) { seconds = timerStoped; - } else { - if ('yes' == timerStarted) { - if (0 < timerRemaning) { - seconds = parseInt(timerRemaning); - } - } else { - seconds = parseFloat($curr_page_opt.pagetimer) * 60; + } else if ('yes' == timerStarted) { + if (0 < timerRemaning) { + seconds = parseInt(timerRemaning); } + } else { + seconds = parseFloat($curr_page_opt.pagetimer) * 60; } qmn_quiz_data[quizID].qpages[pid].timerRemaning = seconds; /* Makes the timer appear. */ @@ -1015,6 +1010,7 @@ function qmnFormSubmit(quiz_form_id) { }); fd.append("action", 'qmn_process_quiz'); fd.append("nonce", jQuery('#qsm_nonce_' + quiz_id ).val() ); + fd.append("qsm_unique_key", jQuery('#qsm_unique_key_' + quiz_id ).val() ); fd.append("currentuserTime", Math.round(new Date().getTime() / 1000)); fd.append("currentuserTimeZone", Intl.DateTimeFormat().resolvedOptions().timeZone); @@ -1883,22 +1879,18 @@ function qsm_question_quick_result_js(question_id, answer, answer_type = '', sho if (answer_array[answer[key]] !== undefined) { if (1 == answer_array[answer[key]][2]) { answer_count++; - } else { - if (answer[key] !== undefined) { - answer_count--; - } + } else if (answer[key] !== undefined) { + answer_count--; } } if (1 == value[2]) { total_correct_answer++; } } - } else { - if (parseInt(answer) === parseInt(key) && 1 === parseInt(value[2])) { - got_ans = true; - correct_answer = true; - break; - } + } else if (parseInt(answer) === parseInt(key) && 1 === parseInt(value[2])) { + got_ans = true; + correct_answer = true; + break; } } diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index ce760fb59..b0e77a710 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -2,7 +2,7 @@ /** * Plugin Name: Quiz And Survey Master * Description: Easily and quickly add quizzes and surveys to your website. - * Version: 8.1.13 + * Version: 8.1.14 * Author: ExpressTech * Author URI: https://quizandsurveymaster.com/ * Plugin URI: https://expresstech.io/ @@ -43,7 +43,7 @@ class MLWQuizMasterNext { * @var string * @since 4.0.0 */ - public $version = '8.1.13'; + public $version = '8.1.14'; /** * QSM Alert Manager Object diff --git a/php/admin/options-page-results-page-tab.php b/php/admin/options-page-results-page-tab.php index ade350706..57747f75d 100644 --- a/php/admin/options-page-results-page-tab.php +++ b/php/admin/options-page-results-page-tab.php @@ -219,6 +219,7 @@ function qsm_options_results_tab_template(){
+ diff --git a/php/admin/options-page-text-tab.php b/php/admin/options-page-text-tab.php index 37f04b945..438cc7bb2 100644 --- a/php/admin/options-page-text-tab.php +++ b/php/admin/options-page-text-tab.php @@ -96,6 +96,10 @@ function mlw_options_text_tab_content() { wp_editor( htmlspecialchars_decode( $value_answer, ENT_QUOTES ), 'qsm_question_text_message', array( 'editor_height' => 250, 'textarea_rows' => 10, + 'tinymce' => array( + 'toolbar1' => 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv', + 'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help', + ), ) ); ?> @@ -148,6 +152,10 @@ function mlw_options_text_tab_content() { wp_editor( htmlspecialchars_decode( $value_answer, ENT_QUOTES ), 'qsm_question_text_message_variable', array( 'editor_height' => 250, 'textarea_rows' => 10, + 'tinymce' => array( + 'toolbar1' => 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv', + 'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help', + ), ) ); ?> diff --git a/php/admin/settings-page.php b/php/admin/settings-page.php index 0a42658a8..884b32cb0 100644 --- a/php/admin/settings-page.php +++ b/php/admin/settings-page.php @@ -462,7 +462,14 @@ public function results_details_template() {The answers were as follows:
%QUESTIONS_ANSWERS%'; } - wp_editor( $template, 'results_template', array( 'textarea_name' => 'qmn-settings[results_details_template]' ) ); + wp_editor( $template, 'results_template', array( + 'textarea_name' => 'qmn-settings[results_details_template]', + 'tinymce' => array( + 'toolbar1' => 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv', + 'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help', + ), + ) + ); } /** diff --git a/php/classes/class-qmn-log-manager.php b/php/classes/class-qmn-log-manager.php index 0164bcfe9..fab384560 100644 --- a/php/classes/class-qmn-log-manager.php +++ b/php/classes/class-qmn-log-manager.php @@ -43,13 +43,15 @@ public function register_post_type() { /* logs post type */ $settings = (array) get_option( 'qmn-settings' ); $log_args = array( - 'labels' => array( 'name' => 'QSM Logs' ), - 'public' => ! empty( $settings['enable_qsm_log'] ) && $settings['enable_qsm_log'], - 'query_var' => false, - 'rewrite' => false, - 'capability_type' => 'post', - 'supports' => array( 'title', 'editor' ), - 'can_export' => false, + 'labels' => array( 'name' => 'QSM Logs' ), + 'public' => ! empty( $settings['enable_qsm_log'] ) && $settings['enable_qsm_log'], + 'query_var' => false, + 'publicly_queryable' => false, + 'rewrite' => false, + 'capability_type' => 'post', + 'supports' => array( 'title', 'editor' ), + 'can_export' => false, + 'exclude_from_search' => true, ); // Registers QSM logs post type with filtered $args diff --git a/php/classes/class-qmn-plugin-helper.php b/php/classes/class-qmn-plugin-helper.php index a7e6ef11f..de13793f0 100644 --- a/php/classes/class-qmn-plugin-helper.php +++ b/php/classes/class-qmn-plugin-helper.php @@ -339,6 +339,7 @@ public function register_question_type( $name, $display_function, $graded, $revi 'slug' => $slug, 'options' => $options, ); + $new_type = apply_filters( 'register_question_type_new_type',$new_type ); $this->question_types[ $slug ] = $new_type; } diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index beb72813a..ea8af953a 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -1646,7 +1646,7 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) { $result_display = apply_filters( 'qmn_after_check_answers', $result_display, $qmn_quiz_options, $qmn_array_for_variables ); $qmn_array_for_variables['comments'] = $this->check_comment_section( $qmn_quiz_options, $qmn_array_for_variables ); $result_display = apply_filters( 'qmn_after_check_comments', $result_display, $qmn_quiz_options, $qmn_array_for_variables ); - $unique_id = uniqid(); + $unique_id = ! empty( $_REQUEST['qsm_unique_key'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['qsm_unique_key'] ) ) : uniqid(); $results_id = 0; // Creates our results array. $results_array = array( @@ -2598,7 +2598,10 @@ public function qsm_process_background_email() { */ public function qsm_create_quiz_nonce() { $quiz_id = ! empty( $_REQUEST['quiz_id'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['quiz_id'] ) ) : 0; - wp_send_json_success( wp_create_nonce( 'qsm_submit_quiz_' . $quiz_id ) ); + wp_send_json_success( array( + 'nonce' => wp_create_nonce( 'qsm_submit_quiz_' . $quiz_id ), + 'unique_key' => uniqid(), + ) ); } } diff --git a/php/classes/class-qsm-contact-manager.php b/php/classes/class-qsm-contact-manager.php index 7b5440a93..9d20c9cb8 100644 --- a/php/classes/class-qsm-contact-manager.php +++ b/php/classes/class-qsm-contact-manager.php @@ -274,7 +274,7 @@ public static function load_fields( $type = 'display' ) { global $mlwQuizMasterNext; $default_fields = self::default_fields(); $fields = maybe_unserialize( $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'contact_form' ) ); - if ( ! empty( $fields ) ) { + if ( ! empty( $fields ) && is_array( $fields ) ) { $used_keys = array(); foreach ( $fields as $index => $field ) { /** diff --git a/php/classes/class-qsm-fields.php b/php/classes/class-qsm-fields.php index 0e31153f8..3a147eb66 100644 --- a/php/classes/class-qsm-fields.php +++ b/php/classes/class-qsm-fields.php @@ -443,7 +443,12 @@ public static function generate_editor_field( $field, $value ) {