=== Leadovation Aerodrome METAR TAF ===
Contributors: wptechnology
Tags: metar, taf, aviation, weather, aeronautical
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 3.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

METAR and TAF of your aerodrome on the club's own site, readable without knowing the code: decoded cards, compact bar, badge, blocks.

== Description ==

A student opens the club's website on Saturday morning to see whether the lesson holds. The instructor opens the same page to see what the TAF says for the afternoon slot. The webmaster who built that page has never read a METAR in his life, and should not have to.

**Aerodrome METAR TAF puts the field's weather on the club's own site, readable by all three.** The METAR and the TAF come from the NOAA Aviation Weather Center, are decoded into plain words, and are shown with the flight category first, in cards that follow the site's theme. The raw message stays one click away for the pilots who read the code.

It is written for a flying club or a flight school and its aerodrome: the field's weather in plain words, a legal notice that points to the official sources, and a settings screen a volunteer webmaster gets through in five minutes.

= What the plugin does =

The plugin is built around the club's aerodrome. Every display reads it by default, and any display can be given another ICAO code in its shortcode or block.

* **The raw message.** The METAR or the TAF exactly as received, in a monospaced block, for the pilots who read the code.
* **A compact bar.** One line, ICAO, category, wind, visibility, ceiling, QNH, at the top or the bottom of a page without crowding it.
* **A badge.** The category alone, colour and shape, with the observation time. Fits in a title, a menu, a sidebar.
* **A decoded card, METAR and TAF.** Wind, visibility, clouds, temperature, QNH, in words. A TAF is read as a TAF: the base forecast with its validity, then one line per change period (BECMG, TEMPO, FM, PROB) with its own time window. The badge is the category of the period in progress and says so ("now", "from 18:00 UTC"); the worst case over the whole validity, TEMPO and PROB included, is written underneath instead of colouring the head. An expired TAF is greyed and says it.
* **A compact card.** The same decoded card made dense for a column or a footer: one header line, then a grid of pairs. The `flat` skin removes its background and border so it melts into a column the theme already styles.
* **A disclaimer with the official links.** The legal text, with Aéroweb, OLIVIA and SIA, under each card, once per page, or never, as the setting says. One display can opt out on its own.
* **A dashboard for the aerodrome.** Its last METAR, the category, "observed at" and "fetched" side by side, the health of the NOAA source, and a field to change the aerodrome.
* **Settings that fit on one screen.** The aerodrome, wind unit (knots, km/h, m/s), the category profile with a plain explanation of what NOAA and metric mean and why neither is a regulation, UTC and local time or one of the two, and the disclaimer text and position.
* **An Integration tab that shows before you copy.** Pick a display, set its options (METAR or TAF, size, theme, skin, disclaimer), watch the real preview change, then copy the shortcode or the block. Same options, same names, whichever way you integrate.
* **A Gutenberg block.** One "Aerodrome METAR TAF" block in the Aero category carries every display of the plugin and every option the shortcodes accept.
* **A widget.** The compact bar, the raw message, the badge or the decoded card in a sidebar.
* **Categories in colour and in shape.** VFR, MVFR, IFR and LIFR each have a colour and a distinct dot shape, and the text is always next to the dot: colour alone never carries the information.
* **Two ages, never confused.** "Observed at 17:30 UTC (19:30 local time)" on every card, next to "fetched 2 min ago". Freshness is judged on the time of the observation, and a message more than two hours old is greyed and says so.
* **A source that says when it falls.** The dashboard shows the health of the NOAA source in green only when the last request succeeded, and "unreachable since 17:52" in red otherwise, with the last known message kept and marked as such.
* **METAR AUTO read to the end.** `BKN008///`, `VV///`, `12///`, `Q////`, runway visual range and directional visibility no longer stop the decoder halfway. SPECI, AMD and COR are decoded and tagged.

= Aerodrome METAR TAF Pro, a separate plugin =

