diff --git a/.distignore b/.distignore index 91c7f33..f00831e 100644 --- a/.distignore +++ b/.distignore @@ -21,3 +21,4 @@ .DS_Store /developer-guide.md /faq-guide.md +/user-guide.md diff --git a/README.txt b/README.txt index 8611d45..93a28c3 100644 --- a/README.txt +++ b/README.txt @@ -30,6 +30,8 @@ Woocommerce == Changelog == = 1.3.0 = +* Fix - The FAQ tab now expands and collapses. Its accordion shipped with no styles at all, so every answer was permanently open and the questions looked like plain text. +* Fix - Settings tabs show their default values on a site where the options have not been saved yet, instead of an empty Products Per Page box. * Fix - Custom CSS from the JavaScript/CSS tab now applies rules that use child or sibling combinators. Output was HTML-escaped inside the style tag, so a selector like "ul.products > li.product" shipped with an encoded arrow and silently never matched, while simple selectors kept working. * Fix - The bundled Font Awesome stylesheet now loads, so the default loading spinner is visible on themes that do not ship Font Awesome themselves. It was hooked too early to ever run. * Fix - Infinite scroll now waits until the shopper is near the end of the product list. It previously loaded the next page on any scroll, so the whole catalogue loaded while the shopper was still in the header. @@ -43,7 +45,9 @@ Woocommerce * New - Settings rebuilt on the shared Wbcom admin shell, matching the other Wbcom WooCommerce plugins, with a new Overview tab showing how the shop currently loads products. * New - Filter infinite_loader_scroll_threshold sets how close to the end of the list (in pixels, default 300) infinite scroll starts loading. * New - Filter infinite_loader_render_products_only returns false to go back to rendering the full archive, for themes that build their shop loop outside the standard WooCommerce loop templates. +* Improve - Multisite uninstall uses the supported get_sites() API rather than a direct database query. * Improve - A fresh activation now defaults to Load More instead of classic pagination. Existing sites keep the setting they saved. +* Dev - Settings registrations name their sanitize callback explicitly, and the user guide is no longer packaged in the release zip. * Dev - Added a build-freshness check (bin/verify-build-freshness.sh) that fails CI when a committed minified bundle does not match its source. = 1.2.2 = diff --git a/admin/class-infinite-loader-for-woocommerce-admin.php b/admin/class-infinite-loader-for-woocommerce-admin.php index 22d92df..58e42e0 100644 --- a/admin/class-infinite-loader-for-woocommerce-admin.php +++ b/admin/class-infinite-loader-for-woocommerce-admin.php @@ -418,10 +418,17 @@ private function render_overview_tab() { * @author Wbcom Designs */ public function infinite_loader_for_woocommerce_init_plugin_settings() { - register_setting( 'infinite_loader_admin_general_options', 'infinite_loader_admin_general_option', array( $this, 'validate_general_settings' ) ); - register_setting( 'infinite_loader_admin_button_options', 'infinite_loader_admin_button_option', array( $this, 'validate_button_settings' ) ); - register_setting( 'infinite_loader_admin_previous_button_options', 'infinite_loader_admin_previous_button_option', array( $this, 'validate_button_settings' ) ); - register_setting( 'infinite_loader_admin_css_js_options', 'infinite_loader_admin_css_js_option', array( $this, 'validate_css_js_settings' ) ); + /* + * The sanitize_callback key is spelled out rather than relying on + * register_setting()'s back-compat path, which wraps a bare callable + * third argument for you. That path works - the validators did run - + * but it reads like the callback is being ignored, and it is one core + * deprecation away from silently becoming true. + */ + register_setting( 'infinite_loader_admin_general_options', 'infinite_loader_admin_general_option', array( 'sanitize_callback' => array( $this, 'validate_general_settings' ) ) ); + register_setting( 'infinite_loader_admin_button_options', 'infinite_loader_admin_button_option', array( 'sanitize_callback' => array( $this, 'validate_button_settings' ) ) ); + register_setting( 'infinite_loader_admin_previous_button_options', 'infinite_loader_admin_previous_button_option', array( 'sanitize_callback' => array( $this, 'validate_button_settings' ) ) ); + register_setting( 'infinite_loader_admin_css_js_options', 'infinite_loader_admin_css_js_option', array( 'sanitize_callback' => array( $this, 'validate_css_js_settings' ) ) ); } /** diff --git a/admin/css/infinite-loader-for-woocommerce-admin.css b/admin/css/infinite-loader-for-woocommerce-admin.css index da008dc..bfa640c 100644 --- a/admin/css/infinite-loader-for-woocommerce-admin.css +++ b/admin/css/infinite-loader-for-woocommerce-admin.css @@ -359,3 +359,83 @@ select#infinity-loader-loading-type+.select2-container--default .select2-selecti grid-template-columns: repeat(2, minmax(0, 1fr)); } } + +/* FAQ accordion. + * + * The markup and the toggle script both shipped without any styles, so every + * answer was permanently open and the questions rendered as plain text with no + * hint they could be clicked. + * + * The script sets an inline max-height on the panel to open it and clears that + * value to close it, so the closed state has to come from CSS here - without a + * max-height of 0 there is nothing for "cleared" to fall back to. + */ +.wbcom-faq-accordion { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + width: 100%; + margin: 0; + padding: 14px 18px; + border: 1px solid #dcdcde; + border-radius: 4px; + background: #f6f7f7; + color: #1d2327; + font-size: 14px; + font-weight: 600; + text-align: left; + cursor: pointer; + transition: background 0.15s ease; +} + +.wbcom-faq-accordion + .wbcom-faq-accordion, +.wbcom-faq-panel + .wbcom-faq-accordion { + margin-top: 8px; +} + +.wbcom-faq-accordion:hover, +.wbcom-faq-accordion:focus-visible { + background: #eceded; +} + +.wbcom-faq-accordion:focus-visible { + outline: 2px solid #2271b1; + outline-offset: 1px; +} + +/* Chevron, rotated when the question is open. */ +.wbcom-faq-accordion::after { + content: ""; + flex: 0 0 auto; + width: 8px; + height: 8px; + border-right: 2px solid currentColor; + border-bottom: 2px solid currentColor; + transform: rotate(45deg) translate(-2px, -2px); + transition: transform 0.15s ease; +} + +.wbcom-faq-accordion.active::after { + transform: rotate(-135deg) translate(-2px, -2px); +} + +.wbcom-faq-accordion.active { + background: #e8f0f7; + border-color: #c3d4e3; +} + +.wbcom-faq-panel { + max-height: 0; + overflow: hidden; + padding: 0 18px; + border-inline: 1px solid transparent; + transition: max-height 0.2s ease; +} + +.wbcom-faq-panel p { + margin: 14px 0; + color: #50575e; + font-size: 13px; + line-height: 1.6; +} diff --git a/admin/partials/infinite-loader-for-woocommerce-setting-button-tab.php b/admin/partials/infinite-loader-for-woocommerce-setting-button-tab.php index b174086..c5e34dc 100644 --- a/admin/partials/infinite-loader-for-woocommerce-setting-button-tab.php +++ b/admin/partials/infinite-loader-for-woocommerce-setting-button-tab.php @@ -16,7 +16,7 @@ exit; } -$infinite_loader_button_setting = get_option( 'infinite_loader_admin_button_option' ); +$infinite_loader_button_setting = get_option( 'infinite_loader_admin_button_option', array() ); ?>