Merged
Conversation
Contributor
There was a problem hiding this comment.
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_resizesetting to optionally disable placeholder-based behavior and skip loading gumlet.js. - Fix/adjust DOM fragment preprocessing by normalizing JSON-style escapes (e.g.,
\/) prior toDOMDocument::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 onis_auto_resize_enabled(), which means gumlet.js will not load even whenlazy_loadis 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 togumlet_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-functionallazy_loadtoggle.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.