=== Admin Maintenance Message ===
Contributors: antman313
Donate link: https://codekeks.de/
Tags: admin, notice, maintenance, banner
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show a maintenance banner in WP-Admin and optionally a full frontend maintenance mode with custom templates or HTML pages.

== Description ==
A flexible admin & frontend maintenance plugin for WordPress.

Display a non-dismissible banner across the admin area to notify users of upcoming maintenance windows — and optionally replace the **public site** with a fully customizable maintenance page (WordPress page, custom HTML, or template file).

### Features
* Admin notice visible to all or selected roles
* Configurable date/time window (`from`/`to`)
* Free text with placeholders: `{DATE}`, `{FROM}`, `{TO}`, `{TZ}`, `{WEEKDAY}`, `{DATE_TO}`, `{WEEKDAY_TO}`, `{DATETIME_FROM}`, `{DATETIME_TO}`
* Frontend maintenance mode:
  * WordPress page mode
  * Custom HTML block
  * Template file (in `/assets/maintenance/templates/`)
* Optional bypass for logged-in users
* Multisite-safe uninstall
* Fully translatable (`Text Domain: admin-maintance-msg`)

Configure under **Settings → Wartungshinweis**.

---

== Usage ==

### 1. Aktivierung und Zugriff

Nach der Installation findest du den Menüpunkt unter:
**Einstellungen → Wartungshinweis**

Hier kannst du das Verhalten des Plugins vollständig steuern.

---

### 2. Admin-Warnleiste (Dashboard-Hinweis)

Diese Leiste wird oben im WordPress-Dashboard angezeigt, für alle oder ausgewählte Benutzerrollen.

**Einstellungen:**
- **Wartung aktiv (Checkbox):** Zeigt den Hinweis sofort an, auch außerhalb eines Zeitfensters.
- **Von / Bis (Datum + Uhrzeit):** Optionales Zeitfenster, innerhalb dessen der Hinweis automatisch aktiv ist.
- **Nachricht:** Freitext oder Vorlage mit Platzhaltern:
  - `{WEEKDAY}`, `{DATE}`, `{FROM}`, `{TO}`, `{TZ}`
  - `{DATETIME_FROM}`, `{DATETIME_TO}`, `{WEEKDAY_TO}`, `{DATE_TO}`
- **Sichtbar für Rollen:** Bestimme, welche Rollen die Nachricht sehen (z. B. nur Administratoren oder Redakteure).

💡 *Wenn kein Text eingegeben ist, erzeugt das Plugin automatisch eine Standardmeldung auf Basis des Zeitfensters.*

---

### 3. Frontend-Wartungsmodus

Wenn aktiviert, ersetzt das Plugin deine öffentliche Website während der Wartungszeit durch eine **Maintenance Landingpage**.

**Einstellungen:**
- **Frontend Maintenance aktiv:** Schaltet den Modus ein.
- **Bypass für eingeloggte Nutzer:** erlaubt angemeldeten Benutzern, die Seite weiterhin normal zu sehen.
- **Landingpage-Modus:**
  1. **WordPress-Seite:** Nutzt den Inhalt einer bestehenden Seite (Dropdown-Auswahl).
  2. **Custom HTML:** Du kannst eine eigene HTML-Struktur direkt im Textfeld hinterlegen.
  3. **Template-Datei:** Wähle eine HTML-Datei aus dem Plugin-Verzeichnis (`assets/maintenance/templates/`).

💡 *Das Standard-Template `default.html` zeigt Titel, Nachricht und Zeitraum automatisch an.*

---

### 4. Templates anpassen

Eigene Templates kannst du einfach ergänzen:

1. Erstelle im Verzeichnis `/assets/maintenance/templates/` eine Datei, z. B. `blue-theme.html`.
2. Verwende Platzhalter für dynamische Inhalte:
   - `{{TITLE}}`, `{{MESSAGE}}`, `{{SITE_NAME}}`, `{{WINDOW}}`
   - `{{FROM}}`, `{{TO}}`, `{{DATE}}`, `{{DATE_TO}}`, `{{TZ}}`
3. Füge eigene CSS-Dateien unter `/assets/maintenance/css/` hinzu und binde sie im Template mit `<link>` ein.

