=== BingoRentals ===
Contributors: bitsworld
Tags: car rental, booking, reservation, rental, cars
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 1.5.4
Requires PHP: 8.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed a car rental booking form on your WordPress site, connected to your BingoRentals installation.

== Description ==

BingoRentals allows you to embed a complete car rental booking system on your WordPress website. It connects to your BingoRentals installation via API, enabling customers to:

* Search for available cars by date and location
* View car details, specifications, and pricing
* Complete reservations directly on your WordPress site
* Receive confirmation emails automatically

**Features:**

* **Easy Setup** - Just enter your API URL and tenant slug (for SaaS)
* **SaaS & Standalone Support** - Works with both standalone and multi-tenant BingoRentals installations
* **Shortcode Integration** - Add `[wpcr_car_rental]` to any page or post
* **Auto Language Detection** - Detects visitor country via IP (Romania → Romanian, else English)
* **Language Switcher** - Visitors can manually switch between languages
* **Customizable Appearance** - Light/dark themes, custom colors
* **Smart Caching** - Locations cached for 1 hour, with manual clear option
* **Mobile Responsive** - Works perfectly on all devices
* **Multiple Languages** - English and Romanian built-in

== Installation ==

1. Upload the `bingorentals` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to Settings → BingoRentals
4. Enter your BingoRentals API URL
5. For SaaS: Enter your tenant slug (e.g., "acme" from yoursite.com/app/acme/)
6. Add `[wpcr_car_rental]` shortcode to any page

== Shortcode Usage ==

Basic usage:
`[wpcr_car_rental]`

With options:
`[car_rental show_locations="true" show_categories="true" show_lang_switch="true" theme="light" primary_color="#0d6efd"]`

**Available Options:**

* `show_locations` - Show pickup/return location dropdowns (true/false)
* `show_categories` - Show category filter (true/false)
* `show_lang_switch` - Show language switcher buttons (true/false)
* `theme` - Color theme: "light" or "dark"
* `primary_color` - Custom primary color (hex code)

== Frequently Asked Questions ==

= What is BingoRentals? =

BingoRentals is a car rental management system available in both standalone and multi-tenant (SaaS) editions. This plugin connects to your BingoRentals installation via API.

= What is a tenant slug? =

For SaaS installations, each company has a unique slug (e.g., "acme"). Find it in your dashboard URL: yoursite.com/app/**acme**/

= Do I need an API key? =

The API key is optional and depends on your installation. If your API requires authentication, enter the key in the plugin settings.

= Why do locations disappear after some time? =

This was fixed in v1.1.0. Locations are now cached for 1 hour. If you still have issues, click "Clear Cache" in plugin settings.

= How does auto-language detection work? =

The plugin detects visitor's country via IP using ip-api.com. If the visitor is from Romania, it shows Romanian. Everyone else sees English. Visitors can override this with the language switcher, and their choice is remembered.

= Can I disable auto-language detection? =

Yes, set "Auto-detect Language" to "No" in plugin settings. The form will use your default language.

== Screenshots ==

1. Search form for finding available cars
2. Language switcher and themed form
3. Admin settings page with tenant configuration
4. Cache management options

== Changelog ==

= 1.5.4 =
* **Fixed:** "Powered by" credit link is now opt-in — hidden by default, enabled via new admin toggle in Appearance settings
* **Fixed:** `wpReview` non-plugin file removed from distribution; `.distignore` added
* **Fixed:** Backward-compatible `[car_rental]` shortcode alias removed — only `[wpcr_car_rental]` is registered
* **Updated:** Admin settings page and documentation updated to reference `[wpcr_car_rental]`

= 1.5.3 =
* **Fixed:** Inline `<style>` and `<script>` blocks moved to `wp_add_inline_style()` and `wp_add_inline_script()` via `admin_enqueue_scripts` hook
* **Fixed:** Shortcode callback return now uses `esc_html__()` and `esc_url()` in the API-not-configured error branch
* **Fixed:** Added prefixed shortcode `[wpcr_car_rental]`; `[car_rental]` kept as backward-compatible alias
* **Fixed:** `ipapi.co` external service now documented in readme with terms and privacy policy links
* **Fixed:** Replaced `ip-api.com` reference in readme with the correct service (`ipapi.co`)

= 1.5.2 =
* **Fixed:** Language switcher flags replaced with SVG images for cross-platform rendering (Windows servers do not render Unicode flag emoji)
* **Improved:** Flag images served as local assets, no external requests

= 1.5.1 =
* **Fixed:** Full WordPress Plugin Check compliance — all escaping, unslashing, and sanitization requirements met
* **Fixed:** Deprecated `_e()` / `__()` replaced with `esc_html_e()` / `esc_attr_e()` throughout admin settings
* **Fixed:** `date()` replaced with `gmdate()` for timezone-safe output
* **Fixed:** `wp_create_nonce()` output now escaped with `esc_attr()` in inline JS
* **Fixed:** `parse_url()` replaced with `wp_parse_url()` in API class
* **Fixed:** `error_log()` calls guarded behind `WP_DEBUG` check
* **Improved:** Plugin Check reports "No errors found"

