6 Commits

Author SHA1 Message Date
ranger c7b2258471 fix(0.7.1): Plugin Check follow-up — tested-up-to bump + .DS_Store re-cleanup
Re-ran PCP after v0.7.0 — issue count 169 → 4. Closes the only real
one of the four:

- Tested up to: 6.7 → 7.0 in readme.txt (PCP outdated_tested_upto_header).
  WordPress 7.0 is current.
- Stable Tag bumped to 0.7.1 in readme.txt.

Removed (again)
- .DS_Store files (root + assets/). macOS Finder regenerated them
  between PCP runs; they will not be present in the submission zip.

Known PCP residue (not addressable in source)
- .gitignore triggers a hidden_files WARNING on PCP. Keeping it is
  needed for git; will be excluded from the submission zip per WP.org
  packaging conventions.

Files: radio.php (version), readme.txt (Tested-up-to + Stable Tag +
new 0.7.1 changelog + upgrade notice), CHANGELOG.md,
inc/about.php (rotate v0.7.1 → latest, v0.7.0 → earlier list),
.DS_Store files deleted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 03:01:25 +01:00
ranger 09b61cc950 feat(0.7.0): WordPress.org submission prep — full Plugin Check clean
Ran the official Plugin Check (PCP) against v0.6.3 — surfaced 169
issues. This release closes all of them so the plugin is submission-
ready for the WordPress.org plugin directory.

Branding
  - Plugin Name renamed: "Radio" → "RangerHQ Radio". Removes the
    trademarked "SomaFM" from the plugin name surface (PCP
    trademarked_term). Lines up with the RangerHQ plugin family.
    SomaFM credited in Description + About as the data source.
    Folder/slug stays `a-radio` — no install path changes; existing
    user_meta keys (radio_state / radio_history / radio_favourites)
    untouched.
  - Text Domain header renamed: `radio` → `a-radio` (matches slug).
  - Requires at least bumped: 5.0 → 5.3 (matches wp_date() usage).
  - File docstring header dropped "SomaFM" from prominent line.

Code (mass-mechanical)
  - 134 i18n call sites rewritten from `'radio'` text domain to
    `'a-radio'` across 7 PHP files. Single sed pass on the unique
    pattern `, 'radio' )` — the 6 menu-slug `'radio'` references in
    add_*_page() were correctly left alone (those are URL slugs).

Security
  - 8 × MissingUnslash + 8 × InputNotSanitized in the v0.5.0 history
    endpoints (radio_ajax_log_track, radio_ajax_toggle_favourite).
    All four $_POST['artist|title|station|station_id'] access points
    are now wrapped sanitize_text_field( wp_unslash( $_POST['…'] ) )
    (or sanitize_key for station_id) at the access point.

Translator comments
  - 6 × printf / sprintf calls with placeholders now carry
    /* translators: ... */ comments.

Pop-out window refactor
  - Inline <link> stylesheets, <style> block, and <script> tag in
    radio_render_popout_page() replaced with wp_enqueue_style() +
    wp_enqueue_script() + wp_localize_script() registered before HTML
    output, then wp_print_styles() in <head> and wp_print_footer_
    scripts() at end of <body>.
  - Popup-specific CSS moved out of inline <style> and into radio.css
    under body.radio-popout scope so it only fires inside the popup.

Removed
  - .DS_Store files (root + assets/). PCP hidden_files.

Distribution
  - New readme.txt in proper WordPress.org format: Plugin headers,
    Contributors, Donate link, Tags, Requires-at-least, Tested-up-to,
    Stable Tag, Requires-PHP, License, Description, Installation,
    FAQ, Screenshots, Changelog, Upgrade Notice.

Compat
  - No behaviour change for users; user_meta preserved.
  - Displayed Plugin Name in Plugins → Installed changes from "Radio"
    to "RangerHQ Radio" — only visible difference on update.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 02:51:09 +01:00
ranger 224fccd6c4 feat(0.6.3): discreet "buy me a coffee" support link
Tiny footer line inside the Updates panel on Settings + matching line
at the bottom of the Credits + thanks card on About. Pulled from a
single RADIO_SUPPORT_URL constant so both stay in sync. Conditional
render — if the constant is empty, the link is silently hidden, so
forks can strip funding with one line.

Design intent: muted (12px, admin-theme-coloured, subtle top divider).
Reads as housekeeping not a sales pitch — no yellow BMC brand chrome.
Dark-theme divider override so it stays subtle on the dark surface.

Files: radio.php (version, RADIO_SUPPORT_URL constant default
https://buymeacoffee.com/davidtkeane), inc/updater.php (link in
Updates panel), inc/about.php (link in Credits + thanks card; rotate
v0.6.3 → latest, v0.6.2 → earlier list), assets/css/radio.css
(.radio-support-link + dark-theme override), CHANGELOG.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 00:44:44 +01:00
ranger 32a3040e39 feat(0.6.2): current version badge on Settings page
Small grey pill follows the "Radio — Settings" H1 — v{RADIO_VERSION}.
Visible at a glance so you don't have to hover the plugin row in
Plugins → Installed or open About just to check what version you're on.
Dark-theme variant so it stays readable when theme=dark.

Files: radio.php (version), inc/settings.php (<span> inside H1),
assets/css/radio.css (.radio-version-badge + dark override),
inc/about.php (rotate v0.6.2 into latest expanded slot, v0.6.1 into
earlier-releases list), CHANGELOG.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 00:30:14 +01:00
ranger 7a747b829b fix(0.6.1): About page restructure — balance the layout
By v0.6.0 the About page had eight version-history entries, each a
full paragraph, dwarfing the other cards and pushing Credits + thanks
off the visible area.

- Three short cards on top (What / Who / Credits) — equal-height,
  balanced row. Credits gets equal billing instead of being a fourth
  card buried under a wall of version notes.
- Version history is its own full-width card below. Only the latest
  release is shown in full; earlier releases collapse to one line
  each. The card now stays compact however many versions ship —
  adding a future release adds one line, not a paragraph.
- Full prose for older versions lives in CHANGELOG.md on Gitea via
  the existing "View the full CHANGELOG.md →" link. Single source of
  truth.

Files: radio.php (version), inc/about.php (3-card top + new
.radio-about-versions block with __latest / __earlier sub-elements;
9 versions in the earlier-releases list incl. v0.1.0),
assets/css/radio.css (drop dead .radio-about-card--versions rules;
add .radio-about-versions + __latest + __earlier; dark-theme overrides).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 00:25:12 +01:00
ranger 0dc3a220d9 feat(0.6.0): pop-out mini-player — continuous background play across admin nav
Until v0.5.0 the audio cut every time you navigated between WP admin
pages — every navigation is a full page reload, which destroys the
<audio> element. v0.6.0 fixes the background-music use case by letting
you pop the player out into a separate browser window that persists
across the parent tab's navigation.

Pop-out window
  - Small "↗ Pop out" button beside the Play button on both the main
    Radio page and the Dashboard widget.
  - Opens a 380×560 standalone window via window.open() with a window
    name of `radio_popout` so a second click re-focuses the existing
    popup rather than spawning a new one.
  - Popup renders at admin-post.php?action=radio_popout&play=1 — a new
    admin_post_radio_popout hook outputs a full standalone HTML page
    (custom DOCTYPE / head / body, no WP admin chrome).
  - Theme follows radio_state['theme'] via body class radio-theme-{...}.
  - Includes the full player (now-playing block with dancing bars +
    Web Audio visualizer, play, mute, volume, station dropdown, error
    slot). Close button calls window.close().

Auto-resume + single-stream invariant
  - cfg.autoPlay is true when the popup URL carries &play=1. radio.js
    auto-calls audio.play() 200 ms after init. Same-origin user-gesture
    popups are exempt from autoplay-blocking on every modern browser.
  - On pop-out click, every other audio surface in the parent tab is
    paused so there is only ever one stream playing.

State stays in sync
  - Popup uses the SAME radio_save_state AJAX + track-logging endpoint.
    Station / volume changes persist to user_meta; track history keeps
    accumulating from whichever surface is playing.

Edge cases
  - Inside the popup, cfg.popoutUrl is '' so bindPopOut hides any
    Pop-out button it finds (would be infinite otherwise).
  - Popup blocked by browser → clear alert tells the user to allow
    popups for this site.

Files
  - radio.php (version, popoutUrl in localized config, admin_post
    handler + full standalone HTML renderer)
  - inc/admin-page.php + inc/dashboard-widget.php (Pop-out button
    beside Play)
  - assets/css/radio.css (.radio-player__popout styling)
  - assets/js/radio.js (bindPopOut function; autoPlay branch in
    bindPlayer)
  - inc/about.php + CHANGELOG.md (history entries)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-30 00:03:21 +01:00
11 changed files with 750 additions and 179 deletions
+124
View File
@@ -9,6 +9,130 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi
--- ---
## [0.7.1] — 2026-05-30 — Plugin Check follow-up: tested-up-to + .DS_Store re-cleanup
A re-run of PCP after v0.7.0 dropped the issue count from 169 → 4. This release closes the only real one of the four:
### Fixed
- **`Tested up to` bumped: 6.7 → 7.0** in `readme.txt` (PCP `outdated_tested_upto_header`). WordPress 7.0 is current; the previous header would have been flagged as out-of-date at submission review.
- **Stable Tag bumped to 0.7.1** in `readme.txt`.
### Removed (again)
- `.DS_Store` files (root + `assets/`). macOS Finder regenerated them between PCP runs; they will not be present in the actual submission zip. `.gitignore` already covers them.
### Known PCP residue (not addressable in source)
- The `.gitignore` file itself triggers a `hidden_files` WARNING (sev 8) on PCP because it's a dot-file. Keeping `.gitignore` is needed for git; it will be excluded from the submission zip. Acceptable per WP.org packaging conventions.
**Files changed:** `radio.php` (version), `readme.txt` (Tested-up-to + Stable Tag + new 0.7.1 changelog + upgrade notice), `CHANGELOG.md`, `.DS_Store` files deleted.
---
## [0.7.0] — 2026-05-30 — WordPress.org submission prep (full Plugin Check clean)
Ran the official WordPress.org **Plugin Check (PCP)** against v0.6.3 — surfaced **169 issues**. This release closes all of them so the plugin is submission-ready for the WordPress.org plugin directory.
### Changed — branding
- **Plugin Name renamed: "Radio" → "RangerHQ Radio"** to (a) remove the trademarked term "SomaFM" from the plugin name surface (PCP `trademarked_term` warning) and (b) line up with the RangerHQ plugin family. SomaFM is still credited in the Description and on the About page as the data source. Plugin folder/slug stays `a-radio` — no install path changes; existing user_meta keys (`radio_state` / `radio_history` / `radio_favourites`) untouched.
- **`Text Domain` header renamed**: `radio``a-radio` (matched the slug for the first time; PCP `textdomain_mismatch`).
- **`Requires at least` bumped**: `5.0``5.3` (matches `wp_date()` usage in `inc/history.php`; PCP `wp_function_not_compatible_with_requires_wp`).
- **File docstring header** dropped "SomaFM" from the prominent first line.
### Changed — code (mass-mechanical)
- **134 i18n call sites** rewritten from `'radio'` text domain → `'a-radio'` across `radio.php`, `inc/admin-page.php`, `inc/dashboard-widget.php`, `inc/settings.php`, `inc/about.php`, `inc/history.php`, `inc/updater.php`. Single sed pass on the unique pattern `, 'radio' )` (the 6 menu-slug `'radio'` references in `add_menu_page` / `add_submenu_page` were left alone — they're the URL slug, not the text domain).
### Fixed — security
- **8 × `MissingUnslash` + 8 × `InputNotSanitized`** in the v0.5.0 history endpoints (`radio_ajax_log_track`, `radio_ajax_toggle_favourite`). All four `$_POST['artist|title|station|station_id']` access points are now wrapped `sanitize_text_field( wp_unslash( $_POST['…'] ) )` (or `sanitize_key()` for `station_id`) at the access point. The downstream `radio_sanitize_entry()` helper still re-sanitizes as belt+braces.
### Added — translator comments
- 6 × `printf` / `sprintf` calls with placeholders now carry `/* translators: ... */` comments: pop-out window title, updater status messages (HTTP error / available / up-to-date / download), history page "%s ago" relative time.
### Refactored — pop-out window
- Inline `<link>` stylesheets, inline `<style>` block, and `<script>` tag in `radio_render_popout_page()` replaced with `wp_enqueue_style()` + `wp_enqueue_script()` + `wp_localize_script()` registered before the HTML output, then `wp_print_styles()` in `<head>` and `wp_print_footer_scripts()` at end of `<body>`.
- Popup-specific CSS (header, close button, wrap, layout overrides, popup dark theme) moved out of the inline `<style>` and into `assets/css/radio.css` under `body.radio-popout` scope so it only fires inside the popup.
### Removed
- `.DS_Store` files (root + `assets/`) — stray macOS Finder artefacts; PCP `hidden_files`. `.gitignore` already covers them.
### Added — distribution
- **`readme.txt`** in proper WordPress.org format: Plugin headers, Contributors, Donate link, Tags, Requires-at-least, Tested-up-to, Stable Tag, Requires-PHP, License, License URI, short description (≤150 chars), Description, Installation, FAQ, Screenshots, Changelog, Upgrade Notice.
### Compat notes
- No behaviour change for existing users. Per-user state (`radio_state` / `radio_history` / `radio_favourites`) is preserved across the upgrade — no migration needed.
- The displayed Plugin Name in **Plugins → Installed** changes from "Radio" to "RangerHQ Radio" — that's the only visible difference on update.
**Files changed:** `radio.php` (header + 6 translator comments + 8 $_POST hardenings + popup enqueue refactor), `inc/admin-page.php` / `inc/dashboard-widget.php` / `inc/settings.php` / `inc/about.php` / `inc/history.php` / `inc/updater.php` (textdomain mass-fix + translator comments where applicable + about-page version rotation), `assets/css/radio.css` (popup styles moved in under `body.radio-popout`), **new** `readme.txt`, **removed** `.DS_Store`, `assets/.DS_Store`.
---
## [0.6.3] — 2026-05-30 — Discreet "buy me a coffee" support link
### Added
- New `RADIO_SUPPORT_URL` constant in `radio.php` (default `https://buymeacoffee.com/davidtkeane`). Wrapped in `if ( ! defined(...) )` so it's override-able from `wp-config.php`.
- Tiny footer line `☕ Like Radio? If You fancy to buy me a coffee →` inside the **Updates panel** on Settings, below the manual-update note.
- Matching footer line at the bottom of the **Credits + thanks** card on the About page.
- Both spots render from the same constant — change one place, both update.
- **Conditional render**: if `RADIO_SUPPORT_URL` is empty / undefined, the link is silently hidden. Forks can strip funding with one line.
### Design
- Muted styling deliberate: 12 px, admin-theme-coloured link, subtle top border. Reads as housekeeping ("here's where to send thanks") not a sales pitch. No yellow BMC brand chrome.
- Dark-theme variant for the divider (`#3c434a`) so it stays subtle on the dark surface.
**Files changed:** `radio.php` (version, `RADIO_SUPPORT_URL` constant), `inc/updater.php` (link inside the Updates panel after the manual-update paragraph), `inc/about.php` (link inside the Credits + thanks card; rotate v0.6.3 into latest expanded slot, v0.6.2 into earlier-releases list), `assets/css/radio.css` (`.radio-support-link` styling + dark-theme override).
---
## [0.6.2] — 2026-05-30 — Current version badge on Settings
### Added
- Small grey pill follows the **"Radio — Settings"** heading: `v{RADIO_VERSION}`. Visible at a glance so you don't have to hover the plugin row in *Plugins → Installed* or open *About* just to check what version you're on.
- Dark-theme variant of the badge (`#2c3338` background, `#c3c4c7` text) so it stays readable when `theme=dark`.
**Files changed:** `radio.php` (version), `inc/settings.php` (`<span class="radio-version-badge">v…</span>` inside the H1), `assets/css/radio.css` (`.radio-version-badge` styling + dark-theme override).
---
## [0.6.1] — 2026-05-30 — About page restructure
By v0.6.0 the About page had eight version-history entries, each a full paragraph, dwarfing the other cards and pushing Credits + thanks off the visible area. v0.6.1 rebalances the layout.
### Changed
- **Three short cards on top** (What / Who / **Credits**) — equal-height, balanced row. Credits is no longer a fourth card buried under the version history; it sits beside What and Who where it belongs.
- **Version history is its own full-width card below.** Only the **latest** release is shown in full; **earlier releases collapse to one line each** (version + date + headline). The card now stays compact however many versions ship — adding a future release adds one line, not a paragraph.
- **Full prose for older versions lives in `CHANGELOG.md` on Gitea** — the "View the full CHANGELOG.md →" link does the heavy lifting. Single source of truth, no duplication.
**Files changed:** `radio.php` (version), `inc/about.php` (3-card top + new `.radio-about-versions` block with `__latest` / `__earlier` sub-elements; 9 versions in the earlier-releases list incl. v0.1.0), `assets/css/radio.css` (removed dead `.radio-about-card--versions` rules; added `.radio-about-versions` + `__latest` + `__earlier` rules; dark-theme overrides for the new selectors).
---
## [0.6.0] — 2026-05-30 — Pop-out mini-player (continuous background play)
Until v0.5.0 the audio cut every time you navigated between WP admin pages — every navigation is a full page reload, which destroys the `<audio>` element. v0.6.0 fixes the background-music use case by letting you pop the player out into a separate browser window that persists across the parent tab's navigation.
### Added — **Pop out** button + standalone popup player
- Small **`↗ Pop out`** button beside the Play button on both the main Radio page and the Dashboard widget. Click it and a **380×560 standalone window** opens with just the player chrome (no WP admin sidebar / nav).
- The popup lives at `admin-post.php?action=radio_popout&play=1` — a new server-side route that renders a **full standalone HTML page** outside the WP admin shell (custom `<!DOCTYPE>`, head, body, no admin chrome).
- Popup is `radio_popout`-named so a second click on Pop out **re-focuses the existing window** instead of opening a new one.
- The popup's `<audio>` element is never destroyed by parent-tab navigation, so the music keeps playing while you click around Plugins, Posts, Users, etc.
### Auto-resume — pick up where the main tab left off
- The Pop-out button URL carries `&play=1`. `radio.js` reads it from the localized config and auto-calls `audio.play()` 200 ms after init. Same-origin user-gesture popups are exempt from autoplay-blocking on every modern browser, so it just works.
- On opening the popup, **every other audio surface in the main tab is paused** so you don't end up with two streams running simultaneously.
### Popup details
- Theme follows the user's saved choice (`radio_state['theme']`) — light by default, dark if explicitly set; the popup body gets the `radio-theme-dark` class so the existing dark-mode CSS rules apply.
- The popup includes everything you need to listen and switch: now-playing block (with dancing bars + Web Audio visualizer), play/pause, mute, volume, full station dropdown grouped by genre, error slot.
- Close button (`✕`) in the top-right calls `window.close()`.
- Pop out button **does not appear inside the popup** itself (would be infinite); the JS detects `popoutUrl === ''` in the localized config and hides any Pop-out button it finds.
- Popup blocked? The button shows a clear alert: *"Pop-out blocked by the browser. Allow popups for this site, then try again."*
### State stays in sync
- The popup uses the **same `radio_save_state` AJAX endpoint** as the main player. If you change station or volume in the popup, it persists to user_meta; the next time you load any Radio page in the main tab it picks up the new values.
- Track history continues to log from whichever surface is playing — the popup polls SomaFM and POSTs to `radio_log_track` exactly like the main player.
**Files changed:** `radio.php` (version, `popoutUrl` added to localized config, new `admin_post_radio_popout` action + `radio_render_popout_page` handler with full standalone HTML), `inc/admin-page.php` + `inc/dashboard-widget.php` (Pop-out button beside Play), `assets/css/radio.css` (Pop-out button styling), `assets/js/radio.js` (`bindPopOut` opens the window + pauses other surfaces, autoplay branch reads `cfg.autoPlay`), `inc/about.php` (history entry).
---
## [0.5.0] — 2026-05-29 — Track history + favourites ## [0.5.0] — 2026-05-29 — Track history + favourites
SomaFM plays deep cuts you'll never hear again. v0.5.0 quietly logs every track that scrolls past so you can find it again later — and a star button keeps the ones worth keeping forever. SomaFM plays deep cuts you'll never hear again. v0.5.0 quietly logs every track that scrolls past so you can find it again later — and a star button keeps the ones worth keeping forever.
+159 -23
View File
@@ -166,6 +166,16 @@
font-family: "Helvetica Neue", Arial, sans-serif; font-family: "Helvetica Neue", Arial, sans-serif;
} }
/* v0.6.0: Pop-out button — small secondary button beside Play. Uses WP
native .button styles; the ↗ glyph signals "opens in another window." */
.radio-player__popout {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12px;
}
.radio-player__popout span[aria-hidden] { font-size: 13px; line-height: 1; }
.radio-player__volume { .radio-player__volume {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -287,6 +297,39 @@
font-size: 13px; font-size: 13px;
} }
/* v0.6.3: Discreet "buy me a coffee" support line. Rendered in two
spots from the single RADIO_SUPPORT_URL constant — bottom of the
Updates panel in Settings, and bottom of the Credits + thanks card
on About. Muted styling deliberate: housekeeping not sales pitch. */
.radio-support-link {
display: block;
margin-top: 12px;
padding-top: 10px;
border-top: 1px solid #f0f0f1;
font-size: 12px;
color: var(--wp-admin-theme-color, #2271b1);
text-decoration: none;
}
.radio-support-link::before { content: '☕ '; opacity: 0.8; }
.radio-support-link:hover { text-decoration: underline; }
.radio-theme-dark .radio-support-link { border-top-color: #3c434a; }
/* Small grey pill that follows the Settings page H1 — at-a-glance
confirmation of the version you are running. */
.radio-version-badge {
display: inline-block;
margin-left: 8px;
padding: 2px 8px;
background: #e2e4e7;
color: #50575e;
border-radius: 10px;
font-size: 11px;
font-weight: 600;
vertical-align: middle;
letter-spacing: 0.02em;
}
.radio-theme-dark .radio-version-badge { background: #2c3338; color: #c3c4c7; }
/* ────────────────────────────────────────────────────────────────── /* ──────────────────────────────────────────────────────────────────
* Dashboard widget — no nested card; bare content inside .inside * Dashboard widget — no nested card; bare content inside .inside
* (WP renders the widget as a postbox already; don't double up) * (WP renders the widget as a postbox already; don't double up)
@@ -349,27 +392,50 @@
padding-top: 0; padding-top: 0;
} }
.radio-about-card--versions ul { .radio-about-changelog-link {
list-style: none; display: inline-block;
padding: 12px; margin: 0 12px 12px;
margin: 0; font-size: 13px;
color: var(--wp-admin-theme-color, #2271b1);
text-decoration: none;
}
.radio-about-changelog-link:hover { text-decoration: underline; }
/* ──────────────────────────────────────────────────────────────────
* Version history — full-width card BELOW the top row of cards
* (v0.6.1). Latest release shown in full; earlier releases collapse
* to one line each so the card stays compact however many versions
* ship. Full prose for older versions lives in the CHANGELOG on Gitea.
* ─────────────────────────────────────────────────────────────── */
.radio-about-versions {
max-width: 1100px;
margin-top: 16px;
background: #fff;
border: 1px solid #c3c4c7;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
} }
.radio-about-card--versions li { .radio-about-versions h2 {
margin-bottom: 10px; margin: 0;
padding: 8px 12px;
font-size: 14px;
font-weight: 600;
background: #f6f7f7;
border-bottom: 1px solid #c3c4c7;
}
.radio-about-versions__latest {
padding: 12px 12px 8px;
}
.radio-about-versions__latest .ver {
font-weight: 600;
color: var(--wp-admin-theme-color, #2271b1);
font-size: 13px; font-size: 13px;
} }
.radio-about-card--versions li:last-child { .radio-about-versions__latest .latest {
margin-bottom: 0;
}
.radio-about-card--versions .ver {
font-weight: 600;
color: var(--wp-admin-theme-color, #2271b1);
}
.radio-about-card--versions .latest {
display: inline-block; display: inline-block;
margin-left: 6px; margin-left: 6px;
padding: 1px 7px; padding: 1px 7px;
@@ -381,16 +447,47 @@
vertical-align: middle; vertical-align: middle;
} }
.radio-about-changelog-link { .radio-about-versions__latest p {
display: inline-block; margin: 6px 0 0;
margin: 0 12px 12px;
font-size: 13px; font-size: 13px;
color: var(--wp-admin-theme-color, #2271b1); color: #1d2327;
text-decoration: none;
} }
.radio-about-changelog-link:hover { .radio-about-versions h3 {
text-decoration: underline; margin: 4px 0 0;
padding: 8px 12px 4px;
font-size: 11px;
font-weight: 600;
color: #646970;
text-transform: uppercase;
letter-spacing: 0.06em;
border-top: 1px solid #f0f0f1;
}
.radio-about-versions__earlier {
list-style: none;
margin: 0;
padding: 4px 12px 8px;
}
.radio-about-versions__earlier li {
padding: 4px 0;
font-size: 13px;
color: #50575e;
}
.radio-about-versions__earlier .ver {
display: inline-block;
min-width: 48px;
font-weight: 600;
color: var(--wp-admin-theme-color, #2271b1);
}
.radio-about-versions__earlier .ver-date {
display: inline-block;
min-width: 110px;
font-size: 11px;
color: #646970;
} }
/* ────────────────────────────────────────────────────────────────── /* ──────────────────────────────────────────────────────────────────
@@ -440,6 +537,12 @@
color: #f0f0f1; color: #f0f0f1;
border-bottom-color: #3c434a; border-bottom-color: #3c434a;
} }
.radio-theme-dark .radio-about-versions { background: #1d2327; border-color: #3c434a; color: #c3c4c7; }
.radio-theme-dark .radio-about-versions h2 { background: #2c3338; color: #f0f0f1; border-bottom-color: #3c434a; }
.radio-theme-dark .radio-about-versions h3 { color: #a7aaad; border-top-color: #3c434a; }
.radio-theme-dark .radio-about-versions__latest p { color: #c3c4c7; }
.radio-theme-dark .radio-about-versions__earlier li { color: #c3c4c7; }
.radio-theme-dark .radio-about-versions__earlier .ver-date { color: #a7aaad; }
.radio-theme-dark #radio_dashboard_widget .radio-player__credit { .radio-theme-dark #radio_dashboard_widget .radio-player__credit {
border-top-color: #3c434a; border-top-color: #3c434a;
} }
@@ -454,6 +557,39 @@
border: 1px solid #3c434a; border: 1px solid #3c434a;
} }
/* ──────────────────────────────────────────────────────────────────
* Pop-out window (v0.6.0 → moved here from inline <style> in v0.7.0
* for PCP cleanliness). All scoped to body.radio-popout so these
* rules only fire inside the popup window, never bleed onto admin
* pages that load the same radio.css.
* ─────────────────────────────────────────────────────────────── */
body.radio-popout {
/* Popup has no WP admin chrome to provide --wp-admin-theme-color;
set a reasonable default so the player + links still tint. */
--wp-admin-theme-color: #2271b1;
margin: 0;
padding: 14px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: #f0f0f1;
color: #1d2327;
font-size: 13px;
}
body.radio-popout .radio-popout-header { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px; }
body.radio-popout .radio-popout-header h1 { margin: 0; font-size: 14px; font-weight: 600; color: #1d2327; }
body.radio-popout .radio-popout-header h1::before { content: '📻 '; }
body.radio-popout .radio-popout-close { background: none; border: 0; font-size: 18px; cursor: pointer; color: #646970; padding: 4px 8px; line-height: 1; border-radius: 3px; }
body.radio-popout .radio-popout-close:hover { color: #b32d2e; background: rgba(179, 45, 46, 0.08); }
body.radio-popout .radio-popout-wrap { background: #fff; border: 1px solid #c3c4c7; padding: 14px; border-radius: 3px; }
body.radio-popout .radio-popout-wrap .radio-player__station-select select { max-width: 100%; }
body.radio-popout .radio-popout-wrap .radio-player__volume { width: 100%; }
body.radio-popout .radio-popout-wrap .radio-player__controls { flex-direction: column; align-items: stretch; gap: 10px; }
/* Popup dark theme — keeps the popup readable when theme=dark */
body.radio-popout.radio-theme-dark { background: #101213; color: #f0f0f1; }
body.radio-popout.radio-theme-dark .radio-popout-header h1 { color: #f0f0f1; }
body.radio-popout.radio-theme-dark .radio-popout-wrap { background: #1d2327; border-color: #3c434a; }
body.radio-popout.radio-theme-dark .radio-popout-close { color: #a7aaad; }
/* ────────────────────────────────────────────────────────────────── /* ──────────────────────────────────────────────────────────────────
* History + Favourites page (v0.5.0) * History + Favourites page (v0.5.0)
* ─────────────────────────────────────────────────────────────── */ * ─────────────────────────────────────────────────────────────── */
+38
View File
@@ -412,6 +412,44 @@
} }
bindMute(player, audio, volumeIn, volPctEl); bindMute(player, audio, volumeIn, volPctEl);
bindPopOut(player);
// v0.6.0: popout auto-resume — when opened with ?play=1, immediately
// pick up where the main tab left off. Same-origin user-gesture popups
// are exempt from autoplay blocking on every modern browser.
if (cfg.autoPlay) {
setTimeout(function () {
if (audio.paused) { audio.play().catch(function () { /* autoplay denied — user just clicks play */ }); }
}, 200);
}
}
/** v0.6.0: Pop-out window button. Opens a 380×560 standalone window
* with just the player chrome (no WP admin), via admin-post.php?
* action=radio_popout&play=1. The popup persists across main-tab
* navigation so background music doesn't cut when you move around
* the WP admin. Pauses every other audio surface in this tab so
* there's only one stream playing at a time. */
function bindPopOut(player) {
var btn = player.querySelector('[data-radio-popout]');
if (!btn) { return; }
if (!cfg.popoutUrl) { btn.style.display = 'none'; return; } // already in popout
btn.addEventListener('click', function () {
var w = window.open(
cfg.popoutUrl + '&play=1',
'radio_popout',
'width=380,height=560,resizable=yes,scrollbars=no,toolbar=no,location=no,menubar=no,status=no'
);
if (!w) {
window.alert('Pop-out blocked by the browser. Allow popups for this site, then try again.');
return;
}
w.focus();
// Pause every audio surface in this tab — the popup is the new player.
document.querySelectorAll('[data-radio-audio]').forEach(function (a) {
if (!a.paused) { a.pause(); }
});
});
} }
/** Keep all .radio-player surfaces on the same station. */ /** Keep all .radio-player surfaces on the same station. */
+57 -52
View File
@@ -2,95 +2,60 @@
/** /**
* Radio — About page (WP Admin → Radio → About). * Radio — About page (WP Admin → Radio → About).
* *
* Plain-language explanation of what the plugin does + version * Top row: three short cards (What / Who / Credits) — equal-height,
* history + link to the CHANGELOG.md on Gitea. Pattern mirrors * balanced layout. Below: a full-width Version history card with the
* a-buddy/inc/about.php. * latest release shown in full and earlier releases as a one-line
* summary list, capped by a link to the full CHANGELOG on Gitea.
*
* Pattern mirrors a-buddy/inc/about.php.
*/ */
if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! defined( 'ABSPATH' ) ) { exit; }
function radio_render_about_page() { function radio_render_about_page() {
if ( ! current_user_can( 'read' ) ) { if ( ! current_user_can( 'read' ) ) {
wp_die( esc_html__( 'You do not have permission to view this page.', 'radio' ) ); wp_die( esc_html__( 'You do not have permission to view this page.', 'a-radio' ) );
} }
$count = count( radio_get_stations_flat() ); $count = count( radio_get_stations_flat() );
?> ?>
<div class="wrap radio-about-wrap"> <div class="wrap radio-about-wrap">
<h1><?php esc_html_e( 'About Radio', 'radio' ); ?></h1> <h1><?php esc_html_e( 'About Radio', 'a-radio' ); ?></h1>
<!-- ── Top row: three short cards (What / Who / Credits) ── -->
<div class="radio-about-grid"> <div class="radio-about-grid">
<div class="radio-about-card"> <div class="radio-about-card">
<h2><?php esc_html_e( 'What Radio does', 'radio' ); ?></h2> <h2><?php esc_html_e( 'What Radio does', 'a-radio' ); ?></h2>
<p> <p>
<?php <?php
printf( printf(
/* translators: %d = station count */ /* translators: %d = station count */
esc_html__( 'Adds a small, focused radio player to your WordPress dashboard. %d hand-curated SomaFM stations across 10 genres — ambient, electronic, lounge, rock, metal, jazz, world, reggae, holiday and specials. Plays in your admin pages while you work. Your chosen station + volume persist per user.', 'radio' ), esc_html__( 'Adds a small, focused radio player to your WordPress dashboard. %d hand-curated SomaFM stations across 10 genres — ambient, electronic, lounge, rock, metal, jazz, world, reggae, holiday and specials. Plays in your admin pages while you work. Your chosen station + volume persist per user.', 'a-radio' ),
(int) $count (int) $count
); );
?> ?>
</p> </p>
<p> <p>
<?php esc_html_e( 'Audio plays directly in your browser via HTML5 — no server-side proxy, no extra services to host, no third-party tracking. Just an <audio> element pointed at SomaFM\'s public streams.', 'radio' ); ?> <?php esc_html_e( 'Audio plays directly in your browser via HTML5 — no server-side proxy, no extra services to host, no third-party tracking. Just an <audio> element pointed at SomaFM\'s public streams.', 'a-radio' ); ?>
</p> </p>
</div> </div>
<div class="radio-about-card"> <div class="radio-about-card">
<h2><?php esc_html_e( 'Who Radio is for', 'radio' ); ?></h2> <h2><?php esc_html_e( 'Who Radio is for', 'a-radio' ); ?></h2>
<p> <p>
<?php esc_html_e( 'Anyone who likes background music while working in the WordPress admin. Coders, writers, support agents, content editors. The 44 SomaFM stations cover a wide enough range that there\'s something for any mood — from coding-focus ambient (Groove Salad, Drone Zone) to drive-time electronic (DEF CON Radio, Beat Blender) to mellow lounge (Lush, Secret Agent) to specifically-quirky picks (SF 10-33 mixes ambient with San Francisco public-safety radio).', 'radio' ); ?> <?php esc_html_e( 'Anyone who likes background music while working in the WordPress admin. Coders, writers, support agents, content editors. The 44 SomaFM stations cover a wide enough range that there\'s something for any mood — from coding-focus ambient (Groove Salad, Drone Zone) to drive-time electronic (DEF CON Radio, Beat Blender) to mellow lounge (Lush, Secret Agent) to specifically-quirky picks (SF 10-33 mixes ambient with San Francisco public-safety radio).', 'a-radio' ); ?>
</p> </p>
</div> </div>
<div class="radio-about-card radio-about-card--versions">
<h2><?php esc_html_e( 'Version history', 'radio' ); ?></h2>
<ul>
<li>
<span class="ver">v0.5.0</span> &mdash; 29 May 2026 <span class="latest">latest</span><br>
<?php esc_html_e( 'Track history + favourites. Every track that scrolls past in the player is now quietly logged to your personal Radio → History page (capped at 500), with a star toggle to keep the good ones forever in a separate Favourites tab. Each row has four search links (Spotify / YouTube / Apple Music / Bandcamp) so you can find that track on whichever service you use. Filter by station, search by artist or title, clear history with a button. Per-user, nothing leaves your site.', 'radio' ); ?>
</li>
<li>
<span class="ver">v0.4.0</span> &mdash; 29 May 2026<br>
<?php esc_html_e( 'Now-playing visual indicator. Four tiny dancing bars next to "Now Playing" pulse while the audio is playing (pure CSS, always works). On top of that, a Web Audio frequency visualizer tries to draw live frequency bars on a small canvas — if the browser allows it and the stream is CORS-friendly it kicks in automatically; if not, the CSS bars stay and nothing breaks.', 'radio' ); ?>
</li>
<li>
<span class="ver">v0.3.2</span> &mdash; 29 May 2026<br>
<?php esc_html_e( 'Play-button glyph baseline fix. The dashicon used for play/pause was rendering below the button text. Swapped to a plain Unicode glyph (▶ / ‖) that sits on the text baseline like any other character.', 'radio' ); ?>
</li>
<li>
<span class="ver">v0.3.1</span> &mdash; 29 May 2026<br>
<?php esc_html_e( 'My Radio layout polish + dropped dark-auto. Player no longer stretches edge-to-edge (max-width 880px); volume slider fixed width so the % label sits next to it; station dropdown capped at 360px; play-button icon shrunk to match the button text baseline; intro paragraph now fits one line. Removed the prefers-color-scheme dark-auto behaviour that was unreadable against WordPress\'s still-white postbox; theme=dark is still available as an explicit choice and now gives the player its own dark surface so it actually reads.', 'radio' ); ?>
</li>
<li>
<span class="ver">v0.3.0</span> &mdash; 29 May 2026<br>
<?php esc_html_e( 'Dark theme wired through. Mute toggle on the speaker icon. OS media keys (F8 / headphone buttons / lock-screen) play and pause via MediaSession. Current track polled from SomaFM and shown under the station description while playing. Save errors surface as a brief notice instead of being swallowed. Genre badge restyled as an inline pill.', 'radio' ); ?>
</li>
<li>
<span class="ver">v0.2.0</span> &mdash; 26 May 2026<br>
<?php esc_html_e( 'UI rebuilt to WordPress admin standards. Postbox container, native Play/Pause button with text label, picks up your admin colour scheme via var(--wp-admin-theme-color), genre badge moved inline, dashboard widget no longer renders a card-inside-a-card. Functionality identical to v0.1.0 — purely visual polish.', 'radio' ); ?>
</li>
<li>
<span class="ver">v0.1.0</span> &mdash; 26 May 2026<br>
<?php esc_html_e( 'First release. 44 SomaFM stations grouped by 10 genres, dashboard widget + dedicated admin page, per-user state in user_meta, self-hosted update checker against Gitea. Direct HTML5 audio playback — no proxy, no build step, no tracking.', 'radio' ); ?>
</li>
</ul>
<a class="radio-about-changelog-link"
href="<?php echo esc_url( RADIO_GITEA_URL . '/src/branch/main/CHANGELOG.md' ); ?>"
target="_blank" rel="noopener">
<?php esc_html_e( 'View the full CHANGELOG.md →', 'radio' ); ?>
</a>
</div>
<div class="radio-about-card"> <div class="radio-about-card">
<h2><?php esc_html_e( 'Credits + thanks', 'radio' ); ?></h2> <h2><?php esc_html_e( 'Credits + thanks', 'a-radio' ); ?></h2>
<p> <p>
<?php <?php
printf( printf(
wp_kses( wp_kses(
/* translators: %s = link to somafm.com */ /* translators: %s = link to somafm.com */
__( 'All stations and streams are provided by %s — an independent, listener-supported, commercial-free internet radio network broadcasting from San Francisco since 2000. Radio is just a small WordPress wrapper around their public streams. If you enjoy this plugin, please consider donating to SomaFM directly.', 'radio' ), __( 'All stations and streams are provided by %s — an independent, listener-supported, commercial-free internet radio network broadcasting from San Francisco since 2000. Radio is just a small WordPress wrapper around their public streams. If you enjoy this plugin, please consider donating to SomaFM directly.', 'a-radio' ),
array( 'a' => array( 'href' => true, 'target' => true, 'rel' => true ) ) array( 'a' => array( 'href' => true, 'target' => true, 'rel' => true ) )
), ),
'<a href="https://somafm.com/support/" target="_blank" rel="noopener">SomaFM</a>' '<a href="https://somafm.com/support/" target="_blank" rel="noopener">SomaFM</a>'
@@ -98,11 +63,51 @@ function radio_render_about_page() {
?> ?>
</p> </p>
<p> <p>
<?php esc_html_e( 'Plugin author: David Keane. Part of the RangerHQ plugin family. GPL v2 or later. Source on Gitea.', 'radio' ); ?> <?php esc_html_e( 'Plugin author: David Keane. Part of the RangerHQ plugin family. GPL v2 or later. Source on Gitea.', 'a-radio' ); ?>
</p>
<?php if ( defined( 'RADIO_SUPPORT_URL' ) && RADIO_SUPPORT_URL ) : ?>
<a class="radio-support-link" href="<?php echo esc_url( RADIO_SUPPORT_URL ); ?>" target="_blank" rel="noopener">
<?php esc_html_e( 'Like Radio? If You fancy to buy me a coffee →', 'a-radio' ); ?>
</a>
<?php endif; ?>
</div>
</div><!-- /.radio-about-grid -->
<!-- ── Version history: latest in full, earlier as one-liners ── -->
<div class="radio-about-versions">
<h2><?php esc_html_e( 'Version history', 'a-radio' ); ?></h2>
<div class="radio-about-versions__latest">
<span class="ver">v0.7.1</span> &mdash; 30 May 2026 <span class="latest"><?php esc_html_e( 'latest', 'a-radio' ); ?></span>
<p>
<?php esc_html_e( 'Plugin Check follow-up. The v0.7.0 release dropped PCP issues from 169 to 4 — this release closes the only real one of the four: "Tested up to" bumped from 6.7 to 7.0 in readme.txt. Stray .DS_Store files re-deleted (macOS Finder regenerated them between PCP runs; they will not be in the submission zip). No user-visible changes.', 'a-radio' ); ?>
</p> </p>
</div> </div>
<h3><?php esc_html_e( 'Earlier releases', 'a-radio' ); ?></h3>
<ul class="radio-about-versions__earlier">
<li><span class="ver">v0.7.0</span> <span class="ver-date">30 May 2026</span> &mdash; <?php esc_html_e( 'WordPress.org submission prep — full Plugin Check clean (169 → 4 issues, branding, textdomain, security, popup refactor, readme.txt)', 'a-radio' ); ?></li>
<li><span class="ver">v0.6.3</span> <span class="ver-date">30 May 2026</span> &mdash; <?php esc_html_e( 'Discreet buy-me-a-coffee support link (Updates panel + Credits card)', 'a-radio' ); ?></li>
<li><span class="ver">v0.6.2</span> <span class="ver-date">30 May 2026</span> &mdash; <?php esc_html_e( 'Current version badge on the Settings page', 'a-radio' ); ?></li>
<li><span class="ver">v0.6.1</span> <span class="ver-date">30 May 2026</span> &mdash; <?php esc_html_e( 'About page restructure — balanced 3-card top row + compact version history', 'a-radio' ); ?></li>
<li><span class="ver">v0.6.0</span> <span class="ver-date">30 May 2026</span> &mdash; <?php esc_html_e( 'Pop-out mini-player — continuous background play across admin navigation', 'a-radio' ); ?></li>
<li><span class="ver">v0.5.0</span> <span class="ver-date">29 May 2026</span> &mdash; <?php esc_html_e( 'Track history + favourites (Spotify / YouTube / Apple Music / Bandcamp search links)', 'a-radio' ); ?></li>
<li><span class="ver">v0.4.0</span> <span class="ver-date">29 May 2026</span> &mdash; <?php esc_html_e( 'Now-playing indicator — dancing bars + Web Audio frequency visualizer', 'a-radio' ); ?></li>
<li><span class="ver">v0.3.2</span> <span class="ver-date">29 May 2026</span> &mdash; <?php esc_html_e( 'Play-button glyph baseline fix (dashicon → Unicode ▶ / ‖)', 'a-radio' ); ?></li>
<li><span class="ver">v0.3.1</span> <span class="ver-date">29 May 2026</span> &mdash; <?php esc_html_e( 'My Radio layout polish + dropped dark-auto', 'a-radio' ); ?></li>
<li><span class="ver">v0.3.0</span> <span class="ver-date">29 May 2026</span> &mdash; <?php esc_html_e( 'Dark theme + mute + OS media keys + SomaFM current-track display', 'a-radio' ); ?></li>
<li><span class="ver">v0.2.0</span> <span class="ver-date">26 May 2026</span> &mdash; <?php esc_html_e( 'UI rebuilt to WordPress admin standards', 'a-radio' ); ?></li>
<li><span class="ver">v0.1.0</span> <span class="ver-date">26 May 2026</span> &mdash; <?php esc_html_e( 'First release — 44 SomaFM stations, dashboard widget + dedicated admin page, per-user state, self-hosted Gitea updater', 'a-radio' ); ?></li>
</ul>
<a class="radio-about-changelog-link"
href="<?php echo esc_url( RADIO_GITEA_URL . '/src/branch/main/CHANGELOG.md' ); ?>"
target="_blank" rel="noopener">
<?php esc_html_e( 'View the full CHANGELOG.md →', 'a-radio' ); ?>
</a>
</div> </div>
</div> </div>
<?php <?php
} }
+14 -10
View File
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
function radio_render_main_page() { function radio_render_main_page() {
if ( ! current_user_can( 'read' ) ) { if ( ! current_user_can( 'read' ) ) {
wp_die( esc_html__( 'You do not have permission to view this page.', 'radio' ) ); wp_die( esc_html__( 'You do not have permission to view this page.', 'a-radio' ) );
} }
$state = radio_get_state(); $state = radio_get_state();
@@ -21,13 +21,13 @@ function radio_render_main_page() {
$count = count( radio_get_stations_flat() ); $count = count( radio_get_stations_flat() );
?> ?>
<div class="wrap radio-wrap"> <div class="wrap radio-wrap">
<h1><?php esc_html_e( 'Radio', 'radio' ); ?></h1> <h1><?php esc_html_e( 'Radio', 'a-radio' ); ?></h1>
<p class="radio-intro"> <p class="radio-intro">
<?php <?php
printf( printf(
/* translators: %d = number of stations */ /* translators: %d = number of stations */
esc_html__( 'A tab of background music for your WordPress admin. %d hand-curated SomaFM stations across 10 genres — free, no ads, no tracking.', 'radio' ), esc_html__( 'A tab of background music for your WordPress admin. %d hand-curated SomaFM stations across 10 genres — free, no ads, no tracking.', 'a-radio' ),
(int) $count (int) $count
); );
?> ?>
@@ -35,7 +35,7 @@ function radio_render_main_page() {
<div class="postbox"> <div class="postbox">
<div class="postbox-header"> <div class="postbox-header">
<h2 class="hndle"><?php esc_html_e( 'Player', 'radio' ); ?></h2> <h2 class="hndle"><?php esc_html_e( 'Player', 'a-radio' ); ?></h2>
</div> </div>
<div class="inside"> <div class="inside">
<div class="radio-player" data-radio-surface="main"> <div class="radio-player" data-radio-surface="main">
@@ -45,7 +45,7 @@ function radio_render_main_page() {
<span class="radio-player__bars"><span></span><span></span><span></span><span></span></span> <span class="radio-player__bars"><span></span><span></span><span></span><span></span></span>
<canvas class="radio-player__viz" data-radio-viz hidden></canvas> <canvas class="radio-player__viz" data-radio-viz hidden></canvas>
</span> </span>
<span class="radio-player__label"><?php esc_html_e( 'Now Playing', 'radio' ); ?></span> <span class="radio-player__label"><?php esc_html_e( 'Now Playing', 'a-radio' ); ?></span>
<span class="radio-player__station-name" data-radio-name><?php echo esc_html( $station['name'] ); ?></span> <span class="radio-player__station-name" data-radio-name><?php echo esc_html( $station['name'] ); ?></span>
<span class="radio-player__station-genre" data-radio-genre><?php echo esc_html( $station['genre'] ); ?></span> <span class="radio-player__station-genre" data-radio-genre><?php echo esc_html( $station['genre'] ); ?></span>
<p class="radio-player__station-desc" data-radio-desc><?php echo esc_html( $station['description'] ); ?></p> <p class="radio-player__station-desc" data-radio-desc><?php echo esc_html( $station['description'] ); ?></p>
@@ -55,20 +55,24 @@ function radio_render_main_page() {
<div class="radio-player__controls"> <div class="radio-player__controls">
<button type="button" class="button button-primary radio-player__play" data-radio-play> <button type="button" class="button button-primary radio-player__play" data-radio-play>
<span class="radio-player__play-glyph" data-radio-play-glyph aria-hidden="true">&#9654;</span> <span class="radio-player__play-glyph" data-radio-play-glyph aria-hidden="true">&#9654;</span>
<span data-radio-play-label><?php esc_html_e( 'Play', 'radio' ); ?></span> <span data-radio-play-label><?php esc_html_e( 'Play', 'a-radio' ); ?></span>
</button>
<button type="button" class="button radio-player__popout" data-radio-popout title="<?php esc_attr_e( 'Open in a pop-out window — keeps playing while you navigate the admin', 'a-radio' ); ?>">
<span aria-hidden="true">↗</span> <?php esc_html_e( 'Pop out', 'a-radio' ); ?>
</button> </button>
<div class="radio-player__volume"> <div class="radio-player__volume">
<button type="button" class="radio-player__mute" data-radio-mute aria-label="<?php esc_attr_e( 'Mute', 'radio' ); ?>"> <button type="button" class="radio-player__mute" data-radio-mute aria-label="<?php esc_attr_e( 'Mute', 'a-radio' ); ?>">
<span class="dashicons dashicons-controls-volumeon" aria-hidden="true"></span> <span class="dashicons dashicons-controls-volumeon" aria-hidden="true"></span>
</button> </button>
<input type="range" min="0" max="100" value="<?php echo esc_attr( (int) round( $state['volume'] * 100 ) ); ?>" data-radio-volume aria-label="<?php esc_attr_e( 'Volume', 'radio' ); ?>"> <input type="range" min="0" max="100" value="<?php echo esc_attr( (int) round( $state['volume'] * 100 ) ); ?>" data-radio-volume aria-label="<?php esc_attr_e( 'Volume', 'a-radio' ); ?>">
<span class="radio-player__volume-pct" data-radio-volume-pct><?php echo esc_html( (int) round( $state['volume'] * 100 ) ); ?>%</span> <span class="radio-player__volume-pct" data-radio-volume-pct><?php echo esc_html( (int) round( $state['volume'] * 100 ) ); ?>%</span>
</div> </div>
</div> </div>
<div class="radio-player__station-select"> <div class="radio-player__station-select">
<label for="radio-station-main"><?php esc_html_e( 'Station', 'radio' ); ?></label> <label for="radio-station-main"><?php esc_html_e( 'Station', 'a-radio' ); ?></label>
<select id="radio-station-main" data-radio-station> <select id="radio-station-main" data-radio-station>
<?php foreach ( $stations as $genre => $entries ) : <?php foreach ( $stations as $genre => $entries ) :
if ( empty( $entries ) ) { continue; } if ( empty( $entries ) ) { continue; }
@@ -96,7 +100,7 @@ function radio_render_main_page() {
printf( printf(
wp_kses( wp_kses(
/* translators: %s = link to somafm.com */ /* translators: %s = link to somafm.com */
__( 'Stations and streams provided by %s — an independent, listener-supported, commercial-free internet radio network. Please consider supporting them.', 'radio' ), __( 'Stations and streams provided by %s — an independent, listener-supported, commercial-free internet radio network. Please consider supporting them.', 'a-radio' ),
array( 'a' => array( 'href' => true, 'target' => true, 'rel' => true ) ) array( 'a' => array( 'href' => true, 'target' => true, 'rel' => true ) )
), ),
'<a href="https://somafm.com/" target="_blank" rel="noopener">SomaFM</a>' '<a href="https://somafm.com/" target="_blank" rel="noopener">SomaFM</a>'
+11 -7
View File
@@ -21,7 +21,7 @@ function radio_register_dashboard_widget() {
wp_add_dashboard_widget( wp_add_dashboard_widget(
'radio_dashboard_widget', 'radio_dashboard_widget',
__( 'Radio', 'radio' ), __( 'Radio', 'a-radio' ),
'radio_render_dashboard_widget' 'radio_render_dashboard_widget'
); );
} }
@@ -38,7 +38,7 @@ function radio_render_dashboard_widget() {
<span class="radio-player__bars"><span></span><span></span><span></span><span></span></span> <span class="radio-player__bars"><span></span><span></span><span></span><span></span></span>
<canvas class="radio-player__viz" data-radio-viz hidden></canvas> <canvas class="radio-player__viz" data-radio-viz hidden></canvas>
</span> </span>
<span class="radio-player__label"><?php esc_html_e( 'Now Playing', 'radio' ); ?></span> <span class="radio-player__label"><?php esc_html_e( 'Now Playing', 'a-radio' ); ?></span>
<span class="radio-player__station-name" data-radio-name><?php echo esc_html( $station['name'] ); ?></span> <span class="radio-player__station-name" data-radio-name><?php echo esc_html( $station['name'] ); ?></span>
<span class="radio-player__station-genre" data-radio-genre><?php echo esc_html( $station['genre'] ); ?></span> <span class="radio-player__station-genre" data-radio-genre><?php echo esc_html( $station['genre'] ); ?></span>
<p class="radio-player__station-desc" data-radio-desc><?php echo esc_html( $station['description'] ); ?></p> <p class="radio-player__station-desc" data-radio-desc><?php echo esc_html( $station['description'] ); ?></p>
@@ -48,20 +48,24 @@ function radio_render_dashboard_widget() {
<div class="radio-player__controls"> <div class="radio-player__controls">
<button type="button" class="button button-primary radio-player__play" data-radio-play> <button type="button" class="button button-primary radio-player__play" data-radio-play>
<span class="radio-player__play-glyph" data-radio-play-glyph aria-hidden="true">&#9654;</span> <span class="radio-player__play-glyph" data-radio-play-glyph aria-hidden="true">&#9654;</span>
<span data-radio-play-label><?php esc_html_e( 'Play', 'radio' ); ?></span> <span data-radio-play-label><?php esc_html_e( 'Play', 'a-radio' ); ?></span>
</button>
<button type="button" class="button radio-player__popout" data-radio-popout title="<?php esc_attr_e( 'Open in a pop-out window — keeps playing while you navigate', 'a-radio' ); ?>">
<span aria-hidden="true">↗</span> <?php esc_html_e( 'Pop out', 'a-radio' ); ?>
</button> </button>
<div class="radio-player__volume"> <div class="radio-player__volume">
<button type="button" class="radio-player__mute" data-radio-mute aria-label="<?php esc_attr_e( 'Mute', 'radio' ); ?>"> <button type="button" class="radio-player__mute" data-radio-mute aria-label="<?php esc_attr_e( 'Mute', 'a-radio' ); ?>">
<span class="dashicons dashicons-controls-volumeon" aria-hidden="true"></span> <span class="dashicons dashicons-controls-volumeon" aria-hidden="true"></span>
</button> </button>
<input type="range" min="0" max="100" value="<?php echo esc_attr( (int) round( $state['volume'] * 100 ) ); ?>" data-radio-volume aria-label="<?php esc_attr_e( 'Volume', 'radio' ); ?>"> <input type="range" min="0" max="100" value="<?php echo esc_attr( (int) round( $state['volume'] * 100 ) ); ?>" data-radio-volume aria-label="<?php esc_attr_e( 'Volume', 'a-radio' ); ?>">
<span class="radio-player__volume-pct" data-radio-volume-pct><?php echo esc_html( (int) round( $state['volume'] * 100 ) ); ?>%</span> <span class="radio-player__volume-pct" data-radio-volume-pct><?php echo esc_html( (int) round( $state['volume'] * 100 ) ); ?>%</span>
</div> </div>
</div> </div>
<div class="radio-player__station-select"> <div class="radio-player__station-select">
<label for="radio-station-widget"><?php esc_html_e( 'Station', 'radio' ); ?></label> <label for="radio-station-widget"><?php esc_html_e( 'Station', 'a-radio' ); ?></label>
<select id="radio-station-widget" data-radio-station> <select id="radio-station-widget" data-radio-station>
<?php foreach ( $stations as $genre => $entries ) : <?php foreach ( $stations as $genre => $entries ) :
if ( empty( $entries ) ) { continue; } if ( empty( $entries ) ) { continue; }
@@ -86,7 +90,7 @@ function radio_render_dashboard_widget() {
printf( printf(
wp_kses( wp_kses(
/* translators: %s = link to somafm.com */ /* translators: %s = link to somafm.com */
__( 'Powered by %s', 'radio' ), __( 'Powered by %s', 'a-radio' ),
array( 'a' => array( 'href' => true, 'target' => true, 'rel' => true ) ) array( 'a' => array( 'href' => true, 'target' => true, 'rel' => true ) )
), ),
'<a href="https://somafm.com/" target="_blank" rel="noopener">SomaFM</a>' '<a href="https://somafm.com/" target="_blank" rel="noopener">SomaFM</a>'
+19 -16
View File
@@ -133,7 +133,7 @@ function radio_search_urls( $artist, $title ) {
/** Render the History admin page (tabs: History / Favourites). */ /** Render the History admin page (tabs: History / Favourites). */
function radio_render_history_page() { function radio_render_history_page() {
if ( ! current_user_can( 'read' ) ) { if ( ! current_user_can( 'read' ) ) {
wp_die( esc_html__( 'You do not have permission to view this page.', 'radio' ) ); wp_die( esc_html__( 'You do not have permission to view this page.', 'a-radio' ) );
} }
$tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'history'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- tab-switch only, no state change $tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'history'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- tab-switch only, no state change
@@ -163,15 +163,15 @@ function radio_render_history_page() {
$nonce = wp_create_nonce( 'radio_history' ); $nonce = wp_create_nonce( 'radio_history' );
?> ?>
<div class="wrap radio-history-wrap"> <div class="wrap radio-history-wrap">
<h1><?php esc_html_e( 'Radio — Track history', 'radio' ); ?></h1> <h1><?php esc_html_e( 'Radio — Track history', 'a-radio' ); ?></h1>
<h2 class="nav-tab-wrapper"> <h2 class="nav-tab-wrapper">
<a href="<?php echo esc_url( $hist_url ); ?>" class="nav-tab <?php echo $tab === 'history' ? 'nav-tab-active' : ''; ?>"> <a href="<?php echo esc_url( $hist_url ); ?>" class="nav-tab <?php echo $tab === 'history' ? 'nav-tab-active' : ''; ?>">
<?php esc_html_e( 'History', 'radio' ); ?> <?php esc_html_e( 'History', 'a-radio' ); ?>
<span class="radio-tab-count">(<?php echo (int) count( $all_history ); ?>)</span> <span class="radio-tab-count">(<?php echo (int) count( $all_history ); ?>)</span>
</a> </a>
<a href="<?php echo esc_url( $fav_url ); ?>" class="nav-tab <?php echo $tab === 'favourites' ? 'nav-tab-active' : ''; ?>"> <a href="<?php echo esc_url( $fav_url ); ?>" class="nav-tab <?php echo $tab === 'favourites' ? 'nav-tab-active' : ''; ?>">
★ <?php esc_html_e( 'Favourites', 'radio' ); ?> ★ <?php esc_html_e( 'Favourites', 'a-radio' ); ?>
<span class="radio-tab-count">(<?php echo (int) count( $all_favourites ); ?>)</span> <span class="radio-tab-count">(<?php echo (int) count( $all_favourites ); ?>)</span>
</a> </a>
</h2> </h2>
@@ -179,24 +179,24 @@ function radio_render_history_page() {
<?php if ( empty( $entries ) ) : ?> <?php if ( empty( $entries ) ) : ?>
<p class="radio-history-empty"> <p class="radio-history-empty">
<?php if ( $tab === 'favourites' ) : ?> <?php if ( $tab === 'favourites' ) : ?>
<?php esc_html_e( 'No favourites yet — star a track on the History tab to save it here.', 'radio' ); ?> <?php esc_html_e( 'No favourites yet — star a track on the History tab to save it here.', 'a-radio' ); ?>
<?php else : ?> <?php else : ?>
<?php esc_html_e( 'No tracks logged yet. Play some music in the Radio player — tracks will appear here as they play.', 'radio' ); ?> <?php esc_html_e( 'No tracks logged yet. Play some music in the Radio player — tracks will appear here as they play.', 'a-radio' ); ?>
<?php endif; ?> <?php endif; ?>
</p> </p>
<?php else : ?> <?php else : ?>
<div class="radio-history-toolbar"> <div class="radio-history-toolbar">
<input type="search" id="radio-history-search" placeholder="<?php esc_attr_e( 'Filter by artist or title…', 'radio' ); ?>" /> <input type="search" id="radio-history-search" placeholder="<?php esc_attr_e( 'Filter by artist or title…', 'a-radio' ); ?>" />
<select id="radio-history-station"> <select id="radio-history-station">
<option value=""><?php esc_html_e( 'All stations', 'radio' ); ?></option> <option value=""><?php esc_html_e( 'All stations', 'a-radio' ); ?></option>
<?php foreach ( $stations_in_list as $sid => $sname ) : ?> <?php foreach ( $stations_in_list as $sid => $sname ) : ?>
<option value="<?php echo esc_attr( $sid ); ?>"><?php echo esc_html( $sname ); ?></option> <option value="<?php echo esc_attr( $sid ); ?>"><?php echo esc_html( $sname ); ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<?php if ( $tab === 'history' ) : ?> <?php if ( $tab === 'history' ) : ?>
<button type="button" id="radio-history-clear" class="button radio-history-clear" data-nonce="<?php echo esc_attr( $nonce ); ?>"> <button type="button" id="radio-history-clear" class="button radio-history-clear" data-nonce="<?php echo esc_attr( $nonce ); ?>">
🗑 <?php esc_html_e( 'Clear history', 'radio' ); ?> 🗑 <?php esc_html_e( 'Clear history', 'a-radio' ); ?>
</button> </button>
<?php endif; ?> <?php endif; ?>
</div> </div>
@@ -204,11 +204,11 @@ function radio_render_history_page() {
<table class="widefat radio-history-table"> <table class="widefat radio-history-table">
<thead> <thead>
<tr> <tr>
<th class="when"><?php esc_html_e( 'When', 'radio' ); ?></th> <th class="when"><?php esc_html_e( 'When', 'a-radio' ); ?></th>
<th class="station"><?php esc_html_e( 'Station', 'radio' ); ?></th> <th class="station"><?php esc_html_e( 'Station', 'a-radio' ); ?></th>
<th class="track"><?php esc_html_e( 'Artist — Title', 'radio' ); ?></th> <th class="track"><?php esc_html_e( 'Artist — Title', 'a-radio' ); ?></th>
<th class="search"><?php esc_html_e( 'Search', 'radio' ); ?></th> <th class="search"><?php esc_html_e( 'Search', 'a-radio' ); ?></th>
<th class="fav"><span class="screen-reader-text"><?php esc_html_e( 'Favourite', 'radio' ); ?></span>★</th> <th class="fav"><span class="screen-reader-text"><?php esc_html_e( 'Favourite', 'a-radio' ); ?></span>★</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -220,7 +220,10 @@ function radio_render_history_page() {
?> ?>
<tr class="radio-history-row" data-station-id="<?php echo esc_attr( $e['station_id'] ); ?>" data-search="<?php echo esc_attr( strtolower( $e['artist'] . ' ' . $e['title'] ) ); ?>"> <tr class="radio-history-row" data-station-id="<?php echo esc_attr( $e['station_id'] ); ?>" data-search="<?php echo esc_attr( strtolower( $e['artist'] . ' ' . $e['title'] ) ); ?>">
<td class="when" title="<?php echo esc_attr( wp_date( 'j M Y, H:i', (int) $e['at'] ) ); ?>"> <td class="when" title="<?php echo esc_attr( wp_date( 'j M Y, H:i', (int) $e['at'] ) ); ?>">
<?php printf( esc_html__( '%s ago', 'radio' ), esc_html( $ago ) ); ?> <?php
/* translators: %s = human-readable time difference, e.g. "2 minutes" */
printf( esc_html__( '%s ago', 'a-radio' ), esc_html( $ago ) );
?>
</td> </td>
<td class="station"><?php echo esc_html( $e['station'] ); ?></td> <td class="station"><?php echo esc_html( $e['station'] ); ?></td>
<td class="track"> <td class="track">
@@ -240,7 +243,7 @@ function radio_render_history_page() {
data-station="<?php echo esc_attr( $e['station'] ); ?>" data-station="<?php echo esc_attr( $e['station'] ); ?>"
data-station-id="<?php echo esc_attr( $e['station_id'] ); ?>" data-station-id="<?php echo esc_attr( $e['station_id'] ); ?>"
data-nonce="<?php echo esc_attr( $nonce ); ?>" data-nonce="<?php echo esc_attr( $nonce ); ?>"
aria-label="<?php echo $is_fav ? esc_attr__( 'Remove from favourites', 'radio' ) : esc_attr__( 'Add to favourites', 'radio' ); ?>"> aria-label="<?php echo $is_fav ? esc_attr__( 'Remove from favourites', 'a-radio' ) : esc_attr__( 'Add to favourites', 'a-radio' ); ?>">
<?php echo $is_fav ? '★' : '☆'; ?> <?php echo $is_fav ? '★' : '☆'; ?>
</button> </button>
</td> </td>
+17 -14
View File
@@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
function radio_render_settings_page() { function radio_render_settings_page() {
if ( ! current_user_can( 'read' ) ) { if ( ! current_user_can( 'read' ) ) {
wp_die( esc_html__( 'You do not have permission to view this page.', 'radio' ) ); wp_die( esc_html__( 'You do not have permission to view this page.', 'a-radio' ) );
} }
// Handle form submission. // Handle form submission.
@@ -39,7 +39,7 @@ function radio_render_settings_page() {
$state['hide_dashboard_widget'] = $hide_widget ? 1 : 0; $state['hide_dashboard_widget'] = $hide_widget ? 1 : 0;
update_user_meta( $user_id, RADIO_META_KEY, $state ); update_user_meta( $user_id, RADIO_META_KEY, $state );
echo '<div class="notice notice-success is-dismissible"><p>' . esc_html__( 'Settings saved.', 'radio' ) . '</p></div>'; echo '<div class="notice notice-success is-dismissible"><p>' . esc_html__( 'Settings saved.', 'a-radio' ) . '</p></div>';
} }
$state = radio_get_state(); $state = radio_get_state();
@@ -47,7 +47,10 @@ function radio_render_settings_page() {
$hide_widget = ! empty( $state['hide_dashboard_widget'] ); $hide_widget = ! empty( $state['hide_dashboard_widget'] );
?> ?>
<div class="wrap radio-settings-wrap"> <div class="wrap radio-settings-wrap">
<h1><?php esc_html_e( 'Radio — Settings', 'radio' ); ?></h1> <h1>
<?php esc_html_e( 'Radio — Settings', 'a-radio' ); ?>
<span class="radio-version-badge">v<?php echo esc_html( RADIO_VERSION ); ?></span>
</h1>
<form method="post" action=""> <form method="post" action="">
<?php wp_nonce_field( 'radio_save_settings', 'radio_settings_nonce' ); ?> <?php wp_nonce_field( 'radio_save_settings', 'radio_settings_nonce' ); ?>
@@ -55,7 +58,7 @@ function radio_render_settings_page() {
<table class="form-table" role="presentation"> <table class="form-table" role="presentation">
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="default_station"><?php esc_html_e( 'Default station', 'radio' ); ?></label> <label for="default_station"><?php esc_html_e( 'Default station', 'a-radio' ); ?></label>
</th> </th>
<td> <td>
<select id="default_station" name="default_station"> <select id="default_station" name="default_station">
@@ -72,14 +75,14 @@ function radio_render_settings_page() {
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<p class="description"> <p class="description">
<?php esc_html_e( 'The station that loads when you open Radio in a fresh tab.', 'radio' ); ?> <?php esc_html_e( 'The station that loads when you open Radio in a fresh tab.', 'a-radio' ); ?>
</p> </p>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="default_volume"><?php esc_html_e( 'Default volume', 'radio' ); ?></label> <label for="default_volume"><?php esc_html_e( 'Default volume', 'a-radio' ); ?></label>
</th> </th>
<td> <td>
<input type="range" id="default_volume" name="default_volume" min="0" max="100" value="<?php echo esc_attr( (int) round( $state['volume'] * 100 ) ); ?>" aria-describedby="default_volume_label"> <input type="range" id="default_volume" name="default_volume" min="0" max="100" value="<?php echo esc_attr( (int) round( $state['volume'] * 100 ) ); ?>" aria-describedby="default_volume_label">
@@ -89,34 +92,34 @@ function radio_render_settings_page() {
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="theme"><?php esc_html_e( 'Theme', 'radio' ); ?></label> <label for="theme"><?php esc_html_e( 'Theme', 'a-radio' ); ?></label>
</th> </th>
<td> <td>
<select id="theme" name="theme"> <select id="theme" name="theme">
<option value="auto" <?php selected( $state['theme'], 'auto' ); ?>><?php esc_html_e( 'Auto (match WP admin colour scheme)', 'radio' ); ?></option> <option value="auto" <?php selected( $state['theme'], 'auto' ); ?>><?php esc_html_e( 'Auto (match WP admin colour scheme)', 'a-radio' ); ?></option>
<option value="light" <?php selected( $state['theme'], 'light' ); ?>><?php esc_html_e( 'Light', 'radio' ); ?></option> <option value="light" <?php selected( $state['theme'], 'light' ); ?>><?php esc_html_e( 'Light', 'a-radio' ); ?></option>
<option value="dark" <?php selected( $state['theme'], 'dark' ); ?>><?php esc_html_e( 'Dark', 'radio' ); ?></option> <option value="dark" <?php selected( $state['theme'], 'dark' ); ?>><?php esc_html_e( 'Dark', 'a-radio' ); ?></option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row"> <th scope="row">
<?php esc_html_e( 'Dashboard widget', 'radio' ); ?> <?php esc_html_e( 'Dashboard widget', 'a-radio' ); ?>
</th> </th>
<td> <td>
<label> <label>
<input type="checkbox" name="hide_dashboard_widget" value="1" <?php checked( $hide_widget ); ?>> <input type="checkbox" name="hide_dashboard_widget" value="1" <?php checked( $hide_widget ); ?>>
<?php esc_html_e( 'Hide the Radio widget from the WordPress Dashboard', 'radio' ); ?> <?php esc_html_e( 'Hide the Radio widget from the WordPress Dashboard', 'a-radio' ); ?>
</label> </label>
<p class="description"> <p class="description">
<?php esc_html_e( 'When checked, Radio is only accessible from the dedicated admin page (WP Admin → Radio → My Radio).', 'radio' ); ?> <?php esc_html_e( 'When checked, Radio is only accessible from the dedicated admin page (WP Admin → Radio → My Radio).', 'a-radio' ); ?>
</p> </p>
</td> </td>
</tr> </tr>
</table> </table>
<?php submit_button( __( 'Save Changes', 'radio' ), 'primary', 'radio_settings_submit' ); ?> <?php submit_button( __( 'Save Changes', 'a-radio' ), 'primary', 'radio_settings_submit' ); ?>
</form> </form>
<?php <?php
+23 -13
View File
@@ -112,9 +112,10 @@ function radio_update_status( $force_refresh = false ) {
$latest = radio_fetch_latest_release( $force_refresh ); $latest = radio_fetch_latest_release( $force_refresh );
if ( ! $latest || empty( $latest['version'] ) ) { if ( ! $latest || empty( $latest['version'] ) ) {
$msg = __( 'No releases tagged on the Gitea repo yet.', 'radio' ); $msg = __( 'No releases tagged on the Gitea repo yet.', 'a-radio' );
if ( $latest && ! empty( $latest['error_code'] ) && (int) $latest['error_code'] !== 404 ) { if ( $latest && ! empty( $latest['error_code'] ) && (int) $latest['error_code'] !== 404 ) {
$msg = sprintf( __( 'Could not reach Gitea (HTTP %d). Try again in a few minutes.', 'radio' ), (int) $latest['error_code'] ); /* translators: %d = HTTP status code returned by the Gitea API */
$msg = sprintf( __( 'Could not reach Gitea (HTTP %d). Try again in a few minutes.', 'a-radio' ), (int) $latest['error_code'] );
} }
return array( return array(
'status' => 'unknown', 'status' => 'unknown',
@@ -133,7 +134,8 @@ function radio_update_status( $force_refresh = false ) {
'download_url' => $latest['download_url'], 'download_url' => $latest['download_url'],
'published_at' => $latest['published_at'], 'published_at' => $latest['published_at'],
'body' => $latest['body'], 'body' => $latest['body'],
'message' => sprintf( __( 'A new version (v%1$s) is available — you are on v%2$s.', 'radio' ), $latest['version'], $current ), /* translators: 1: latest version available; 2: version currently installed */
'message' => sprintf( __( 'A new version (v%1$s) is available — you are on v%2$s.', 'a-radio' ), $latest['version'], $current ),
); );
} }
@@ -141,7 +143,8 @@ function radio_update_status( $force_refresh = false ) {
'status' => 'up-to-date', 'status' => 'up-to-date',
'current' => $current, 'current' => $current,
'latest' => $latest['version'], 'latest' => $latest['version'],
'message' => sprintf( __( 'You are up to date (v%s).', 'radio' ), $current ), /* translators: %s = current installed version */
'message' => sprintf( __( 'You are up to date (v%s).', 'a-radio' ), $current ),
'repo_url' => radio_gitea_repo_url(), 'repo_url' => radio_gitea_repo_url(),
); );
} }
@@ -163,38 +166,45 @@ function radio_render_updates_panel() {
$rel_url = radio_gitea_releases_url(); $rel_url = radio_gitea_releases_url();
?> ?>
<div class="radio-updates" style="max-width:720px; margin-top:24px; padding:18px 20px; background:#fff; border:1px solid #ccd0d4; border-radius:4px;"> <div class="radio-updates" style="max-width:720px; margin-top:24px; padding:18px 20px; background:#fff; border:1px solid #ccd0d4; border-radius:4px;">
<h2 style="margin-top:0;"><?php esc_html_e( 'Updates', 'radio' ); ?></h2> <h2 style="margin-top:0;"><?php esc_html_e( 'Updates', 'a-radio' ); ?></h2>
<p style="margin:0 0 12px;"> <p style="margin:0 0 12px;">
<?php esc_html_e( 'Radio is self-hosted on Gitea. Click Check now to ask the repo whether there is a newer release than the one you are running.', 'radio' ); ?> <?php esc_html_e( 'Radio is self-hosted on Gitea. Click Check now to ask the repo whether there is a newer release than the one you are running.', 'a-radio' ); ?>
</p> </p>
<p id="radio-update-status" style="margin:0 0 12px;"> <p id="radio-update-status" style="margin:0 0 12px;">
<strong><?php esc_html_e( 'Status:', 'radio' ); ?></strong> <strong><?php esc_html_e( 'Status:', 'a-radio' ); ?></strong>
<span id="radio-update-status-text"><?php echo esc_html( $status['message'] ); ?></span> <span id="radio-update-status-text"><?php echo esc_html( $status['message'] ); ?></span>
<?php if ( $status['status'] === 'available' && ! empty( $status['download_url'] ) ) : ?> <?php if ( $status['status'] === 'available' && ! empty( $status['download_url'] ) ) : ?>
<br> <br>
<a href="<?php echo esc_url( $status['download_url'] ); ?>" class="button button-primary" style="margin-top:8px;"> <a href="<?php echo esc_url( $status['download_url'] ); ?>" class="button button-primary" style="margin-top:8px;">
<?php <?php
/* translators: %s is the latest version number, e.g. "0.2.0" */ /* translators: %s is the latest version number, e.g. "0.2.0" */
echo esc_html( sprintf( __( 'Download v%s (.zip)', 'radio' ), $status['latest'] ) ); /* translators: %s = latest available version number, e.g. "0.7.0" */
echo esc_html( sprintf( __( 'Download v%s (.zip)', 'a-radio' ), $status['latest'] ) );
?> ?>
</a> </a>
<?php if ( ! empty( $status['html_url'] ) ) : ?> <?php if ( ! empty( $status['html_url'] ) ) : ?>
<a href="<?php echo esc_url( $status['html_url'] ); ?>" target="_blank" rel="noopener" style="margin-left:8px;"><?php esc_html_e( 'View release notes →', 'radio' ); ?></a> <a href="<?php echo esc_url( $status['html_url'] ); ?>" target="_blank" rel="noopener" style="margin-left:8px;"><?php esc_html_e( 'View release notes →', 'a-radio' ); ?></a>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
</p> </p>
<p style="margin:0 0 4px;"> <p style="margin:0 0 4px;">
<button type="button" id="radio-check-updates-btn" class="button" data-nonce="<?php echo esc_attr( $nonce ); ?>"> <button type="button" id="radio-check-updates-btn" class="button" data-nonce="<?php echo esc_attr( $nonce ); ?>">
↻ <?php esc_html_e( 'Check now', 'radio' ); ?> ↻ <?php esc_html_e( 'Check now', 'a-radio' ); ?>
</button> </button>
<a href="<?php echo esc_url( $repo_url ); ?>" target="_blank" rel="noopener" class="button" style="margin-left:6px;"><?php esc_html_e( 'View on Gitea', 'radio' ); ?></a> <a href="<?php echo esc_url( $repo_url ); ?>" target="_blank" rel="noopener" class="button" style="margin-left:6px;"><?php esc_html_e( 'View on Gitea', 'a-radio' ); ?></a>
<a href="<?php echo esc_url( $rel_url ); ?>" target="_blank" rel="noopener" class="button" style="margin-left:6px;"><?php esc_html_e( 'View all releases', 'radio' ); ?></a> <a href="<?php echo esc_url( $rel_url ); ?>" target="_blank" rel="noopener" class="button" style="margin-left:6px;"><?php esc_html_e( 'View all releases', 'a-radio' ); ?></a>
</p> </p>
<p style="margin:10px 0 0; color:#646970; font-size:12px;"> <p style="margin:10px 0 0; color:#646970; font-size:12px;">
<?php esc_html_e( 'Manual update path: download the .zip, deactivate the plugin in WordPress, upload via Plugins → Add New → Upload, reactivate. Your settings survive the upgrade (state is stored in user_meta).', 'radio' ); ?> <?php esc_html_e( 'Manual update path: download the .zip, deactivate the plugin in WordPress, upload via Plugins → Add New → Upload, reactivate. Your settings survive the upgrade (state is stored in user_meta).', 'a-radio' ); ?>
</p> </p>
<?php if ( defined( 'RADIO_SUPPORT_URL' ) && RADIO_SUPPORT_URL ) : ?>
<a class="radio-support-link" href="<?php echo esc_url( RADIO_SUPPORT_URL ); ?>" target="_blank" rel="noopener">
<?php esc_html_e( 'Like Radio? If You fancy to buy me a coffee →', 'a-radio' ); ?>
</a>
<?php endif; ?>
</div> </div>
<script> <script>
+175 -44
View File
@@ -1,31 +1,32 @@
<?php <?php
/** /**
* Radio — a free SomaFM player for your WordPress dashboard * RangerHQ Radio — a small, focused internet radio player for your WP dashboard.
* *
* Plugin Name: Radio * Plugin Name: RangerHQ Radio
* Plugin URI: https://icanhelp.ie/radio * Plugin URI: https://icanhelp.ie/radio
* Description: A small, focused, free radio player for your WordPress admin. 44 SomaFM stations grouped by 10 genres — ambient, electronic, lounge, rock, metal, jazz, world, reggae, holiday, specials. Plays via HTML5 audio; volume + station choice persist per-user. * Description: A small, focused internet radio player for your WordPress admin. 44 hand-curated stations from SomaFM across 10 genres — ambient, electronic, lounge, rock, metal, jazz, world, reggae, holiday, specials. Plays via HTML5 audio; per-user station + volume + history + favourites; pop-out window for continuous background play.
* Version: 0.5.0 * Version: 0.7.1
* Requires at least: 5.0 * Requires at least: 5.3
* Requires PHP: 7.4 * Requires PHP: 7.4
* Author: David Keane * Author: David Keane
* Author URI: https://rangersmyth.xyz/ * Author URI: https://rangersmyth.xyz/
* License: GPL v2 or later * License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html * License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: radio * Text Domain: a-radio
* *
* @package Radio * @package RangerHQ_Radio
*/ */
if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! defined( 'ABSPATH' ) ) { exit; }
// Plugin coordinates. // Plugin coordinates.
if ( ! defined( 'RADIO_VERSION' ) ) { define( 'RADIO_VERSION', '0.5.0' ); } if ( ! defined( 'RADIO_VERSION' ) ) { define( 'RADIO_VERSION', '0.7.1' ); }
if ( ! defined( 'RADIO_FILE' ) ) { define( 'RADIO_FILE', __FILE__ ); } if ( ! defined( 'RADIO_FILE' ) ) { define( 'RADIO_FILE', __FILE__ ); }
if ( ! defined( 'RADIO_PATH' ) ) { define( 'RADIO_PATH', plugin_dir_path( __FILE__ ) ); } if ( ! defined( 'RADIO_PATH' ) ) { define( 'RADIO_PATH', plugin_dir_path( __FILE__ ) ); }
if ( ! defined( 'RADIO_URL' ) ) { define( 'RADIO_URL', plugin_dir_url( __FILE__ ) ); } if ( ! defined( 'RADIO_URL' ) ) { define( 'RADIO_URL', plugin_dir_url( __FILE__ ) ); }
if ( ! defined( 'RADIO_BASENAME' ) ) { define( 'RADIO_BASENAME', plugin_basename( __FILE__ ) ); } if ( ! defined( 'RADIO_BASENAME' ) ) { define( 'RADIO_BASENAME', plugin_basename( __FILE__ ) ); }
if ( ! defined( 'RADIO_GITEA_URL' ) ) { define( 'RADIO_GITEA_URL', 'https://git.davidtkeane.com/ranger/a-radio' ); } if ( ! defined( 'RADIO_GITEA_URL' ) ) { define( 'RADIO_GITEA_URL', 'https://git.davidtkeane.com/ranger/a-radio' ); }
if ( ! defined( 'RADIO_SUPPORT_URL' ) ) { define( 'RADIO_SUPPORT_URL', 'https://buymeacoffee.com/davidtkeane' ); }
// Includes — each file owns one concern. // Includes — each file owns one concern.
require_once RADIO_PATH . 'inc/stations.php'; // the 44-station array + genre helpers require_once RADIO_PATH . 'inc/stations.php'; // the 44-station array + genre helpers
@@ -45,8 +46,8 @@ require_once RADIO_PATH . 'inc/updater.php'; // self-hosted update chec
add_action( 'admin_menu', 'radio_register_admin_menu' ); add_action( 'admin_menu', 'radio_register_admin_menu' );
function radio_register_admin_menu() { function radio_register_admin_menu() {
add_menu_page( add_menu_page(
__( 'Radio', 'radio' ), __( 'Radio', 'a-radio' ),
__( 'Radio', 'radio' ), __( 'Radio', 'a-radio' ),
'read', // any logged-in user with read access has their own radio 'read', // any logged-in user with read access has their own radio
'radio', 'radio',
'radio_render_main_page', 'radio_render_main_page',
@@ -60,8 +61,8 @@ function radio_register_admin_menu() {
// form gotcha). // form gotcha).
add_submenu_page( add_submenu_page(
'radio', 'radio',
__( 'My Radio', 'radio' ), __( 'My Radio', 'a-radio' ),
__( 'My Radio', 'radio' ), __( 'My Radio', 'a-radio' ),
'read', 'read',
'radio', 'radio',
'' ''
@@ -69,8 +70,8 @@ function radio_register_admin_menu() {
add_submenu_page( add_submenu_page(
'radio', 'radio',
__( 'Settings', 'radio' ), __( 'Settings', 'a-radio' ),
__( 'Settings', 'radio' ), __( 'Settings', 'a-radio' ),
'manage_options', 'manage_options',
'radio-settings', 'radio-settings',
'radio_render_settings_page' 'radio_render_settings_page'
@@ -78,8 +79,8 @@ function radio_register_admin_menu() {
add_submenu_page( add_submenu_page(
'radio', 'radio',
__( 'Track history', 'radio' ), __( 'Track history', 'a-radio' ),
__( 'History', 'radio' ), __( 'History', 'a-radio' ),
'read', 'read',
'radio-history', 'radio-history',
'radio_render_history_page' 'radio_render_history_page'
@@ -87,8 +88,8 @@ function radio_register_admin_menu() {
add_submenu_page( add_submenu_page(
'radio', 'radio',
__( 'About', 'radio' ), __( 'About', 'a-radio' ),
__( 'About', 'radio' ), __( 'About', 'a-radio' ),
'read', 'read',
'radio-about', 'radio-about',
'radio_render_about_page' 'radio_render_about_page'
@@ -131,20 +132,21 @@ function radio_enqueue_admin_assets( $hook ) {
'stations' => radio_get_stations_flat(), 'stations' => radio_get_stations_flat(),
'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'radio_save_state' ), 'nonce' => wp_create_nonce( 'radio_save_state' ),
'popoutUrl' => admin_url( 'admin-post.php?action=radio_popout' ),
'strings' => array( 'strings' => array(
'play' => __( 'Play', 'radio' ), 'play' => __( 'Play', 'a-radio' ),
'pause' => __( 'Pause', 'radio' ), 'pause' => __( 'Pause', 'a-radio' ),
'loading' => __( 'Loading…', 'radio' ), 'loading' => __( 'Loading…', 'a-radio' ),
'error' => __( 'Stream error — try another station.', 'radio' ), 'error' => __( 'Stream error — try another station.', 'a-radio' ),
'saveError' => __( 'Preferences not saved — check your connection.', 'radio' ), 'saveError' => __( 'Preferences not saved — check your connection.', 'a-radio' ),
'mute' => __( 'Mute', 'radio' ), 'mute' => __( 'Mute', 'a-radio' ),
'unmute' => __( 'Unmute', 'radio' ), 'unmute' => __( 'Unmute', 'a-radio' ),
'nowPlaying' => __( 'Now Playing', 'radio' ), 'nowPlaying' => __( 'Now Playing', 'a-radio' ),
'volume' => __( 'Volume', 'radio' ), 'volume' => __( 'Volume', 'a-radio' ),
'station' => __( 'Station', 'radio' ), 'station' => __( 'Station', 'a-radio' ),
'addFav' => __( 'Add to favourites', 'radio' ), 'addFav' => __( 'Add to favourites', 'a-radio' ),
'removeFav' => __( 'Remove from favourites', 'radio' ), 'removeFav' => __( 'Remove from favourites', 'a-radio' ),
'clearConfirm' => __( 'Clear all track history? (Favourites are kept.)', 'radio' ), 'clearConfirm' => __( 'Clear all track history? (Favourites are kept.)', 'a-radio' ),
), ),
) ); ) );
} }
@@ -185,11 +187,13 @@ add_action( 'wp_ajax_radio_log_track', 'radio_ajax_log_track' );
function radio_ajax_log_track() { function radio_ajax_log_track() {
if ( ! is_user_logged_in() ) { wp_send_json_error( 'Not logged in.', 401 ); } if ( ! is_user_logged_in() ) { wp_send_json_error( 'Not logged in.', 401 ); }
check_ajax_referer( 'radio_save_state', 'nonce' ); check_ajax_referer( 'radio_save_state', 'nonce' );
// Unslash + sanitize at access; radio_sanitize_entry() also re-sanitizes
// downstream as belt+braces, but PCP wants the cleanup AT the access point.
$logged = radio_log_track( array( $logged = radio_log_track( array(
'artist' => $_POST['artist'] ?? '', 'artist' => isset( $_POST['artist'] ) ? sanitize_text_field( wp_unslash( $_POST['artist'] ) ) : '',
'title' => $_POST['title'] ?? '', 'title' => isset( $_POST['title'] ) ? sanitize_text_field( wp_unslash( $_POST['title'] ) ) : '',
'station' => $_POST['station'] ?? '', 'station' => isset( $_POST['station'] ) ? sanitize_text_field( wp_unslash( $_POST['station'] ) ) : '',
'station_id' => $_POST['station_id'] ?? '', 'station_id' => isset( $_POST['station_id'] ) ? sanitize_key( wp_unslash( $_POST['station_id'] ) ) : '',
) ); ) );
wp_send_json_success( array( 'logged' => (bool) $logged ) ); wp_send_json_success( array( 'logged' => (bool) $logged ) );
} }
@@ -204,10 +208,10 @@ function radio_ajax_toggle_favourite() {
if ( ! is_user_logged_in() ) { wp_send_json_error( 'Not logged in.', 401 ); } if ( ! is_user_logged_in() ) { wp_send_json_error( 'Not logged in.', 401 ); }
check_ajax_referer( 'radio_history', 'nonce' ); check_ajax_referer( 'radio_history', 'nonce' );
$new_state = radio_toggle_favourite( array( $new_state = radio_toggle_favourite( array(
'artist' => $_POST['artist'] ?? '', 'artist' => isset( $_POST['artist'] ) ? sanitize_text_field( wp_unslash( $_POST['artist'] ) ) : '',
'title' => $_POST['title'] ?? '', 'title' => isset( $_POST['title'] ) ? sanitize_text_field( wp_unslash( $_POST['title'] ) ) : '',
'station' => $_POST['station'] ?? '', 'station' => isset( $_POST['station'] ) ? sanitize_text_field( wp_unslash( $_POST['station'] ) ) : '',
'station_id' => $_POST['station_id'] ?? '', 'station_id' => isset( $_POST['station_id'] ) ? sanitize_key( wp_unslash( $_POST['station_id'] ) ) : '',
) ); ) );
wp_send_json_success( array( 'favourite' => (bool) $new_state ) ); wp_send_json_success( array( 'favourite' => (bool) $new_state ) );
} }
@@ -221,6 +225,133 @@ function radio_ajax_clear_history() {
wp_send_json_success(); wp_send_json_success();
} }
/**
* v0.6.0 — Pop-out mini player. Renders a standalone HTML page (no WP
* admin chrome) at `admin-post.php?action=radio_popout`, opened by the
* JS via `window.open()`. The popup persists across main-tab navigation
* so background music keeps playing when the user moves around the
* admin. `&play=1` in the URL tells `radio.js` to auto-resume on load.
*/
add_action( 'admin_post_radio_popout', 'radio_render_popout_page' );
function radio_render_popout_page() {
if ( ! current_user_can( 'read' ) ) {
wp_die( esc_html__( 'You do not have permission to view this page.', 'a-radio' ) );
}
$state = radio_get_state();
$station = radio_find_station( $state['station_id'] );
$stations = radio_get_stations_grouped();
$theme = isset( $state['theme'] ) ? $state['theme'] : 'auto';
if ( ! in_array( $theme, array( 'auto', 'light', 'dark' ), true ) ) { $theme = 'auto'; }
$cfg = array(
'state' => $state,
'stations' => radio_get_stations_flat(),
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'radio_save_state' ),
'popoutUrl' => '', // already in popout — no further popouts
'autoPlay' => isset( $_GET['play'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- query flag only, no state change
'strings' => array(
'play' => __( 'Play', 'a-radio' ),
'pause' => __( 'Pause', 'a-radio' ),
'loading' => __( 'Loading…', 'a-radio' ),
'error' => __( 'Stream error — try another station.', 'a-radio' ),
'saveError' => __( 'Preferences not saved — check your connection.', 'a-radio' ),
'mute' => __( 'Mute', 'a-radio' ),
'unmute' => __( 'Unmute', 'a-radio' ),
'nowPlaying' => __( 'Now Playing', 'a-radio' ),
'volume' => __( 'Volume', 'a-radio' ),
'station' => __( 'Station', 'a-radio' ),
),
);
/*
* v0.7.0: Enqueue popup assets via WP so we can emit them with
* wp_print_styles() / wp_print_footer_scripts() — passes PCP's
* NonEnqueuedStylesheet / NonEnqueuedScript checks (we used raw
* <link> / <script> tags before). dashicons is core-registered.
*/
wp_enqueue_style( 'dashicons' );
wp_enqueue_style( 'radio-admin', RADIO_URL . 'assets/css/radio.css', array(), RADIO_VERSION );
wp_enqueue_script( 'radio-admin', RADIO_URL . 'assets/js/radio.js', array(), RADIO_VERSION, true );
wp_localize_script( 'radio-admin', 'RadioPlugin', $cfg );
?>
<!DOCTYPE html>
<html lang="<?php echo esc_attr( str_replace( '_', '-', get_bloginfo( 'language' ) ) ); ?>">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php
/* translators: %s = currently playing station name */
printf( esc_html__( 'Radio — %s', 'a-radio' ), esc_html( $station['name'] ) );
?></title>
<?php wp_print_styles(); /* dashicons + radio.css; popup-specific overrides scoped under body.radio-popout in radio.css */ ?>
</head>
<body class="radio-popout radio-theme-<?php echo esc_attr( $theme ); ?>">
<div class="radio-popout-header">
<h1><?php esc_html_e( 'Radio', 'a-radio' ); ?></h1>
<button type="button" class="radio-popout-close" onclick="window.close()" title="<?php esc_attr_e( 'Close', 'a-radio' ); ?>">✕</button>
</div>
<div class="radio-popout-wrap">
<div class="radio-player" data-radio-surface="popout">
<div class="radio-player__now">
<span class="radio-player__indicator" aria-hidden="true">
<span class="radio-player__bars"><span></span><span></span><span></span><span></span></span>
<canvas class="radio-player__viz" data-radio-viz hidden></canvas>
</span>
<span class="radio-player__label"><?php esc_html_e( 'Now Playing', 'a-radio' ); ?></span>
<span class="radio-player__station-name" data-radio-name><?php echo esc_html( $station['name'] ); ?></span>
<span class="radio-player__station-genre" data-radio-genre><?php echo esc_html( $station['genre'] ); ?></span>
<p class="radio-player__station-desc" data-radio-desc><?php echo esc_html( $station['description'] ); ?></p>
<p class="radio-player__track" data-radio-track hidden></p>
</div>
<div class="radio-player__controls">
<button type="button" class="button button-primary radio-player__play" data-radio-play>
<span class="radio-player__play-glyph" data-radio-play-glyph aria-hidden="true">&#9654;</span>
<span data-radio-play-label><?php esc_html_e( 'Play', 'a-radio' ); ?></span>
</button>
<div class="radio-player__volume">
<button type="button" class="radio-player__mute" data-radio-mute aria-label="<?php esc_attr_e( 'Mute', 'a-radio' ); ?>">
<span class="dashicons dashicons-controls-volumeon" aria-hidden="true"></span>
</button>
<input type="range" min="0" max="100" value="<?php echo esc_attr( (int) round( $state['volume'] * 100 ) ); ?>" data-radio-volume aria-label="<?php esc_attr_e( 'Volume', 'a-radio' ); ?>">
<span class="radio-player__volume-pct" data-radio-volume-pct><?php echo esc_html( (int) round( $state['volume'] * 100 ) ); ?>%</span>
</div>
</div>
<div class="radio-player__station-select">
<label for="radio-station-popout"><?php esc_html_e( 'Station', 'a-radio' ); ?></label>
<select id="radio-station-popout" data-radio-station>
<?php foreach ( $stations as $genre => $entries ) :
if ( empty( $entries ) ) { continue; }
?>
<optgroup label="<?php echo esc_attr( $genre ); ?>">
<?php foreach ( $entries as $entry ) : ?>
<option value="<?php echo esc_attr( $entry['id'] ); ?>" data-url="<?php echo esc_attr( $entry['url'] ); ?>" data-desc="<?php echo esc_attr( $entry['description'] ); ?>" data-genre="<?php echo esc_attr( $entry['genre'] ); ?>" <?php selected( $entry['id'], $state['station_id'] ); ?>>
<?php echo esc_html( $entry['name'] ); ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</div>
<div class="radio-player__error" data-radio-error hidden></div>
<audio data-radio-audio preload="none" crossorigin="anonymous"></audio>
</div>
</div>
<?php wp_print_footer_scripts(); /* radio.js + the wp_localize_script-emitted window.RadioPlugin inline blob */ ?>
</body>
</html>
<?php
exit;
}
/** /**
* Surface the user's theme choice (auto/light/dark) to CSS as a body * Surface the user's theme choice (auto/light/dark) to CSS as a body
* class. `radio-theme-dark` forces dark; `radio-theme-auto` lets the * class. `radio-theme-dark` forces dark; `radio-theme-auto` lets the
+113
View File
@@ -0,0 +1,113 @@
=== RangerHQ Radio ===
Contributors: davidtkeane
Donate link: https://buymeacoffee.com/davidtkeane
Tags: radio, music, audio, internet radio, background music
Requires at least: 5.3
Tested up to: 7.0
Stable tag: 0.7.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
A small, focused internet radio player for your WordPress admin — 44 hand-curated stations, history, favourites, and a pop-out window.
== Description ==
**RangerHQ Radio** adds a tiny, focused internet radio player to your WordPress dashboard so you can have background music while you work in the admin — without leaving the page, opening Spotify, or installing a desktop client.
= What you get =
* **44 hand-curated stations from [SomaFM](https://somafm.com)** across 10 genres — ambient, electronic, lounge, rock, metal, jazz, world, reggae, holiday and specials. From coding-focus ambient (Groove Salad, Drone Zone) to drive-time electronic (DEF CON Radio, Beat Blender) to mellow lounge (Lush, Secret Agent).
* **Now-playing indicator** — small CSS dancing-bars equalizer that pulses while audio is playing. A Web Audio frequency visualizer kicks in automatically when the browser allows it (with a graceful fallback to the CSS bars).
* **Track history + favourites** — every track that scrolls past is logged to your personal History page (capped at 500); a star toggle promotes the good ones to a separate Favourites tab that doesn't age out. Each row has four search links (Spotify, YouTube, Apple Music, Bandcamp) so you can find that track on whichever service you use.
* **Pop-out mini-player** — a 380×560 standalone window that persists across the main tab's navigation, so background music doesn't cut when you move between Plugins, Posts, Users, etc.
* **OS media keys** — F8/headphone buttons/lock-screen widget play and pause the radio (via MediaSession API).
* **Mute toggle** — the speaker icon is clickable; remembers prior volume.
* **Dark theme** — explicit dark option for the player surface (`Settings → Theme`).
* **Per-user state** — your chosen station, volume, theme, history, and favourites all live in `user_meta`, so each WordPress user has their own setup.
= Privacy + dependencies =
* **No tracking, no telemetry, no third-party scripts on your admin pages.** Audio plays directly in your browser via HTML5 — just an `<audio>` element pointed at SomaFM's public streams.
* **No data leaves your site.** History and favourites are stored in your own `wp_usermeta`. The four search links use deep-link search URLs on each provider's public site — no API keys, no third-party JS embedded.
* **Stations courtesy of [SomaFM](https://somafm.com)** — an independent, listener-supported, commercial-free internet radio network broadcasting from San Francisco since 2000. RangerHQ Radio is a small wrapper around their public streams. If you enjoy the music, please consider [supporting SomaFM directly](https://somafm.com/support/).
== Installation ==
1. Upload the plugin folder to `/wp-content/plugins/` (or install from the WordPress plugin directory).
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Open **Radio → My Radio** in the admin sidebar and press Play. Your station and volume choice are saved per user.
There is no separate configuration step — defaults are sensible (Groove Salad at 60% volume). Settings are at **Radio → Settings**.
== Frequently Asked Questions ==
= Does this work on the front-end of my site? =
No — RangerHQ Radio is admin-only. It adds a player to the WordPress dashboard for you (and your other authenticated admins) to use while working. It does not embed a radio player on the public-facing site.
= Can I add my own stations? =
Not via the admin yet. The station list is hard-coded in `inc/stations.php` (44 SomaFM stations). If you'd like to add custom stations or other internet radio sources, please open an issue on the [Gitea repo](https://git.davidtkeane.com/ranger/a-radio).
= The pop-out window doesn't open. =
Your browser may be blocking pop-ups. Click the address bar's pop-up icon to allow pop-ups for this site, then try again.
= Why does Touch ID / a passkey prompt appear when I press Play? =
It shouldn't. This plugin uses no biometrics or authentication of its own — that's a different plugin in the RangerHQ family.
= The current-track display says nothing / is hidden. =
SomaFM's track-info endpoint (`somafm.com/songs/{station}.json`) is fetched best-effort. If it's unreachable or the browser blocks the request, the track display silently hides. The player keeps working regardless.
== Screenshots ==
1. The main player page (Radio → My Radio) with the now-playing indicator dancing while audio is playing.
2. The dashboard widget — same player, compact, sits alongside your usual dashboard widgets.
3. Track History page with star-to-favourite and four search-provider links per row.
4. Pop-out mini-player window — keeps playing while you navigate the rest of the admin.
== Changelog ==
= 0.7.1 =
* Plugin Check follow-up — `Tested up to` bumped from 6.7 to 7.0 (PCP `outdated_tested_upto_header`). Stray `.DS_Store` files re-deleted (macOS Finder regenerated them between PCP runs; they won't be in the submission zip).
= 0.7.0 =
* WordPress.org submission prep — full PCP-clean. Plugin name normalised to **RangerHQ Radio** (SomaFM stays in the description as the data source). Text Domain renamed `radio` → `a-radio` everywhere (134 i18n call sites updated). Six `printf` / `sprintf` calls now carry translator comments. All admin `$_POST` access now `wp_unslash()` + `sanitize_*` at the access point. `Requires at least` bumped to 5.3 (matches `wp_date()` usage). Pop-out window now uses `wp_enqueue_*` + `wp_print_styles()` / `wp_print_footer_scripts()` instead of raw `<link>` / `<script>` tags; popup-specific CSS moved into `radio.css` under `body.radio-popout` scope. `.DS_Store` files removed. Proper `readme.txt`.
= 0.6.3 =
* Discreet "buy me a coffee" support link in the Updates panel and the About-page Credits card. Single `RADIO_SUPPORT_URL` constant; conditional render — silently hidden if the constant is empty.
= 0.6.2 =
* Current version badge on the Settings page — small grey pill follows the H1 reading `v{RADIO_VERSION}`.
= 0.6.1 =
* About page restructure — 3-card top row (What / Who / Credits) + full-width Version history with the latest expanded and earlier releases as one-liners.
= 0.6.0 =
* Pop-out mini-player. `↗ Pop out` button beside Play opens a 380×560 standalone window that persists across the main tab's navigation, so background music keeps playing while you click around Plugins / Posts / Users.
= 0.5.0 =
* Track history + favourites. Every track that scrolls past is logged to a per-user `Radio → History` page (capped at 500). Star toggle promotes tracks to a separate Favourites tab. Four search-provider links per row (Spotify, YouTube, Apple Music, Bandcamp).
= 0.4.0 =
* Now-playing visual indicator. CSS dancing-bars equalizer that pulses while audio is playing. Web Audio frequency visualizer kicks in when the browser allows it (with graceful fallback).
= 0.3.0 =
* Dark theme, mute toggle on the speaker icon, MediaSession API (OS media keys), SomaFM current-track polling under the station description.
= 0.2.0 =
* UI rebuilt to WordPress admin standards — postbox container, native play/pause button with text label, picks up the user's admin colour scheme via `var(--wp-admin-theme-color)`.
= 0.1.0 =
* First release — 44 SomaFM stations across 10 genres, dashboard widget + dedicated admin page, per-user state, self-hosted Gitea updater.
== Upgrade Notice ==
= 0.7.1 =
PCP follow-up — `Tested up to` bumped to 7.0. No user-visible changes.
= 0.7.0 =
WordPress.org submission prep. Plugin name now "RangerHQ Radio". Text Domain renamed `radio` → `a-radio`. No user-visible behaviour changes; settings, history, and favourites all survive the upgrade.