Skip to content

Fixes #1003 Remove esc_html() when outputting data with HTML#1004

Merged
Mai-Saad merged 2 commits intodevelopfrom
fix/1003-ui-bulk
Jan 8, 2026
Merged

Fixes #1003 Remove esc_html() when outputting data with HTML#1004
Mai-Saad merged 2 commits intodevelopfrom
fix/1003-ui-bulk

Conversation

@remyperona
Copy link
Copy Markdown
Contributor

Description

Fixes #1003

The UI was displayed incorrectly on bulk optimization page showing raw HTML

Type of change

  • Bug fix (non-breaking change which fixes an issue).

Detailed scenario

What was tested

Tested the output on the bulk optimization page, content is displayed as expected

How to test

  • Go to bulk optimization page
  • Optimize some images to show the different sections
  • Validate everything is displayed correctly

Affected Features & Quality Assurance Scope

  • Bulk optimization UI page

Technical description

Documentation

TBD

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I did not introduce unnecessary complexity.

Unticked items justification

No tests applicable for this change

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Jan 6, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for f71ec9b1 (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f71ec9b) Report Missing Report Missing Report Missing
Head commit (e474232) 0 0 0.00%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1004) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Copy link
Copy Markdown

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

This PR fixes a UI display bug where HTML content was being escaped and shown as raw HTML text on the bulk optimization page. The fix removes esc_html() calls where the output intentionally contains safe HTML markup.

Key changes:

  • Removed esc_html() escaping from data fields that contain intentionally constructed HTML (counts, sizes, labels)
  • Added PHPCS ignore comments to suppress WordPress coding standard warnings for unescaped output
  • Applied the same pattern consistently used throughout the codebase (30+ similar instances)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
views/part-bulk-optimization-table-row-folder-type.php Removed esc_html() from count-optimized, count-errors, optimized-size, and original-size fields that contain safe HTML spans and links constructed in AbstractBulk::format_context_data()
views/input/selector.php Removed esc_html() from selector value displays and labels that contain SVG icons and formatted text from imagify_get_optimization_level_label()

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

Comment thread views/input/selector.php
@Mai-Saad Mai-Saad self-requested a review January 8, 2026 07:31
@Mai-Saad
Copy link
Copy Markdown
Contributor

Mai-Saad commented Jan 8, 2026

@remyperona Thanks for the PR, the #1003 is fixed.
Note:

  • while exploring here, can see Fatal error and plugin/buttons not displayed when adding image in nextgen gallery #1006 (already on develop)
  • when apply bulk optimization and when restore image, can see DB error, will check that on Fix Instantiation through singleton #1005 ====> fixed on 1005
    [08-Jan-2026 08:45:40 UTC] WordPress database error Unknown column 'optimized_size' in 'SELECT' for query SELECT SUM( optimized_size ) FROM wp_imagify_folders WHERE status = 'success' made by require_once('wp-admin/admin.php'), do_action('media_page_imagify-bulk-optimization'), WP_Hook->do_action, WP_Hook->apply_filters, Imagify_Views->display_bulk_page, imagify_get_bulk_stats, Imagify_Files_Stats::get_optimized_size, Imagify_Files_Stats::get_size

[08-Jan-2026 08:45:39 UTC] WordPress database error Unknown column 'status' in 'WHERE' for query DELETE FROM wp_imagify_folders WHERE status != 'success' OR status IS NULL made by update_option, sanitize_option, apply_filters('sanitize_option_imagify_settings'), WP_Hook->apply_filters, Imagify_Settings->populate_values_on_save, Imagify_Settings->populate_custom_folders, Imagify_Custom_Folders::remove_unoptimized_files_from_inactive_folders

@Mai-Saad Mai-Saad merged commit 5770d3c into develop Jan 8, 2026
11 checks passed
@Mai-Saad Mai-Saad deleted the fix/1003-ui-bulk branch January 8, 2026 11:52
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.

UI is corrupted at bulk optimization view

3 participants