From 312072a34de4a8b63c42361e00f4b3a8a7d4d7e3 Mon Sep 17 00:00:00 2001 From: manandeep singh Date: Thu, 17 Oct 2024 13:06:15 +0530 Subject: [PATCH 01/85] Fix legacy timer count up --- js/qsm-quiz.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index bbd87c64..125b4e41 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -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; } From 311d2e156fcbacbafceb6ee056661ead67663f76 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 18 Oct 2024 11:49:53 +0530 Subject: [PATCH 02/85] added index to response_data --- php/classes/class-qsm-results-pages.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/classes/class-qsm-results-pages.php b/php/classes/class-qsm-results-pages.php index 2f7d6e46..d74b6615 100644 --- a/php/classes/class-qsm-results-pages.php +++ b/php/classes/class-qsm-results-pages.php @@ -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 ); From c095ba79070d8ae2a61934d61179e533ca5ab6fd Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 18 Oct 2024 12:34:02 +0530 Subject: [PATCH 03/85] Override the individual quiz text data in quiz options --- php/classes/class-qsm-settings.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/php/classes/class-qsm-settings.php b/php/classes/class-qsm-settings.php index 5046ca6e..25be0d6b 100644 --- a/php/classes/class-qsm-settings.php +++ b/php/classes/class-qsm-settings.php @@ -471,13 +471,7 @@ public function get_quiz_options() { } $text = $this->get_setting('quiz_text'); - if ( is_array($text) ) { - foreach ( $text as $key => $value ) { - if ( ! empty($value) ) { - $quiz_options[ $key ] = $value; - } - } - } + $quiz_options = array_merge( $quiz_options, $text ); // Return as old object model return (object) $quiz_options; From 2bcb27df2b31825f46ec163045d6d63c41a36e7e Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 18 Oct 2024 13:13:55 +0530 Subject: [PATCH 04/85] added previous condition --- php/classes/class-qsm-settings.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/php/classes/class-qsm-settings.php b/php/classes/class-qsm-settings.php index 25be0d6b..2053d265 100644 --- a/php/classes/class-qsm-settings.php +++ b/php/classes/class-qsm-settings.php @@ -471,6 +471,13 @@ public function get_quiz_options() { } $text = $this->get_setting('quiz_text'); + if ( is_array($text) ) { + foreach ( $text as $key => $value ) { + if ( ! empty($value) ) { + $quiz_options[ $key ] = $value; + } + } + } $quiz_options = array_merge( $quiz_options, $text ); // Return as old object model From 2e22491457d72375a073f660b34b08c59c28f950 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 18 Oct 2024 16:00:58 +0530 Subject: [PATCH 05/85] fix condition to merge text array --- php/classes/class-qsm-settings.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/php/classes/class-qsm-settings.php b/php/classes/class-qsm-settings.php index 2053d265..916afe61 100644 --- a/php/classes/class-qsm-settings.php +++ b/php/classes/class-qsm-settings.php @@ -472,13 +472,8 @@ public function get_quiz_options() { $text = $this->get_setting('quiz_text'); if ( is_array($text) ) { - foreach ( $text as $key => $value ) { - if ( ! empty($value) ) { - $quiz_options[ $key ] = $value; - } - } + $quiz_options = array_merge( $quiz_options, $text ); } - $quiz_options = array_merge( $quiz_options, $text ); // Return as old object model return (object) $quiz_options; From 817dbe8347d5e1a2264d63b62245e5f52b632335 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Tue, 22 Oct 2024 19:12:09 +0530 Subject: [PATCH 06/85] fixed quiz label color issue --- templates/qmn_primary.css | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/qmn_primary.css b/templates/qmn_primary.css index 850335df..fcc54b91 100644 --- a/templates/qmn_primary.css +++ b/templates/qmn_primary.css @@ -108,6 +108,7 @@ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; + color: #222; } .quiz_section>.quiz-cat { From fd8282a91a1fb137f776096c4a55d94949d9fe48 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Wed, 23 Oct 2024 16:45:49 +0530 Subject: [PATCH 07/85] Modified permissions on pages --- php/admin/about-page.php | 2 +- php/admin/addons-page.php | 2 +- php/admin/admin-dashboard.php | 2 +- php/admin/stats-page.php | 2 +- php/admin/tools-page.php | 2 +- php/rest-api.php | 10 +++++----- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/php/admin/about-page.php b/php/admin/about-page.php index b54d9cc2..60fd7985 100644 --- a/php/admin/about-page.php +++ b/php/admin/about-page.php @@ -18,7 +18,7 @@ function qsm_generate_about_page() { global $mlwQuizMasterNext; $version = $mlwQuizMasterNext->version; - if ( ! current_user_can( 'moderate_comments' ) ) { + if ( ! current_user_can( 'delete_others_qsm_quizzes' ) ) { return; } $tab_array = [ diff --git a/php/admin/addons-page.php b/php/admin/addons-page.php index 6c055261..00c81c5b 100644 --- a/php/admin/addons-page.php +++ b/php/admin/addons-page.php @@ -10,7 +10,7 @@ * @since 4.4.0 */ function qmn_addons_page() { - if ( ! current_user_can( 'moderate_comments' ) ) { + if ( ! current_user_can( 'delete_others_qsm_quizzes' ) ) { return; } diff --git a/php/admin/admin-dashboard.php b/php/admin/admin-dashboard.php index b4f2eb7c..21895a48 100644 --- a/php/admin/admin-dashboard.php +++ b/php/admin/admin-dashboard.php @@ -102,7 +102,7 @@ function qsm_dashboard_screen_options( $status, $args ) { */ function qsm_generate_dashboard_page() { // Only let admins and editors see this page. - if ( ! current_user_can( 'edit_posts' ) ) { + if ( ! current_user_can( 'edit_qsm_quizzes' ) ) { return; } global $mlwQuizMasterNext; diff --git a/php/admin/stats-page.php b/php/admin/stats-page.php index 243d74fe..211dcd2d 100644 --- a/php/admin/stats-page.php +++ b/php/admin/stats-page.php @@ -16,7 +16,7 @@ * @return void */ function qmn_generate_stats_page() { - if ( ! current_user_can('moderate_comments') ) { + if ( ! current_user_can('delete_others_qsm_quizzes') ) { return; } global $mlwQuizMasterNext; diff --git a/php/admin/tools-page.php b/php/admin/tools-page.php index 472ede5e..70951f6b 100644 --- a/php/admin/tools-page.php +++ b/php/admin/tools-page.php @@ -15,7 +15,7 @@ * @since 6.2.0 */ function qsm_generate_quiz_tools() { - if ( ! current_user_can( 'moderate_comments' ) ) { + if ( ! current_user_can( 'delete_others_qsm_quizzes' ) ) { return; } add_meta_box( 'qsm_restore_box', 'Restore Quiz', 'qsm_restore_function', 'quiz_wpss' ); diff --git a/php/rest-api.php b/php/rest-api.php index bbb612a1..07c626cf 100644 --- a/php/rest-api.php +++ b/php/rest-api.php @@ -30,7 +30,7 @@ function qsm_register_rest_routes() { 'methods' => WP_REST_Server::CREATABLE, 'callback' => 'qsm_rest_create_question', 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -41,7 +41,7 @@ function qsm_register_rest_routes() { 'methods' => WP_REST_Server::EDITABLE, 'callback' => 'qsm_rest_save_question', 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -70,7 +70,7 @@ function qsm_register_rest_routes() { 'methods' => WP_REST_Server::EDITABLE, 'callback' => 'qsm_rest_save_results', 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -90,7 +90,7 @@ function qsm_register_rest_routes() { 'methods' => WP_REST_Server::EDITABLE, 'callback' => 'qsm_rest_save_emails', 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -123,7 +123,7 @@ function qsm_register_rest_routes() { 'methods' => WP_REST_Server::READABLE, 'callback' => 'qsm_rest_get_bank_questions', 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); From 963a837c5bb45bdb784baa9cef4d273ebd074db3 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Thu, 24 Oct 2024 12:14:42 +0530 Subject: [PATCH 08/85] modified permission for global settings page --- mlw_quizmaster2.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 2a6e8e6b..7a0a4266 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -840,6 +840,7 @@ public function setup_admin_menu() { 'manage_qsm_quiz_categories', 'manage_qsm_quiz_answer_label', 'view_qsm_quiz_result', + 'manage_options', ); add_menu_page( 'Quiz And Survey Master', __( 'QSM', 'quiz-master-next' ), $capabilities[1], 'qsm_dashboard', 'qsm_generate_dashboard_page', 'dashicons-feedback', $menu_position ); @@ -862,7 +863,7 @@ public function setup_admin_menu() { add_submenu_page( 'qsm_dashboard', __( 'Failed DB Queries', 'quiz-master-next' ), __( 'Failed Database Queries', 'quiz-master-next' ), $capabilities[2], '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' ), $capabilities[5], 'qsm_quiz_result_details', 'qsm_generate_result_details' ); - add_submenu_page( 'qsm_dashboard', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), $capabilities[2], 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) ); + add_submenu_page( 'qsm_dashboard', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), $capabilities[6], 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) ); add_submenu_page( 'qsm_dashboard', __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), $capabilities[2], 'qsm_quiz_tools', 'qsm_generate_quiz_tools' ); add_submenu_page( 'qsm_dashboard', __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), $capabilities[2], 'qmn_stats', 'qmn_generate_stats_page' ); add_submenu_page( 'qsm_dashboard', __( 'About', 'quiz-master-next' ), __( 'About', 'quiz-master-next' ), $capabilities[2], 'qsm_quiz_about', 'qsm_generate_about_page' ); From 0b8442a447f57413239559f1c3623e041ac63030 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Sat, 26 Oct 2024 15:39:56 +0530 Subject: [PATCH 09/85] fixed string intiger issue --- php/template-variables.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/php/template-variables.php b/php/template-variables.php index 5a561122..ff047bc8 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -496,7 +496,10 @@ function mlw_qmn_variable_user_email( $content, $mlw_quiz_array ) { function qsm_contact_field_variable( $content, $results_array ) { preg_match_all( '~%CONTACT_(.*?)%~i', $content, $matches ); for ( $i = 0; $i < count( $matches[0] ); $i++ ) { - $content = str_replace( '%CONTACT_' . $matches[1][ $i ] . '%', $results_array['contact'][ $matches[1][ $i ] - 1 ]['value'], $content ); + $contact_index = intval($matches[1][ $i ]) - 1; + if ( isset($results_array['contact'][ $contact_index ]['value']) ) { + $content = str_replace('%CONTACT_' . $matches[1][ $i ] . '%', $results_array['contact'][ $contact_index ]['value'], $content); + } } return $content; } From f3fc08662193c0f374bef4de1261fed29bff5774 Mon Sep 17 00:00:00 2001 From: manandeep singh Date: Mon, 28 Oct 2024 10:43:52 +0530 Subject: [PATCH 10/85] Fix Completion time is doubled in user dashboard --- js/qsm-quiz.js | 2 -- php/template-variables.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 125b4e41..31000d6e 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -52,8 +52,6 @@ var qsmTimerInterval = []; if (quiz.hasOwnProperty('timer_limit') && 0 != quiz.timer_limit) { QSM.initTimer(quizID); quizType = 'timer'; - } else { - qsmTimerInterval[quizID] = setInterval(function () { qmnTimeTakenTimer(quizID) }, 1000); } if (jQuery('.qsm-quiz-container-' + quizID + ' .qsm-submit-btn').is(':visible') && !jQuery('.qsm-quiz-container-' + quizID).hasClass('qsm_auto_pagination_enabled') ) { jQuery('.qsm-quiz-container-' + quizID + ' .qsm-quiz-comment-section').fadeIn(); diff --git a/php/template-variables.php b/php/template-variables.php index 5a561122..de3bb42e 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -1597,7 +1597,7 @@ function qmn_polar_display_on_resultspage( $id, $question, $answers, $answer ) { * @since 7.3.3 */ function qmn_sanitize_input_data( $data, $strip = false ) { - if ( $strip ) { + if ( $strip && is_string( $data ) ) { $data = stripslashes( $data ); } return maybe_unserialize( $data ); From 6221a68d5a459d334ce75d52752d344fd2ff873f Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Mon, 28 Oct 2024 11:38:24 +0530 Subject: [PATCH 11/85] added option to deactivate question --- css/qsm-admin.css | 9 ++++++++ js/qsm-admin.js | 20 +++++++++++++++++ php/admin/options-page-questions-tab.php | 9 +++++--- php/classes/class-qmn-plugin-helper.php | 28 +++++++++++++++++++++++- php/classes/class-qmn-quiz-manager.php | 7 ++++++ php/classes/class-qsm-questions.php | 14 ++++++++---- php/rest-api.php | 5 +++-- 7 files changed, 82 insertions(+), 10 deletions(-) diff --git a/css/qsm-admin.css b/css/qsm-admin.css index f15f72b6..fae45f1a 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -1250,6 +1250,10 @@ h3.addon_category_name { width: 60px; height: 34px; } +.switch.small-switch { + width: 50px; + height: 22px; +} /* Hide default HTML checkbox */ .switch input[type="checkbox"] { opacity: 0; @@ -1279,6 +1283,11 @@ h3.addon_category_name { -webkit-transition: 0.4s; transition: 0.4s; } +.switch.small-switch .slider:before { + height: 14px; + width: 15px; + left: 5px; +} input:checked+.slider { background-color: #2196f3; } diff --git a/js/qsm-admin.js b/js/qsm-admin.js index 277e3378..460eed0c 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -2346,6 +2346,7 @@ var import_button; var type = $("#question_type").val(); var comments = $("#comments").val(); let required = $(".questionElements input[name='required']").is(":checked") ? 0 : 1; + let isPublished = $(".questionElements input[name='question_status']").is(":checked") ? 1 : 0; advanced_option['required'] = required; var category = $(".category-radio:checked").val(); var type_arr = []; @@ -2434,6 +2435,7 @@ var import_button; }); model.set('answers', answers); model.set('required', required); + model.set('is_published', isPublished); jQuery(document).trigger('qsm_save_question_before', [questionID, CurrentElement, model, advanced_option]); $('.questionElements .advanced-content > .qsm-row:not(.core-option)').each(function () { if ($(this).find('input[type="text"]').length > 0) { @@ -2748,6 +2750,9 @@ var import_button; } //Append extra settings var all_setting = question.get('settings'); + if ((typeof all_setting === 'undefined') || (all_setting && typeof all_setting.isPublished === 'undefined')) { + $('#question-status').prop('checked', true).trigger('change'); + } if (all_setting === null || typeof all_setting === "undefined") { } else { $.each(all_setting, function (index, value) { if ($('#' + index + '_area').length > 0) { @@ -2765,6 +2770,13 @@ var import_button; if (index == 'matchAnswer') { $('#match-answer').val(value); } + if (index == 'isPublished') { + if ( all_setting.isPublished == 1 ) { + $('#question-status').prop('checked', true).trigger('change'); + } else { + $('#question-status').prop('checked', false).trigger('change'); + } + } }); jQuery(document).trigger('qsm_all_question_setting_after', [all_setting]); } @@ -3202,6 +3214,14 @@ var import_button; event.preventDefault(); $(this).parents('.questionElements').slideUp('slow'); }); + $(document).on('change', '#question-status', function (event) { + event.preventDefault(); + if($(this).is(':checked')){ + $(document).find('#question-status-text').html('Published'); + } else { + $(document).find('#question-status-text').html('Draft'); + } + }); $(document).on('click', '#save-popup-button', function (event) { event.preventDefault(); questionElements = $(this).parents('.questionElements'); diff --git a/php/admin/options-page-questions-tab.php b/php/admin/options-page-questions-tab.php index 33ceaa4f..10d18aea 100644 --- a/php/admin/options-page-questions-tab.php +++ b/php/admin/options-page-questions-tab.php @@ -54,8 +54,8 @@ function qsm_options_questions_tab_content() { $form_type = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'form_type' ); $quiz_system = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'system' ); $default_answers = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'default_answers' ); - $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() ); - $db_qpages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'qpages', array() ); + $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array(), 'admin' ); + $db_qpages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'qpages', array(), 'admin' ); $qpages = array(); if ( ! empty( $pages ) ) { $defaultQPage = array( @@ -513,7 +513,10 @@ class="save-page-button button button-primary">

