Skip to content

fix: wp.org compliance — implicit global and handle collision in astra-notices#90

Merged
rajmohanreddy774 merged 2 commits into
masterfrom
wporg-compliance-fixes
May 20, 2026
Merged

fix: wp.org compliance — implicit global and handle collision in astra-notices#90
rajmohanreddy774 merged 2 commits into
masterfrom
wporg-compliance-fixes

Conversation

@rajmohanreddy774

Copy link
Copy Markdown
Contributor

Summary

  • Fix 1 — Implicit global (notices.js): Added var declaration to AstraNotices = {var AstraNotices = {. Without it the variable leaked into the global scope, which wp.org flags as a rejection-level issue.
  • Fix 2 — Script/style handle collision (class-bsf-admin-notices.php): Renamed all wp_register_script, wp_register_style, wp_enqueue_script, wp_enqueue_style handles from astra-notices to bsf-astra-notices. Generic handles like astra-notices collide with other plugins using the same name.
  • Fix 3 — Localized JS global renamed (class-bsf-admin-notices.php + notices.js): Renamed wp_localize_script object from astraNoticesbsfAstraNotices and updated notices.js to reference bsfAstraNotices._notice_nonce. Unprefixed globals are flagged by wp.org review.
  • Frozen (backward-compat): AJAX action astra-notice-dismiss, nonce astra-notices, CSS classes, option keys, and user meta keys are all unchanged.
  • Required for spectra-blocks wp.org submission — this library is bundled and must pass wp.org review.

Test plan

  • Verify admin notices render correctly on a test WordPress site
  • Dismiss a notice — confirm AJAX fires with action astra-notice-dismiss (Network tab) and nonce is present
  • Confirm notice stays dismissed after page reload (user meta persists)
  • Confirm no JS console errors on admin pages
  • Confirm no handle collision warnings in wp_register_script (test alongside a plugin that uses astra-notices handle)
  • Run phpcs --standard=phpcs.xml.dist class-bsf-admin-notices.php — no new violations
  • Test with spectra-blocks bundling this lib and confirm wp.org scanner no longer flags the implicit global or handle

@rajmohanreddy774 rajmohanreddy774 self-assigned this May 19, 2026
@rajmohanreddy774 rajmohanreddy774 merged commit f671df9 into master May 20, 2026
3 checks passed
@rajmohanreddy774 rajmohanreddy774 deleted the wporg-compliance-fixes branch May 20, 2026 07:50
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.

2 participants