=== BBK Warning ===
Contributors: Harald Laier
Tags: warning, civil protection, nina, bbk, flood, severe weather, danger, safety, shortcode
Requires at least: 5.0
Tested up to: 6.9
Stable tag: 2.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Displays current warning messages from the German Federal Office of Civil Protection (BBK) for any location or district via shortcode. Ideal for municipalities, fire departments, and citizen websites.

== Description ==

This plugin integrates the official BBK warning API (warnung.bund.de) into your WordPress site. It retrieves warnings about hazards such as severe weather, floods, fires, hazardous material releases, or police messages for freely selectable regions.

**Main Features**

* **Shortcode `[bbk_warnung]`** – display warnings for one or more regions.
* **Searchable region list** – all municipalities, cities, and districts of Germany are directly selectable.
* **Shortcode generator** in the backend – visually assembles all options.
* **Custom heading** – individually control visibility and text of the heading.
* **External link hint** – informs visitors that a link leads to warnung.bund.de.
* **Always visible BBK link** – even when no warning is active, a link to the start page can be displayed.
* **App download links** – references to Google Play and Apple App Store.
* **Custom region name** – overwrites the automatic name in square brackets (useful for municipal associations or custom labels).
* **Searchable ARS table** – use `[bbk_ars_tabelle]` to display an interactive table of all stored regions (ARS, name, type).
* **Custom CSS** – adjust the appearance of the warning box via the settings page without modifying plugin files (see FAQ).
* **Multilingual** – the plugin is fully internationalized. A German language file (.po/.mo) is included.

**Shortcode Examples**

    [bbk_warnung]                                   – uses the region selected in the settings
    [bbk_warnung ars="073350000000" show_extern="true"]  – activate external hints
    [bbk_warnung ars="073120000000, 073350000000" show_title="false" custom_name="Kaiserslautern Region"]
    [bbk_warnung show_always_link="true" show_nina_link="true"] – always visible link and app icons

**Privacy Notice**

No personal data is collected. The API requests are made directly from your server to the BBK servers. No cookies are set.

== Notes on the data source ==

This plugin uses the official warning messages from the German Federal Office of Civil Protection and Disaster Assistance (BBK) via the warnung.bund.de interface.

* **Data source:** Federal Office of Civil Protection and Disaster Assistance (BBK) / warnung.bund.de
* **Influence:** We have no influence on the provision, correctness or timeliness of the data. The plugin retrieves the API data and displays it unchanged. The warning messages themselves are not edited.
* **Linking:** For more information, a link to the original warning on warnung.bund.de is automatically added.
* **Availability:** No guarantee can be given for the permanent and uninterrupted availability of the API. If the data cannot be retrieved for technical reasons, error messages or empty output may occur.
* **First call of the settings page:** After installation and activation of the plugin, the first call of the settings page may take a few seconds longer because the regional data (all municipalities and districts of Germany) is written to the database. This is a one-time process.

== Installation ==

1. **Download the plugin** and unzip it into `/wp-content/plugins/bbk-warnung/`.
2. **Activate the plugin** via the WordPress admin menu.
3. Go to **Settings → BBK Warning** and select a default region.
4. Insert the shortcode `[bbk_warnung]` into a post, page, or widget.

== Frequently Asked Questions ==

= Why does the first call of the settings page take so long? =

After installation and activation of the plugin, the first call of the settings page may take a few seconds longer because the regional data (all municipalities and districts of Germany) is written to the database. This is a one-time process.

= How do I find the correct ARS (regional key) for my location? =

Use either the searchable Select2 list on the settings page or the shortcode `[bbk_ars_tabelle]`, which displays all stored regions with ARS and name. Alternatively, the settings also link directly to the official Excel lists from the Federal Statistical Office.

= How do I use the shortcode for multiple locations? =

Provide the ARS separated by commas: `ars="073350000000, 091630000000"`. For both locations, warnings of the respective parent district will be displayed.

= Can I hide the heading or replace it with my own text? =

Yes, use `show_title="false"` to completely suppress the heading. Use `custom_title="My warning notice"` to set your own text.

= What does the external link hint mean? =

When `show_extern="true"` is set, the text "(external link to warnung.bund.de)" appears after each warning link. This informs your visitors that they are being redirected to an external government site.

= How can I customize the appearance of the warnings? =

On the settings page you will find the text field **Custom CSS (optional)**. There you can enter any CSS rules, for example:

    .bbk-warnung-header { color: #b30000; font-size: 1.6em; }
    .bbk-warnung-container { background: #f0f7ff; border-left: 5px solid #cc0000; }
    .bbk-warnung-list a { color: #0056b3; text-decoration: none; }

These rules are automatically output on every page that uses the shortcode. This way you can adjust colors, fonts, spacing, or borders to match your theme – without modifying the plugin files.

= Warnings are not displayed. What can I do? =

First, check whether the region exists in the database (page with `[bbk_ars_tabelle]`). Ensure that your WordPress installation allows `wp_remote_get` and that your firewall does not block API requests. The plugin caches warnings for 5 minutes – after a new warning it may take a short while.

= Is the plugin multilingual? =

Yes, all texts are translatable. The current version ships with a German language file. If you wish, you can create other languages (e.g., English) using Poedit.

== Changelog ==

= 2.7 =
* Improved distinction between district-free cities and rural districts in the region selection (e.g., "Regensburg (district-free city)" vs. "Regensburg (rural district)").

= 2.6 =
* Improved deduplication: Identical warnings for multiple requested regions (ARS) are output only once.
* The region names of all affected locations are combined in square brackets, separated by commas (e.g. `[Otterbach, Katzweiler, Schneckenhausen]`).
* The warning itself appears only once – prevents multiple repetitions, e.g. for collective municipalities.

= 2.5 =
* First stable version
* Support for all German municipalities and districts
* Extensive shortcode parameters (heading, external hint, always link, app icons, custom name)
* Shortcode generator in the backend
* ARS table (`[bbk_ars_tabelle]`) for searchable region list
* Custom CSS field in the settings
* Caching for high performance (API transients)
* Internationalization (text domain `bbk-warnung`)
* German language file (.po/.mo) included

= 2.4 =
* Internal pre-release – not public