=== MapAPlace ===
Contributors: mapaplace
Tags: maps, map editor, map block
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 2.0.83
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Create, edit, publish and display maps entirely within WordPress.

== Description ==

MapAPlace is a standalone WordPress map editor and dynamic Map block. The base plugin does not require a service connection or credentials. The optional MapAPlace Connector adds published web-app maps to the block's grouped map selector.

Each map is a private `map_document` custom post type record. Its normalized working document, published snapshot, versions, public-access policy, categories, places and extension configuration are stored using fixed `_map_document_*` post metadata. Saving creates a WordPress revision and immediately updates the published map. Image and SVG assets are Media Library attachments parented to their map and stored below `uploads/map-documents/<map-id>/`.

The storage schema is deliberately independent from the plugin name. Rebranding a distribution must not change the post type, metadata, capabilities, options or upload directory. Version 2.0.0 is a clean storage break and does not read, migrate or remove records created with the earlier branded schema.

The base plugin supports up to three maps per WordPress user and up to 100 ordinary markers per map. Buildings, Post Type Markers and route data do not consume the ordinary marker allowance.

Installed add-ons register through WordPress hooks. The base plugin does not implement subscriptions, licensing, entitlement checks, remote extension downloads, heartbeats or a remote map cache. Hosted map access is isolated in the optional Connector plugin.

== Installation ==

1. Install and activate MapAPlace.
2. Open MapAPlace > Maps.
3. Create a map, edit it and select Save map to publish it.
4. Add the MapAPlace Map block and select a published map.

== Frequently Asked Questions ==

= Why does a public map fail when REST API access is restricted? =

Public map blocks need logged-out access to the `/mapaplace/v1/public/maps/` REST route prefix, including its asset and extension routes. Add that prefix to the exclusions in your REST-blocking plugin or `rest_authentication_errors` snippet. Use the route prefix without the site's subdirectory or `/wp-json`. Map handlers still enforce publication and any configured map password; editor routes remain restricted.

A `rest_forbidden` response saying "You must be logged in to access the REST API." comes from a site-wide REST restriction. It does not mean the map has a password. The viewer requests a password only when the map API returns `mapaplace_map_access_required`; other access failures display the map-unavailable message. Check an unprotected map while logged out after changing the restriction.

== Capabilities ==

Map management uses `create_map_documents`, `edit_map_documents`, `publish_map_documents` and `delete_map_documents`. Non-administrator users can access only maps they authored; administrators can access every local map.

== External services ==

Map data, editor requests, uploads and published payloads remain in WordPress. When the standard basemap is enabled, it may request map styles, vector tiles, glyphs and attribution resources from OpenFreeMap. It is not requested when Custom Basemap's Show standard base map setting is off. Optional Photon location search is contacted from the visitor's browser only after the visitor enables location search.

OpenFreeMap: https://openfreemap.org/
Photon: https://photon.komoot.io/

== Privacy ==

MapAPlace stores map content and password hashes in WordPress post meta. It never stores a plain-text map password. Uploaded map assets are normal WordPress attachments. No account credentials, API keys, subscription details or visitor analytics are collected by this plugin.

Deactivation preserves maps and uploads. Uninstall permanently removes only the current `map_document` records, their child attachments, the neutral map capabilities and the neutral capability-version option from each site in a multisite network. It does not inspect or delete the earlier branded storage schema.

== Changelog ==
= 2.0.83 =
* Validate, unslash and sanitize the map creation request method before enforcing POST submissions.

= 2.0.82 =
* Group the Gutenberg map selector only when both local and connected maps are available.

= 2.0.81 =
* Require a nonce-verified form submission to create maps; opening Add New no longer writes map data.

= 2.0.80 =
* Allow mouse tilt and rotation in the map editor without opening the camera settings panel.

= 2.0.79 =
* Prevent rapid Add marker clicks from creating overlapping requests with repeated default names.
* Keep the published marker fit instead of overwriting it with the saved camera; explicit block camera views still take priority.

= 2.0.78 =
* Show the actual marker count and explain why Add marker is disabled when a map reaches its limit.

= 2.0.77 =
* Save connected camera views per WordPress block and remove references to the retired Sync plugin.

= 2.0.76 =
* Let Connector extend the Map block with grouped local and connected map choices and native connected previews.

= 2.0.75 =
* Update the Tested up to header to WordPress 7.1.

= 2.0.74 =
* Escape map creation errors and clarify translated placeholders.
* Sanitize rate-limit addresses before validation and remove debug-only extension logging.
* Use WordPress file and URL helpers while preserving media locking and atomic cache publication.

= 2.0.73 =
* Refresh shared styles and rebuild the local editor and viewer assets.

= 2.0.72 =
* Allow temporary hover popups alongside the clicked location popup while preserving existing click behavior.

= 2.0.71 =
* Keep hovered Building popups open when their location is clicked; dismiss on outside clicks.

= 2.0.70 =
* Support the shared Show popups on hover setting while keeping clicked popups open until dismissed.

= 2.0.69 =
* Move shared popup content into its own Popups panel after Markers, with a saved main on/off switch for editor and published map popups.

