=== Prop Nexia ===
Contributors: propnexia
Tags: real-estate, property, listings, idx, estate-agent
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 3.0.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Dubai-focused real estate plugin. Properties, projects, developers, area guides, RERA fields. Works with any theme or builder.

== Description ==

Prop Nexia is a purpose-built WordPress plugin for Dubai and UAE real estate agencies. Unlike generic real estate plugins adapted for the UAE market, Prop Nexia ships with DLD compliance fields (Trakheesi/permit numbers, ORN/BRN agent registrations, QR validation), UAE-specific property fields (chiller-free, service charge, ownership type, DLD waiver offers), and payment plan structures for off-plan projects — all out of the box.

= Core features =

* **5 custom post types** — Properties, Projects, Developers, Area Guides, Agents
* **Dubai-specific metadata** — Permit numbers with expiry tracking, ORN/BRN fields, DLD validation URLs, QR image upload
* **Agent profiles** — RERA-certified agent CPT with BRN, languages, specialties, assignable to properties and projects
* **Payment plans** — Down payment + milestone breakdown for off-plan projects
* **AJAX lead capture** — Spam-protected contact forms (honeypot + nonce + rate limiting) with admin email notifications
* **Favorites and compare** — Cookie-based (no account required), side-by-side spec comparison of up to 4 properties
* **Recently Viewed** — Auto-tracks the last 5 properties a visitor browses
* **Search and filter** — Purpose (buy/rent), property type, community, bedrooms, price range
* **Arabic translation included** — Full RTL support with UAE real-estate vocabulary

= Works with your page builder =

Core listing, search, lead, and account experiences are available through shortcodes, Gutenberg blocks, and Elementor-compatible widgets where supported. Agencies use whatever tool they already know:

* **Shortcodes** — `[propnexia_properties]`, `[propnexia_featured_properties]`, `[propnexia_search]`, `[propnexia_lead_form]`, `[propnexia_projects]`, `[propnexia_developers]`, `[propnexia_areas]`, `[propnexia_agents]`, `[propnexia_favorites]`, `[propnexia_compare]`, `[propnexia_mortgage_calculator]`
* **Gutenberg blocks** — 8 server-rendered blocks in the "Prop Nexia" category, each with live preview in the editor
* **Elementor widgets** — 8 widgets (requires Elementor 3.5+, optional — plugin works fine without it)

= Accessibility =

* WCAG 2.1 AA focus states via `:focus-visible`
* `aria-pressed` on heart and compare toggle buttons
* `aria-live` announcements for lead form success/error
* Skip-to-content link on every single page
* 44px minimum tap target on mobile
* `prefers-reduced-motion` support
* Windows High Contrast mode support

= Performance =

* Conditional asset loading — plugin CSS/JS only loads on pages that need it
* Image lazy loading on all card and gallery thumbnails
* `loading="eager" fetchpriority="high"` on above-fold hero images
* Query optimization with `no_found_rows` where pagination isn't needed
* Minified CSS and JS shipped alongside unminified source

= Theme compatibility =

All plugin markup is scoped under `.prop-nexia` class to avoid collisions with your theme. Design tokens use CSS custom properties so agencies can re-brand colors without overriding every rule. Template overrides work the WooCommerce way: copy `wp-content/plugins/prop-nexia/templates/` to `wp-content/themes/YOUR-THEME/prop-nexia/` and edit freely.

== Installation ==

1. Upload the `prop-nexia` folder to `/wp-content/plugins/` or install via the WordPress plugin installer
2. Activate the plugin through the "Plugins" menu
3. Navigate to **Properties → Add New** to create your first listing
4. Create pages with the `[propnexia_favorites]` and `[propnexia_compare]` shortcodes (optional, enables favorites and compare features)
5. Visit **Properties → Settings** to configure default currency, notification email, and posts-per-page

No database migration required. On activation, the plugin registers 4 custom post types and flushes rewrite rules once.

== Frequently Asked Questions ==

= Does this work without Elementor? =

Yes. Elementor integration is entirely optional. The plugin detects whether Elementor is active and only loads widgets if it is. Without Elementor, you still have shortcodes and Gutenberg blocks — same rendering logic, same output.

= Can I customize the card designs? =

