=== Mortgage Lead Wizard ===
Plugin Name:  Mortgage Lead Wizard
Version:      1.3.1
Author:       HiRizzi
Author URI:   https://hirizzi.com
Plugin URI:   https://hirizzi.com/mortgage-lead-wizard
License:      GPL v2 or later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Requires WP:  5.3
Tested up to: 6.6
Requires PHP: 7.4

== Description ==

Mortgage Lead Wizard is a conversion-focused mortgage lead generation plugin for WordPress. It adds a beautiful multi-step quote wizard to any page using a simple shortcode, captures leads into a built-in CRM, and notifies you instantly by email or SMS.

Built for loan officers, mortgage brokers, and real estate finance professionals who need a professional lead funnel without monthly SaaS fees.

Free to install and use for your first 3 leads. Upgrade to Pro any time for unlimited lead capture — your first 3 leads and all their data are preserved either way.

= Core Features =

* Multi-step mortgage quote wizard — clean, modern, mobile-first design
* Three loan flows: Purchase, Refinance, and Cash-Out Refinance
* Built-in lead CRM — view, search, filter, and export leads as CSV
* Admin email notifications on every new lead
* Optional auto-responder email to borrowers
* Webhook support for CRM integrations (HubSpot, Salesforce, Zoho)
* Optional SMS notifications via Twilio
* Appearance panel — customize colors, fonts & shape with live preview, 7 one-click presets
* Dark theme support — [mortgage_wizard theme="dark"]
* Optional consent checkbox + disclosure modal for TCPA compliance
* Automatic update notifications in WP Admin
* Fully responsive — works on all screen sizes
* Simple shortcode: [mortgage_wizard]
* Free version captures your first 3 leads — no credit card required
* No monthly fees — one-time purchase for unlimited leads, yours forever

= Who Is This For? =

* Loan officers wanting to capture leads from their WordPress site
* Mortgage brokers replacing expensive SaaS lead tools
* Real estate agencies adding a mortgage calculator + lead form
* Developers building mortgage sites for clients

== Installation ==

1. Purchase and download the plugin zip from hirizzi.com
2. Go to WP Admin → Plugins → Add New → Upload Plugin
3. Upload the mortgage-lead-wizard.zip file
4. Click "Activate Plugin"
5. Go to Mortgage Leads → Settings to configure your options
6. Add [mortgage_wizard] to any page or post

== Configuration ==

= Basic Setup =
1. Go to Mortgage Leads → Settings
2. Set your notification email address
3. Enable/disable the borrower auto-responder
4. Save settings

= SMS Notifications (Optional) =
Requires a Twilio account (free trial available at twilio.com)
1. Go to Mortgage Leads → Settings → Integrations
2. Enter your Twilio Account SID
3. Enter your Twilio Auth Token
4. Enter your Twilio "From" phone number (must be a Twilio number)
5. Save settings

= CRM Integrations (Optional) =
1. Go to Mortgage Leads → Settings → Integrations
2. Enter your HubSpot API key (or Salesforce / Zoho key)
3. Save settings — leads will be pushed automatically on submission

= SMTP Email =
Mortgage Lead Wizard uses WordPress's wp_mail() function.
For reliable email delivery, install a SMTP plugin such as:
- Brevo (Sendinblue) SMTP
- Fluent SMTP
- WP Mail SMTP

== Shortcode ==

Add the mortgage wizard to any page:

[mortgage_wizard]

The wizard automatically detects the loan type selected by the user and switches between Purchase, Refinance, and Cash-Out flows.

== Lead Management ==

All leads are stored in your WordPress database.

Go to WP Admin → Mortgage Leads → All Leads to:
- View all submitted leads with full details
- Search by name, email, or phone
- Filter by loan type or date
- Export all leads as CSV

== Frequently Asked Questions ==

= Does this work with any WordPress theme? =
Yes. The wizard uses its own self-contained CSS and works with any theme.

= Does it work with page builders? =
Yes. Add [mortgage_wizard] as a shortcode block in Gutenberg, Elementor, or any builder.

= Can I customize the colors? =
The CSS file (assets/mlw-styles.css) is fully editable. You can override styles in your theme's CSS.

