=== Nanitalk MovieDB Widget ===
Contributors: tanjencompany
Tags: movies, tv series, widget, moviedb, shortcode
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Display rich movie and TV series widgets from a self-hosted MovieDB instance inside your WordPress posts.

== Description ==

MovieDB Widget connects your WordPress site to a self-hosted **MovieDB (Nanitalk)** instance and renders a rich information widget for movies and TV series directly inside your posts.

Features:

* Search movies and TV series from the post editor sidebar.
* Insert a widget as the post's main title, or drop multiple `[moviedb_widget]` shortcodes for list-style articles.
* Auto-insert the widget after a chosen paragraph, after the content, or shortcode-only.
* Per-country watch-provider data (configurable default country).
* Server-side caching via the WordPress Transient API (12-hour TTL).
* Optional outbound webhook that notifies your MovieDB instance when a linked article is published, unpublished, or trashed (signed with HMAC-SHA256).

The plugin works out of the box against the default MovieDB instance (https://moviedb.nanitalk.com). Advanced users can point it at their own self-hosted MovieDB instance under the settings page.

== External services ==

This plugin connects to a third-party / self-hosted MovieDB instance that **you configure** under Settings → MovieDB Widget. Nothing is sent until you enter a Base URL.

It connects to the configured MovieDB instance (e.g. `https://moviedb.nanitalk.com`) to:

1. **Search titles** — when you type in the editor search box, the search term is sent to `GET {base_url}/api/search`.
2. **Fetch widget data** — when rendering a widget, the title ID, country code and variant are sent to `GET {base_url}/api/widgets/title/{id}`.
3. **Report article links (webhook)** — when a post linked to a title is published, unpublished, or trashed, the site name, post ID, post URL, title ID and status are sent to `POST {base_url}/api/integrations/wordpress/article-link`, signed with a shared HMAC-SHA256 secret.

Widget responses may include image URLs served from `https://image.tmdb.org` and `https://images.justwatch.com`, which are loaded by the visitor's browser.

Because the MovieDB instance is configured by the site owner, the data sent and any applicable terms or privacy policy depend on that deployment. The reference instance is available at https://moviedb.nanitalk.com

== Installation ==

1. Install the plugin via Plugins → Add New, or upload the ZIP via Plugins → Add New → Upload Plugin.
2. Activate the plugin through the Plugins menu in WordPress.
3. That's it — the plugin works out of the box against the default MovieDB instance (https://moviedb.nanitalk.com). Optionally visit Settings → MovieDB Widget to point it at a different MovieDB instance or set a default country.

== Frequently Asked Questions ==

= Do I need to configure anything? =

No. After activation the plugin works immediately using the default MovieDB instance. You only need the settings page if you run your own MovieDB instance and want to point the plugin at it.

= Can I use my own MovieDB backend? =

Yes. Enter your own MovieDB Base URL (and, if you use the article-link webhook, an Integration Secret matching your instance) under Settings → MovieDB Widget.

= How do I add a widget to a post? =

Use the "MovieDB Widget" box in the post sidebar to search and link a title, or insert the `[moviedb_widget id="123"]` shortcode manually.

= Is the integration secret stored safely? =

The secret is stored as a WordPress option and is only used server-side to sign outbound webhooks with HMAC-SHA256. It is never printed back into the settings form.

== Screenshots ==

1. Movie widget rendered inside a post — backdrop, ratings, cast and watch providers.
2. TV series widget — compact layout with scores, synopsis and streaming availability.

== Changelog ==

= 1.2.1 =
* Initial public release.
