=== Matchday Blocks === Contributors: meinturnierplan, ramzesimus Tags: gutenberg, blocks, tournament, football, sports Requires at least: 6.0 Tested up to: 7.0 Requires PHP: 7.4 Stable tag: 1.1.2 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Display tournament schedules, standings and match results from MeinTurnierplan directly in your WordPress site using Gutenberg blocks. == Description == Matchday Blocks integrates with the MeinTurnierplan platform to let you embed live tournament data — match schedules, group standings and results — anywhere on your site using native Gutenberg blocks. Features: * Match Schedule block — list all matches grouped by round and date * Standings block — show live group standings * Latest Matches block — display the most recently played fixtures * Upcoming Matches block — show the next scheduled fixtures * Configurable cache to reduce external API requests * Team logos downloaded and served locally (no third-party image requests from visitor browsers) == Installation == 1. Upload the plugin folder to `/wp-content/plugins/matchday-blocks/`. 2. Activate the plugin through the **Plugins** screen in WordPress. 3. Go to **Matchday** in the admin menu and enter your Tournament ID. 4. Add any Matchday block to a page or post from the block inserter. == Frequently Asked Questions == = Where do I find my Tournament ID? = Log in to your MeinTurnierplan account, open the tournament and copy the numeric ID from the URL (e.g. `https://www.meinturnierplan.de/…?id=12345`). = How often is tournament data refreshed? = You can configure the cache duration (1–168 hours) on the settings page. A background WP-Cron job automatically refreshes the cache at the configured interval so no visitor ever waits for a live API call. You can also force an immediate refresh by clicking **Clear Cache Now** on the settings page. = Are visitor IP addresses shared with MeinTurnierplan? = No. Team logos are downloaded to your server when the cache is first populated and served locally thereafter. Visitor browsers never contact MeinTurnierplan's servers directly. == External Services == This plugin connects to **MeinTurnierplan** ([https://www.meinturnierplan.de](https://www.meinturnierplan.de)) to retrieve tournament data. * **Data sent:** The Tournament ID you configured in the plugin settings. * **Data received:** Match results, team names, group standings, final round fixtures and team logo URLs. * **When:** Only on the server side — when the cache is empty or expired, or when you manually clear the cache. Visitor browsers are never used to contact MeinTurnierplan. * **Logo images:** Team logos are downloaded to your WordPress uploads directory (`/uploads/matchday-blocks/logos/`) and served from your own server. Service terms of use: [https://www.meinturnierplan.de/legal.php](https://www.meinturnierplan.de/legal.php) Privacy policy: [https://www.meinturnierplan.de/legal.php](https://www.meinturnierplan.de/legal.php) == Development == Source code and build tools are available at [GitHub Repository](https://github.com/danfisher85/matchday-blocks) Prerequisites: Node.js and npm. Blocks are compiled using `@wordpress/scripts` (webpack-based). CSS is processed using PostCSS with Tailwind CSS. To install dependencies: `npm install` To build the plugin: `npm run build` To watch for changes during development: `npm run start` The `build/` directory and `assets/css/blocks.css` are generated by these commands and should not be edited directly. == Screenshots == 1. Matchday Settings. 2. Add a New Latest Matches block. 3. Add a new Upcoming Matches block. 4. Add a new Match Schedule block. 5. Add a new Standings block. == Changelog == = 1.1.2 = * Fix - Standings block: show "Standings are hidden for this tournament" instead of a generic error when the API omits `groupRankTables` due to `hideRanks` being set. * Fix - Latest Matches block: guard against missing `homeParticipant`/`awayParticipant` fields before accessing them (API marks these as optional). * Fix - Upcoming Matches block: same guard as above for unassigned future matches. * Fix - Match Schedule block: guard against missing `homeParticipant`/`awayParticipant` in group matches (the API marks these as optional on all match types). = 1.1.1 = * Fix - Uninstall routine: replaced direct `rmdir()` calls with WP_Filesystem methods to comply with WordPress coding standards. * Fix - Uninstall routine: prefixed all script-level variables with the plugin prefix to comply with WordPress naming conventions. = 1.1.0 = * New - Background WP-Cron job refreshes the cache automatically so no visitor triggers a live API call. * New - Plugin uninstall routine removes all options, transients, scheduled events and locally cached logo files. * New - Standings block displays custom group names (e.g. "Deutsche Bundesliga (A)") and group logos when provided by the tournament. * Tweak - Admin menu item and page title renamed from "MeinTurnierplan" to "Matchday". * Tweak - Admin menu icon updated to the Matchday brand logo. * Tweak - Match Schedule: "Preliminary Round" heading is hidden when no Final Round exists. * Tweak - Match Schedule: first column (match number) is now left-aligned. * Tweak - Higher-resolution logos used across all blocks (participants: lx95w; group logos: lx95; Upcoming Matches: lx160). * Tweak - Unnamed participants display an en dash (–) placeholder instead of a blank. * Tweak - Tested and confirmed compatible with WordPress 7.0. * Fix - Compatibility with updated MeinTurnierplan API: renamed fields `teams` → `participants`, `team1Id`/`team2Id` → `homeParticipant`/`awayParticipant`, and rank table stat fields. * Fix - PHP warnings for incomplete rank table entries (unconfirmed/TBD participants now show – placeholders). = 1.0.1 = * Tweak - Update readme.txt. = 1.0.0 = * Initial release. == Upgrade Notice == = 1.1.2 = Improves robustness against optional API fields; fixes misleading error message in the Standings block when standings are intentionally hidden. = 1.1.1 = Minor code quality fixes in the uninstall routine. No functional changes. = 1.1.0 = Adds background cache refresh via WP-Cron and a full uninstall cleanup routine. Update recommended for all users. Fixes compatibility with the updated MeinTurnierplan API. = 1.0.1 = Minor readme update, no functional changes. = 1.0.0 = * Initial release.