---

### 5. Verhalten und Priorität

Das Plugin aktiviert die Frontend-Wartung, wenn:
- „Frontend Maintenance aktiv“ **oder**
- ein gültiges **Von/Bis-Zeitfenster** aktiv ist.

Während dieser Zeit:
- wird HTTP **503 (Service Unavailable)** gesendet,
- ein `Retry-After` Header gesetzt,
- und `noindex, nofollow` Meta-Tags ausgegeben (SEO-freundlich).

Nach Ablauf oder Deaktivierung wird die normale Seite automatisch wieder angezeigt.

---

### 6. Deinstallation

Beim Entfernen über „Plugins → Deinstallieren“:
- werden alle Optionen (`ammsg_options`, alte `ck_admin_maintenance_opts`) gelöscht,
- in Multisite-Umgebungen automatisch für alle Sites bereinigt.

---

### 7. Tipps & Best Practices

- Verwende **UTC+X Zeitzonen** bewusst – die Pluginzeiten richten sich nach der WordPress-Zeitzone.
- Wenn du Templates bearbeitest, achte auf **UTF-8 ohne BOM**.
- Du kannst über Filter eigene Verhalten ergänzen:
  - `ammsg_uninstall_option_keys` – eigene Optionen löschen
  - `ammsg_frontend_template_replacements` – Platzhalter erweitern

---

== Installation ==
1. Upload the plugin folder `admin-maintance-msg` to `/wp-content/plugins/`
2. Activate the plugin via **Plugins → Installed Plugins**
3. Open **Settings → Wartungshinweis**
4. Define your time window, message, and optional frontend page or template.

---

== Frequently Asked Questions ==

= Can I use placeholders in my custom message? =
Yes: `{WEEKDAY}`, `{DATE}`, `{FROM}`, `{TO}`, `{TZ}`, `{DATETIME_FROM}`, `{DATETIME_TO}`, `{WEEKDAY_TO}`, `{DATE_TO}`.

= How do I enable the frontend maintenance mode? =
Check “Frontend Maintenance active” and choose between:
- “WordPress page” → select an existing page
- “Custom HTML” → enter your own markup
- “Template file” → choose a file from `assets/maintenance/templates/`

= Can I limit who sees the admin notice? =
Yes. Use the role selector to restrict the banner to specific user roles.

= Does it work with multisite? =
Yes, it respects network activation and uninstalls cleanly.

---

== Screenshots ==
1. Admin settings page
2. Dashboard maintenance banner
3. Frontend maintenance landing page (template mode)

---

== Changelog ==

= 1.0.2 =
* Fixed a bad issue - sorry
* some small improvements

= 1.0.1 =
* New: Admin Settings page redesigned with hero header and sidebar.
* Fix: Unified textdomain with WordPress.org slug.
* Polish: Default maintenance template improved.
* Fixed some smaller Bugs
* Some small improvements
* Tested up to: 6.8.

= 1.0.0 =
* Major release — new Frontend Maintenance Mode with selectable templates and custom HTML.
* Role-based visibility for admin notice.
* Centralized defaults and cleaner architecture.
* Local asset loading (no CDN).
* Improved WPCS compliance, escaping, and sanitization.
* Ready for translation and WordPress.org standards.

= 0.1.5 =
* Replaced inline `<style>` with proper `admin_enqueue_scripts` and assets/admin.css.
* Adopted unique 5-char prefix `ammsg` for class and options; migration added.

= 0.1.4 =
* Fix: i18n string literal domains, numbered placeholders, translators comments, security escaping, tested up to 6.8.

= 0.1.3 =
* Unified textdomain, fixed PHP 8.2 deprecations, added Settings link.

= 0.1.2 =
* Time window rendering, placeholders, timezone handling.

= 0.1.0 =
* Initial release.

---

== Upgrade Notice ==

= 1.0.1 =
Major upgrade with full frontend maintenance mode, role control, and improved compliance.  
Please re-save your settings once after updating.

---

== Support ==
Questions or ideas?  
→ Visit [https://codekeks.de](https://codekeks.de) or the [WordPress.org support forum](https://wordpress.org/support/plugin/admin-maintanance-message/)