= 2.0.68 =
* Preserve uploaded routing SVG scale when opening the map editor. Match all four projected map corners while editing, including rotated and pitched maps, without changing the saved SVG viewBox.

= 2.0.67 =
* Align shared editor controls, category ordering, same-page links and grouped vector SVG exports with the web app; rebuild current SVG editing behaviour.

= 2.0.66 =
* Shift-dragging a corner now makes the adjoining walls perpendicular instead of aligning the point to horizontal or vertical axes.

= 2.0.65 =
* Hold Shift while dragging shape vertices to constrain edges to horizontal or vertical alignment with neighboring points.

= 2.0.64 =
* Share the Always stay open popup control with individual Buildings panels.

= 2.0.63 =
* Add an Always stay open toggle to individual Places popup panels, keeping those popups visible automatically while their places are shown.

= 2.0.62 =
* Add a Maputnik style editor link beside the map style JSON field.

= 2.0.61 =
* Automatically extract style changes when applying a full JSON export.

= 2.0.60 =
* Support sparse map style changes and full-export comparison.

= 2.0.59 =
* Add custom map style JSON settings and refresh editor and viewer assets.

= 2.0.58 =
* Set automatic linked Building selection on post load to zoom 17.

= 2.0.57 =
* Use zoom 16 only for automatic linked Building selection on post load and restore normal click-selection zoom.

= 2.0.56 =
* Zoom farther out to level 17 when selecting a Building, including automatic post-load selection.

= 2.0.55 =
* Use a wider zoom when automatically selecting the linked Building on WordPress post load.

= 2.0.54 =
* Keep the linked Building active without opening its popup when its WordPress post loads.

= 2.0.53 =
* Select the first Building in saved order when multiple Buildings link to the current WordPress post.

= 2.0.52 =
* Set popup close button padding to 0 5px in the editor and viewer.

= 2.0.51 =
* Warn before leaving, refreshing or closing a map editor with unsaved changes or a save in progress.

= 2.0.50 =
* Export each 2D Building once using its persistent record ID, removing overlapping tile copies and internal tile strokes.

= 2.0.49 =
* Export the background map, Building decoration and Buildings in separate named SVG groups.
* Retain the vector background and its colours below the decoration and Buildings, with basemap labels excluded.

= 2.0.48 =
* Match outlined Building lettering to its rendered baseline and bold font weight in SVG exports.

= 2.0.47 =
* Export Buildings on a transparent canvas without background layers or ordinary markers.
* Export each flat Building as one original footprint with its own stroke, without tile splits or duplicate outlines.

= 2.0.46 =
* Convert exported lettering to portable vector outlines.

= 2.0.45 =
* Preserve simple pedestrian patterns as vectors and restore dashed path styles in SVG exports without black pattern fallbacks.

= 2.0.44 =
* Fix SVG export colours and transparent backgrounds for vector editors, physically crop map geometry, and include custom Buildings layers.
* Exclude base-map text labels from SVG exports while retaining extension-authored Building labels and SVG logos.

= 2.0.43 =
* Buildings inherit popup fields and order from the Markers settings builder.
* Add Save map (SVG) to download the current view as vector paths and editable text, with notices for omitted raster content.

= 2.0.42 =
* Increases standard basemap road-number label spacing to at least 2000 pixels.

= 2.0.41 =
* Increases standard basemap road-number label spacing from 200 to at least 800 pixels, preserving wider custom spacing and other labels.

= 2.0.40 =
* Allows successful unprotected image batches to stay in the visitor's browser cache for one hour across page loads. Protected batches and partial failures remain uncached.

= 2.0.39 =
* Adds bounded batches of public map images so Buildings logos can share one REST request while retaining publication, asset ownership and password checks.

= 2.0.38 =
* Updates the core release version alongside the Buildings subtitle normalization release.

= 2.0.37 =
* Batches rapid Building title and subtitle edits and applies pending text when leaving the field.
* Versions editor and viewer scripts by their contents so rebuilt assets receive fresh browser cache keys.

= 2.0.36 =
* Lets a singular WordPress post select its explicitly linked Building or Post Type Marker when a map block is rendered directly or through a server-rendered template content block.

= 2.0.35 =
* Makes portable SVG imports reliable on hosts whose PHP upload temporary files cannot be rewritten, prevents early script-registration notices from corrupting SVG responses, validates cached image bytes before serving them, and preserves exact WordPress upload errors.

= 2.0.34 =
* Keeps portable map images distinct during import, restores imported Building logos correctly, and keeps Gutenberg camera settings aligned with the published map view.

= 2.0.33 =
* Keeps the WordPress editor camera in place when selecting or editing markers; Fit map to markers now affects only the published map's initial view.

= 2.0.32 =
* Adds Treasure Hunt to the WordPress premium extension catalogue before its standalone plugin is activated.

= 2.0.31 =
* Restores the full draggable hit area for Building SVG editor control points in mouse and touch input.

= 2.0.30 =
* Accepts image responses created by the WordPress editor and block-preview iframe so synchronized images render reliably.

= 2.0.29 =
* Renders the current working map in the authenticated Gutenberg preview while public blocks continue to use the published snapshot.

