Fix Plugin Check issues across the codebase#2912
Open
Conversation
Address ~40 actionable items from the WordPress Plugin Check report: - Add ABSPATH guards to 15 files missing them - Fix readme.txt header mismatches (PHP 7.4, GPL-2.0-or-later, WP 6.9) - Remove deprecated wp_no_robots() fallback and fix wp_count_terms() signature - Convert unordered sprintf placeholders to ordered (%1$s, %2$s) in templates - Add missing translators comments for i18n strings with placeholders - Replace _e() with esc_html_e() in template files - Convert heredoc syntax to string concatenation (4 files) - Add proper escaping (wp_kses_post, esc_html) to template outputs - Remove load_plugin_textdomain() (WP auto-loads for .org plugins since 4.6) - Bundle jQuery UI CSS locally instead of loading from CDN - Rename chosen-sprite@2x.png to chosen-sprite-2x.png
# Conflicts: # readme.txt
The bundled jquery-ui.min.css references 11 sprite/background images via relative `images/...` paths, but only the CSS file was committed — every reference 404'd, breaking datepicker icons, dialog overlays, and button state backgrounds. Sourced from https://code.jquery.com/ui/1.13.3/themes/smoothness/images/ to match the bundled CSS version.
The earlier escape-hardening pass wrapped output from UI_Elements::*, Notice::*, and UI_Elements::actions_menu() in wp_kses_post(). Those helpers return trusted markup that includes elements wp_kses_post strips by default: * <input type="checkbox"> from wp_terms_checklist() — the term-checklist form field rendered labels with no checkboxes. * onclick handlers on action buttons — UI_Settings modal open/close buttons rendered inert. * onfocusout on the dashboard <details> actions menu — the menu no longer auto-closed on tab-out. * <svg> notice icons — silently stripped where Notice::render's docblock explicitly supports SVG icons. Revert each wrap and add a phpcs:ignore explaining why, matching the codebase's existing pattern for trusted helper output (e.g. get_job_listing_pagination in shortcodes.php). The $message variable in notice.php keeps wp_kses_post() since it's caller-supplied text.
Removing load_plugin_textdomain() is fine for .org-hosted installs,
since WordPress auto-loads translations from WP_LANG_DIR/plugins/. But
the previous code also explicitly loaded from the custom path
WP_LANG_DIR/wp-job-manager/wp-job-manager-{locale}.mo, and dropping that
silently broke translations for sites using that legacy location.
Add a minimal init callback that only loads from the legacy path when
the file exists. determine_locale() picks up admin/site/user locale
correctly in all contexts.
License declares GPL-2.0-or-later but the URI still pointed to the GPLv3 license text. Switch the URI to the GPL-2.0 license page (and upgrade to https while we're here).
The earlier baseline edit removed the WP_LANG_DIR entry along with the deleted load_plugin_textdomain() method. Adding load_legacy_textdomain() brought the constant reference back, so re-add the baseline entry to keep psalm green.
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.
Summary
Addresses ~40 actionable items from the WordPress Plugin Check report across 43 files.
Naming convention warnings and other false positives were intentionally skipped — see below.
Changes
Requires PHP(7.4),License(GPL-2.0-or-later),Tested up to(6.9) to match plugin headerwp_no_robots()fallback (WP 5.7+), fixedwp_count_terms()to use array-only signature (WP 5.6+)%sto%1$s/%2$sin 4 email/submission templates// translators:comments for strings with placeholders_e()withesc_html_e()in 4 templates; wrapped UI helper outputs withwp_kses_post(); addedesc_html()aroundsize_format()and$search_input<<<HTML/<<<CSSblocks to string concatenation in 4 filesload_plugin_textdomain()— WordPress auto-loads translations for .org-hosted plugins since WP 4.6code.jquery.com) with local copychosen-sprite@2x.png→chosen-sprite-2x.pngand updated CSS referenceIntentionally skipped
NonPrefixedHookname/NonPrefixedVariable/NonPrefixedFunctionwarnings — established public API, would be a breaking changetrademarked_term— can't rename the pluginplugin_updater_detectedin helper class — intentional for add-on license managementExceptionNotEscaped— exception messages aren't output to HTMLpaginate_links()output — WordPress core returns safe HTML$job_submitted_content— already sanitized withwp_kses_post()Test plan
find . -name '*.php' -exec php -l {} \;