= Does it store leads in the database? =
Yes. All leads are stored in a custom database table created on activation. No data is sent to external servers unless you configure a CRM integration.

= Is Twilio required? =
No. Twilio SMS is completely optional. Email notifications work out of the box.

= Is the free version limited? =
Yes. The free version captures your first 3 leads. Once that limit is reached, the quote form is hidden from visitors until you activate a Pro license — your first 3 leads remain safely stored and exportable either way. Activating a license unlocks unlimited lead capture immediately, with nothing to reconfigure.

= Is this GDPR compliant? =
The plugin collects only the data users voluntarily submit. You are responsible for adding appropriate privacy policy language to your site disclosing what data you collect and how it is used.

== Support ==

For installation help, bug reports, or custom modifications:
https://hirizzi.com/support

For custom development or white-labeling:
https://hirizzi.com/hire-me

== Changelog ==

= 1.3.1 =
* Fixed: The 3-lead allowance now uses a true lifetime counter, so deleting stored leads cannot reset the free allowance.
* Fixed: Disabling local lead storage no longer bypasses the free lead cap.
* Fixed: Atomic slot reservation prevents simultaneous submissions from exceeding the 3-lead limit.
* Verified: All PHP files pass `php -l` syntax checks.

= 1.3.0 =
* Added: Freemium version. The plugin now works out of the box for free, capturing up to 3 leads (lifetime) before a license is required.
* Added: `MLW_Gate` class — single choke point for all free-vs-licensed decisions.
* Added: Once the free lead limit is reached, the [mortgage_wizard] shortcode shows an upgrade notice (with license/upgrade links for admins, a simple "temporarily unavailable" message for visitors) instead of the quote form.
* Added: Server-side enforcement in the lead submission handler — no lead is stored and no email/SMS/CRM/webhook integrations run once the free limit is reached, even if a cached page still shows the form.
* Added: Free-plan usage banner (leads captured / free limit, with progress bar and upgrade link) on the All Leads admin page. Hidden entirely once a license is active.
* Integrations (Twilio SMS, HubSpot/Salesforce/Zoho webhooks) remain available on the free version — only the lead cap is gated.
* Existing captured leads are never touched, hidden, or deleted by the free-tier limit; only new submissions beyond the cap are blocked.

= 1.2.3 =
* Security hardening pass. Changes:
* Escaped lead field values and labels in the admin notification email (was previously inserted into the HTML table unescaped).
* Escaped the borrower's first name in the auto-responder email.
* Removed production `error_log()` calls that logged lead-save success/failure and mail send status.
* Added `wp_unslash()` before sanitizing `$_POST`/`$_GET` values throughout (27 instances).
* IP address is now validated with `filter_var(..., FILTER_VALIDATE_IP)` after `wp_unslash()`, instead of being stored as a bare sanitized string.
* Remote update manifest fields (`description`, `changelog`) are now passed through `wp_kses_post()` before display.
* The license key field no longer echoes the full stored key back into the page - only a masked preview (e.g. `XXXX••••1234`) shows when a key is on file but not currently active.

= 1.1.1 =
* Fixed: Export CSV button on All Leads page wasn't triggering a download (incorrect URL)

= 1.1.0 =
* Fixed: Lead database table not being created on activation (leads now save correctly)
* Fixed: Admin notification emails failing silently on some hosts
* Added: Appearance settings panel - customize colors, fonts, and border radius with live preview and 7 color presets
* Added: Getting Started admin page with shortcode reference and quick setup guide
* Added: Dark theme support (theme="dark" shortcode attribute now fully functional)
* Added: Consent checkbox + disclosure modal for TCPA compliance (optional, off by default)
* Added: Customizable Company/Brokerage Name and NMLS Number settings
* Added: Customizable "From Name" for outgoing emails
* Added: Automatic update checker - get notified of new versions in WP Admin
* Improved: Email branding now uses your company name instead of generic "The Mortgage Team"

= 1.0.0 =
* Initial release
* Multi-step wizard with Purchase, Refinance, Cash-Out flows
* Built-in lead CRM with CSV export
* Email notifications and auto-responder
* Twilio SMS integration
* HubSpot, Salesforce, Zoho webhook support