- + +

diff --git a/php/classes/class-qmn-plugin-helper.php b/php/classes/class-qmn-plugin-helper.php index d6c6ffae..286530e9 100644 --- a/php/classes/class-qmn-plugin-helper.php +++ b/php/classes/class-qmn-plugin-helper.php @@ -284,8 +284,34 @@ public function get_section_setting( $section, $setting, $default = false ) { * @param mixed $default What we need to return if no setting exists with given $setting * @return $mixed Value set for $setting or $default if setting does not exist */ - public function get_quiz_setting( $setting, $default = false ) { + public function get_quiz_setting( $setting, $default = false, $caller = '' ) { global $mlwQuizMasterNext; + if ( ( $setting === 'pages' || $setting === 'qpages' ) && empty( $caller ) ) { + $pages = $mlwQuizMasterNext->quiz_settings->get_setting( $setting, $default ); + $temp_pages = array(); + foreach ( $pages as $index => $page ) { + $page_should_display = array(); + $page = $setting === 'qpages' ? $page['questions'] : $page; + foreach ( $page as $key =>$question_id ) { + $isPublished = $mlwQuizMasterNext->pluginHelper->get_question_setting( $question_id, 'isPublished' ); + if ( '' == $isPublished || ( '' != $isPublished && 1 === intval( $isPublished ) ) ) { + $page_should_display[] = true; + } elseif ( '' != $isPublished && 0 === intval( $isPublished ) ) { + $page_should_display[] = false; + unset( $page[$key] ); + } + } + if ( in_array( true, $page_should_display, true ) ) { + if ( $setting === 'qpages' ) { + $pages[$index]['questions'] = $page; + $temp_pages[] = $pages[$index]; + } else { + $temp_pages[] = $page; + } + } + } + return $temp_pages; + } return $mlwQuizMasterNext->quiz_settings->get_setting( $setting, $default ); } diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index 756641c2..c89cbec3 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -993,6 +993,13 @@ public function load_questions( $quiz_id, $quiz_options, $is_quiz_page, $questio question_settings ); + return ! isset( $question_settings['isPublished'] ) || $question_settings['isPublished'] !== '0'; + } + ); return apply_filters( 'qsm_load_questions_filter', $questions, $quiz_id, $quiz_options ); } diff --git a/php/classes/class-qsm-questions.php b/php/classes/class-qsm-questions.php index 52f6441e..b510429c 100644 --- a/php/classes/class-qsm-questions.php +++ b/php/classes/class-qsm-questions.php @@ -66,7 +66,7 @@ public static function load_question_data( $question_id, $question_data ) { * @param int $quiz_id The ID of the quiz. * @return array The array of questions. */ - public static function load_questions_by_pages( $quiz_id ) { + public static function load_questions_by_pages( $quiz_id, $caller = '' ) { // Prepares our variables. global $wpdb; global $mlwQuizMasterNext; @@ -77,7 +77,7 @@ public static function load_questions_by_pages( $quiz_id ) { // Gets the pages for the quiz. $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id ); - $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() ); + $pages = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array(), $caller ); // Get all question IDs needed. if ( ! empty( $pages ) ) { @@ -125,7 +125,7 @@ public static function load_questions_by_pages( $quiz_id ) { } } else { // If we do not have pages on this quiz yet, use older load_questions and add page to them. - $questions = self::load_questions( $quiz_id ); + $questions = self::load_questions( $quiz_id, $caller ); foreach ( $questions as $key => $question ) { $questions[ $key ]['page'] = isset( $question['page'] ) ? $question['page'] : 0; } @@ -140,7 +140,7 @@ public static function load_questions_by_pages( $quiz_id ) { * @param int $quiz_id The ID of the quiz. * @return array The array of questions. */ - public static function load_questions( $quiz_id ) { + public static function load_questions( $quiz_id, $caller = '' ) { global $wpdb; $question_array = array(); @@ -178,6 +178,12 @@ public static function load_questions( $quiz_id ) { $question_array[ $question['question_id'] ] = $question; } + $question_array = ! empty( $caller ) ? $question_array : array_filter( + $question_array, + function ( $question ) { + return ! isset( $question['settings']['isPublished'] ) || $question['settings']['isPublished'] !== '0'; + } + ); return apply_filters( 'qsm_load_questions', $question_array, $quiz_id ); } diff --git a/php/rest-api.php b/php/rest-api.php index bbb612a1..8e3ca48d 100644 --- a/php/rest-api.php +++ b/php/rest-api.php @@ -533,9 +533,9 @@ function qsm_rest_get_questions( WP_REST_Request $request ) { if ( 0 !== $current_user ) { $quiz_id = isset( $request['quizID'] ) ? intval( $request['quizID'] ) : 0; if ( 0 !== $quiz_id ) { - $questions = QSM_Questions::load_questions_by_pages( $quiz_id ); + $questions = QSM_Questions::load_questions_by_pages( $quiz_id, 'admin' ); } else { - $questions = QSM_Questions::load_questions( 0 ); + $questions = QSM_Questions::load_questions( 0, 'admin' ); } global $wpdb; $question_array = array(); @@ -677,6 +677,7 @@ function qsm_rest_save_question( WP_REST_Request $request ) { $settings['featureImageID'] = sanitize_text_field( $request['featureImageID'] ); $settings['featureImageSrc'] = sanitize_text_field( $request['featureImageSrc'] ); $settings['matchAnswer'] = sanitize_text_field( $request['matchAnswer'] ); + $settings['isPublished'] = sanitize_text_field( $request['is_published'] ); if ( isset( $request['other_settings'] ) && is_array( $request['other_settings'] ) ) { foreach ( $request['other_settings'] as $setting_key => $setting_value ) { $settings[ $setting_key ] = $setting_value; From ab226dfd6d8fcdc98cd5023ab4f5f3cac050113c Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Mon, 28 Oct 2024 12:27:20 +0530 Subject: [PATCH 12/85] Modified class name --- css/qsm-admin.css | 22 +++++++++++----------- php/admin/options-page-questions-tab.php | 4 ++-- php/admin/settings-page.php | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/css/qsm-admin.css b/css/qsm-admin.css index 5fd2986e..6c64c879 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -1244,24 +1244,24 @@ h3.addon_category_name { margin-left: 15px; } /* The switch - the box around the slider */ -.switch { +.qsm-checkbox-switch { position: relative; display: inline-block; width: 60px; height: 34px; } -.switch.small-switch { +.qsm-checkbox-switch.small-switch { width: 50px; height: 22px; } /* Hide default HTML checkbox */ -.switch input[type="checkbox"] { +.qsm-checkbox-switch input[type="checkbox"] { opacity: 0; width: 0; height: 0; } /* The slider */ -.slider { +.qsm-switch-slider { position: absolute; cursor: pointer; top: 0; @@ -1272,7 +1272,7 @@ h3.addon_category_name { -webkit-transition: 0.4s; transition: 0.4s; } -.slider:before { +.qsm-switch-slider:before { position: absolute; content: ""; height: 26px; @@ -1283,27 +1283,27 @@ h3.addon_category_name { -webkit-transition: 0.4s; transition: 0.4s; } -.switch.small-switch .slider:before { +.qsm-checkbox-switch.small-switch .qsm-switch-slider:before { height: 14px; width: 15px; left: 5px; } -input:checked+.slider { +input:checked+.qsm-switch-slider { background-color: #2196f3; } -input:focus+.slider { +input:focus+.qsm-switch-slider { box-shadow: 0 0 1px #2196f3; } -input:checked+.slider:before { +input:checked+.qsm-switch-slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); } /* Rounded sliders */ -.slider.round { +.qsm-switch-slider.round { border-radius: 34px; } -.slider.round:before { +.qsm-switch-slider.round:before { border-radius: 50%; } input#sc-shortcode-model-text, input#sc-shortcode-model-text-link { diff --git a/php/admin/options-page-questions-tab.php b/php/admin/options-page-questions-tab.php index 10d18aea..c87edd25 100644 --- a/php/admin/options-page-questions-tab.php +++ b/php/admin/options-page-questions-tab.php @@ -513,8 +513,8 @@ class="save-page-button button button-primary">

-

- + - - 'modal-extra-shortcodes', - "title" => __('Extra Shortcode', 'quiz-master-next'), - "description" => __('Need dynamic content on your results pages? Our QSM conditional shortcode makes it easy. Create personalized experiences based on specific conditions or rules.', 'quiz-master-next'), - "chart_image" => plugins_url('', dirname(__FILE__)) . '/images/extra-shortcodes.png', - "information" => __('QSM Addon Bundle is the best way to get all our add-ons at a discount. Upgrade to save 95% today OR you can buy QSM Extra Shortodes Addon separately.', 'quiz-master-next'), - "buy_btn_text" => __('Buy QSM Extra Shortodes Addon', 'quiz-master-next'), - "doc_link" => qsm_get_plugin_link( 'docs/add-ons/extra-shortcodes/', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_read_documentation', 'qsm_plugin_upsell' ), - "upgrade_link" => qsm_get_plugin_link( 'pricing', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_upgrade', 'qsm_plugin_upsell' ), - "addon_link" => qsm_get_plugin_link( 'downloads/extra-shortcodes', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_buy_addon', 'qsm_plugin_upsell' ), - ); - qsm_admin_upgrade_popup($qsm_pop_up_arguments); - ?> - -
@@ -302,8 +279,33 @@ function qsm_options_results_tab_template(){ } }) }}} +
+ + 'modal-extra-shortcodes', + "title" => __('Extra Shortcode', 'quiz-master-next'), + "description" => __('Need dynamic content on your results pages? Our QSM conditional shortcode makes it easy. Create personalized experiences based on specific conditions or rules.', 'quiz-master-next'), + "chart_image" => plugins_url('', dirname(__FILE__)) . '/images/extra-shortcodes.png', + "information" => __('QSM Addon Bundle is the best way to get all our add-ons at a discount. Upgrade to save 95% today OR you can buy QSM Extra Shortodes Addon separately.', 'quiz-master-next'), + "buy_btn_text" => __('Buy QSM Extra Shortodes Addon', 'quiz-master-next'), + "doc_link" => qsm_get_plugin_link( 'docs/add-ons/extra-shortcodes/', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_read_documentation', 'qsm_plugin_upsell' ), + "upgrade_link" => qsm_get_plugin_link( 'pricing', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_upgrade', 'qsm_plugin_upsell' ), + "addon_link" => qsm_get_plugin_link( 'downloads/extra-shortcodes', 'qsm_list', 'extrashortcodea_button', 'extra-shortcodes-upsell_buy_addon', 'qsm_plugin_upsell' ), + ); + qsm_admin_upgrade_popup($qsm_pop_up_arguments); + ?> + + +
-

