=== Ts-Immo Sync ===
Contributors: tsimmo
Tags: real estate, idx, crm, property, listings
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Synchronise your real-estate listings from your CRM to WordPress automatically: text, photos, features and taxonomies, always up to date.

== Description ==

**Ts-Immo Sync** is the official sync connector of the Ts-Immo platform. It receives the
properties pushed by the Ts-Immo gateway from your CRM and automatically materialises
them as complete, structured WordPress pages — text, media, features and taxonomies —
so your website always reflects your real portfolio, with zero re-entry.

You keep managing your properties in your usual business software (CRM). The Ts-Immo
gateway fetches the data, normalises it to a canonical format, then pushes it to this
plugin, which creates, updates or removes the matching WordPress pages on the next sync.

= Why it matters =

An outdated catalogue destroys trust and drives buyers away: a visitor who calls about
an already-sold property or a changed price won't come back. Continuous syncing
guarantees that what the visitor sees matches your real portfolio exactly, at all times.

= Key features =

* Automatic import of properties and their media (photos imported in full resolution)
* Features and taxonomies handled out of the box
* Automatic removal of unpublished/withdrawn listings
* Compatible with 20+ real-estate CRMs and portals (Apimo, Hektor, SweepBright, Netty, Whise, Seloger…) through the Ts-Immo multi-connector architecture
* Theme-agnostic: exposes a primitive shortcode `[ts-immo-field name="<meta_key>"]` and developer hooks/filters to extend each listing
* Foundation for every Ts-Immo display add-on (map, AI search, compliance, PDF sheets…)

= Developer extension points =

* `ts_immo_sync_property_imported` (action) — fired after every create/update/delete
* `ts_immo_sync_after_upsert` (action) — fired after an upsert with the full payload
* `ts_immo_sync_field_mappings` (filter) — declare a postmeta ↔ canonical-field mapping

== External services ==

This plugin connects your WordPress site to the Ts-Immo platform in order to receive and
synchronise your real-estate listings. It is the WordPress endpoint of the Ts-Immo
sync gateway and **requires a Ts-Immo account** to be useful.

What is exchanged and when:

* The Ts-Immo platform (api.ts-immo.org) sends your property data (descriptions, prices,
  characteristics, media URLs, taxonomies and translations) to this plugin's REST
  endpoints during each scheduled synchronisation. The plugin then downloads the media
  files referenced in that payload.
* During site activation, the plugin exchanges an authentication key and the site domain
  with the Ts-Immo platform to register the link between your WordPress site and your
  Ts-Immo gateway.

No data is sent to the Ts-Immo platform without your configuration of the connection.
This service is provided by Ts-Services.

* Terms of use: https://ts-immo.org/fr/cgu
* Privacy policy: https://ts-immo.org/fr/confidentialite

== Installation ==

1. Upload the `ts-immo-sync` folder to the `/wp-content/plugins/` directory, or install the plugin through the **Plugins** screen in WordPress.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to the Ts-Immo Sync settings screen and connect your site to your Ts-Immo gateway using the activation key from your Ts-Immo account.
4. Run a synchronisation from your Ts-Immo gateway: your listings appear automatically on your site.

== Frequently Asked Questions ==

= Do I have to re-enter my properties on the site? =

No, never. You keep managing your properties in your CRM; they are pushed automatically
to WordPress on every sync. No double entry, no technical work on your side.

= How often is the site updated? =

Syncing is periodic and orchestrated by a scheduler, with full or incremental modes. New
listings, price changes and removals are reflected very regularly, automatically.

= Are high-resolution photos imported? =

Yes. Images are transferred one by one in full resolution from your CRM, then WordPress
generates the variants (thumbnail, medium, large) via the media library.

= Is my CRM compatible? =

Ts-Immo supports more than twenty real-estate CRMs and portals through its
multi-connector architecture. If you use a common market tool, there's a strong chance
it's already supported — contact us to confirm.

= Do I need a Ts-Immo account? =

Yes. This plugin is the WordPress endpoint of the Ts-Immo sync platform and requires a
Ts-Immo account to receive listings. See https://ts-immo.org.

== Screenshots ==

1. Dashboard: licence status, sync health and your catalogue at a glance.
2. Every property pushed from your CRM, published automatically on WordPress.
3. Real-time synchronisation logs and status.

== Changelog ==

= 1.0.7 =
* Activation is never blocking: on a fresh WordPress with "plain" permalinks, the plugin now switches the site to a sane default (`/%postname%/`) so its custom routing works out of the box, instead of deactivating itself and stopping activation with a fatal error.
* Routing self-check: the "regenerate your permalinks" notice no longer loops on every admin page. It is throttled, treats a blocked loopback request as inconclusive (not a failure), self-heals by flushing the rewrite rules, and is dismissible for good.

= 1.0.6 =
* Isolation of metadata: `get_post` now returns only the postmeta written by the synchronisation.
* Field mappings: postmeta keys declared by the mapping template are now registered in the allowlist.

= 1.0.5 =
* Licensing: bundle the full GPLv2 license text (`license.txt`) and add the `License URI` header to the main plugin file.
* Metadata: plugin author aligned with the WordPress.org account (`tsimmo`).

= 1.0.2 =
* Compatibility: "last sync" queries no longer use MySQL-only `TIMESTAMPDIFF()`, fixing database errors on SQLite-backed installs (WordPress Playground / plugin-directory live preview).
* Hardening: the routing self-check loopback request now follows the WordPress core convention (`https_local_ssl_verify` filter) instead of unconditionally disabling SSL verification.
* Confirmed compatible with WordPress 7.0.2 and PHP 8.4.

= 1.0.1 =
* Security: escape all `[ts-immo-field]` shortcode output.
* Security: explicit sanitization of remote-licence fields and of values used in log messages.
* Hardening: rate limiter now keyed on the connection IP (REMOTE_ADDR) to prevent transient bloat from spoofed proxy headers.
* Admin notices (licence/key) are now limited to the plugin's own screens.

= 1.0.0 =
* Initial public release.
