From 0e4613e5db049232cf4be3e72cf46de2d460f216 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Thu, 27 Jul 2023 18:19:06 +0530 Subject: [PATCH 01/71] fixed error --- php/classes/class-qmn-quiz-manager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index fe985c0fb..13726378a 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -1691,6 +1691,7 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) { } } else { $http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : ''; + $http_referer = substr($http_referer, 0, 254); $results_insert = $wpdb->insert( $table_name, array( @@ -1952,7 +1953,7 @@ public static function check_answers( $options, $quiz_data ) { } // If the user's answer was correct - if ( 'correct' == $results_array['correct'] && in_array( intval( $question_type_new ), $result_question_types, true ) && ! in_array( intval( $question_id ), $hidden_questions, true ) ) { + if ( !empty( $results_array['correct'] ) && 'correct' == $results_array['correct'] && in_array( intval( $question_type_new ), $result_question_types, true ) && ! in_array( intval( $question_id ), $hidden_questions, true ) ) { $total_correct += 1; $correct_status = 'correct'; } From 6a664285131e719472f25e638925f735049ae670 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Tue, 1 Aug 2023 13:11:15 +0530 Subject: [PATCH 02/71] fixed issue with wpml german words --- php/classes/class-qmn-plugin-helper.php | 16 ++++++++++++---- .../qsm-question-type-dropdown.php | 2 +- ...-question-type-multiple-choice-horizontal.php | 4 ++-- .../qsm-question-type-multiple-choice.php | 4 ++-- .../qsm-question-type-multiple-response.php | 4 ++-- php/question-types/qsm-question-type-polar.php | 8 ++++---- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/php/classes/class-qmn-plugin-helper.php b/php/classes/class-qmn-plugin-helper.php index a07a5b7fd..a7e6ef11f 100644 --- a/php/classes/class-qmn-plugin-helper.php +++ b/php/classes/class-qmn-plugin-helper.php @@ -619,6 +619,14 @@ public static function qsm_language_support( $translation_text = '', $translatio $translation_text = htmlspecialchars_decode( $translation_text, ENT_QUOTES ); $translation_slug = sanitize_title( $translation_slug ); $new_text = apply_filters( 'wpml_translate_single_string', $translation_text, $domain, $translation_slug ); + if ( 'QSM Answers' === $domain && $new_text == $translation_text ) { + if ( 0 === strpos($translation_slug, 'caption-') ) { + $translation_slug = sanitize_title( 'caption-' . $translation_text ); + }else { + $translation_slug = sanitize_title( 'answer-' . $translation_text ); + } + $new_text = apply_filters( 'wpml_translate_single_string', $translation_text, $domain, $translation_slug ); + } $new_text = htmlspecialchars_decode( $new_text, ENT_QUOTES ); /** * Return translation for non-default strings. @@ -675,13 +683,13 @@ public function qsm_add_question_translations( $question_id, $question_data ) { $answers = isset( $question_data['answer_array'] ) ? maybe_unserialize( $question_data['answer_array'] ) : array(); if ( ! empty( $answers ) ) { $answerEditor = isset( $settings['answerEditor'] ) ? $settings['answerEditor'] : 'text'; - foreach ( $answers as $ans ) { + foreach ( $answers as $key => $ans ) { if ( 'image' === $answerEditor ) { $caption_text = trim( htmlspecialchars_decode( $ans[3], ENT_QUOTES ) ); - $this->qsm_register_language_support( $caption_text, 'caption-' . $caption_text, 'QSM Answers' ); + $this->qsm_register_language_support( $caption_text, 'caption-' . $question_id . '-' . $key, 'QSM Answers' ); } else { $answer_text = trim( htmlspecialchars_decode( $ans[0], ENT_QUOTES ) ); - $this->qsm_register_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' ); + $this->qsm_register_language_support( $answer_text, 'answer-' . $question_id . '-' . $key, 'QSM Answers' ); } } } @@ -980,7 +988,7 @@ public function quiz_animation_effect() { 'value' => 'heartBeat', ), array( - 'label' => __( 'No animation', 'quiz-master-next' ), + 'label' => __( 'Select Quiz Animation', 'quiz-master-next' ), 'value' => '', ), ); diff --git a/php/question-types/qsm-question-type-dropdown.php b/php/question-types/qsm-question-type-dropdown.php index db8acf8a1..09779fee9 100644 --- a/php/question-types/qsm-question-type-dropdown.php +++ b/php/question-types/qsm-question-type-dropdown.php @@ -32,7 +32,7 @@ function qmn_drop_down_display( $id, $question, $answers ) { $mlw_answer_total++; if ( '' !== $answer[0] ) { $answer_text = trim( htmlspecialchars_decode( $answer[0], ENT_QUOTES ) ); - $answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, "answer-" . $answer_text, "QSM Answers" ); + $answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, "answer-" . $id . "-" . $answer_index, "QSM Answers" ); ?> pluginHelper->qsm_language_support( $caption_text, 'caption-' . $caption_text, 'QSM Answers' ); + $caption_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $caption_text, 'caption-' . $id . '-' . $answer_index, 'QSM Answers' ); echo wp_kses_post( $add_label_value )." ".esc_html( $caption_text ); ?> pluginHelper->qsm_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' ); + $answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, 'answer-' . $id . '-' . $answer_index, 'QSM Answers' ); echo do_shortcode( wp_kses_post( $answer_text ) ); } ?> diff --git a/php/question-types/qsm-question-type-multiple-choice.php b/php/question-types/qsm-question-type-multiple-choice.php index ff4ee69d6..b78e1b252 100644 --- a/php/question-types/qsm-question-type-multiple-choice.php +++ b/php/question-types/qsm-question-type-multiple-choice.php @@ -73,14 +73,14 @@ function qmn_multiple_choice_display( $id, $question, $answers ) { pluginHelper->qsm_language_support( $caption_text, 'caption-' . $caption_text, 'QSM Answers' ); + $caption_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $caption_text, 'caption-' . $id . '-' . $answer_index, 'QSM Answers' ); echo wp_kses_post( $add_label_value )." ".esc_html( $caption_text ); ?> pluginHelper->qsm_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' ); + $answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, 'answer-' . $id . '-' . $answer_index, 'QSM Answers' ); echo do_shortcode( wp_kses_post($answer_text ) ); } ?> diff --git a/php/question-types/qsm-question-type-multiple-response.php b/php/question-types/qsm-question-type-multiple-response.php index 9579b2ce6..a8a70199f 100644 --- a/php/question-types/qsm-question-type-multiple-response.php +++ b/php/question-types/qsm-question-type-multiple-response.php @@ -64,14 +64,14 @@ function qmn_multiple_response_display( $id, $question, $answers ) { pluginHelper->qsm_language_support( $caption_text, 'caption-' . $caption_text, 'QSM Answers' ); + $caption_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $caption_text, 'caption-' . $id . '-' . $answer_index, 'QSM Answers' ); echo wp_kses_post( $add_label_value )." ".esc_html( $caption_text ); ?> pluginHelper->qsm_language_support( $answer_text, 'answer-' . $answer_text, 'QSM Answers' ); + $answer_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answer_text, 'answer-' . $id . '-' . $answer_index, 'QSM Answers' ); echo do_shortcode( wp_kses_post( $answer_text ) ); } ?> diff --git a/php/question-types/qsm-question-type-polar.php b/php/question-types/qsm-question-type-polar.php index 582b4b8c8..caa676664 100644 --- a/php/question-types/qsm-question-type-polar.php +++ b/php/question-types/qsm-question-type-polar.php @@ -59,13 +59,13 @@ function qmn_polar_display( $id, $question, $answers ) { pluginHelper->qsm_language_support( $caption_text, 'caption-' . $caption_text, 'QSM Answers' ); + $caption_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $caption_text, 'caption-' . $id . '-0', 'QSM Answers' ); echo esc_html( $caption_text ); ?> pluginHelper->qsm_language_support( $answers[0][0], "answer-" . $answers[0][0], "QSM Answers" ); + $left_title = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answers[0][0], 'answer-' . $id . '-0', "QSM Answers" ); echo do_shortcode( wp_kses_post( $left_title ) ); } ?> @@ -88,13 +88,13 @@ function qmn_polar_display( $id, $question, $answers ) { pluginHelper->qsm_language_support( $caption_text, 'caption-' . $caption_text, 'QSM Answers' ); + $caption_text = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $caption_text, 'caption-' . $id . '-1', 'QSM Answers' ); echo esc_html( $caption_text ); ?> pluginHelper->qsm_language_support( $answers[1][0], "answer-" . $answers[1][0], "QSM Answers" ); + $right_title = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $answers[1][0], 'answer-' . $id . '-1', "QSM Answers" ); echo do_shortcode( wp_kses_post( $right_title ) ); } ?> From 71c84a4214ea174f2f71f6b35c29da38eb18b7a7 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Tue, 1 Aug 2023 13:49:20 +0530 Subject: [PATCH 03/71] fixed issue with long page url --- php/admin/admin-results-page.php | 6 +++++- php/classes/class-qmn-quiz-manager.php | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/php/admin/admin-results-page.php b/php/admin/admin-results-page.php index 6520c9b35..104ccc139 100644 --- a/php/admin/admin-results-page.php +++ b/php/admin/admin-results-page.php @@ -461,7 +461,11 @@ function qsm_results_overview_tab_content() { $values['page_name']['content'][] = $mlw_quiz_info->page_name; } if ( isset( $values['page_url'] ) ) { - $values['page_url']['content'][] = '' . esc_html( $mlw_quiz_info->page_url ) . ''; + $quiz_page_url = $mlw_quiz_info->page_url; + if ( ! empty( $mlw_qmn_results_array['page_url'] ) ) { + $quiz_page_url = $mlw_qmn_results_array['page_url']; + } + $values['page_url']['content'][] = '' . esc_html( $quiz_page_url ) . ''; } foreach ( $values as $k => $v ) { if ( ! in_array( $k, [ 'score', 'time_complete', 'name', 'business', 'email', 'phone', 'user', 'time_taken', 'ip', 'page_name', 'page_url' ], true ) ) { diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index fe985c0fb..76921cc04 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -1691,6 +1691,10 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) { } } else { $http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : ''; + if ( 254 < strlen($http_referer) ) { + $results_array['page_url'] = $http_referer; + $http_referer = substr($http_referer, 0, 254); + } $results_insert = $wpdb->insert( $table_name, array( From e6c7bb98227c5c409eb0cbef4dfb77c79d601a9f Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Thu, 3 Aug 2023 10:14:17 +0530 Subject: [PATCH 04/71] fixed typo in changelog --- php/classes/class-qmn-quiz-manager.php | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index 31b8d8d5a..beb72813a 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -1956,7 +1956,7 @@ public static function check_answers( $options, $quiz_data ) { } // If the user's answer was correct - if ( !empty( $results_array['correct'] ) && 'correct' == $results_array['correct'] && in_array( intval( $question_type_new ), $result_question_types, true ) && ! in_array( intval( $question_id ), $hidden_questions, true ) ) { + if ( ! empty( $results_array['correct'] ) && 'correct' == $results_array['correct'] && in_array( intval( $question_type_new ), $result_question_types, true ) && ! in_array( intval( $question_id ), $hidden_questions, true ) ) { $total_correct += 1; $correct_status = 'correct'; } diff --git a/readme.txt b/readme.txt index a3e7c4fa4..b0896abb4 100644 --- a/readme.txt +++ b/readme.txt @@ -164,7 +164,7 @@ This is usually a theme conflict. You can [checkout out our common conflict solu == Changelog == = 8.1.13 (August 02, 2023) = -* Bug: Fixed translation issue with German latters +* Bug: Fixed translation issue with German letters * Bug: Resolved quiz store issue related to long quiz URLs * Bug: Fixed issue with inline CSS class in quiz answer selection From 47e4b4eb91eabbebc37bf06a7f07c3f1792d339e Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Thu, 10 Aug 2023 12:53:25 +0530 Subject: [PATCH 05/71] fixed qsm log publically visible issue --- php/classes/class-qmn-log-manager.php | 15 ++++++++------- php/classes/class-qsm-contact-manager.php | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/php/classes/class-qmn-log-manager.php b/php/classes/class-qmn-log-manager.php index 0164bcfe9..3ba589d2c 100644 --- a/php/classes/class-qmn-log-manager.php +++ b/php/classes/class-qmn-log-manager.php @@ -43,13 +43,14 @@ 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, ); // Registers QSM logs post type with filtered $args 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 ) { /** From 33e9ba0f37ad97f5f51e96e6e3e4b3d9c83beb8e Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Fri, 11 Aug 2023 10:43:13 +0530 Subject: [PATCH 06/71] hide qsm logs from search --- php/classes/class-qmn-log-manager.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/php/classes/class-qmn-log-manager.php b/php/classes/class-qmn-log-manager.php index 3ba589d2c..fab384560 100644 --- a/php/classes/class-qmn-log-manager.php +++ b/php/classes/class-qmn-log-manager.php @@ -43,14 +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, - 'publicly_queryable' => 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 From bdb8be4e1c51f5aba5dcd1a3b963fcd5169ce5fa Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Wed, 16 Aug 2023 01:10:19 +0530 Subject: [PATCH 07/71] added underline option in text editor --- js/qsm-admin.js | 12 ++++++++---- php/admin/options-page-text-tab.php | 8 ++++++++ php/admin/settings-page.php | 9 ++++++++- php/classes/class-qsm-fields.php | 7 ++++++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/js/qsm-admin.js b/js/qsm-admin.js index d99d27498..f83c489c9 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, }; @@ -2522,7 +2524,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, }; @@ -3397,7 +3400,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/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-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 ) { - + 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', + ), +) ); ?> Date: Wed, 16 Aug 2023 11:20:01 +0530 Subject: [PATCH 08/71] added answer no provide text to Fill in the Blank, Short Answer, Paragraph and Number questions --- php/template-variables.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/php/template-variables.php b/php/template-variables.php index c1fd849ca..0df7c3573 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -1073,7 +1073,6 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question if ( 0 == $form_type && ( 0 == $quiz_system || 3 == $quiz_system ) ) { if ( isset( $single_answer[2] ) && 1 == $single_answer[2] ) { if ( 5 == $answer['question_type'] ) { - $user_given_answer = htmlentities( $answer[1] ); $current_answer_zero = trim( str_replace( ' ', '', preg_replace( '/\s\s+/', '', $current_answer_zero ) ) ); } @@ -1279,8 +1278,8 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question } } $user_answer_new = $answer[1]; - $is_choice_question_type = 0 == $answer['question_type'] || 1 == $answer['question_type'] || 2 == $answer['question_type'] || 4 == $answer['question_type'] || 10 == $answer['question_type']; - if ( $is_choice_question_type && '' === $answer[1] ) { + $no_answer_question_type = array( 0, 1, 2, 3, 4, 5, 7, 10, 12, 14 ); + if ( in_array( intval( $answer['question_type'] ), $no_answer_question_type, true) && empty( str_replace( ', ','',$user_answer_new ) ) ) { $user_answer_new = $quiz_options->no_answer_text; } if ( isset( $question_settings['answerEditor'] ) && 'image' === $question_settings['answerEditor'] && '' !== $user_answer_new ) { From 61528f009e9c1ec8f86205d1186cb6d3b517fef7 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Wed, 16 Aug 2023 11:57:03 +0530 Subject: [PATCH 09/71] fixed timer showing in title after disabling timer --- js/qsm-quiz.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index a5bb4ef51..458883c63 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -180,7 +180,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') { From b7518bf0789f55a21f5ee979059ae7a6e55c6846 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Thu, 17 Aug 2023 10:07:10 +0530 Subject: [PATCH 10/71] fixed issue with timer popup if timer is disabled --- js/qsm-quiz.js | 2 +- php/shortcodes.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 458883c63..40e8f9292 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -206,7 +206,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); diff --git a/php/shortcodes.php b/php/shortcodes.php index 68a8cc28c..157564d38 100644 --- a/php/shortcodes.php +++ b/php/shortcodes.php @@ -78,7 +78,7 @@ function qsm_display_recent_quizzes( $attrs ) { $setting = maybe_unserialize( $quiz->quiz_settings ); $options = maybe_unserialize( $setting['quiz_options'] ); $start_date = strtotime( $options['scheduled_time_start'] ); - $end_date = strtotime( $options['scheduled_time_end'] ); + $end_date = strtotime( $options['scheduled_time_end'] ); $now = strtotime( current_time( 'm/d/Y H:i' ) ); if ( $end_date && $end_date < $now ) { continue; @@ -243,7 +243,7 @@ function qsm_get_post_id_from_quiz_id( $quiz_id ) { add_filter( 'qmn_end_shortcode', 'qsm_display_popup_div', 10, 3 ); function qsm_display_popup_div( $return_display, $qmn_quiz_options ) { - if ( '0' === $qmn_quiz_options->enable_result_after_timer_end ) { + if ( '0' === $qmn_quiz_options->enable_result_after_timer_end && 0 < $qmn_quiz_options->timer_limit ) { $return_display .= '