[Aerodrome METAR TAF Pro](https://www.wptechnology.com/plugins/aerodrome-metar-taf/) is a separate download from the publisher, which replaces this plugin and keeps its settings. Nothing described below is part of this plugin, and nothing in this plugin waits for it. Pro adds.

* **Several aerodromes.** Favourite aerodromes followed on the dashboard, a multi-aerodrome table with one line per field, and a visitor selector where the visitor types an ICAO code.
* **The crosswind on the club's runway.** Total wind, gust and crosswind component on the runway in use, on every card that shows wind.
* **Station details.** Elevation, runways and frequencies from OurAirports, each field checked by the club against the VAC chart.
* **More displays.** A tabbed METAR and TAF panel, a single field to drop into a sentence ("QNH 1016 hPa"), and the aerodrome's webcam with its directories.
* **Conditions of the day, against the Club thresholds.** A green, orange or red light per profile, period by period, on the TAF of the day. Three profiles (student, pilot, instructor), two thresholds per criterion (a warning figure, then a stop figure) for wind, gust, crosswind, ceiling and visibility, plus the phenomena each profile rules out (fog, thunderstorm, freezing...). The club writes what it allows; the plugin compares and never says whether the day is good to fly. A compact light for a single profile fits in a sidebar.
* **A TAF timeline.** The forecast hour by hour, so the best slot can be chosen on the page.
* **A wind rose on the runways.** The wind drawn against the runway headings, the active runway at a glance.
* **A club-house screen.** Fills the whole screen and rotates on its own, for the television by the coffee machine.
* **A scrolling banner.** The conditions scroll like a news feed and take no vertical space.
* **Student mode.** Every part of the METAR and the TAF explained token by token, to learn to read the weather during training.
* **Avada elements.** The displays as native Fusion Builder elements, under "WPTechnology", with the same options as the shortcodes.
* **In the colours of the club.** An Appearance card in the settings: the club's accent colour and logo in the card headers, the NWS palette for the categories (blue MVFR, magenta LIFR) as an alternative to the Aero one, the fonts of the theme instead of the range's, square or rounded corners, a dark default or the visitor's own setting, and a box of additional CSS scoped to the displays. A live preview shows the real cards while you choose. The 3 px stripe and the dot shapes never change: they carry the information.

The plugin's screens carry a short note where Pro would add something, with a link to its page; each note closes for good with one click, account by account.

[See what Pro adds and what it costs](https://www.wptechnology.com/plugins/aerodrome-metar-taf/).

= Part of the Aero range =

Aerodrome METAR TAF is one of the WPTechnology plugins written for flight schools and flying clubs. They share the same look and the same idea: one job each, done properly, and they talk to each other when installed side by side.

* [Aero Courses](https://wordpress.org/plugins/leadovation-aero-courses/): theory course scheduling and booking, the semester built once and published on the school's site.
* [Aero Users](https://wordpress.org/plugins/leadovation-aero-users/): the school's roster (students, pilots, instructors, examiners) shared by the whole range.

= Translations =

The plugin is written in English.

= What this plugin does not claim =

The data is provided for information only. It is not an approved source for flight preparation: for that, the pilot goes to the national weather service and the aeronautical information service (in France, Aéroweb, OLIVIA and the SIA), and the plugin's own disclaimer says so with the links. The decision to fly, and how, remains the pilot in command's.

The VFR, MVFR, IFR and LIFR categories are a display convention, NOAA's or an indicative metric transposition of it, and have no regulatory value: they are not EASA or SERA minima.

= Third-party services =

The plugin fetches the METAR and the TAF from the public API of the [NOAA Aviation Weather Center](https://aviationweather.gov/). What is sent is the ICAO code of the aerodrome asked for (LFPN, say), when a display is rendered, when the dashboard is opened, or when the cache is refreshed. No personal data is sent, and no API key is needed. Terms and notices: [weather.gov/disclaimer](https://www.weather.gov/disclaimer).

The plugin bundles the Freemius SDK, the shop through which Pro is sold, and which also offers anonymous usage statistics if you agree to them on activation. You are asked, you may decline, and declining changes nothing about how the plugin works. Freemius is contacted to read the current price of the Pro plan shown on the Pro tab (a public request that carries nothing about your site) and, with your consent, to send those statistics. Service: [Freemius](https://freemius.com/) · [terms](https://freemius.com/terms/) · [privacy](https://freemius.com/privacy/).

The dashboard shows the other plugins of the Aero range. That list is read from [wptechnology.com](https://www.wptechnology.com/), the publisher's own site, at most once a day and only when an administrator opens the dashboard: a plain GET on a public address, with nothing about your site in it. If the site does not answer, the last list received is shown, or the one bundled with the plugin. Whether a plugin is installed here is read locally and never sent. [Legal notice](https://www.wptechnology.com/mentions-legales/) · [privacy](https://www.wptechnology.com/confidentialite/).

== Screenshots ==

1. The dashboard: the aerodrome's last METAR, the category, "observed at" and "fetched" side by side, and the health of the NOAA source.
2. The Integration tab: a display picked on the left, its options set, the real preview updating, and the shortcode or the block ready to copy.
3. The decoded card, METAR and TAF, in light and dark: category first, the TAF as base forecast then periods, the worst case written underneath.
4. The settings: aerodrome, wind unit, category profile explained, time zone and disclaimer.

== Installation ==

1. In your WordPress admin, go to Plugins → Add New and search for **Aerodrome METAR TAF**, then click "Install Now" and activate. (Or upload the zip from Plugins → Add New → Upload Plugin.)
2. Open the **Aerodrome METAR TAF** menu and choose your aerodrome by its ICAO code. Every display proposed in the Integration tab and every new block starts on it.
3. Put a display on a page: the "Aerodrome METAR TAF" block in the block editor (Aero category), or a shortcode. The Integration tab writes either one for you, with the options you picked.

The shortcode grammar is one tag, a view, an ICAO code, then options:

`[aero_weather decoded LFPN type="taf" size="compact" theme="dark" skin="flat" disclaimer="no"]` gives the decoded TAF card, dense, dark, without background, and without the legal notice under it.

`[aero_weather compact LFPO]` gives the compact bar of another aerodrome: any display takes the ICAO code you write.

The views are `metar` and `taf` (raw message), `compact`, `badge` and `decoded`. The legal notice has its own tag, `[aero_weather_disclaimer]`. Only the options that differ from the defaults need writing.

== Frequently Asked Questions ==

= Is the data official? =

No. It is provided for information only. For flight preparation, always refer to approved sources (national weather service, AIS, NOTAM). The plugin's disclaimer carries the links to Aéroweb, OLIVIA and the SIA.

= Do I need an API key? =

No. The data comes from the free, public NOAA API.

= Why does the TAF card show a different category from the METAR card? =

Because they answer two different questions. The METAR card shows the category of the last observation. The TAF card shows the category of the forecast period in progress, and says which one ("now", "from 18:00 UTC"); the worst case over the whole validity, TEMPO and PROB included, is written underneath in small. A CAVOK afternoon with a PROB30 of fog at night reads VFR now, with the worst case LIFR written underneath.

= Does it work with Gutenberg and page builders? =

Gutenberg, yes, in full: the "Aerodrome METAR TAF" block carries every display and every option. On any builder, the shortcode works.

= For developers =

Two template-tag functions for theme integrators:

```
<?php echo aero_weather_metar( 'LFPN', 'decoded' ); ?>
<?php echo aero_weather_taf( 'LFPN' ); ?>
```

They are equivalent to the unified `[aero_weather]` shortcode and use the same views. An unknown view falls back to `raw`. The Gutenberg block builds the same shortcode and hands it to `do_shortcode()`, so the three ways of integrating render exactly the same markup.

== Changelog ==

= 3.0.0 =
* The plugin is built around the club's aerodrome: the dashboard shows it, with a field to change it, and every display reads it unless its shortcode or block names another one.
* The displays are the raw message, the compact bar, the badge, the decoded card and the legal notice. In the unified `[aero_weather]` shortcode, an unknown view renders the raw message.
* The developer interface `Aero\Weather\Api` is now 2.0.
* The plugin's screens may show a short note about the Pro version, closed for good with one click.

= 2.2.6 =
* Updated Freemius SDK to the latest version.
* Uninstalling the plugin also removes the airfield records it kept from the weather service.
* Other plugins read the airfield weather through a stable developer interface, `Aero\Weather\Api`.

= 2.2.5 =
* In the Aero range card of the dashboard, each plugin name reads the same way: Aerodrome METAR TAF shows “Aero” in black, “drome” in grey and “Metar Taf” in colour.

= 2.2.4 =
* The admin menu reads “Aero Metar Taf”, which fits on one line of the WordPress sidebar; the screen keeps its full name.

= 2.2.3 =
* Every value placed in a display (wind, temperature, labels, classes) is escaped where it is written, and every display returned to WordPress goes through the list of allowed tags.

= 2.2.2 =
* Every display rendered inside another one (the blocks, the template tags, the live previews) goes through the same list of allowed tags before it is returned.

= 2.2.1 =
* Filter output entering a rendered card is escaped like the rest; the cache lock is atomic.

= 2.2.0 =
* Renamed Leadovation Aerodrome METAR TAF; the on-screen name is Aerodrome METAR TAF.
* Settings are sanitized field by field before they are stored.
* The Integration tab hands you, for every display it lists, a shortcode that works.

= 2.1.3 =
* The Aero Core base moves to 1.5.0 and knows Aero Fleet's place in the menu.

= 2.1.2 =
* The Aero range card on the dashboard now reads the list of the range from wptechnology.com, once a day at most, so that a plugin published later appears without an update; the last list received, or the bundled one, serves when the site does not answer.

= 2.1.1 =
* Translations now come through translate.wordpress.org and install themselves.

= 2.1.0 =
* `theme="auto"` on every display: the card follows the visitor's light or dark setting.
* The `club`, `ecole` and `fbo` skins are gone; `flat` stays.

= 2.0.4 =
* The dashboard says plainly how fresh the source is.

= 2.0.3 =
* The unified `[aero_weather]` shortcode falls back to the raw message for an unknown view, instead of leaving the page blank.

= 2.0.2 =
* The link to the plans goes straight to the pricing page instead of an empty screen.

= 2.0.1 =
* Freemius SDK updated to 2.13.4.
* The price line on the dashboard shows the monthly price as the shop states it.

= 2.0.0 =
* **The front joins the Aero range.** Every display now shares one anatomy (station and category in the head, a body, an age and a notice in the foot), the fonts and the palette of the range, a 3 px category stripe on the left edge, and a light and a dark theme that follow the site unless the shortcode says otherwise. Categories are coded in colour and in shape, with LIFR as its own colour; the text is always next to the dot.
* **The TAF is read as a TAF.** Base forecast, then one line per change period with its window and category. The badge is the category of the period in progress and says so; the worst case is written underneath. An expired TAF is greyed.
* **Two ages on every card.** "Observed at 17:30 UTC (19:30 local time)" next to "fetched 2 min ago". Freshness is judged on the observation; a message more than two hours old is marked as expired.
* **The source says when it falls.** Green only when the last request succeeded, "unreachable since HH:MM" in red otherwise, with the last known message kept and marked.
* **One Gutenberg block for everything.** The "Aerodrome METAR TAF" block, in the Aero category, carries every display and every option; the blocks of the 1.x remain as hidden aliases so existing pages still render.
* **The Integration tab replaces the test bench.** The decoded card in large, then the utilities; every option per display, a real preview that never goes blank, and the output as shortcode or block. Options are declared once and offered identically in the tab and the blocks.
* **Settings rewritten.** Main aerodrome, asked for when the plugin is first opened and proposed everywhere; wind unit (knots, km/h, m/s); the category profile explained in plain words with its lack of regulatory value stated; UTC and local time, or one of the two; the disclaimer shown under each card, once per page, or never, in the words the club chooses.
* **One option registry for the three ways of integrating.** The shortcodes, the blocks and the Integration tab read the same declarations, so an option is named and behaves the same way whichever route you take.
* **Uninstall runs through Freemius.** Cleanup hangs from the `after_uninstall` hook instead of `uninstall.php`, so Freemius no longer believes the plugin is still installed.

= 1.0.0 =
* First release under the WPTechnology brand (derived from WPTafMetar2).
* Unified flight category engine (NOAA and European metric profiles).
* Optional, editable "for information only" disclaimer.
