Skip to content

Fix Plugin Check issues across the codebase#2912

Open
donnchawp wants to merge 7 commits intotrunkfrom
fix/plugin-check-issues
Open

Fix Plugin Check issues across the codebase#2912
donnchawp wants to merge 7 commits intotrunkfrom
fix/plugin-check-issues

Conversation

@donnchawp
Copy link
Copy Markdown
Contributor

@donnchawp donnchawp commented Feb 24, 2026

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

  • ABSPATH guards — added to 15 files missing them
  • readme.txt — fixed Requires PHP (7.4), License (GPL-2.0-or-later), Tested up to (6.9) to match plugin header
  • Deprecated functions — removed wp_no_robots() fallback (WP 5.7+), fixed wp_count_terms() to use array-only signature (WP 5.6+)
  • Ordered placeholders — converted %s to %1$s/%2$s in 4 email/submission templates
  • Translators comments — added missing // translators: comments for strings with placeholders
  • Escaping — replaced _e() with esc_html_e() in 4 templates; wrapped UI helper outputs with wp_kses_post(); added esc_html() around size_format() and $search_input
  • Heredoc removal — converted <<<HTML/<<<CSS blocks to string concatenation in 4 files
  • Removed load_plugin_textdomain() — WordPress auto-loads translations for .org-hosted plugins since WP 4.6
  • Bundled jQuery UI CSS — replaced external CDN URL (code.jquery.com) with local copy
  • Renamed chosen-sprite@2x.pngchosen-sprite-2x.png and updated CSS reference

Intentionally skipped

  • All NonPrefixedHookname / NonPrefixedVariable / NonPrefixedFunction warnings — established public API, would be a breaking change
  • trademarked_term — can't rename the plugin
  • plugin_updater_detected in helper class — intentional for add-on license management
  • ExceptionNotEscaped — exception messages aren't output to HTML
  • paginate_links() output — WordPress core returns safe HTML
  • $job_submitted_content — already sanitized with wp_kses_post()

Test plan

  • Verify PHP syntax: find . -name '*.php' -exec php -l {} \;
  • Re-run Plugin Check and confirm error count decreases
  • Smoke-test job submission flow and email templates (placeholder ordering)
  • Verify datepicker styling loads correctly (jQuery UI CSS)
  • Verify chosen dropdown retina sprites display correctly
  • Check job dashboard renders correctly (escaping changes, actions menu, notice dialogs)

Plugin build for cd3a566
📦 Download plugin zip
▶️ Open in playground

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
@donnchawp donnchawp marked this pull request as ready for review May 6, 2026 15:05
donnchawp added 5 commits May 6, 2026 16:33
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.
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.

1 participant