Yes. All templates are located in `/wp-content/plugins/prop-nexia/templates/`. Copy any template to `/wp-content/themes/YOUR-THEME/prop-nexia/` and WordPress will use your copy instead. The design system uses CSS custom properties so you can rebrand with a single stylesheet.

= What RERA compliance fields are supported? =

Trakheesi/permit numbers, permit expiry date, DLD validation URL, broker ORN, agent BRN, and QR image upload. All fields render on the property single page under a "Permit & Compliance" section.

= Does this plugin send data to external services? =

No. All data stays on your WordPress installation. No analytics, no remote logging, no external API calls. The only external asset is Google Fonts (Inter), which can be disabled in Settings.

= Is there a migration path from v1.x? =

Prop Nexia 2.0 is a clean-slate rebuild with a new data model. Migration tooling from v1.x is planned for a future release. For now, manual re-entry is required.

= What browsers are supported? =

Modern evergreen browsers — Chrome, Firefox, Safari, Edge (last 2 versions). Mobile Safari (iOS 14+) and Chrome Android fully supported. IE11 is not supported.

= How is data stored? =

Custom post types (rev_property, rev_project, rev_developer, rev_area, rev_lead) with custom fields in `wp_postmeta`. No custom tables. Fully compatible with WordPress backup tools and migration plugins.

= Where can I get support and read documentation? =

Documentation: https://www.propnexia.com/docs
Support: support@propnexia.com
Plugin home: https://www.propnexia.com

== Screenshots ==

1. Property archive — modern search bar, filters modal, and responsive property grid
2. Single property page with Dubai RERA compliance box — Trakheesi permit, Madmoun QR, broker credentials displayed for visitor trust
3. Admin property editor with tabbed metabox — compliance fields built in, no extra plugins needed
4. Gutenberg block inserter showing the Prop Nexia category with 7 blocks
5. Dashboard with stats, recent leads, and onboarding checklist
6. Mortgage calculator with UAE-standard defaults (20% down, 25-year term)

== Changelog ==

= 3.0.4 =
* Maintenance: documentation and shortcode-reference comment polish. Replaced legacy companion-product wording in the readme with clearer phrasing ("Prop Nexia Elite", "extensions", "extra plugins"). Updated the 3.0.0 upgrade note to reference the latest 3.0.x package. No functional changes; data model and behaviour unchanged from 3.0.3.

= 3.0.3 =
* Maintenance: documentation, changelog, and demo-content polish for the public launch package. No functional changes; data model and behaviour unchanged from 3.0.2.

= 3.0.2 =
* Maintenance: migration partial-pass continuation fix so the 3.0.1 data-model normalisation completes correctly on sites with very large content libraries (no data loss; existing records are unchanged).
* Public-launch polish: documentation, admin copy, and changelog updates.

= 3.0.1 =
* Cross-plugin data-model normalisation:
  * Lead "related post" key unified across the Free and Pro plugins.
  * Project currency stored under the same canonical key as property currency.
  * Gallery and floor-plan attachment lists routed through a single normaliser so every reader handles the data shape consistently.
  * Community field now reads from either the taxonomy or the display meta as a fallback — listings configured with only one side display correctly.
* Backwards compatible: existing posts, taxonomies, and meta are preserved. A one-time migration backfills the canonical slots from legacy data.

= 3.0.0 =
* Major release: project rebranded under the Prop Nexia identity. Plugin slug, text domain, shortcodes, and asset class names updated to match.
* Visual refresh: brand palette, Inter typography, and updated UI tokens.
* Maintenance: bumped minimum tested WordPress and refreshed translation strings.
* Note: this is a clean rename — existing post types, taxonomies, and post meta are unaffected. If you are upgrading from an earlier release of this plugin, deactivate the old version first, install the latest Prop Nexia 3.0.x package, then reactivate.

= 2.7.0 =
* New: **Safe Mode**. A recovery mode for broken installs — when active, only the core structural CSS loads (no decorative skin, no custom design tokens, no Google Fonts, no Pro modules). Content and settings are untouched. Useful for isolating whether a rendering problem is in the decorative layer or the structural layer.
  * Toggle from **Prop Nexia → Tools → Diagnostics → Safe Mode section**.
  * Or via URL: `?propnexia_safe_mode=1` on any admin page (requires manage_options).
  * Or programmatically: `add_filter('prop_nexia_safe_mode', '__return_true');` — bypasses the option entirely, useful for mu-plugin emergency overrides.
  * A persistent orange admin banner appears on every admin page while active, with a one-click disable button.
  * Pro plugin automatically skips loading its modules when free's safe mode is on.

