Skip to content

Phase 17: Assets, i18n & Packaging

Finalize all client-facing assets, ensure every user-visible string is i18n-wrapped, and prepare the plugin for distribution.

  • assets/css/admin.css
  • assets/js/admin.js
  • templates/myaccount/wplm-licenses.php
  • templates/myaccount/wplm-subscriptions.php
  • composer.json
  • phpcs.xml
  • README.md
  • CHANGELOG.md

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:

ClassColorStatus
.wplm-status-0YellowPending
.wplm-status-1GreenActive
.wplm-status-2GreyInactive
.wplm-status-3RedExpired
.wplm-status-4CyanSuspended
.wplm-status-5RedRevoked
.wplm-status-6DarkTerminated

Three interactive behaviours in assets/js/admin.js:

  1. Product panel field toggle#_wplm_is_licensed checkbox shows/hides .wplm-license-conditional fields on change and on page load.
  2. Dangerous action confirm.wplm-confirm-action elements show a window.confirm() dialog with the message from data-confirm attribute.
  3. Copy key to clipboard.wplm-copy-key buttons write data-key to navigator.clipboard.
  4. Keypair re-roll warning#wplm-reroll-keypair warns that re-rolling invalidates all previously signed tokens.

All JavaScript uses jQuery (already loaded in wp-admin) wrapped in an IIFE, 'use strict'.

All PHP files use:

  • esc_html__() / esc_html_e() for escaped text output
  • __() / _e() for unescaped strings passed to JS via wp_localize_script()
  • _n() for plurals
  • Text domain: wp-license-manager (matches Text 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' ),
] );

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/
{
"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"
}
}