=== SharpLaunch Property Search Engine ===
Contributors: sharplaunch
Tags: properties, real-estate, listings, sync, api
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 3.1.8
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect your SharpLaunch properties with your WordPress site. Automatically sync property listings with SEO optimization.

== Description ==

The SharpLaunch Property Search Engine plugin seamlessly integrates your SharpLaunch property marketplace with your WordPress website. This plugin automatically syncs your property listings, creating SEO-optimized pages for each property.

**Key Features:**

* **Automatic Sync**: Keep your WordPress site updated with your latest SharpLaunch properties
* **SEO Optimized**: Custom meta titles and descriptions for better search engine visibility  
* **Custom Post Type**: Properties are organized as a dedicated post type in WordPress
* **REST API Integration**: Secure API connection with your SharpLaunch account
* **Template Override**: Customize how property pages display on your site
* **Manual & Automatic Sync**: Sync on-demand or set up automated updates

**Perfect For:**
* Real estate agents and brokers
* Property management companies
* Anyone using SharpLaunch for property listings

**Requirements:**
* Active SharpLaunch account with API access
* SharpLaunch PSE Key (provided by SharpLaunch)

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/sharplaunch-property-search-engine/` directory
2. Activate the plugin through the 'Plugins' screen in WordPress
3. Go to Settings > SharpLaunch PSE Settings
4. Enter your SharpLaunch PSE Key and slug
5. Click "Sync Properties" to import your listings

== Frequently Asked Questions ==

= Do I need a SharpLaunch account? =

Yes, you need an active SharpLaunch account with API access. Contact SharpLaunch to get your PSE Key.

= How often does the sync happen? =

You can manually sync anytime from the admin panel. For automatic sync, provide your REST API endpoint to SharpLaunch.

= Will this affect my existing WordPress content? =

No, the plugin only creates and manages property posts. Your existing content remains untouched.

= Can I customize how properties display? =

Yes, you can override the template by creating a custom `single-sl_properties.php` template in your theme.

= What happens if I deactivate the plugin? =

Deactivating the plugin preserves all your settings and synced properties. They will only be permanently deleted if you choose to uninstall (delete) the plugin from WordPress.

= How do I get a PSE key? =

Please contact SharpLaunch support to get a PSE key. It's not the same as the regular API key.

= Where can I view my properties? =

All properties are displayed in your WordPress admin Properties section. Each property can be accessed at: `https://yourwebsite.com/sl_properties/property-slug`

== Screenshots ==

1. Plugin settings page where you enter your SharpLaunch credentials
2. Properties post type in WordPress admin
3. Example property page on the frontend
4. Manual sync interface

== External services ==

This plugin connects to the SharpLaunch server in order to fetch the client API.

== Changelog ==

= 3.1.8 =
* Use meta_title and meta_description from API when available, falling back to property name and description

= 3.1.7 =
* Updated meta description to pull content from the SEO section of the CMS

= 3.1.6 =
* Fixed API key and settings being wiped on plugin update — data is now preserved on deactivation
* Moved all data cleanup (options, properties, transients) to uninstall.php so it only runs when the plugin is fully deleted

= 3.1.5 =
* Added JSON-LD structured data (Schema.org @graph) to property pages: WebPage, RealEstateListing, property node (type-mapped by property type), and Offer with optional price
* Registered new post meta fields for address, city, state, zip, country, coordinates, property type, transaction types, image, sale price, and currency to support structured data
* Removed duplicate og:url tag from fetched property head content

= 3.1.4 =
* Added trailing slash to listings_route for consistent URL matching

= 3.1.3 =
* Fixed Alpine.js :href bindings being incorrectly rewritten as absolute URLs when fetching rendered property pages

= 3.1.2 =
* Changed capability_type from page to post for the properties custom post type

= 3.1.1 =
* Removed unused filter hook (sharplaunch_pse_processed_html)

= 3.1.0 =
* Improved full sync: properties are now processed in batches of 50 to prevent timeouts on large datasets
* Improved full sync: real-time progress feedback shown during sync ("Syncing... X / total")
* Improved full sync: stale properties no longer in the API are removed after all batches complete

= 3.0.3 =
* Fixed rendering bug on single property pages when the origin site had no classes on the body tag

= 3.0.2 =
* Fixed post cache not being invalidated after sync, ensuring persistent object caches (e.g. Redis) reflect updated property slugs immediately

= 3.0.1 =
* Removed archive page for the properties post type
* Set no time limit for sync operations to prevent timeouts on large datasets

= 3.0.0 =
* Added single property detail page — property pages are now fully rendered within WordPress, with proper SEO metadata, canonical URLs, and 24-hour caching
* Added `[sharplaunch_pse]` shortcode to embed the PSE widget anywhere on the site
* Added archive page template — the properties archive URL now automatically displays the PSE widget
* Added "Include Closed Properties" setting to optionally show closed listings
* Added canonical URL tags to property pages for better SEO
* Added SEO warning when changing the property slug
* Improved sync: full sync now runs securely via admin dashboard only
* Improved sync: API endpoint now supports partial sync by property ID (max 25 at a time)
* Improved sync: rewrite rules flush automatically on activation and slug changes
* Updated sync endpoint to stable URL (`/wp-json/sharplaunch/sync`)
* Updated API to use `pse-api.sharplaunch.com`

= 2.0.1 =
* Security improvements and WordPress.org compliance
* Enhanced input sanitization and output escaping
* Added timeout protection for API calls
* Improved error handling

= 2.0 =
* Complete plugin rewrite
* Added REST API integration
* Improved sync functionality
* Enhanced SEO features
* Better admin interface
* Create a settings page to configure the PSE key and slug
* Create a button to sync properties manually
* Sync properties from SharpLaunch
* Create a view page for each property with SEO metadata
* Create an API endpoint to trigger property sync
* Protect API endpoint with token authentication

= 1.0 =
* Initial release

== Upgrade Notice ==

= 3.0.0 =
Major update: property detail pages now render fully within WordPress, new shortcode support, archive page, and performance improvements. Re-sync your properties after upgrading.

= 2.0.1 =
Security update recommended for all users. No functionality changes.

== Roadmap ==

**Phase 2 (Coming Soon):**
* Create a page under configured slug to display PSE automatically
* Improve token generation with more secure method
* Improve sync process performance

== Support ==

For support with this plugin, please contact SharpLaunch support or visit our documentation at https://sharplaunch.com/support