/

+

/

diff --git a/php/admin/options-page-style-tab.php b/php/admin/options-page-style-tab.php index caa54ceb..321eddfc 100644 --- a/php/admin/options-page-style-tab.php +++ b/php/admin/options-page-style-tab.php @@ -205,8 +205,8 @@ function qsm_options_styling_tab_content() { "upgrade_link" => qsm_get_plugin_link( 'pricing', 'result_page', 'ultimate', 'result-ultimate-upsell_upgrade', 'qsm_plugin_upsell' ), "addon_link" => qsm_get_plugin_link( 'downloads/Ultimate', 'result_page', 'ultimate', 'result-ultimate-upsell_buy_addon', 'qsm_plugin_upsell' ), "benefits" => array( - 'briefing' => __( 'The QSM Ultimate Add-On boosts quiz flexibility and control, making quiz creation and management smoother and more user-friendly.', 'quiz-master-next' ), - 'list_items' => array( + 'briefing' => __( 'The QSM Ultimate Add-On boosts quiz flexibility and control, making quiz creation and management smoother and more user-friendly.', 'quiz-master-next' ), + 'list_items' => array( __( 'Advanced customization for themes, progress bars, and buttons.', 'quiz-master-next' ), __( 'Streamlined retakes by focusing on incorrect answers.', 'quiz-master-next' ), __( 'Role management for assigning user-specific quiz permissions.', 'quiz-master-next' ), @@ -215,8 +215,8 @@ function qsm_options_styling_tab_content() { ), ), "use_cases" => array( - 'briefing' => __( 'Ideal for educational programs, marketing surveys, and detailed feedback collection.', 'quiz-master-next' ), - 'list_items' => array( + 'briefing' => __( 'Ideal for educational programs, marketing surveys, and detailed feedback collection.', 'quiz-master-next' ), + 'list_items' => array( __( 'Custom progress tracking for employee training.', 'quiz-master-next' ), __( 'Collect emails for lead generation.', 'quiz-master-next' ), __( 'Manage instructor permissions for online courses.', 'quiz-master-next' ), @@ -230,7 +230,7 @@ function qsm_options_styling_tab_content() { qsm_get_plugin_link( 'pricing', 'qsm_list', 'importexport_button', 'import-export-upsell_upgrade', 'qsm_plugin_upsell' ), "addon_link" => qsm_get_plugin_link( 'downloads/export-import', 'qsm_list', 'importexport_button', 'import-export-upsell_buy_addon', 'qsm_plugin_upsell' ), "benefits" => array( - 'briefing' => '', - 'list_items' => array( + 'briefing' => '', + 'list_items' => array( __( 'Saves time by quickly transferring quizzes and surveys between sites.', 'quiz-master-next' ), __( 'Supports flexible export formats like JSON and CSV for easy editing.', 'quiz-master-next' ), __( 'Allows customizable imports for full quizzes, questions, or settings.', 'quiz-master-next' ), @@ -504,8 +504,8 @@ class="qsm-popup__btn qsm-popup__btn-primary"> array( - 'briefing' => '', - 'list_items' => array( + 'briefing' => '', + 'list_items' => array( __( 'Facilitates site migration by moving quizzes between staging and live sites.', 'quiz-master-next' ), __( 'Simplifies data transfer during website redesigns.', 'quiz-master-next' ), __( 'Allows sharing quizzes across multiple websites.', 'quiz-master-next' ), From c5e225ea7ef8d9e9d8eec1ae7b90cf7eab24f983 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Mon, 25 Nov 2024 10:35:33 +0530 Subject: [PATCH 42/85] fixed ALter Table query issue --- php/admin/functions.php | 3 --- php/classes/class-qsm-install.php | 8 +------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/php/admin/functions.php b/php/admin/functions.php index 8eb6e113..10a32485 100644 --- a/php/admin/functions.php +++ b/php/admin/functions.php @@ -251,9 +251,6 @@ function qsm_add_author_column_in_db() { $success = false; $mlwQuizMasterNext->log_manager->add( 'Error updating column charset utf8mb4_unicode_ci', "Tried $query but got {$wpdb->last_error}.", 0, 'error' ); } - } - - if ( $success ) { update_option( 'qsm_update_db_column_charset_utf8mb4_unicode_ci', 1 ); } } diff --git a/php/classes/class-qsm-install.php b/php/classes/class-qsm-install.php index eb02b062..6c1fa9d4 100644 --- a/php/classes/class-qsm-install.php +++ b/php/classes/class-qsm-install.php @@ -1966,12 +1966,6 @@ public function update() { $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql ); } - // Update 2.6.1 - $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' ); - $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_questions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' ); - $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_quizzes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' ); - $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_results CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' ); - global $wpdb; $table_name = $wpdb->prefix . 'mlw_results'; $audit_table = $wpdb->prefix . 'mlw_qm_audit_trail'; @@ -2038,7 +2032,7 @@ public function update() { } update_option( 'mlw_quiz_master_version', $data ); - + // Update 9.1.3 $mlw_questions_table = $wpdb->prefix . 'mlw_questions'; if ( 'linked_question' != $wpdb->get_var( "SHOW COLUMNS FROM $mlw_questions_table LIKE 'linked_question'" ) ) { From fc86e2ccee12d59ea34b225e85453ddcdac8c06b Mon Sep 17 00:00:00 2001 From: etchirag Date: Mon, 25 Nov 2024 10:42:18 +0530 Subject: [PATCH 43/85] Updated eschtml function with wpksespost for allow some html tags --- php/shortcodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/shortcodes.php b/php/shortcodes.php index 45dad941..1684a8ff 100644 --- a/php/shortcodes.php +++ b/php/shortcodes.php @@ -45,9 +45,9 @@ function qsm_quiz_link_shortcode( $atts, $content = '' ) { // Craft the target attribute if one is passed to shortcode $target_html = ''; if ( ! empty( $target ) ) { - return "" . esc_html( $content ) . ''; + return "" . wp_kses_post( $content ) . ''; } else { - return "" . esc_html( $content ) . ''; + return "" . wp_kses_post( $content ) . ''; } } From 5a6fa52ba93f010d07b106c5a9c7029f1652bfe9 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Mon, 25 Nov 2024 12:10:50 +0530 Subject: [PATCH 44/85] made dashboard card responsive for large screen --- css/admin-dashboard.css | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/css/admin-dashboard.css b/css/admin-dashboard.css index d5cf4180..2124c8f2 100644 --- a/css/admin-dashboard.css +++ b/css/admin-dashboard.css @@ -1073,6 +1073,30 @@ h2.hndle.ui-sortable-handle { padding: 25px; } +@media (max-width: 768px) { + .qsm-dashboard-cards-container .qsm-dashboard-card { + width: 100%; + } + .qsm-dashboard-cards-container .qsm-dashboard-card:not(:last-child) { + margin-bottom: 10px; + } +} + +@media (min-width: 770px) and (max-width: 1280px) { + .qsm-dashboard-cards-container .qsm-dashboard-card { + width: calc(50% - 20px); + } + .qsm-dashboard-cards-container .qsm-dashboard-card:not(:last-child) { + margin-bottom: 10px; + } +} + +@media (min-width: 1441px) { + .qsm-dashboard-cards-container .qsm-dashboard-card { + width: 32%; + } +} + .qsm-dashboard-cards-container .qsm-dashboard-card .qsm-dashboard-card-content { display: flex; flex-direction: column; From 0ff30b3624d98420ca121992a7d7f8f77ed925e1 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Mon, 25 Nov 2024 12:22:12 +0530 Subject: [PATCH 45/85] added version in dashboard --- css/admin-dashboard.css | 8 ++------ php/admin/admin-dashboard.php | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/css/admin-dashboard.css b/css/admin-dashboard.css index 2124c8f2..5dcfd44a 100644 --- a/css/admin-dashboard.css +++ b/css/admin-dashboard.css @@ -48,14 +48,11 @@ } .welcome-panel .current_version { - color: #111827; text-align: center; - font-size: 16px; - font-weight: bold; + font-size: 14px; margin: 0; padding: 0; position: relative; - top: -30px; } .welcome-panel .welcome-icon { @@ -1034,8 +1031,7 @@ h2.hndle.ui-sortable-handle { padding: 0 0 0 25px; } .qsm-welcome-panel-content img { - position: relative; - bottom: 4px; + height: 40px; } .qsm-welcome-panel-content p { margin: 7px 0; diff --git a/php/admin/admin-dashboard.php b/php/admin/admin-dashboard.php index ac6396bd..2b991980 100644 --- a/php/admin/admin-dashboard.php +++ b/php/admin/admin-dashboard.php @@ -122,6 +122,7 @@ function qsm_generate_dashboard_page() {
Welcome Logo +

version ); ?>

From 8064b836344b1b3b1990e142ae9d5021618b5af4 Mon Sep 17 00:00:00 2001 From: etchirag Date: Mon, 25 Nov 2024 12:25:13 +0530 Subject: [PATCH 46/85] Updated allowd tags option for qsm link --- php/shortcodes.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/php/shortcodes.php b/php/shortcodes.php index 1684a8ff..940c4a05 100644 --- a/php/shortcodes.php +++ b/php/shortcodes.php @@ -44,10 +44,16 @@ function qsm_quiz_link_shortcode( $atts, $content = '' ) { // Craft the target attribute if one is passed to shortcode $target_html = ''; + $allowed_tags = apply_filters( 'qsm_quiz_link_allowed_tags', array( + 'span' => array(), + 'b' => array(), + 'strong' => array(), + ) ); + if ( ! empty( $target ) ) { - return "" . wp_kses_post( $content ) . ''; + return "" . wp_kses( $content, $allowed_tags ) . ''; } else { - return "" . wp_kses_post( $content ) . ''; + return "" . wp_kses( $content, $allowed_tags ) . ''; } } From c667b43640d9ec6d0ca98e56cc92e698ecd53a23 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Mon, 25 Nov 2024 12:31:35 +0530 Subject: [PATCH 47/85] fixed escaping --- php/admin/admin-dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/admin/admin-dashboard.php b/php/admin/admin-dashboard.php index 2b991980..678cdc74 100644 --- a/php/admin/admin-dashboard.php +++ b/php/admin/admin-dashboard.php @@ -122,7 +122,7 @@ function qsm_generate_dashboard_page() {
Welcome Logo -

version ); ?>

+

version ) ); ?>

From bc8a3bd5da594b02d3af9e55e82ce34e7407c06d Mon Sep 17 00:00:00 2001 From: etchirag Date: Mon, 25 Nov 2024 12:34:09 +0530 Subject: [PATCH 48/85] Updated allowd tags option for qsm link --- php/shortcodes.php | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/php/shortcodes.php b/php/shortcodes.php index 940c4a05..3076f653 100644 --- a/php/shortcodes.php +++ b/php/shortcodes.php @@ -45,10 +45,45 @@ function qsm_quiz_link_shortcode( $atts, $content = '' ) { // Craft the target attribute if one is passed to shortcode $target_html = ''; $allowed_tags = apply_filters( 'qsm_quiz_link_allowed_tags', array( - 'span' => array(), + 'span' => array( + 'class' => true, + 'id' => true, + 'style' => true, + ), + 'a' => array( + 'href' => true, + 'target' => true, + 'class' => true, + 'id' => true, + 'rel' => true, + ), + 'img' => array( + 'src' => true, + 'alt' => true, + 'width' => true, + 'height' => true, + 'class' => true, + 'id' => true, + ), + 'div' => array( + 'class' => true, + 'id' => true, + 'style' => true, + ), + 'h1' => array( 'class' => true ), + 'h2' => array( 'class' => true ), + 'h3' => array( 'class' => true ), + 'h4' => array( 'class' => true ), + 'h5' => array( 'class' => true ), + 'h6' => array( 'class' => true ), + 'p' => array(), + 'br' => array(), 'b' => array(), 'strong' => array(), - ) ); + 'i' => array(), + 'em' => array(), + 'u' => array(), + ) ); if ( ! empty( $target ) ) { return "" . wp_kses( $content, $allowed_tags ) . ''; From 974e8391c6b52941b686e8b8b27e75416dc4a328 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Mon, 25 Nov 2024 15:19:55 +0530 Subject: [PATCH 49/85] removed code which adding post thumbnail in Quiz --- php/classes/class-qmn-quiz-manager.php | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index 756641c2..4d0ebd65 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -1120,29 +1120,6 @@ public function display_quiz( $options, $quiz_data, $question_amount, $shortcode $randomness_class = 0 === intval( $options->randomness_order ) ? '' : 'random'; ?>
qmn_quiz_container mlw_qmn_quiz quiz_theme_ '> 1, - 'post_type' => 'qsm_quiz', - 'meta_query' => array( - array( - 'key' => 'quiz_id', - 'value' => $quiz_data['quiz_id'], - 'compare' => '=', - ), - ), - ); - $the_query = new WP_Query( $args ); - - // The Loop - if ( $the_query->have_posts() ) { - while ( $the_query->have_posts() ) { - $the_query->the_post(); - echo get_the_post_thumbnail( get_the_ID(), 'full' ); - } - /* Restore original Post Data */ - wp_reset_postdata(); - } echo apply_filters( 'qsm_display_before_form', '', $options, $quiz_data ); $quiz_form_action = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; ?> From 04d8a39df70acbc57a01316df5aa573e23307af7 Mon Sep 17 00:00:00 2001 From: etchirag Date: Tue, 26 Nov 2024 09:23:42 +0530 Subject: [PATCH 50/85] Updated icons and UI as per figma file --- assets/arrow-down-s-line.svg | 1 + assets/arrow-up-down-fill.png | Bin 311 -> 0 bytes assets/arrow-up-down-fill.svg | 1 + assets/arrow-up-s-line.svg | 1 + assets/copy.png | Bin 319 -> 0 bytes assets/copy.svg | 1 + assets/edit-pencil.png | Bin 256 -> 0 bytes assets/edit-pencil.svg | 1 + assets/gear.png | Bin 514 -> 0 bytes assets/gear.svg | 1 + assets/mind-map.svg | 1 + assets/trash.png | Bin 355 -> 0 bytes assets/trash.svg | 1 + css/qsm-admin.css | 99 ++++++++++---------- js/qsm-admin.js | 50 +++++----- mlw_quizmaster2.php | 2 + php/admin/options-page-contact-tab.php | 6 +- php/admin/options-page-email-tab.php | 23 +++-- php/admin/options-page-questions-tab.php | 8 +- php/admin/options-page-results-page-tab.php | 64 ++++++------- 20 files changed, 139 insertions(+), 121 deletions(-) create mode 100644 assets/arrow-down-s-line.svg delete mode 100644 assets/arrow-up-down-fill.png create mode 100644 assets/arrow-up-down-fill.svg create mode 100644 assets/arrow-up-s-line.svg delete mode 100644 assets/copy.png create mode 100644 assets/copy.svg delete mode 100644 assets/edit-pencil.png create mode 100644 assets/edit-pencil.svg delete mode 100644 assets/gear.png create mode 100644 assets/gear.svg create mode 100644 assets/mind-map.svg delete mode 100644 assets/trash.png create mode 100644 assets/trash.svg diff --git a/assets/arrow-down-s-line.svg b/assets/arrow-down-s-line.svg new file mode 100644 index 00000000..e1bc908a --- /dev/null +++ b/assets/arrow-down-s-line.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/arrow-up-down-fill.png b/assets/arrow-up-down-fill.png deleted file mode 100644 index 1167f3a2a6c8ff3cbad27ef22fcef0ce00716e5a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 311 zcmV-70m%M|P)PUkQcDA5?Qd21zC{P&6ZpDX}pAmvbGR!pa`M7f{m3ZHZ(Q2=KlN7 z|39(3zBQfm|IazUW=?aCf7)2V3Dz3orZF3B5evA-H=eMZNgBkML5b)h9%909J!i!G zalc \ No newline at end of file diff --git a/assets/arrow-up-s-line.svg b/assets/arrow-up-s-line.svg new file mode 100644 index 00000000..3a424dff --- /dev/null +++ b/assets/arrow-up-s-line.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/copy.png b/assets/copy.png deleted file mode 100644 index 256a50623ba0c9ee307743abb122cf2d74276d8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 319 zcmV-F0l@x=P)8%$R1x`R=IgCZu=e1Rnct1XY$*V2MPwIqWLfs9s!82V zu&P!7O2aq5^`V?{5)F$cl;kdO2pNnum1l+f9W0hkHd>|rUtMdfB^qI%n`Dy=P0FDfPS^Ewd Ri%$Rm002ovPDHLkV1mI=lGgwL diff --git a/assets/copy.svg b/assets/copy.svg new file mode 100644 index 00000000..84dfcd93 --- /dev/null +++ b/assets/copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/edit-pencil.png b/assets/edit-pencil.png deleted file mode 100644 index c4bd31f61c7090c18e6f5356a5d8e7d47b16f155..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmV+b0ssDqP)6fW#U^EkHyx7a_#(V1(t}%)Y~O zVAz>i`19@XvFaKPw5rzD!6$ZjstVf17cP+pJm*3SrON=W@D}wxM|lb@R?x)*K4P}X zg \ No newline at end of file diff --git a/assets/gear.png b/assets/gear.png deleted file mode 100644 index e626181127753e0ecab45859b21246d38c4da761..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 514 zcmV+d0{#7oP)5JmqC1Kvn84MnT2T~7=Xyr%C4dhARs@9*5KFI_SV)&tK!i3lzF!<f%Ys!JGZpyM`$%L_rC6$WE4|k{X)qcNc`a)G7 zVx_;2IM2b;>6Gx=%+~I{0&p0NEX$~@3L!KRTIYGbarf^OLIKEl74UJx4NI<_BG|Kd2O5AAR&#=ryEBLGg \ No newline at end of file diff --git a/assets/mind-map.svg b/assets/mind-map.svg new file mode 100644 index 00000000..34d98e65 --- /dev/null +++ b/assets/mind-map.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/trash.png b/assets/trash.png deleted file mode 100644 index 224a8cb50c43b54f147d60472efa9a380316f93d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 355 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4foCO|{#S9GG!XV7ZFl&wkP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eB{tr(V$B+ufx0B!UHW>)C@fR?#F*HeAIL&pD zJ;*6@a0jFEjz-yoyg3PsYz`ZcAJXGnpLk@gR2j% z%DugIeVKD&me_$weeo0iH*ao{>^$eUjoCUg>CoiG8mB)Qa;kMU1V&{){ZVdU`RCHN z^4RUm^JSN3dU>4tc%s#x!$aAH&p+9ICzoZH(}LH^+g5ci5)f%DwwRuMC&G(cP*$$I zH8*aPj`io?7JcC}q|bepTh(30b8%L?1&{N&(>x~qS9Qxo{;SK#%C%iNU@}d6q2!-^ x$@`La{9)&6komVZo%{PTj{p|$Ez3pa^PjUho6TzO)dYqCgQu&X%Q~loCIF=Th6(@x diff --git a/assets/trash.svg b/assets/trash.svg new file mode 100644 index 00000000..e074d3a0 --- /dev/null +++ b/assets/trash.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/css/qsm-admin.css b/css/qsm-admin.css index d332c01e..9ba707f7 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -511,6 +511,11 @@ span.qsm-quiz-name { padding: 15px; min-width: 60%; } +.results-page-show input[type="text"], .email-show input[type="text"], +.results-page-show input[type="url"], .email-show input[type="url"], +.results-page-show input[type="email"], .email-show input[type="email"] { + max-width: 25rem; +} .results-page-when, .qsm-email-when { margin-right: 15px; border-right: 1px solid #dfd4d4; @@ -552,15 +557,15 @@ span.qsm-quiz-name { .qsm_tab_content .results-page-condition .qsm-result-condition-container input[type="text"], .email-condition select, .qsm_tab_content .email-condition .qsm-email-condition-container input[type="text"], -.results-page-show .qsm-result-page-common-section select, -.results-page-show .qsm-result-page-common-section input[type="text"], +.qsm_tab_content .results-page-show .qsm-result-page-common-section select, +.qsm_tab_content .results-page-show .qsm-result-page-common-section input[type="text"], .qsm-email-content .qsm-email-page-common-section select, -.qsm-email-content .qsm-email-page-common-section input[type="text"] - { +.qsm-email-content .qsm-email-page-common-section input[type="text"], +.qsm-email-content .qsm-email-page-common-section input[type="email"] { min-width: auto; width: 100%; border-radius: 5px; - border-color: #ccc; + border-color: #555555; padding-top: 2px; padding-bottom: 2px; } @@ -587,6 +592,11 @@ span.qsm-quiz-name { .results-page-content label, .results-page-content p, .qsm-email-content label, .qsm-email-content p { color: #1E1E1E; } +.qsm-common-svg-image-class { + height: 18px; + padding: 2px; + vertical-align: -webkit-baseline-middle; +} .delete-condition-button { background: none; @@ -610,7 +620,7 @@ span.qsm-quiz-name { .qsm_tab_content input[type="text"].qsm-email-subject, .qsm_tab_content input[type="text"].results-page-redirect{ border-radius: 3px; - border-color: #8C8FAC; + border-color: #555555; } @media screen and (min-width: 760px) { .results-page-content, .qsm-email-content { @@ -2867,22 +2877,18 @@ input#duplicate_questions { flex-wrap: nowrap; border-radius: 5px; margin: 0 5px; - border: 1px solid #dfd4d4; + border: 1px solid #1E1E1E; } .qsm-actions-link-box a:first-child { border-radius: 5px 0 0 5px; } -.qsm-actions-link-box a:last-child { +.qsm-actions-link-box a:last-child, .qsm-template-btn-group .qsm-actions-link-box a:last-child { border-radius: 0 5px 5px 0; } .qsm-actions-link-box a { - padding: 4px 8px; + padding: 0 6px 4px 6px; color: #3c434a; - cursor: pointer; - min-height: 35px; -} -.qsm-actions-link-box a img { - vertical-align: -webkit-baseline-middle; + cursor: pointer;; } .qsm-actions-link-box a.disabled { cursor: not-allowed; @@ -2895,18 +2901,16 @@ input#duplicate_questions { .qsm-actions-link-box a:not(:first-child) { border-left: 1px solid #d6d6d6; } -a.qsm-toggle-result-page-button, a.qsm-toggle-email-template-button { - height: 35px; - display: flex; - align-items: center; - justify-content: center; -} .qsm-actions-link-box a.qsm-settings-box-result-button:focus { background-color: #ebf4fc; } -.results-page-when .qsm-new-condition, .qsm-email-when .qsm-new-condition{ - width: 121px; - font-weight: 600; +.results-page-when .qsm-new-condition, .qsm-email-when .qsm-new-condition, +.results-page-when .qsm-new-condition:active, .qsm-email-when .qsm-new-condition:active, +.results-page-when .qsm-new-condition:focus, .qsm-email-when .qsm-new-condition:focus { + width: auto; + padding: 0; + color: #2271B1; + font-size: 14px; } .qsm-actions-link-box a span { font-size: 16px; @@ -3813,34 +3817,27 @@ button.button.qsm-extra-shortcode-popup span.dashicons.dashicons-shortcode { margin-right: 4px; } -button.button.qsm-slashcommand-variables-button .qsm-slash-inside { - margin: 0 4px 0 -1px; - font-weight: 1000; +.results-page-show .wp-media-buttons button.button { + border: 1px solid #2271B1; + font-weight: 500; +} + +.qsm-quiz-result-tab button.add-new-page, +.qsm-quiz-email-tab button.add-new-email { border: 1px solid #2271B1; - padding: 0px 4px 0px 4px; - font-size: 10px; - vertical-align: text-bottom; - display: inline-flex; - align-items: center; - height: 13px; - justify-content: center; + font-weight: 500; } -.results-page-show button.button.insert-media.add_media{ - border: 1px solid #2271B1; - font-weight: 500; +.qsm-extra-shortcode-conditional-button img.qsm-common-svg-image-class { + vertical-align: text-top; + padding: 0 1px 0 0; } -@media screen and (max-width: 782px) { - button.button.qsm-extra-shortcode-resultpage-button { - display: flex; - align-items: center; - position: relative; - top: 3px; - left: 0px; - z-index: 10; - } +.contact-form-actions .contact-form-actions-box a.disabled { + opacity: 0.5; +} +@media screen and (max-width: 782px) { .qsm-email-condition-container-inner, .qsm-result-condition-container-inner { width: 100%; } @@ -3887,9 +3884,15 @@ button.button.qsm-slashcommand-variables-button .qsm-slash-inside { .results-page-show .quicktags-toolbar input[type="button"]{ border-color: #2271B1; } -p.qsm-insert-template-variable-text { - margin-top: 5px; - margin-bottom: 15px; +span.qsm-insert-template-variable-text { + line-height: 2; + margin-left: 7px; + color: #1E1E1E; +} + +.qsm-quiz-result-tab p.qsm-result-redirect-text { + margin-bottom: 5px; + margin-top: 20px; } .qsm_page_mlw_quiz_results .widefat tbody td input[type="checkbox"], diff --git a/js/qsm-admin.js b/js/qsm-admin.js index 90220d0e..e0df57c7 100644 --- a/js/qsm-admin.js +++ b/js/qsm-admin.js @@ -1961,9 +1961,6 @@ var QSMContact; event.preventDefault(); $(this).closest('.qsm-email').remove(); }); - jQuery(document).on('click', '.qsm-toggle-email-template-button', function () { - jQuery(this).closest("header").next("main").slideToggle(); - }); $('#qsm_emails').on('click', '.delete-condition-button', function (event) { event.preventDefault(); let $parent = $(this).parents('.qsm-email-when'); @@ -4227,9 +4224,9 @@ var QSM_Quiz_Broadcast_Channel; jQuery(document).trigger('qsm_tinyMCE_settings_after', [settings]); wp.editor.initialize('results-page-' + QSMAdminResults.total, settings); jQuery(document).trigger('qsm_after_add_result_block', [conditions, page, redirect, QSMAdminResults.total, singlePage]); - // const $resultsPage = jQuery(`#results-page-${QSMAdminResults.total}`).closest('.results-page-show'); - // const $slashCommandButton = $resultsPage.find('.qsm-slashcommand-variables-button'); - // $resultsPage.find('.wp-media-buttons .insert-media').after($slashCommandButton); + const $resultsPage = jQuery(`#results-page-${QSMAdminResults.total}`).closest('.results-page-show'); + const $conditionalButton = $resultsPage.find('.qsm-extra-shortcode-conditional-button'); + $resultsPage.find('.wp-media-buttons .insert-media').after($conditionalButton); }, newResultsPage: function () { var conditions = [{ @@ -4289,24 +4286,35 @@ var QSM_Quiz_Broadcast_Channel; console.log($parent); $(this).closest('.results-page-condition').remove(); QSMAdminResults.updateResultConditonCount($parent); - }); - jQuery(document).on('click', '.qsm-toggle-result-page-button', function () { - jQuery(this).closest("header").next("main").slideToggle(); - jQuery(this).find('.dashicons-arrow-up-alt2, .dashicons-arrow-down-alt2').toggleClass('dashicons-arrow-up-alt2 dashicons-arrow-down-alt2'); - }); - jQuery(document).on('click', '.qsm-settings-box-result-button', function () { - jQuery('.qsm-settings-box-details').not(jQuery(this).parents('.qsm-template-btn-group').find('.qsm-settings-box-details')).hide(); - jQuery(this).parents('.qsm-template-btn-group').find('.qsm-settings-box-details').toggle(); - }); - jQuery(document).on('click', function (e) { - // Check if the click was outside .qsm-template-btn-group - if (!jQuery(e.target).closest('.qsm-template-btn-group').length) { - jQuery('.qsm-settings-box-details').hide(); - } - }); + }); }); } } + + jQuery(document).on('click', '.qsm-toggle-result-page-button, .qsm-toggle-email-template-button', function () { + jQuery(this).closest("header").next("main").slideToggle(); + let $img = jQuery(this).find('img'); + let currentSrc = $img.attr('src'); + let arrowUpImage = qsm_admin_messages.arrow_up_image; + let arrowDownImage = qsm_admin_messages.arrow_down_image; + + // Toggle the image + if (currentSrc === arrowUpImage) { + $img.attr('src', arrowDownImage); + } else { + $img.attr('src', arrowUpImage); + } + }); + jQuery(document).on('click', '.qsm-settings-box-result-button', function () { + jQuery('.qsm-settings-box-details').not(jQuery(this).parents('.qsm-template-btn-group').find('.qsm-settings-box-details')).hide(); + jQuery(this).parents('.qsm-template-btn-group').find('.qsm-settings-box-details').toggle(); + }); + jQuery(document).on('click', function (e) { + // Check if the click was outside .qsm-template-btn-group + if (!jQuery(e.target).closest('.qsm-template-btn-group').length) { + jQuery('.qsm-settings-box-details').hide(); + } + }); $(document).on('click', '.qsm_global_settings .qsm-generate-api-key', function (event) { event.preventDefault(); diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index d164893e..e499f2be 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -584,6 +584,8 @@ public function qsm_admin_scripts_style( $hook ) { 'select_all' => __("Select All", 'quiz-master-next'), 'select' => __("Select", 'quiz-master-next'), 'qsmQuizzesObject' => $qsm_quizzes, + 'arrow_up_image' => esc_url(QSM_PLUGIN_URL . 'assets/arrow-up-s-line.svg'), + 'arrow_down_image' => esc_url(QSM_PLUGIN_URL . 'assets/arrow-down-s-line.svg'), ); $qsm_admin_messages = apply_filters( 'qsm_admin_messages_after', $qsm_admin_messages ); wp_localize_script( 'qsm_admin_js', 'qsm_admin_messages', $qsm_admin_messages ); diff --git a/php/admin/options-page-contact-tab.php b/php/admin/options-page-contact-tab.php index 336039bd..ebdbc8cb 100644 --- a/php/admin/options-page-contact-tab.php +++ b/php/admin/options-page-contact-tab.php @@ -234,9 +234,9 @@ function qsm_options_contact_tab_template() {
diff --git a/php/admin/options-page-email-tab.php b/php/admin/options-page-email-tab.php index 79d48d52..823f06a4 100644 --- a/php/admin/options-page-email-tab.php +++ b/php/admin/options-page-email-tab.php @@ -183,21 +183,20 @@ function qsm_options_emails_tab_template() { {{data.id}}