From 04bb54dc5248cd1bad8517e7b8ee8a104570a416 Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Tue, 5 Aug 2025 14:03:14 +0300 Subject: [PATCH 01/11] refactor: redesign support page --- includes/admin/feedzy-rss-feeds-admin.php | 94 +++++++++++++---------- includes/feedzy-rss-feeds.php | 3 +- includes/layouts/feedzy-support.php | 14 ++++ includes/layouts/header.php | 2 +- includes/layouts/setup-wizard.php | 12 +-- 5 files changed, 77 insertions(+), 48 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index 337d7dd6b..a1c2508e0 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -932,6 +932,17 @@ public function feedzy_menu_pages() { $svg_base64_icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNzdweCIgaGVpZ2h0PSI3N3B4IiB2aWV3Qm94PSIwIDAgNzcgNzciIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjYgKDY3NDkxKSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Db21iaW5lZC1TaGFwZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxnIGlkPSJQcm9kdWN0LVBhZ2UiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXb3JkUHJlc3MtcGx1Z2lucyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE5Ni4wMDAwMDAsIC05NTcuMDAwMDAwKSIgZmlsbD0iIzQyNjhDRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yMzQuNSwxMDM0IEMyMTMuMjM3MDM3LDEwMzQgMTk2LDEwMTYuNzYyOTYgMTk2LDk5NS41IEMxOTYsOTc0LjIzNzAzNyAyMTMuMjM3MDM3LDk1NyAyMzQuNSw5NTcgQzI1NS43NjI5NjMsOTU3IDI3Myw5NzQuMjM3MDM3IDI3Myw5OTUuNSBDMjczLDEwMTYuNzYyOTYgMjU1Ljc2Mjk2MywxMDM0IDIzNC41LDEwMzQgWiBNMjM4LjM4OTA4NywxMDAzLjYxMDkxIEMyMzYuMjQxMjU2LDEwMDEuNDYzMDggMjMyLjc1ODg1MSwxMDAxLjQ2Mjk3IDIzMC42MTA5NDMsMTAwMy42MTA4OCBDMjI4LjQ2MzAzNSwxMDA1Ljc1ODc5IDIyOC40NjMwMjEsMTAwOS4yNDEyIDIzMC42MTA5MTMsMTAxMS4zODkwOSBDMjMyLjc1ODgwNCwxMDEzLjUzNjk4IDIzNi4yNDExNDksMTAxMy41MzcwMyAyMzguMzg5MDU3LDEwMTEuMzg5MTIgQzI0MC41MzY5NjUsMTAwOS4yNDEyMSAyNDAuNTM2OTc5LDEwMDUuNzU4OCAyMzguMzg5MDg3LDEwMDMuNjEwOTEgWiBNMjUxLjE5OTE5Niw5OTYuNTI0MjY5IEMyNDEuNzE2MDEsOTg4LjAxMzQwOSAyMjcuMjk0MTQzLDk4OC4wMDQzMDcgMjE3LjgwMDg1OSw5OTYuNTI0MjE0IEMyMTcuMjQwNDk2LDk5Ny4wMjcwNzkgMjE3LjIyMjEwOCw5OTcuODk5Nzc3IDIxNy43NTQ0OCw5OTguNDMyMTUgTDIyMC41NTE4NzksMTAwMS4yMjk1NSBDMjIxLjA0MTU5NCwxMDAxLjcxOTI2IDIyMS44Mjk5NjcsMTAwMS43NTIyNiAyMjIuMzUwNDA4LDEwMDEuMjk1MzcgQzIyOS4yODI0MDEsOTk1LjIxMTE3IDIzOS43MDI4MSw5OTUuMTk4MjA5IDI0Ni42NDk1NDYsMTAwMS4yOTU0MSBDMjQ3LjE3MDA0NywxMDAxLjc1MjI1IDI0Ny45NTg0MiwxMDAxLjcxOTI1IDI0OC40NDgwNzUsMTAwMS4yMjk1OSBMMjUxLjI0NTQ2NSw5OTguNDMyMjA1IEMyNTEuNzc3OTUyLDk5Ny44OTk4MzQgMjUxLjc1OTU2MSw5OTcuMDI3MTM2IDI1MS4xOTkxOTYsOTk2LjUyNDI2OSBaIE0yNTkuNTE3NDgxLDk4OC4wNjI4MTggQzI0NS43NTQ2NjIsOTc1LjI1MzkxIDIyNC4zMTI1MzEsOTc1LjE5MTM3NCAyMTAuNDgyNDY0LDk4OC4wNjI4NzMgQzIwOS45NTA5Niw5ODguNTU3NTU3IDIwOS45NDA4NDUsOTg5LjM5NjY4OSAyMTAuNDU0MjIyLDk4OS45MTAwNjYgTDIxMy4xODU0ODksOTkyLjY0MTMzMyBDMjEzLjY3NTU2OSw5OTMuMTMxNDEzIDIxNC40NjI4MjQsOTkzLjE0MTkyNCAyMTQuOTcyNjIyLDk5Mi42NzIzNTUgQzIyNi4yODEwMjksOTgyLjI1NDc4NiAyNDMuNzIwODA0LDk4Mi4yNTY0MTUgMjU5LjUxNzQ4MSw5ODguMDYyODE4IFoiIGlkPSJDb21iaW5lZC1TaGFwZSI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+'; add_menu_page( __( 'Feedzy', 'feedzy-rss-feeds' ), __( 'Feedzy', 'feedzy-rss-feeds' ), apply_filters( 'feedzy_admin_menu_capability', 'publish_posts' ), 'feedzy-admin-menu', '', $svg_base64_icon, 98.7666 ); + add_submenu_page( + 'feedzy-admin-menu', + __( 'Dashboard', 'feedzy-rss-feeds' ), + __( 'Dashboard', 'feedzy-rss-feeds' ), + 'manage_options', + 'feedzy-support', + array( + $this, + 'render_support', + ) + ); add_submenu_page( 'feedzy-admin-menu', __( 'Settings', 'feedzy-rss-feeds' ), @@ -954,19 +965,8 @@ public function feedzy_menu_pages() { 'feedzy_integration_page', ) ); - add_submenu_page( - 'feedzy-admin-menu', - __( 'Support', 'feedzy-rss-feeds' ), - __( 'Support', 'feedzy-rss-feeds' ) . '', - 'manage_options', - 'feedzy-support', - array( - $this, - 'render_support', - ) - ); - if ( ! feedzy_is_pro() && get_option( 'feedzy_fresh_install', false ) ) { + if ( ! feedzy_is_pro() && get_option( 'feedzy_fresh_install', false ) ) { $hook = add_submenu_page( 'feedzy-admin-menu', __( 'Setup Wizard', 'feedzy-rss-feeds' ), @@ -981,37 +981,51 @@ public function feedzy_menu_pages() { add_action( "load-$hook", array( $this, 'feedzy_load_setup_wizard_page' ) ); add_action( 'adminmenu', array( $this, 'feedzy_hide_wizard_menu' ) ); } - if ( ! defined( 'REVIVE_NETWORK_VERSION' ) ) { - $rss_to_social = __( 'RSS to Social', 'feedzy-rss-feeds' ) . ''; - add_action( - 'admin_footer', - function () { - ?> - - '; + add_action( + 'admin_footer', + function () { + ?> + + loader->add_action( 'feedzy_post_http_teardown', self::$instance->admin, 'post_http_teardown', 10, 1 ); self::$instance->loader->add_action( 'admin_init', self::$instance->admin, 'admin_init', 10, 1 ); self::$instance->loader->add_action( 'manage_feedzy_categories_posts_custom_column', self::$instance->admin, 'manage_feedzy_category_columns', 10, 2 ); - self::$instance->loader->add_action( 'admin_menu', self::$instance->admin, 'feedzy_menu_pages' ); + self::$instance->loader->add_action( 'admin_menu', self::$instance->admin, 'feedzy_menu_pages', 8); + self::$instance->loader->add_action( 'admin_menu', self::$instance->admin, 'rss_to_social_menu', 20 ); self::$instance->loader->add_action( 'wp_ajax_get_tinymce_form', self::$instance->admin, 'get_tinymce_form' ); self::$instance->loader->add_action( 'wp_enqueue_scripts', self::$instance->admin, 'enqueue_styles' ); self::$instance->loader->add_action( 'admin_enqueue_scripts', self::$instance->admin, 'enqueue_styles_admin', 99 ); diff --git a/includes/layouts/feedzy-support.php b/includes/layouts/feedzy-support.php index e7e975744..eebf29f34 100644 --- a/includes/layouts/feedzy-support.php +++ b/includes/layouts/feedzy-support.php @@ -31,6 +31,20 @@ class="">" class=""> +
  • + + + + +
  • +
  • + + + + +
  • diff --git a/includes/layouts/header.php b/includes/layouts/header.php index b2f0e8b47..ea53b34a4 100644 --- a/includes/layouts/header.php +++ b/includes/layouts/header.php @@ -10,7 +10,7 @@ // phpcs:disable WordPress.Security.NonceVerification $page_title = __( 'Settings', 'feedzy-rss-feeds' ); if ( isset( $_GET['page'] ) && 'feedzy-support' === $_GET['page'] ) { - $page_title = __( 'Support', 'feedzy-rss-feeds' ); + $page_title = __( 'Dashboard', 'feedzy-rss-feeds' ); } elseif ( isset( $_GET['page'] ) && 'feedzy-integration' === $_GET['page'] ) { $page_title = __( 'Integration', 'feedzy-rss-feeds' ); } diff --git a/includes/layouts/setup-wizard.php b/includes/layouts/setup-wizard.php index e47e289d7..33c1ae86d 100644 --- a/includes/layouts/setup-wizard.php +++ b/includes/layouts/setup-wizard.php @@ -6,12 +6,12 @@ */ $dashboard_url = add_query_arg( - array( - 'post_type' => 'feedzy_imports', - 'action' => 'feedzy_dismiss_wizard', - 'status' => 0, - ), - admin_url( 'edit.php' ) + array( + 'page' => 'feedzy-support', + 'action' => 'feedzy_dismiss_wizard', + 'status' => 0, + ), + admin_url( 'admin.php' ) ); // phpcs:ignore WordPress.Security.NonceVerification $integrate_with = ! empty( $_GET['integrate-with'] ) ? sanitize_text_field( wp_unslash( $_GET['integrate-with'] ) ) : ''; From 437500ede716ebaf2790552f4864a962fe134c1b Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:00:36 +0300 Subject: [PATCH 02/11] feat: add license management functionality and UI updates --- includes/admin/feedzy-rss-feeds-admin.php | 26 +++++++- includes/feedzy-rss-feeds.php | 2 +- includes/layouts/feedzy-license.php | 3 + includes/layouts/feedzy-support.php | 11 +++- includes/layouts/setup-wizard.php | 12 ++-- js/feedzy-license.js | 72 +++++++++++++++++++++++ js/feedzy-setting.js | 44 -------------- 7 files changed, 115 insertions(+), 55 deletions(-) create mode 100644 includes/layouts/feedzy-license.php create mode 100644 js/feedzy-license.js diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index a1c2508e0..5195e42eb 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -278,7 +278,13 @@ public function enqueue_styles_admin() { } // phpcs:ignore WordPress.Security.NonceVerification.Recommended - if ( 'feedzy_page_feedzy-support' === $screen->base && ( ( isset( $_GET['tab'] ) && 'improve' === $_GET['tab'] ) || ( 'edit' !== $screen->base && 'feedzy_imports' === $screen->post_type ) ) ) { + if ( 'feedzy_page_feedzy-support' === $screen->base && + ( + ( isset( $_GET['tab'] ) && 'improve' === $_GET['tab'] ) + || ( 'edit' !== $screen->base && 'feedzy_imports' === $screen->post_type ) + || ( isset( $_GET['tab'] ) && 'license' === $_GET['tab'] ) + ) + ) { $asset_file = include FEEDZY_ABSPATH . '/build/feedback/index.asset.php'; wp_enqueue_script( $this->plugin_name . '_feedback', FEEDZY_ABSURL . 'build/feedback/index.js', array_merge( $asset_file['dependencies'], array( 'wp-editor', 'wp-api', 'lodash' ) ), $asset_file['version'], true ); @@ -293,6 +299,20 @@ public function enqueue_styles_admin() { ) ); + wp_enqueue_script( $this->plugin_name . '_license', FEEDZY_ABSURL . 'js/feedzy-license.js', array( 'jquery' ), $this->version, true ); + + wp_localize_script( + $this->plugin_name . '_license', + 'feedzyLicense', + array( + 'l10n' => array( + 'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ), + 'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ), + 'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ), + ), + ) + ); + wp_set_script_translations( $this->plugin_name . '_feedback', 'feedzy-rss-feeds' ); } @@ -966,7 +986,7 @@ public function feedzy_menu_pages() { ) ); - if ( ! feedzy_is_pro() && get_option( 'feedzy_fresh_install', false ) ) { + if ( ! feedzy_is_pro() && get_option( 'feedzy_fresh_install', false ) ) { $hook = add_submenu_page( 'feedzy-admin-menu', __( 'Setup Wizard', 'feedzy-rss-feeds' ), @@ -989,7 +1009,7 @@ public function rss_to_social_menu() { return; } - if ( defined ( 'REVIVE_NETWORK_VERSION' ) && ! feedzy_is_pro() ) { + if ( defined( 'REVIVE_NETWORK_VERSION' ) && ! feedzy_is_pro() ) { return; } diff --git a/includes/feedzy-rss-feeds.php b/includes/feedzy-rss-feeds.php index 34cfdd460..18f292012 100644 --- a/includes/feedzy-rss-feeds.php +++ b/includes/feedzy-rss-feeds.php @@ -176,7 +176,7 @@ private function define_admin_hooks() { self::$instance->loader->add_action( 'feedzy_post_http_teardown', self::$instance->admin, 'post_http_teardown', 10, 1 ); self::$instance->loader->add_action( 'admin_init', self::$instance->admin, 'admin_init', 10, 1 ); self::$instance->loader->add_action( 'manage_feedzy_categories_posts_custom_column', self::$instance->admin, 'manage_feedzy_category_columns', 10, 2 ); - self::$instance->loader->add_action( 'admin_menu', self::$instance->admin, 'feedzy_menu_pages', 8); + self::$instance->loader->add_action( 'admin_menu', self::$instance->admin, 'feedzy_menu_pages', 8 ); self::$instance->loader->add_action( 'admin_menu', self::$instance->admin, 'rss_to_social_menu', 20 ); self::$instance->loader->add_action( 'wp_ajax_get_tinymce_form', self::$instance->admin, 'get_tinymce_form' ); self::$instance->loader->add_action( 'wp_enqueue_scripts', self::$instance->admin, 'enqueue_styles' ); diff --git a/includes/layouts/feedzy-license.php b/includes/layouts/feedzy-license.php new file mode 100644 index 000000000..58b125222 --- /dev/null +++ b/includes/layouts/feedzy-license.php @@ -0,0 +1,3 @@ +
    + +
    \ No newline at end of file diff --git a/includes/layouts/feedzy-support.php b/includes/layouts/feedzy-support.php index eebf29f34..7280fa451 100644 --- a/includes/layouts/feedzy-support.php +++ b/includes/layouts/feedzy-support.php @@ -27,6 +27,12 @@ class="">">
  • + +
  • + +
  • +
  • @@ -68,6 +74,9 @@ class="">"> - + \ No newline at end of file diff --git a/includes/layouts/setup-wizard.php b/includes/layouts/setup-wizard.php index 33c1ae86d..9b3c349ac 100644 --- a/includes/layouts/setup-wizard.php +++ b/includes/layouts/setup-wizard.php @@ -6,12 +6,12 @@ */ $dashboard_url = add_query_arg( - array( - 'page' => 'feedzy-support', - 'action' => 'feedzy_dismiss_wizard', - 'status' => 0, - ), - admin_url( 'admin.php' ) + array( + 'page' => 'feedzy-support', + 'action' => 'feedzy_dismiss_wizard', + 'status' => 0, + ), + admin_url( 'admin.php' ) ); // phpcs:ignore WordPress.Security.NonceVerification $integrate_with = ! empty( $_GET['integrate-with'] ) ? sanitize_text_field( wp_unslash( $_GET['integrate-with'] ) ) : ''; diff --git a/js/feedzy-license.js b/js/feedzy-license.js new file mode 100644 index 000000000..6f740ca59 --- /dev/null +++ b/js/feedzy-license.js @@ -0,0 +1,72 @@ +(function ($) { + /** + * Toggles check button state based on license key input and syncs value across inputs + * @param {window.jQuery} $input - License key input element + */ + const handleLicenseKeyInput = ($input) => { + const licenseKey = $input.val(); + const $checkButton = $('#check_ti_license'); + + if (licenseKey !== '') { + $checkButton.removeAttr('disabled'); + } else { + $checkButton.attr('disabled', true); + } + + $('.fz-license-section input[name="license_key"]').val(licenseKey); + }; + + /** + * Handles license validation response - shows errors or reloads page on success + * @param {Object} response - API response with success flag and message + * @param {window.jQuery} $button - Check license button element + */ + const handleLicenseResponse = (response, $button) => { + if (!response.success) { + const $errorMessage = $( + '

    ' + response.message + '

    ' + ); + $errorMessage.insertAfter( + $('.fz-license-section').find('.help-text') + ); + $button.removeAttr('disabled').removeClass('fz-checking'); + return; + } + window.location.reload(); + }; + + /** + * Validates license via AJAX, disables button and clears previous errors + * @param {Event} e - Click event from check license button + */ + const checkLicense = (e) => { + e.preventDefault(); + const $button = $(e.currentTarget); + + $button.attr('disabled', true).addClass('fz-checking'); + $button + .parents('.fz-license-section') + .find('.feedzy-api-error') + .remove(); + + const licenseData = $button + .parent('.fz-input-group-btn') + .find('input') + .serialize(); + + $.post( + window.ajaxurl, + licenseData, + (response) => handleLicenseResponse(response, $button), + 'json' + ); + }; + + $(document).ready(() => { + $('.fz-license-section #license_key').on('input', function () { + handleLicenseKeyInput($(this)); + }); + + $('.fz-license-section #check_ti_license').on('click', checkLicense); + }); +})(window.jQuery); diff --git a/js/feedzy-setting.js b/js/feedzy-setting.js index 375c581c0..51fe07414 100644 --- a/js/feedzy-setting.js +++ b/js/feedzy-setting.js @@ -98,50 +98,6 @@ jQuery(function ($) { } }); - - // License key. - jQuery('.fz-license-section #license_key').on('input', function () { - const licenseKey = jQuery(this).val(); - if (licenseKey !== '') { - jQuery('#check_ti_license').removeAttr('disabled'); - } else { - jQuery('#check_ti_license').attr('disabled', true); - } - jQuery('.fz-license-section input[name="license_key"]').val(licenseKey); - }); - - jQuery('.fz-license-section #check_ti_license').on('click', function (e) { - e.preventDefault(); - const _this = jQuery(this); - _this.attr('disabled', true).addClass('fz-checking'); - - _this.parents('.fz-license-section').find('.feedzy-api-error').remove(); - - const LicenseData = _this - .parent('.fz-input-group-btn') - .find('input') - .serialize(); - - jQuery.post( - ajaxurl, - LicenseData, - function (response) { - if (!response.success) { - jQuery( - '

    ' + - response.message + - '

    ' - ).insertAfter( - jQuery('.fz-license-section').find('.help-text') - ); - _this.removeAttr('disabled').removeClass('fz-checking'); - } else { - window.location.reload(); - } - }, - 'json' - ); - }); snackbarNotice(); const initializeAutoCatActions = () => { From 11a91b2ebcc183889fe27e096bfcf7f7aaa33362 Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:00:48 +0300 Subject: [PATCH 03/11] fix: sanitize tab input and improve support page rendering --- includes/admin/feedzy-rss-feeds-admin.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index 5195e42eb..3fedbb4a4 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -278,14 +278,15 @@ public function enqueue_styles_admin() { } // phpcs:ignore WordPress.Security.NonceVerification.Recommended - if ( 'feedzy_page_feedzy-support' === $screen->base && - ( - ( isset( $_GET['tab'] ) && 'improve' === $_GET['tab'] ) - || ( 'edit' !== $screen->base && 'feedzy_imports' === $screen->post_type ) - || ( isset( $_GET['tab'] ) && 'license' === $_GET['tab'] ) + $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : ''; + + if ( 'feedzy_page_feedzy-support' === $screen->base && + ( + ( 'improve' === $tab ) + || ( 'edit' !== $screen->base && 'feedzy_imports' === $screen->post_type ) + || ( 'license' === $tab ) ) ) { - $asset_file = include FEEDZY_ABSPATH . '/build/feedback/index.asset.php'; wp_enqueue_script( $this->plugin_name . '_feedback', FEEDZY_ABSURL . 'build/feedback/index.js', array_merge( $asset_file['dependencies'], array( 'wp-editor', 'wp-api', 'lodash' ) ), $asset_file['version'], true ); wp_enqueue_style( 'wp-block-editor' ); @@ -1003,7 +1004,12 @@ public function feedzy_menu_pages() { } } - public function rss_to_social_menu() { + /** + * Method to render the support page. + * + * @access public + */ + public function rss_to_social_menu(): void { $capability = feedzy_current_user_can(); if ( ! $capability ) { return; @@ -1044,8 +1050,6 @@ function () { ), ) ); - - $submenu['feedzy-admin-menu'] = array_values( $submenu['feedzy-admin-menu'] ); } } From eaa837fa5658baf52453d1daf6c9ee83c4c28a6f Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:13:30 +0300 Subject: [PATCH 04/11] fix: button issue --- js/feedzy-setting.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/js/feedzy-setting.js b/js/feedzy-setting.js index 51fe07414..a00f99f9b 100644 --- a/js/feedzy-setting.js +++ b/js/feedzy-setting.js @@ -98,6 +98,49 @@ jQuery(function ($) { } }); + // License key. + jQuery('.fz-license-section #license_key').on('input', function () { + const licenseKey = jQuery(this).val(); + if (licenseKey !== '') { + jQuery('#check_ti_license').removeAttr('disabled'); + } else { + jQuery('#check_ti_license').attr('disabled', true); + } + jQuery('.fz-license-section input[name="license_key"]').val(licenseKey); + }); + + jQuery('.fz-license-section #check_ti_license').on('click', function (e) { + e.preventDefault(); + const _this = jQuery(this); + _this.attr('disabled', true).addClass('fz-checking'); + + _this.parents('.fz-license-section').find('.feedzy-api-error').remove(); + + const LicenseData = _this + .parent('.fz-input-group-btn') + .find('input') + .serialize(); + + jQuery.post( + ajaxurl, + LicenseData, + function (response) { + if (!response.success) { + jQuery( + '

    ' + + response.message + + '

    ' + ).insertAfter( + jQuery('.fz-license-section').find('.help-text') + ); + _this.removeAttr('disabled').removeClass('fz-checking'); + } else { + window.location.reload(); + } + }, + 'json' + ); + }); snackbarNotice(); const initializeAutoCatActions = () => { From 0b165612e4d0e188bdcb3debf6bbd45430fe2449 Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:30:50 +0300 Subject: [PATCH 05/11] fix: redundant code --- includes/admin/feedzy-rss-feeds-admin.php | 14 ++++++++ js/feedzy-setting.js | 43 ----------------------- 2 files changed, 14 insertions(+), 43 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index 3fedbb4a4..3c1a1c8fd 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -206,6 +206,20 @@ public function enqueue_styles_admin() { ), ) ); + + wp_enqueue_script( $this->plugin_name . '_license', FEEDZY_ABSURL . 'js/feedzy-license.js', array( 'jquery' ), $this->version, true ); + + wp_localize_script( + $this->plugin_name . '_license', + 'feedzyLicense', + array( + 'l10n' => array( + 'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ), + 'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ), + 'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ), + ), + ) + ); } $upsell_screens = array( 'feedzy-rss_page_feedzy-settings', 'feedzy-rss_page_feedzy-admin-menu-pro-upsell' ); diff --git a/js/feedzy-setting.js b/js/feedzy-setting.js index a00f99f9b..51fe07414 100644 --- a/js/feedzy-setting.js +++ b/js/feedzy-setting.js @@ -98,49 +98,6 @@ jQuery(function ($) { } }); - // License key. - jQuery('.fz-license-section #license_key').on('input', function () { - const licenseKey = jQuery(this).val(); - if (licenseKey !== '') { - jQuery('#check_ti_license').removeAttr('disabled'); - } else { - jQuery('#check_ti_license').attr('disabled', true); - } - jQuery('.fz-license-section input[name="license_key"]').val(licenseKey); - }); - - jQuery('.fz-license-section #check_ti_license').on('click', function (e) { - e.preventDefault(); - const _this = jQuery(this); - _this.attr('disabled', true).addClass('fz-checking'); - - _this.parents('.fz-license-section').find('.feedzy-api-error').remove(); - - const LicenseData = _this - .parent('.fz-input-group-btn') - .find('input') - .serialize(); - - jQuery.post( - ajaxurl, - LicenseData, - function (response) { - if (!response.success) { - jQuery( - '

    ' + - response.message + - '

    ' - ).insertAfter( - jQuery('.fz-license-section').find('.help-text') - ); - _this.removeAttr('disabled').removeClass('fz-checking'); - } else { - window.location.reload(); - } - }, - 'json' - ); - }); snackbarNotice(); const initializeAutoCatActions = () => { From 59c576809a6ff7c436e7c2c08cff870050363930 Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Wed, 6 Aug 2025 12:11:51 +0300 Subject: [PATCH 06/11] feat: add license script enqueueing --- includes/admin/feedzy-rss-feeds-admin.php | 55 ++++++++++++----------- includes/layouts/feedzy-support.php | 4 +- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index 3c1a1c8fd..8b087656d 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -128,6 +128,31 @@ public function enqueue_styles() { } wp_register_style( $this->plugin_name, FEEDZY_ABSURL . 'css/feedzy-rss-feeds.css', array(), $this->version, 'all' ); } + + /** + * Helper function to enqueue the license script with localization + */ + private function enqueue_license_script() { + wp_enqueue_script( + $this->plugin_name . '_license', + FEEDZY_ABSURL . 'js/feedzy-license.js', + array( 'jquery' ), + $this->version, + true + ); + + wp_localize_script( + $this->plugin_name . '_license', + 'feedzyLicense', + array( + 'l10n' => array( + 'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ), + 'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ), + 'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ), + ), + ) + ); + } /** * Register the stylesheets for the admin area. @@ -207,19 +232,7 @@ public function enqueue_styles_admin() { ) ); - wp_enqueue_script( $this->plugin_name . '_license', FEEDZY_ABSURL . 'js/feedzy-license.js', array( 'jquery' ), $this->version, true ); - - wp_localize_script( - $this->plugin_name . '_license', - 'feedzyLicense', - array( - 'l10n' => array( - 'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ), - 'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ), - 'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ), - ), - ) - ); + $this->enqueue_license_script(); } $upsell_screens = array( 'feedzy-rss_page_feedzy-settings', 'feedzy-rss_page_feedzy-admin-menu-pro-upsell' ); @@ -314,19 +327,7 @@ public function enqueue_styles_admin() { ) ); - wp_enqueue_script( $this->plugin_name . '_license', FEEDZY_ABSURL . 'js/feedzy-license.js', array( 'jquery' ), $this->version, true ); - - wp_localize_script( - $this->plugin_name . '_license', - 'feedzyLicense', - array( - 'l10n' => array( - 'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ), - 'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ), - 'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ), - ), - ) - ); + $this->enqueue_license_script(); wp_set_script_translations( $this->plugin_name . '_feedback', 'feedzy-rss-feeds' ); } @@ -1019,7 +1020,7 @@ public function feedzy_menu_pages() { } /** - * Method to render the support page. + * Handle the RSS to Social menu item. * * @access public */ diff --git a/includes/layouts/feedzy-support.php b/includes/layouts/feedzy-support.php index 7280fa451..f338ae9ea 100644 --- a/includes/layouts/feedzy-support.php +++ b/includes/layouts/feedzy-support.php @@ -39,14 +39,14 @@ class="">
  • + class="">
  • + class=""> From 50ec9dbee5cafc3e0648a3c8d6efc87742c64b00 Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Wed, 6 Aug 2025 12:15:38 +0300 Subject: [PATCH 07/11] fix: format error --- includes/admin/feedzy-rss-feeds-admin.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index 8b087656d..f2c9d4403 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -130,8 +130,11 @@ public function enqueue_styles() { } /** - * Helper function to enqueue the license script with localization - */ + * Helper function to enqueue the license script with localization + * + * @access public + * @return void + */ private function enqueue_license_script() { wp_enqueue_script( $this->plugin_name . '_license', From 2fa7d634acfadcce24dc8735f7f64c367fe3d722 Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Wed, 6 Aug 2025 12:15:57 +0300 Subject: [PATCH 08/11] fix:format --- includes/admin/feedzy-rss-feeds-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index f2c9d4403..4f9330129 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -133,7 +133,7 @@ public function enqueue_styles() { * Helper function to enqueue the license script with localization * * @access public - * @return void + * @return void */ private function enqueue_license_script() { wp_enqueue_script( From 50a3edb663a981e22779a282c24be23166ab74cf Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Thu, 7 Aug 2025 10:09:17 +0300 Subject: [PATCH 09/11] fix: phpstan --- includes/admin/feedzy-rss-feeds-admin.php | 4 +++- phpstan-baseline.neon | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index 4f9330129..daa8fbf2c 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -962,6 +962,7 @@ public function feedzy_filter_plugin_row_meta( $links, $file ) { * * @since 3.0.12 * @access public + * @return void */ public function feedzy_menu_pages() { $capability = feedzy_current_user_can(); @@ -1026,8 +1027,9 @@ public function feedzy_menu_pages() { * Handle the RSS to Social menu item. * * @access public + * @return void */ - public function rss_to_social_menu(): void { + public function rss_to_social_menu() { $capability = feedzy_current_user_can(); if ( ! $capability ) { return; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 079a27453..48144c95d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -630,11 +630,6 @@ parameters: count: 1 path: includes/admin/feedzy-rss-feeds-admin.php - - - message: "#^Method Feedzy_Rss_Feeds_Admin\\:\\:feedzy_menu_pages\\(\\) has no return type specified\\.$#" - count: 1 - path: includes/admin/feedzy-rss-feeds-admin.php - - message: "#^Method Feedzy_Rss_Feeds_Admin\\:\\:feedzy_remove_elementor_feature\\(\\) has no return type specified\\.$#" count: 1 From 315694c54779d1d4ab66265a82e740ade1bf06b8 Mon Sep 17 00:00:00 2001 From: Soare Robert-Daniel Date: Tue, 12 Aug 2025 16:59:52 +0300 Subject: [PATCH 10/11] fix: flag marking on redirection from onboarding --- includes/admin/feedzy-rss-feeds-admin.php | 15 ++++++++++++++- includes/layouts/setup-wizard.php | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index daa8fbf2c..16a1dce3d 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -1663,7 +1663,20 @@ public function feedzy_dismiss_wizard( $redirect_to_dashboard = true ) { update_option( 'feedzy_fresh_install', $status ); delete_option( 'feedzy_wizard_data' ); if ( false !== $redirect_to_dashboard ) { - wp_safe_redirect( remove_query_arg( array( 'action', 'status' ) ) ); + + $cleaned_url = remove_query_arg( array( 'page', 'action', 'status' ) ); + $parsed_url = wp_parse_url( $cleaned_url ); + + // Default to dashboard if no page is set. + if ( + isset( $parsed_url['path'] ) && + strpos( $parsed_url['path'], '/wp-admin/admin.php' ) !== false && + empty( $parsed_url['query'] ) + ) { + $cleaned_url = add_query_arg( 'page', 'feedzy-support', $cleaned_url ); + } + + wp_safe_redirect( $cleaned_url ); exit; } return true; diff --git a/includes/layouts/setup-wizard.php b/includes/layouts/setup-wizard.php index 9b3c349ac..d729e9eab 100644 --- a/includes/layouts/setup-wizard.php +++ b/includes/layouts/setup-wizard.php @@ -5,9 +5,9 @@ * @package Feedzy_Rss_Feeds */ -$dashboard_url = add_query_arg( +// Note: It will be redirect to dashboard by `feedzy_dismiss_wizard` action. +$skip_onboarding_url_callback = add_query_arg( array( - 'page' => 'feedzy-support', 'action' => 'feedzy_dismiss_wizard', 'status' => 0, ), @@ -34,7 +34,7 @@
    - +
    From d2177f7847d5cda33ca5e6ff4fb0c8dadb3fd554 Mon Sep 17 00:00:00 2001 From: Soare Robert-Daniel Date: Tue, 12 Aug 2025 17:15:46 +0300 Subject: [PATCH 11/11] fix: handle shortcode and feed cases for Skip --- includes/admin/feedzy-rss-feeds-admin.php | 57 ++++++++++++++++------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index 16a1dce3d..cd9e9e5ff 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -1880,7 +1880,12 @@ private function setup_wizard_subscribe_process() { $segment = 1; $response = array( 'status' => 1, - 'redirect_to' => add_query_arg( 'post_type', 'feedzy_imports', admin_url( 'edit.php' ) ), + 'redirect_to' => add_query_arg( + array( + 'page' => 'feedzy-support', + ), + admin_url( 'admin.php' ) + ), 'message' => __( 'Redirecting to Feedzy dashboard', 'feedzy-rss-feeds' ), ); @@ -1905,30 +1910,48 @@ private function setup_wizard_subscribe_process() { } else { $response = array( 'status' => 1, - 'redirect_to' => add_query_arg( 'post_type', 'feedzy_imports', admin_url( 'edit.php' ) ), + 'redirect_to' => add_query_arg( + array( + 'page' => 'feedzy-support', + ), + admin_url( 'admin.php' ) + ), 'message' => __( 'Redirecting to Feedzy dashboard', 'feedzy-rss-feeds' ), ); } } elseif ( 'page_builder' === $integrate_with ) { - $post_edit_link = get_edit_post_link( $page_id, 'db' ); - // Get elementor edit page link. - if ( defined( 'ELEMENTOR_PATH' ) && class_exists( 'Elementor\Widget_Base' ) ) { - $segment = 3; - $post_edit_link = add_query_arg( - array( - 'post' => $page_id, - 'action' => 'elementor', + if ( empty( $page_id ) ) { + $response = array( + 'status' => 1, + 'redirect_to' => add_query_arg( + array( + 'page' => 'feedzy-support', + ), + admin_url( 'admin.php' ) ), - admin_url( 'post.php' ) + 'message' => __( 'Redirecting to Feedzy dashboard', 'feedzy-rss-feeds' ), ); } else { - $segment = 4; + $post_edit_link = get_edit_post_link( $page_id, 'db' ); + // Get elementor edit page link. + if ( defined( 'ELEMENTOR_PATH' ) && class_exists( 'Elementor\Widget_Base' ) ) { + $segment = 3; + $post_edit_link = add_query_arg( + array( + 'post' => $page_id, + 'action' => 'elementor', + ), + admin_url( 'post.php' ) + ); + } else { + $segment = 4; + } + $response = array( + 'status' => 1, + 'redirect_to' => $post_edit_link, + 'message' => __( 'Redirecting to draft page', 'feedzy-rss-feeds' ), + ); } - $response = array( - 'status' => 1, - 'redirect_to' => $post_edit_link, - 'message' => __( 'Redirecting to draft page', 'feedzy-rss-feeds' ), - ); } if ( $with_subscribe && is_email( $email ) ) { update_option( 'feedzy_rss_feeds_logger_flag', 'yes' );