= 1.5.0 =
* **New:** Plugin rebranded to **BingoRentals**
* **New:** Text domain updated to `bingorentals`
* **New:** Admin menu and settings page now show BingoRentals branding
* **Improved:** Plugin folder, main file, and assets renamed to match new brand
* **Improved:** All user-facing strings updated to BingoRentals

= 1.4.0 =
* **New:** Fleet widget shortcode attribute support (`show_categories`, `show_locations`)
* **New:** Dark theme support via `theme="dark"` shortcode attribute
* **New:** Custom primary color via `primary_color` shortcode attribute
* **New:** Fleet cards with booking links connected to SaaS API
* **Improved:** Shortcode renders inline styles based on admin appearance settings
* **Improved:** Mobile responsive layout for fleet widget

= 1.3.0 =
* **Fixed:** Empty API responses no longer cached (was causing permanent "All Locations" only)
* **New:** Admin debug panel showing API URL, cache status, and error log
* **New:** "Test API Now" button for real-time API testing
* **Improved:** Comprehensive debug logging for troubleshooting
* **Improved:** Better error handling and reporting

= 1.2.0 =
* **New:** IP-based automatic language detection (Romania → Romanian, else English)
* **New:** Language switcher buttons (🇬🇧 EN / 🇷🇴 RO) with localStorage persistence
* **New:** Admin option to enable/disable auto-detection
* **New:** `show_lang_switch` shortcode attribute
* **Improved:** All form labels now use data-i18n for dynamic switching
* **Improved:** Both EN and RO translations loaded upfront for instant switching

= 1.1.0 =
* **New:** SaaS multi-tenant support with tenant_slug setting
* **New:** Smart API URL building for path-based tenant routing (/api/app/tenant/)
* **New:** Transient caching for locations, settings, extras (1 hour TTL)
* **New:** "Clear Cache" button in admin settings
* **New:** Auto-detection of tenant slug from API URL
* **Fixed:** Locations disappearing after time (was caused by missing tenant context)
* **Fixed:** URL construction for SaaS vs standalone installations
* **Improved:** Debug logging when WP_DEBUG is enabled
* **Improved:** Cache auto-clears when saving settings

= 1.0.0 =
* Initial release (standalone BingoRentals support only)
* Car search by date and location
* Real-time availability checking
* Booking form with customer details
* Light and dark themes
* Responsive design
* Admin settings page
* API connection test

== External Services ==

This plugin connects to the following external services:

= BingoRentals API (your own installation) =

The plugin communicates with the BingoRentals API URL you configure in the settings. This is your own self-hosted or SaaS installation of BingoRentals. Data sent includes: search parameters (dates, location IDs, category), reservation details, and tenant slug. This data is sent whenever a visitor submits the search form or the fleet widget loads. You control this service — refer to your own privacy policy and terms.

= ipapi.co (IP-based language detection) =

When automatic language detection is enabled (default: on), the plugin sends the visitor's IP address to ipapi.co to determine their country. This is used solely to select the default display language (Romanian for Romania/Moldova, English for all others). No personal data beyond the IP address is transmitted. Visitors can override the detected language manually at any time.

* Service URL: https://ipapi.co
* What is sent: visitor IP address (implicit in the HTTP request)
* When: on each page load where the booking form is displayed, if auto-detect language is enabled
* Terms of Service: https://ipapi.co/terms/
* Privacy Policy: https://ipapi.co/privacy/

To disable this feature, go to **Settings → BingoRentals** and set **Auto-detect Language** to **No**.

== Upgrade Notice ==

= 1.5.4 =
WordPress.org review compliance: "Powered by" credit made opt-in (off by default), non-plugin file removed, shortcode alias removed in favour of prefixed `[wpcr_car_rental]`.

= 1.5.3 =

= 1.5.2 =
Fixes flag emoji rendering on Windows servers. Language switcher now uses SVG flag images.

= 1.5.1 =
WordPress Plugin Check compliance update. No functional changes — safe to update.

= 1.5.0 =
Plugin rebranded to BingoRentals. Deactivate and reactivate after updating to ensure settings page loads correctly.

= 1.4.0 =
Adds fleet widget, dark theme, and custom color support via shortcode attributes.

= 1.3.0 =
Fixes caching bug where empty API responses were cached, causing locations to disappear. Adds debug tools to diagnose API issues.

= 1.2.0 =
Added automatic language detection and manual language switcher. Romanian visitors now see Romanian interface automatically.

= 1.1.0 =
Critical update for BingoRentals SaaS users. Fixes location caching issues and adds proper multi-tenant support. Standalone users should also update for improved caching.

= 1.0.0 =
Initial release of BingoRentals.
