Skip to content

Fix: Enforce WordPress Coding Standards compliance#232

Merged
sushmak02 merged 4 commits intorelease-candidatefrom
fix/wpcs-coding-standards
Mar 10, 2026
Merged

Fix: Enforce WordPress Coding Standards compliance#232
sushmak02 merged 4 commits intorelease-candidatefrom
fix/wpcs-coding-standards

Conversation

@akshayurankar48
Copy link
Contributor

Summary

Fixes #231

  • Add ABSPATH direct access guards to 5 files missing them (functions.php, init.php, settings.php, meta-boxes.php, admin/index.php)
  • Convert 80+ loose comparisons (== / !=) to strict (=== / !==) across all PHP files
  • Fix non-Yoda conditions to use constant-on-left pattern per WPCS
  • Add strict flag (true) to all in_array() calls missing it
  • Sanitize nonce values with sanitize_text_field( wp_unslash() ) before wp_verify_nonce() in admin settings
  • Replace print + exit with wp_die() for nonce failure messages
  • Replace raw header() redirect with wp_safe_redirect()
  • Escape site_url() output with esc_url()
  • Remove closing ?> PHP tags from PHP-only files
  • Fix equals sign alignment and remove double blank lines
  • Fix inline comment formatting

PHPCS result: 0 errors, 0 warnings after fixes (was 95+ violations before).

Test plan

  • Verify plugin activates without errors
  • Test all schema type outputs (Review, Event, Person, Product, Recipe, Software, Video, Article, Service)
  • Test admin settings save/reset for each schema type
  • Verify star rating submission works on frontend
  • Verify AJAX rating handlers work correctly
  • Run composer lint — should pass clean
  • Confirm no functional changes — only coding standards fixes

🤖 Generated with Claude Code

- Add ABSPATH direct access guards to 5 files missing them
- Convert 80+ loose comparisons (== / !=) to strict (=== / !==)
- Fix non-Yoda conditions to use constant-on-left pattern
- Add strict flag (true) to all in_array() calls
- Sanitize nonce values with sanitize_text_field(wp_unslash()) before wp_verify_nonce()
- Replace print/exit with wp_die() for nonce failures in admin settings
- Replace raw header() redirect with wp_safe_redirect()
- Escape site_url() output with esc_url()
- Remove closing PHP tags from PHP-only files
- Fix equals sign alignment and double blank lines
- Fix inline comment formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sushmak02 sushmak02 changed the base branch from master to release-candidate March 10, 2026 05:36
@sushmak02
Copy link
Contributor

@akshayurankar48 Resolve conflicts

@akshayurankar48
Copy link
Contributor Author

@akshayurankar48 Resolve conflicts

@sushmak02 Updated

@sushmak02 sushmak02 merged commit 07ac495 into release-candidate Mar 10, 2026
2 checks passed
@sushmak02 sushmak02 deleted the fix/wpcs-coding-standards branch March 10, 2026 06:46
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.

Enforce WordPress Coding Standards compliance

2 participants