Skip to content

New version release#16

Merged
akbansa merged 6 commits intomasterfrom
new-version
Mar 23, 2026
Merged

New version release#16
akbansa merged 6 commits intomasterfrom
new-version

Conversation

@akbansa
Copy link
Copy Markdown
Contributor

@akbansa akbansa commented Mar 23, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Releases plugin version 1.4.0 with changes aimed at improving DOM parsing of matched HTML fragments and adding a new advanced setting to control placeholder/gumlet.js behavior (Auto Resize).

Changes:

  • Add auto_resize setting to optionally disable placeholder-based behavior and skip loading gumlet.js.
  • Fix/adjust DOM fragment preprocessing by normalizing JSON-style escapes (e.g., \/) prior to DOMDocument::loadHTML.
  • Extend URL replacement to include .webp and update release metadata (readme/changelog/version).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/fragment-normalize-test.php Adds a CLI regression test for fragment normalization outside WordPress.
includes/gumlet-html-fragment.php Introduces gumlet_normalize_html_fragment_for_dom() helper used before DOM parsing.
includes/class-gumlet.php Gates gumlet.js enqueue on Auto Resize, adjusts tag rewriting logic, adds webp support, and switches DOM prep to the new normalizer.
includes/options-page.php Adds “Auto Resize” checkbox and enhances internal get_option() default handling.
gumlet.php Bumps plugin version, includes new helper file, and adds auto_resize to activation defaults.
readme.txt Updates stable tag and changelog entries for 1.4.0.
changelog.txt Adds 1.4.0 release notes.
Comments suppressed due to low confidence (1)

includes/class-gumlet.php:182

  • enqueue_script() is now gated on is_auto_resize_enabled(), which means gumlet.js will not load even when lazy_load is enabled. This effectively disables lazy-loading whenever Auto Resize is off, despite there being a separate Lazy Load setting exposed in the UI and passed to gumlet_wp_config. Consider loading gumlet.js when either auto-resize or lazy-load is enabled, or rename/re-scope the option/UI text so users don't end up with a non-functional lazy_load toggle.
    public function enqueue_script()
    {
        if (!empty($this->options['cdn_link']) && $this->isWelcome() && $this->is_auto_resize_enabled()) {
            if (isset($this->options['external_cdn_link'])) {
                $external_cdn_host = parse_url($this->options['external_cdn_link'], PHP_URL_HOST);
            }

            wp_register_script('gumlet-script-async', 'https://cdn.jsdelivr.net/npm/gumlet.js@3.0/dist/main.global.js');
            wp_localize_script('gumlet-script-async', 'gumlet_wp_config', array(
              'gumlet_host' => parse_url($this->options['cdn_link'], PHP_URL_HOST),
              'current_host' => isset($external_cdn_host) ? $external_cdn_host : parse_url(home_url('/'), PHP_URL_HOST),
              'lazy_load' => (!empty($this->options['lazy_load'])) ? 1 : 0,
              'width_from_img' => get_option('gumlet_width_from_img') ? 1 : 0,
              'width_from_flex' => get_option('gumlet_width_from_flex') ? 1 : 0,
              'min_width' => get_option('gumlet_min_width') ? get_option('gumlet_min_width') : '',
              'auto_compress' => (!empty($this->options['auto_compress'])) ? 1 : 0,
              "auto_webp" => (!empty($this->options['server_webp'])) ? 1 : 0,
              'quality' => (!empty($this->options['quality'])) ? $this->options['quality'] : 80
            ));
            wp_enqueue_script('gumlet-script-async');
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/class-gumlet.php
Comment thread includes/options-page.php Outdated
Comment thread includes/options-page.php
akbansa and others added 2 commits March 23, 2026 14:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@akbansa akbansa merged commit 5a5bbb0 into master Mar 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants