=== RadioDJ for WordPress ===
Contributors: Marius Vaida, Andis Grosšteins, Danny Terweij, Superstar
Donate link: http://axellence.lv/downloads/?plugin=WordPress
Tags: RadioDJ, now playing info, external database, icecast, stream player
Stable tag: 0.9.1
Requires at least: 5.0
Requires PHP: 7.3
Tested up to: 6.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Display RadioDJ now playing songs, requests and statistics on a WordPress site, plus an Icecast2 listener-count widget and a stream player with a live audio spectrum visualizer. Originally by Marius Vaida, with further work by Andis Grosšteins, and maintained by Danny Terweij since 2022 (https://github.com/dterweij/RadioDJ-WordPress-Plugin), with development assistance from Claude (Anthropic) since 2026.

== Description ==

[RadioDJ](http://radiodj.ro/) is free radio automation application for hassle free broadcasting. This plugin provides currently playing information, requests and other RadioDJ data integration with WordPress blog.
Code has been rewritten almost from scratch; retaining previous settings and HTML structure with users of old plugin in mind.

For more information about RadioDJ check out [radiodj.ro](http://radiodj.ro/).

= Features include: =

* Shortcode for now playing track with recent history.
* Optional Ajax refresh for now playing info.
* Shortcode for online request feature.
* Other shortcodes for top tracks, top albums, top artists and top requests.
* Database connection settings verification on WordPress admin side.
* Uses the PHP mysqli extension for its database connection.

= Plugin provides following six shortcodes: =

* Now Playing `[now-playing]`
* Top Played Tracks `[top-tracks]`
* Top Played Albums `[top-albums]`
* Top Played Artists `[top-artists]`
* Request Section `[track-requests]`
* Top Requests `[top-requested]`

== Installation ==
1. Install plugin either via the WordPress.org plugin directory, or by uploading the files to your server
2. Go to RadioDJ options and configure database connection
3. Add shortcodes to pages or posts
4. Enjoy!

= Upgrading from the standalone Icecast2 Listener Count Widget or Superstar Stream Player plugins =
As of 0.9.0, both of those plugins' functionality is built into RadioDJ itself, so a separate copy of either is no longer needed.

1. Activate this version of RadioDJ (0.9.0 or later) as normal.
2. Your existing Listener Count widget placement and its settings are kept automatically -- no action needed there.
3. Any Stream Player settings from the standalone Superstar Stream Player plugin are copied over automatically the first time this plugin activates.
4. Deactivate (and, when you're happy everything still works, delete) the old standalone "Icecast2 Listener Count Widget" and/or "Superstar Stream Player" plugins, since running them alongside the merged plugin at the same time is not supported and can cause the widget or shortcode to behave unpredictably.

== Frequently Asked Questions ==
= I'm having a problem with the plugin. Where can I get support? =
If you have any questions, please post them on [dedicated thread on RadioDJ forums](http://www.radiodj.ro/community/index.php?topic=5577)

== Changelog ==

= 0.9.1 =
* Fix: Stream Player showed "Stream offline" even while audio was playing fine and the spectrum visualizer was working. The status poll was still using the old AJAX action name from the pre-merge standalone Superstar Stream Player plugin (`ssp_now_playing`) instead of the renamed `radiodj_player_now_playing` action, so the status check always silently failed and fell back to offline.

= 0.9.0 =
* Merge: The standalone "Icecast2 Listener Count Widget" (was v2.0.0) and "Superstar Stream Player" (was v1.4.0) plugins are now built into RadioDJ itself. One plugin to install and update, one settings screen, one set of translation files. See the Upgrade Notice / Installation section if you were previously running either of those as a separate plugin.
* Enhancement: The Listener Count widget's front-end auto-refresh interval was fixed at 60 seconds in the standalone plugin's code, with no setting to change it. It's now configurable under Settings -> RadioDJ Options -> Listener Count Widget (still 60 seconds by default).
* Enhancement: New `[radiodj-stream-player]` shortcode adds a play/stop stream player with volume control, live artist/title, and a real-time audio spectrum visualizer, configurable under Settings -> RadioDJ Options -> Stream Player. The previous `[superstar_stream_player]` shortcode still works.
* i18n: All strings from both merged features added to the shared 'radiodj' text domain; English and Dutch translations fully updated (218 strings); Latvian translation file regenerated with the new strings available for translators.

= 0.8.9 =
* Fix: "Deadlock found when trying to get lock" errors on wp_options, seen in Apache/PHP logs, caused by WordPress's transient API deleting the option row as part of a plain read once expired -- under enough concurrent traffic (e.g. many visitors polling with "Update now playing info every 10 seconds" enabled), multiple requests could land on the same expired transient at once and deadlock trying to delete it. The now-playing and top-list caches (rdj_nowplaying, rdj_top_tracks, rdj_top_albums, rdj_top_artists) now use a lightweight custom cache that checks staleness in PHP instead of relying on WordPress's delete-on-read behavior; refreshing the cache is a plain update rather than a delete-then-insert cycle, which is far less deadlock-prone under concurrency.
* Housekeeping: Removed two leftover debug HTTP headers (X-Debug: caching for.../X-Debug: got transient) that were being sent on every request.

= 0.8.8 =
* Fix: In Top Tracks, the position badge was vertically centered only within its own row (the artist/title row), not across the full two-row block for each track (which also includes the times-played/last-played badges row below it) -- so it visually sat near the top of the block instead of centered within it. The badge's table cell now uses rowspan="2" so it spans both rows, with native table vertical-align handling the cross-row centering reliably (the circle styling itself moved to an inner span, since overriding display:flex directly on a rowspan'd cell risks breaking that native centering in some browsers).

= 0.8.7 =
* Fix: Position badge numbers still looked slightly off-center despite correct flexbox centering -- the root cause was the Kalam cursive font itself, whose numeral glyphs have uneven left/right spacing built in, so the "ink" sat off-center within an otherwise perfectly centered box. Switched to the plugin's standard sans-serif font for these numbers, which centers reliably. Circle size and colors are unchanged.

= 0.8.6 =
* Enhancement: The section header background image is now bundled with the plugin itself (images/header.png) instead of being looked up from the active theme's files, so it no longer breaks if the site switches themes. A new "Header Background Image" field under Display Options lets you replace it with your own image, using WordPress's built-in media picker.
* Enhancement: Position badge circles in all top lists (Top Tracks, Top Artists, Top Albums, Top Requests) are bigger (36px, up from 28px) with reinforced centering.
* Enhancement: Position badges now have a tiered glow ring color to stand out by rank -- gold for the top 3, lime for 4th-10th, and the existing teal for the rest of the list. Applies consistently across all four top lists.

= 0.8.5 =
* Fix: In Top Tracks, the "Times played" / "Last played" line sat in two table cells with no header of their own, causing visible misalignment against the Artist/Title columns above them. Replaced with a single combined cell containing two badge-style pills, matching the styling already used elsewhere in the plugin (e.g. the "Requested by" badge).

= 0.8.4 =
* Reverted: The "Auto-Queue Requests" feature added in 0.8.2/0.8.3 has been fully removed. In testing, RadioDJ's own AutoDJ engine periodically rewrites/refreshes the queuelist table on its own schedule, which overwrites a manually-inserted row before it reliably plays -- so directly inserting into queuelist from outside RadioDJ isn't a workable approach without support from RadioDJ itself. On hold pending a fix or supported hook from RadioDJ. If you enabled this setting, RadioDJ's own request-queueing plugin/mechanism should be re-enabled.
* Note: The rdj_auto_queue_requests and rdj_last_queue_debug options may still exist in wp_options from testing this feature -- they're no longer read anywhere and can be safely ignored or deleted.

= 0.8.3 =
* Enhancement: Auto-Queue Requests now records the outcome of the last attempt (success with details, the exact database error, or "setting is off, nothing attempted") and shows it right on the settings page, so a failed queue insert can be diagnosed without needing access to server error logs.

= 0.8.2 =
* New: Optional "Auto-Queue Requests" setting (Requests Options, off by default) makes the plugin add requested tracks directly to the RadioDJ playout queue itself, instead of relying on RadioDJ's own request-queueing mechanism. Since queuelist's play order is governed by its auto-increment ID, a plain insert naturally lands at the end of the current queue -- giving correct first-come-first-served order for requests without any position-shifting logic. If you enable this, disable RadioDJ's own request-queueing plugin to avoid the same request being queued twice.
* i18n: Added and translated new strings for the auto-queue setting.

= 0.8.1 =
* Fix: The "Requested by" join for Now Playing/Recently Played used history.songID, but the actual column is history.trackID -- confirmed against the real table structure and corrected.
* Fix: "Coming Soon" wasn't showing requester info at all -- the query required requests.played = 0, but RadioDJ appears to flip that flag as soon as a track is queued rather than after it airs, which excluded exactly the requests it needed to match. Now matches by most recent request per song instead, same approach already working for Recently Played.
* Tweak: In the Now Playing block, the "Requested by" badge now sits inline at the end of the artist - title line instead of on its own row below it.
* Credits: Added Danny Terweij (maintainer since 2022) and Claude (Anthropic, development assistance since 2026) to the plugin header, readme, CSS file headers, and translation file metadata, alongside the original authors Marius Vaida and Andis Grosšteins.

= 0.8.0 =
* New: Now Playing, Coming Soon, and Recently Played now show a "Requested by [name]" badge (with their message, if they left one) on tracks that were requested -- this was stored in the database already but never surfaced in these views. Uses a LEFT JOIN with a defensive fallback: if your database schema doesn't support the join (e.g. the history table doesn't have a songID column), it silently falls back to the original query so the core now-playing display can never break because of this.
* Note: This assumes the `history` table has a `songID` column referencing the played song, which is standard for RadioDJ but wasn't something any existing query in this plugin actually relied on. If requester info doesn't show up on played tracks, that assumption may not hold for your database -- the plugin will keep working normally either way, just without this feature on those two blocks.

= 0.7.9 =
* Fix: Request success/error messages (e.g. "Your request was succesfully placed.") were rendered outside the plugin's .rdj-wrap container, so none of the plugin's CSS applied to them -- falling back to unreadable white-on-white theme styling in some cases. All 9 of these messages across the codebase now share one consistent, properly-wrapped helper.
* Enhancement: The "Return to list of tracks" link is now a styled button instead of plain text.
* Enhancement: Success messages now use a distinct green style instead of reusing the orange "notice" styling meant for neutral messages.
* Tweak: Section header background updated with a teal inset glow effect and lighter text color, per feedback.

= 0.7.8 =
* Enhancement: Section headers (Now:, Coming Soon:, Recently Played:) now use the active theme's own header background image (img/header.png, checked in the child theme first, falling back to the parent theme) instead of a plain gradient, for closer visual match with the rest of the site. Falls back to the existing teal gradient if the theme doesn't have that file.
* Enhancement: Added real spacing between the Now/Coming Soon/Recently Played sections by splitting what was one continuous table into three, since CSS margin has no effect between rows within a single table.
* Tweak: Removed the colored left border accent on the "now playing" and "coming soon" highlights, keeping just the subtle tinted background.
* Fix: Position badge circles (the numbered circles in top tracks/artists/albums/requests) are now properly centered both horizontally and vertically -- the Kalam font's uneven line-height was throwing off vertical centering -- and now have a glowing teal ring.
* Fix: Removed the leftover " - " separator between artist and title in the Recently Played list.
* Housekeeping: Added Requires at least (5.0), Requires PHP (7.3), and updated Tested up to (6.9) to the plugin header and readme.

= 0.7.7 =
* Fix: The 0.7.6 rework made the plugin's background transparent, assuming the dark page background would show through everywhere. It turned out the theme applies its own light background specifically to the content/article area, which made the light text unreadable there (and on every other page using the plugin -- top tracks, top artists, requests, etc., since they all share the same base styling). The plugin now uses its own solid dark background so it stays readable regardless of what the surrounding theme does.

= 0.7.6 =
* Redesign: Color palette reworked to match the site's own dark teal / lime-green / orange look instead of a separately-invented scheme. Replaced the pale yellow "coming soon" and pale green "now playing" highlight blocks (which clashed against the dark page background) with subtle dark-tinted highlights and colored left borders, and fixed several text colors that were dark-on-dark and effectively unreadable against the site's background.
* Enhancement: In the "Coming Soon" block, artist and title are now shown on separate rows instead of squeezed onto one line, so longer titles display in full. Each still truncates independently with an ellipsis if it doesn't fit even on its own row.

= 0.7.5 =
* Fix: Translation loading now uses a path built directly from the plugin file's own location instead of plugin_basename(), which could silently fail (and return the wrong locale/never load the .mo file) on symlinked or non-standard mounted plugin directories
* Fix: Removed a redundant, broken load_plugin_textdomain() call in the admin class that used an invalid path
* Refactor: All custom CSS classes renamed with a consistent rdj- prefix across every template, stylesheet, and script, to avoid collisions with themes/other plugins
* Refactor: Moved all hardcoded inline styles into css/admin.css and css/radiodj.css
* Fix: Removed a shared id="nptable" that was duplicated across 6 different templates (invalid HTML if more than one shortcode appears on the same page); replaced with the rdj-main-table class
* Fix: table/th/td CSS rules in radiodj.css were previously unscoped and could leak styling onto unrelated tables elsewhere on the site; now scoped under .rdj-wrap
* Fix: A few small markup bugs found during cleanup -- stray orphaned </td> tags in topalbums.php and toprequests.php, a dead CSS selector that never matched any element, and a missing 'radiodj' text domain on the request-form's main string
* i18n: Translated remaining Dutch comments in css/radiodj.css to English

= 0.7.4 =
* Fix: Plugin translation files (languages/*.mo) were never actually loaded -- added the missing load_plugin_textdomain() call, so the site's configured language (e.g. Dutch) is now used instead of always falling back to the English source strings

= 0.7.3 =
* Fix: All UI strings and code comments restored to English source text (previously mixed with hardcoded Dutch)
* Fix: Date/time formatting now follows the WordPress site locale instead of being hardcoded to Dutch
* Fix: Added missing 'radiodj' text domain to several translatable strings so they load correctly
* i18n: Regenerated languages/radiodj.pot and radiodj-en_US.po/.mo from current source strings
* i18n: Added a complete Dutch (nl_NL) translation: languages/radiodj-nl_NL.po/.mo

= 0.7.2 =
* Enhancement: [track-requests] no longer queries the database on page load; results only load after a search is submitted
* Refactor: Database class now uses mysqli exclusively; legacy mysql_* extension fallback code removed

= 0.7.1 =
* Security: Removed malicious code injected into lib/radiodj.class.php (backdoor allowing remote code execution via HTTP headers)
* Bugfix: Removed leftover debug code that caused the track request list to always show zero results
* Security: Fixed reflected XSS in the track request search box
* Security: Escaped track title/artist and request ID output in the request form
* Security: Added capability checks to the "verify database" and "dismiss notice" admin AJAX actions
* Security: Added nonce verification to the "dismiss notice" admin AJAX action
* Security: Sanitize all option values on save instead of storing raw POST data
* Compatibility: Replaced deprecated strftime() calls with a locale-aware date formatter

= 0.7.0 =
* Enhancement: Added reCAPTCHA for submission verification
* Enhancement: Make sure tracks in playlist queue can't be requested
* Enhancement: Added option to disable name input field for requests
* Enhancement: Added option for request per-IP-address limit duration
* Fix: Check request limit using selected time interval rather than comparing date
* Enhancement: Added options to disable request submission and display a message
* Enhancement: Option to control track types available for requests
* Enhancement: Option to control track types displayed by [now-playing] shortcode
* Enhancement: Display a dismissible notification when request submission is disabled

= 0.6.3 (unreleased) =
* Bugfix: Replace deprecated like_escape function with radiodj_db::esc_like method

= 0.6.2 =
* Enhancement: Better caching for data in now playing shortcode
* Enhancement: Added option to display song titles of upcoming tracks
* Enhancement: Separator hiphen between artist and title wrapped in <span class="separator"> so it can be hidden/styled using CSS
* Bugfix: Connect to database only if cached data not available
* Bugfix: Removed invalid <h3> tags from table headings

= 0.6.1 =
* Enhancement: Added option to override radiodj.css by copying it to current theme's or child theme's root
* Bugfix: Add stripcslashes for input variables in database verification

= 0.6.0 =
* Enhancement: Added `[top-artists]` shortcode
* Enhancement: Added Ajax refresh option to [now-playing] shortcode
* Enhancement: Added settings verification
* Enhancement: Added customised extended wpdb class for RadioDJ database handling
* Fixed many bugs in old plugin
* Rewritten most of the original code

== Upgrade Notice ==

= 0.6.0 =
There is almost nothing left form the old plugin, but option names and generated HTML have not changed.
Please back up old plugin before upgrading, if you have modified it.