= 2.0.28 =
* Loads draft image assets through the authenticated Gutenberg preview without weakening public map access.

= 2.0.27 =
* Makes every supported SVG geometry type selectable in the on-map vector editor.

= 2.0.26 =
* Keeps uploaded marker and Category images in Preview, Gutenberg blocks and published maps.

= 2.0.25 =
* Keeps the standard map style mounted across extension visibility changes so Gutenberg never transfers a replacement style object across browser realms.

= 2.0.24 =
* Loads absolute image URLs synchronized from the paired web application in the WordPress editor and viewer.

= 2.0.23 =
* Carries each uploaded image's stable content URL through the shared image field so every feature can preserve its upload origin.

= 2.0.22 =
* Returns the stable public URL of each WordPress image upload for document-only synchronization.

= 2.0.21 =
* Resolves newly uploaded image previews through the active application instead of treating web API paths as WordPress URLs.

= 2.0.20 =
* Uses the authoritative local preview returned by a new image upload before synchronization lookup.

= 2.0.19 =
* Scopes synchronized image previews to their map so assets can be loaded from the system where they were uploaded.

= 2.0.18 =
* Sets the default Building text, hover text and active text colours to white.

= 2.0.17 =
* Tells the optional Sync adapter when an editor lease is being yielded to web-app synchronization, preventing the release from starting a competing WordPress-origin queue.

= 2.0.16 =
* Locks the WordPress editor only while it is receiving a web application synchronization.

= 2.0.15 =
* Keeps the system that initiated synchronization editable while the shared lease locks editing on the receiving system.

= 2.0.13 =
* Repairs object-shaped map settings that older synchronization responses stored as empty PHP arrays.

= 2.0.12 =
* Includes the live synchronization status renderer in the shipped WordPress editor bundle.

= 2.0.11 =
* Adds an optional live synchronization status row between Password protection and the publish footer in the editor.

= 2.0.10 =
* Displays shared edit-lock warnings over the top of the map while keeping Retry editing available.

= 2.0.9 =
* Restores editing after a transient shared edit lock clears, with a manual Retry editing action and one expiry-driven retry instead of interval polling.

= 2.0.8 =
* Removes WordPress's duplicate Create new map submenu link while keeping MapAPlace's map creation flow available.

= 2.0.7 =
* Preserves the browser receiver for edit-lock requests so the editor opens normally in both standalone and synchronized installations.

= 2.0.6 =
* Shows the exact safe WordPress transport diagnostic when the shared edit lock cannot reach the paired web application.

= 2.0.5 =
* Adds the optional synchronization hooks and client support required to prevent simultaneous edits of the same map across installations.

= 2.0.4 =
* Starts new maps with Filters and Buildings turned off while leaving Markers and Categories enabled.

= 2.0.3 =
* Adds the bounded exact-id media import seam used by the optional bidirectional Sync plugin.

= 2.0.2 =
* Treat an identical stale map update as a successful retry when its earlier response was lost.
* Allow Building artwork sizes to preserve large real-world SVG dimensions.

= 2.0.1 =
* Refreshes pasted styles immediately without repeating the full map synchronization pass.

= 2.0.0 =
* Replaced branded persistence with the fixed `map_document` custom post type and `_map_document_*` metadata schema.
* Moved map uploads to `uploads/map-documents/<map-id>/` and changed map capabilities and their version option to neutral identifiers.
* Made a clean storage break: existing branded-schema maps are not read, migrated or deleted.

= 1.1.0 =
* Lists maps through the native WordPress custom-post-type screen with standard columns and row actions.
* Limits each WordPress user to three maps and each map to 100 ordinary markers.
* Publishes the current map whenever Save map succeeds and removes the separate Publish action.
* Lets Custom Basemap prevent the standard style from being requested or mounted before the map starts.

= 1.0.6 =
* Shows accessible inline progress while an image is processed, uploaded, previewed and applied.

= 1.0.5 =
* Positions the on-map SVG editor toolbar below the visible top-right map controls.
* Opens SVG editor tooltips inward so they remain readable at the right edge of the map.

= 1.0.4 =
* Disables the settings sidebar while a Custom Routing or Buildings SVG editor is open.
* Closes the mobile settings sidebar before handing focus to an on-map SVG editor.

= 1.0.3 =
* Allows authenticated map editors to preview newly uploaded map-owned images through the private WordPress REST relay.

= 1.0.2 =
* Allows bounded map saves large enough for compressed route geometry and other map extension data.
* Rejects oversized WordPress REST JSON bodies before extension handlers run.
* Preserves backslashes in structured map documents so compressed route caches remain intact.

= 1.0.1 =
* Repairs legacy publication timestamps when maps are loaded.
* Prevents an optional extension error from breaking public maps and Gutenberg previews.

= 1.0.0 =
* Refactored the base plugin into a standalone WordPress-native map editor and viewer.
* Added `mapaplace_map` custom post storage, local REST contracts, local publishing and WordPress Media Library assets.
* Removed application connections, credentials, synchronization, remote catalogue downloads and entitlement enforcement.
