Phase 17: Assets, i18n & Packaging
Finalize all client-facing assets, ensure every user-visible string is i18n-wrapped, and prepare the plugin for distribution.
Files Written
Section titled “Files Written”assets/css/admin.cssassets/js/admin.jstemplates/myaccount/wplm-licenses.phptemplates/myaccount/wplm-subscriptions.phpcomposer.jsonphpcs.xmlREADME.mdCHANGELOG.md
Admin CSS
Section titled “Admin CSS”Dashboard uses CSS Grid with auto-fit columns (min 240 px, 1 fr):
.wplm-dashboard-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;}Seven license status badge classes .wplm-status-0 through .wplm-status-6 use Bootstrap-compatible semantic colours without importing Bootstrap:
| Class | Color | Status |
|---|---|---|
.wplm-status-0 | Yellow | Pending |
.wplm-status-1 | Green | Active |
.wplm-status-2 | Grey | Inactive |
.wplm-status-3 | Red | Expired |
.wplm-status-4 | Cyan | Suspended |
.wplm-status-5 | Red | Revoked |
.wplm-status-6 | Dark | Terminated |
Admin JavaScript
Section titled “Admin JavaScript”Three interactive behaviours in assets/js/admin.js:
- Product panel field toggle —
#_wplm_is_licensedcheckbox shows/hides.wplm-license-conditionalfields on change and on page load. - Dangerous action confirm —
.wplm-confirm-actionelements show awindow.confirm()dialog with the message fromdata-confirmattribute. - Copy key to clipboard —
.wplm-copy-keybuttons writedata-keytonavigator.clipboard. - Keypair re-roll warning —
#wplm-reroll-keypairwarns that re-rolling invalidates all previously signed tokens.
All JavaScript uses jQuery (already loaded in wp-admin) wrapped in an IIFE, 'use strict'.
Internationalization
Section titled “Internationalization”All PHP files use:
esc_html__()/esc_html_e()for escaped text output__()/_e()for unescaped strings passed to JS viawp_localize_script()_n()for plurals- Text domain:
wp-license-manager(matchesText Domain:header in main plugin file)
JavaScript i18n strings are passed via wp_localize_script() in Menu::enqueue_assets():
wp_localize_script( 'wplm-admin', 'wplmAdmin', [ 'confirmText' => __( 'Are you sure?', 'wp-license-manager' ), 'copiedText' => __( 'Copied!', 'wp-license-manager' ), 'rerollWarning' => __( 'Re-rolling the keypair will invalidate all previously signed license tokens. Are you sure?', 'wp-license-manager' ),] );phpcs.xml
Section titled “phpcs.xml”PHP CodeSniffer ruleset enforces:
- WordPress + WordPress-Core + WordPress-Docs rulesets
- Text domain
wp-license-manager - Minimum PHP 7.4
- Minimum WordPress 5.8
- Excludes
vendor/,node_modules/,docs-site/,tests/
composer.json
Section titled “composer.json”{ "autoload": { "psr-4": { "WPLM\\": "src/" } }, "require-dev": { "phpunit/phpunit": "^9.0", "wp-coding-standards/wpcs": "^3.0", "squizlabs/php_codesniffer": "^3.7", "brain/monkey": "^2.6" }}