<?php
/**
 * Upgrade notices shown in the dashboard "What's new" block.
 *
 * Each entry maps a plugin version to a translatable one-line summary
 * (mirrors the readme.txt "Upgrade Notice" section, but localised in 12 languages).
 *
 * At every release the /release skill MUST add a new entry here AND
 * propagate the new English string into the 11 .po files, then recompile the .mo.
 *
 * @package BlaminhorEssentials
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! function_exists( 'blaminhor_essentials_get_upgrade_notices' ) ) {
	/**
	 * Returns the version => localised summary map.
	 *
	 * @return array<string,string>
	 */
	function blaminhor_essentials_get_upgrade_notices() {
		return array(
			'1.11.1' => __( 'Adds Staging and Development modes to the Maintenance page (with live countdown, logo and shortcode support), an "Advanced" sidebar entry listing all your WP-CLI commands, and a richer Cloudflare integration (Dev Mode, recommended settings, token probe).', 'blaminhor-essentials' ),
			'1.11.0' => __( 'Every module is now configurable from the command line via `wp blaminhor ...` — script setup, run CI fixtures, or let an AI assistant (Claude Code, Cursor) configure the plugin for you. Run `wp help blaminhor` to discover the full command tree.', 'blaminhor-essentials' ),
			'1.10.0' => __( 'New Cookie Banner module: automatically blocks tracking scripts and embeds (Analytics, Ads, media) until visitors agree. GDPR/CCPA/LGPD compliant, Google Consent Mode v2 and IAB TCF v2.2 included, no external service required.', 'blaminhor-essentials' ),
			'1.9.10' => __( 'Critical fix for Elementor Pro: dropdown menus now open correctly on hover. Logged-in admins see the front-end as-is so they can debug. New: configurable preload batch size, immediate preload after a purge, and JSON export/import of cache settings.', 'blaminhor-essentials' ),
			'1.9.9' => __( 'Major Cache & Performance update: layout breakage on Avada / Divi / Elementor with async CSS loading is fixed, the module gains a master on/off switch, an automatic render watchdog that auto-disables any optimisation that breaks the page, Cloudflare integration, self-hosted Google Fonts and theme-purge sync. Recommended for all sites.', 'blaminhor-essentials' ),
		);
	}
}

if ( ! function_exists( 'blaminhor_essentials_get_current_upgrade_notice' ) ) {
	/**
	 * Returns the upgrade notice text for the currently installed version,
	 * or an empty string if no entry is mapped.
	 *
	 * @return string
	 */
	function blaminhor_essentials_get_current_upgrade_notice() {
		$version = defined( 'BLAMINHOR_ESSENTIALS_VERSION' ) ? BLAMINHOR_ESSENTIALS_VERSION : '';
		if ( '' === $version ) {
			return '';
		}

		$notices = blaminhor_essentials_get_upgrade_notices();
		return isset( $notices[ $version ] ) ? $notices[ $version ] : '';
	}
}