= 2.6.0 =
* New: **migration runner**. Plugin now tracks `prop_nexia_db_version` and runs numbered migrations on upgrade. First migration seeds the new `load_skin_styles` option from the legacy `load_styles` value so upgrades from 2.5.x and earlier keep the user's previous on/off preference for optional visual styling. Migrations are idempotent, trapped in try/catch, and logged to `prop_nexia_migrations_log` (visible on the new Diagnostics page).
* New: **Tools → Diagnostics tab**. Shows plugin + WP + PHP versions, active theme, RTL state, memory limits, the full current values of critical plugin options, and the migration log with timestamps. One-click "Copy Debug Report" button puts a plain-text dump on the clipboard for pasting into support tickets.
* New: **Reset buttons**. On the Diagnostics tab, four confirmation-gated buttons to restore defaults for: Design & Branding, Display Options, Contact Information, or Everything. Content (properties, projects, leads) is never touched — only settings. The "Reset Display Options" and "Reset All" flows automatically re-enable optional visual styling so the frontend renders normally after a reset.
* Infrastructure: future schema or option changes can now ship as numbered migrations instead of one-off boot-time patches. Adding a migration is one method + one MIGRATIONS entry.

= 2.5.0 =
* Architectural safety: plugin CSS is now split into two layers. `core.css` (~7KB minified) contains only structural rules — wrapper, grid, card flex, image frames, form layout, accessibility utilities — and is loaded unconditionally on every page that renders plugin content. It cannot be disabled by any setting. `frontend.css` (the former main stylesheet) is now the optional visual-polish layer: colors, shadows, decorative borders, hover states.
* New setting on the Others tab: **Apply optional visual polish** (replaces "Load Plugin Styles"). Disabling this leaves layout intact but lets the plugin inherit theme typography and colors instead of applying its own palette.
* Automatic migration: sites that have the legacy `prop_nexia_load_styles` option set to `0` continue to respect that — skin stays off — but their frontend now renders a usable layout from core.css even with skin disabled. No more unstyled archive / single pages from a corrupted setting.
* Developer escape hatch: themes that ship a complete replacement layout for plugin content can disable core.css via `add_filter( 'prop_nexia_load_core_styles', '__return_false' );`. No user-facing setting exposes this — it's for theme authors only.
* Product principle established: **no single setting can destroy layout for public users.** Settings can only control decoration from this release forward.

= 2.4.5 =
* Auto-repair notice: sites that got bitten by the tab-save bug before 2.4.4 still have `prop_nexia_load_styles = '0'` in their database, so plugin CSS remains off until they manually re-enable it. A dismissible admin notice now appears on the Dashboard, Plugins page, and Prop Nexia admin screens offering a one-click "Re-enable plugin styles" button — it resets both Load Plugin Styles and Load Google Fonts to on in one action. Users who genuinely want styles off can click "Dismiss — I disabled them on purpose" instead; the notice never returns for them.

= 2.4.4 =
* CRITICAL FIX: Settings tabs no longer wipe each other's values on save. When the Settings page was restructured into 8 tabs (General, Notifications, Contact, Company Licensing, Archive Content, Search Bar, Design & Branding, Others), all tabs kept sharing a single option group — which meant WordPress ran the sanitize callback for every registered setting on every tab save, including settings whose fields weren't in the submitted form. Checkboxes in particular (which the browser doesn't submit when unchecked) were silently reset to `'0'`. Most visibly: saving any non-Others tab reset **Load Plugin Styles** to off, which killed all plugin CSS on the frontend until the user re-checked it.
* Fix mechanism: a new `pre_update_option_{name}` guard inspects the hidden `_propnexia_settings_tab` marker in each submission. If the option being written belongs to a DIFFERENT tab, the write is discarded and the existing value is preserved. Options saved through other UIs (WP-CLI, programmatic `update_option()`, third-party settings screens) are unaffected.
* If you had been bitten by this bug and your frontend CSS stopped loading: after upgrading to 2.4.4, go to **Prop Nexia → Settings → Others tab**, re-check "Load Plugin Styles" and "Load Google Fonts", and Save. From this point forward, saving any other tab won't disable them again.
* Removed the diagnostic debug logging added in 2.4.3 now that the root cause is fixed.

= 2.4.3 =
* Diagnostic: frontend asset enqueue now writes an `[prop-nexia]` tagged entry to `wp-content/debug.log` when WP_DEBUG is on, showing exactly which gate passed/failed and why. This is for tracking down "no plugin CSS on the page" reports — once diagnosed, diagnostics are cheap to remove.
* Hardening: `is_plugin_content_page()` no longer caches a false result when called before the `wp` action has fired. Previously, an extremely-early call could poison the cache with a false negative that persisted for the remainder of the request.

= 2.4.2 =
* Fix: card images no longer collapse inside their aspect-ratio frames. Two rules in search-contact.css were clobbering the card image layout from frontend.css: an `img` rule was setting `height: auto` (undoing `height: 100%`), and a container rule was setting `display: flex; background: #f3f4f6` on every card image (overriding the frame's `aspect-ratio` and `overflow: hidden`). The container rule is now scoped with `:has(> svg)` and a `.is-empty` modifier so it only applies to cards with no real image (where the placeholder SVG needs centering).
* Fix: frontend JS no longer hard-aborts when the server-side localized config is missing. Non-AJAX UI features (accordion toggles, galleries, modal opens) now run regardless; AJAX-dependent features (favorite toggle, compare, lead submit) individually no-op gracefully with a clear internal error code instead of taking down the entire script.

= 2.4.1 =
* Fix: frontend CSS was silently skipped if the "Load Plugin Styles" option ended up stored as an empty string from a partial form save. The enqueue gate now only treats an explicit `'0'` as disabled — any other value (missing, empty, unexpected) falls back to the default (enabled), so archives and single pages always render with the plugin's styles unless you deliberately turned them off.
* Same hardening applied to the Google Fonts loading option.

= 2.4.0 =
* New hook: `prop_nexia_archive_results_bar` fires inside the results bar on property and project archives (passes post_type and current query filters). Prop Nexia Elite uses this to inject the "Save this search" button.

= 2.3.0 =
* Design & Branding — three new controls in Settings → Design & Branding:
  * Heading Color: standalone color control for listing titles, section headings, and card prices. Defaults to your Primary Color.
  * Border Radius: four-option scale (Sharp / Default / Rounded / Pill) that cascades to cards, images, inputs, and modals site-wide.
  * Card Shadow: four-option scale (None / Soft / Medium / Prominent) that controls the depth of every listing card on archives and grids.
* Settings tabs: active tab is now preserved through the save round-trip — after clicking "Save Changes" on Design & Branding (or any other tab), you land back on that tab instead of being bounced to General.

= 2.2.0 =
* Settings page restructured into 8 top tabs: General, Notifications, Contact Information, Company Licensing, Archive Content, Search Bar, Design & Branding, Others
* Setup Wizard now runs in a full-screen takeover on first plugin activation (hides admin sidebar and admin bar); remains available as a tab inside Tools afterward
* Fix: fatal error when opening Tools → Setup Wizard tab (incorrect class accessor)
* Shortcodes Reference: removed the inline count next to the "Prop Nexia Elite" tab label
* Wizard step navigation now stays in the same surface it started in (fullscreen stays fullscreen; in-tools stays in-tools)

= 2.1.9 =
* Demo content installer now includes 4 sample agents (Senior Consultant, Head of Off-Plan, Family Homes Consultant, Commercial Advisor) with full profile data
* Imported properties are automatically assigned to demo agents so you can preview the property → agent relationship out of the box
* Demo uninstaller removes agents along with the other demo CPTs

= 2.1.8 =
* Admin menu reordered: "All Agents" moved up to sit with the other listing CPTs
* Leads admin page: removed the "Add Post" button and made rows non-clickable (leads are read-only — they come from the public contact form)
* Setup Wizard is now a tab inside Tools rather than a standalone submenu — reduces menu clutter
* Shortcodes Reference now has two tabs: "Prop Nexia" and "Prop Nexia Elite". Pro shortcodes appear automatically when the Pro plugin is active
* Settings page: all sections now render in 16px-padded cards for consistent spacing
* Agent archive: changed from 3-column to 4-column grid on desktop
* New filter: `prop_nexia_elite_shortcodes_list` — Prop Nexia Elite modules use this to populate their tab on the Shortcodes Reference page

= 2.1.7 =
* New filter: `prop_nexia_show_upgrade_menu` — Prop Nexia Elite can hide the "Upgrade to Pro" menu item when a paid plan is active

= 2.1.6 =
* Renamed internal CSS files to semantic names for a cleaner developer experience: `phase6.css` → `interactions.css`, `phase7.css` → `shortcodes.css`, `phase9.css` → `search-contact.css`, `phase10.css` → `agents.css`
* Matching style handles renamed from `prop-nexia-phase*` to their semantic equivalents
* File header comments cleaned up — no more internal dev labels visible in source

= 2.1.5 =
* Fix: single-page section padding was being zeroed out by a reset rule. Sections now have proper 16px vertical padding on all CPT single pages

= 2.1.4 =
* Tightened single-page section padding across all CPTs (8px vertical, 16px horizontal) for a more compact layout
* Reduced inter-section margin from 20px to 12px

= 2.1.3 =
* Developer: 26 new action and filter hooks for third-party integrations and extensions
* Lead capture: `prop_nexia_before_lead_submit`, `prop_nexia_validate_lead`, `prop_nexia_lead_meta`, `prop_nexia_after_lead_saved`, `prop_nexia_lead_notification_email`, `prop_nexia_lead_response`
* Archive queries: meta_query / tax_query filters for property and project archives, generic `prop_nexia_archive_query` action, `prop_nexia_archive_posts_per_page` filter
* Favorites / Compare: `prop_nexia_favorite_toggled`, `prop_nexia_compare_toggled` actions for account-sync integrations; matching `_max` filters to raise limits
* Search: `prop_nexia_search_results_pre` filter for AI-search backends to short-circuit the default query; `prop_nexia_search_results` and `prop_nexia_suggest_min_length` filters
* Single pages: `prop_nexia_single_sidebar_top` and `_single_sidebar_bottom` actions on property and project templates for injecting maps, calculators, alerts
* Admin: `prop_nexia_admin_menu` action for extensions to register their own submenus

= 2.1.2 =
* Agent card contact buttons now match the property card style exactly (Email indigo, Call gray, WhatsApp green)
* Single agent hero: empty stats box no longer renders when agent has no years/listings/BRN
* Single agent: renamed "Specialties" section heading to "Expertise" to avoid redundancy with its sub-headings
* Tightened hero spacing so name and role sit together as a header block

= 2.1.1 =
* Agent CSS styling — cards, archive grid, single-page hero, specialty chips, testimonials, and social links now match the rest of the plugin design
* Moved agent assignment to the Overview tab on properties and projects so it's visible on the first tab instead of buried under Location
* Added "Assignment" section header grouping agent, developer, and area guide selects together

= 2.1.0 =
* New Agent CPT — RERA-certified agent profiles with BRN, languages, specialties, testimonials, and social links
* Properties and projects can now be assigned to agents; listings appear on the agent's profile page
* New `[propnexia_agents]` shortcode plus matching Gutenberg block and Elementor widget
* New `Agent` column on Properties and Projects admin list tables
* Completion checklist now supports agent profiles
* Security hardening: email header injection fix, rate limit on search autocomplete, proxy-header trust behind a filter, SameSite=Lax on all cookies
* CSV import/export: fixed Featured flag mapping (`rev_featured` → `rev_featured_listing`)
* Admin media picker now uses safe DOM construction instead of HTML concat

= 2.0.0 =
* Complete rebuild with clean architecture
* 4 custom post types (Properties, Projects, Developers, Area Guides)
* AJAX lead capture with honeypot, nonce, and rate limiting
* Cookie-based favorites and compare (up to 4 properties)
* Recently Viewed auto-tracking
* 7 shortcodes, 7 Gutenberg blocks, 7 Elementor widgets — all sharing render logic
* Arabic translation and RTL support
* WCAG 2.1 AA accessibility audit
* Settings admin page for currency, email, and display preferences
* DLD compliance fields (permit, ORN, BRN, QR)
* Theme template overrides

= 1.x =
* Legacy versions — see git history

== Upgrade Notice ==

= 2.0.0 =
Complete rebuild. Not backwards-compatible with v1.x data. Fresh install recommended.
