# Mobile Calendar Booking Engine - WordPress Plugin

**Official WordPress plugin for Mobile Calendar booking engine integration**

[![WordPress Version](https://img.shields.io/badge/WordPress-5.8%2B-blue.svg)](https://wordpress.org/)
[![PHP Version](https://img.shields.io/badge/PHP-7.4%2B-purple.svg)](https://php.net/)
[![License](https://img.shields.io/badge/License-GPLv2-green.svg)](https://www.gnu.org/licenses/gpl-2.0.html)
[![Version](https://img.shields.io/badge/Version-1.0.0-orange.svg)](https://github.com/mobile-calendar/wp-plugin-mobile-calendar-booking-engine)

## 📖 Description

**Mobile Calendar Booking Engine** is the official WordPress plugin for integrating [Mobile Calendar](https://mobile-calendar.com)'s powerful booking system directly into your website.

Mobile Calendar is a comprehensive Property Management System (PMS) with integrated Channel Manager and 24/7 Booking Engine designed for hotels, vacation rentals, apartments, and accommodation providers.

## ✨ Key Features

- ✅ **Easy Integration** - One-click OAuth connection or manual token entry
- ✅ **Gutenberg Blocks** - Two powerful blocks for the WordPress block editor
- ✅ **Elementor Support** - Full integration with Elementor page builder
- ✅ **Multi-language** - 40+ languages supported with automatic detection
- ✅ **Customizable Design** - Match your brand with colors and styles
- ✅ **Responsive** - Mobile-friendly design that works on all devices
- ✅ **Professional Date Picker** - Flatpickr with dual-month calendar view
- ✅ **No Double Bookings** - Real-time synchronization with Mobile Calendar

## 🎯 Perfect For

- Hotels
- Vacation Rentals
- Apartments
- Guesthouses
- Bed & Breakfasts
- Any accommodation offering online bookings

## 🚀 Installation

### Automatic Installation

1. Log in to your WordPress admin panel
2. Navigate to **Plugins > Add New**
3. Search for "Mobile Calendar Booking Engine"
4. Click **Install Now** and then **Activate**

### Manual Installation

1. Download the plugin ZIP file from the [releases page](https://github.com/mobile-calendar/wp-plugin-mobile-calendar-booking-engine/releases)
2. Log in to your WordPress admin panel
3. Navigate to **Plugins > Add New > Upload Plugin**
4. Choose the downloaded ZIP file and click **Install Now**
5. Click **Activate Plugin**

## 🔧 Configuration

### Option A: OAuth Connection (Recommended)

1. After activation, go to **Settings > Mobile Calendar**
2. Click **Connect with Mobile Calendar** button
3. Log in with your Mobile Calendar credentials
4. Authorize the connection
5. The plugin will automatically receive and save your widget token

### Option B: Manual Token Entry

1. Log in to your [Mobile Calendar dashboard](https://mobile-calendar.com/dashboard)
2. Navigate to **Booking Engine > Configuration**
3. Copy your Widget Token
4. In WordPress, go to **Settings > Mobile Calendar**
5. Scroll down to "Or Enter Token Manually"
6. Paste the token and click **Save Token**

## 📝 Usage

### Gutenberg Blocks

#### Booking Button Block

A customizable call-to-action button that opens the booking interface in a modal.

**Features:**
- Custom button text and colors
- Border radius, padding, and alignment controls
- Optional pre-filled parameters (room ID, dates, guests)
- Live preview in editor

**How to Add:**
1. Edit any page or post in WordPress
2. Click **+** to add a new block
3. Search for "Booking Button"
4. Customize appearance in the sidebar panel
5. Publish

#### Search Bar Block

Advanced search interface with professional date picker and guest selection.

**Features:**
- Flatpickr date picker with dual-month calendar
- Guest selection (adults 1-20, children 0-20)
- Horizontal or vertical layout
- Customizable primary color
- Responsive design

**How to Add:**
1. Edit any page or post in WordPress
2. Click **+** to add a new block
3. Search for "Search Bar"
4. Customize in the sidebar panel
5. Publish

### Elementor Widgets

Both Gutenberg blocks are also available as native Elementor widgets with the same features.

**How to Add:**
1. Open a page in Elementor Builder
2. Search for "Mobile Calendar" in the widgets panel
3. Drag the widget to your page
4. Configure settings in the left panel
5. Publish

## 🌍 Multi-language Support

The plugin supports 40+ languages with automatic WordPress locale detection:

🇬🇧 English | 🇵🇱 Polski | 🇩🇪 Deutsch | 🇪🇸 Español | 🇫🇷 Français | 🇮🇹 Italiano | 🇵🇹 Português | 🇳🇱 Nederlands | 🇨🇿 Čeština | 🇩🇰 Dansk | 🇫🇮 Suomi | 🇬🇷 Ελληνικά | 🇭🇺 Magyar | 🇳🇴 Norsk | 🇷🇴 Română | 🇸🇰 Slovenčina | 🇸🇪 Svenska | 🇹🇷 Türkçe | 🇺🇦 Українська | 🇷🇺 Русский | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇹🇭 ไทย | 🇻🇳 Tiếng Việt | and many more...

## ⚙️ Requirements

**Server:**
- WordPress 5.8+
- PHP 7.4+
- MySQL 5.6+ / MariaDB 10.0+

**Browser:**
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+

**External:**
- Active Mobile Calendar account - [Sign up here](https://mobile-calendar.com)
- HTTPS recommended (required for production)

## 🔒 Security

The plugin follows WordPress security best practices:

- ✅ Input sanitization for all user data
- ✅ Nonce verification for forms
- ✅ Capability checks (manage_options)
- ✅ Direct access protection
- ✅ XSS protection (esc_html, esc_attr, esc_url)
- ✅ Secure token storage

## 🎨 Customization

### Booking Button Customization

- Button text
- Background color
- Text color
- Border radius (0-50px)
- Padding controls (top, right, bottom, left)
- Alignment (left, center, right)
- Optional icon (emoji or text)
- Icon position (left or right)

### Search Bar Customization

- Primary color
- Button text
- Layout (horizontal or vertical)
- Show/hide guest fields
- Border radius controls
- Section padding (8-32px)
- Dark mode option
- Container width and padding

## 📊 Technical Details

### Architecture

- **Design Pattern:** Singleton for all components
- **Rendering:** Server-side rendering for blocks (better SEO)
- **Extensibility:** Hook-based architecture with filters and actions

### Performance

- Conditional asset loading (admin assets only in admin)
- Local Flatpickr vendor (no external CDN dependency)
- Lazy loading iframe
- Optimized CSS/JS

### Hooks & Filters

Developers can extend the plugin using WordPress hooks:

```php
// Modify widget token before save
add_filter('mcbe_widget_token', function($token) {
    return $token;
});

// Add custom CSS
add_action('mcbe_enqueue_scripts', function() {
    wp_enqueue_style('my-custom-style', 'path/to/style.css');
});
```

## 🐛 Troubleshooting

### Widget not displaying

1. Ensure you have configured the plugin in **Settings > Mobile Calendar**
2. Check that your widget token is valid
3. Clear WordPress cache and browser cache
4. Check browser console for JavaScript errors

### OAuth connection fails

1. Ensure your WordPress site has a valid SSL certificate (HTTPS)
2. Check that your site is accessible from the internet
3. Try manual token entry as an alternative

### Date picker not working

1. Check for JavaScript conflicts with other plugins
2. Ensure jQuery is properly loaded
3. Check browser console for errors

## 📞 Support

Need help? We're here for you:

- **Website:** [https://mobile-calendar.com](https://mobile-calendar.com)
- **Email:** info@mobile-calendar.com
- **Phone:** +48 502-300-023
- **Documentation:** Available in plugin settings page

## 📝 Changelog

### Version 1.0.0 - 2025-11-11

**Initial Release**

**Features:**
- ✅ Gutenberg Booking Button Block
- ✅ Gutenberg Search Bar Block
- ✅ Elementor Booking Button Widget
- ✅ Elementor Search Bar Widget
- ✅ One-click OAuth connection
- ✅ Manual token entry option
- ✅ 40+ languages support
- ✅ Customizable colors and styles
- ✅ Responsive design
- ✅ Flatpickr date picker with 40+ localizations
- ✅ Guest selection controls
- ✅ Security hardening
- ✅ Performance optimization

## 🗺️ Roadmap

Future enhancements planned:

- [ ] Shortcode support for Classic Editor
- [ ] WordPress widget for sidebars
- [ ] WooCommerce integration
- [ ] Analytics integration
- [ ] Custom post types for rooms
- [ ] Enhanced multisite support
- [ ] Additional page builder support (Divi, Beaver Builder)

## 🤝 Contributing

We welcome contributions! Please see our [contribution guidelines](CONTRIBUTING.md) for details.

## 📄 License

This plugin is licensed under GPLv2 or later.

```
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
```

## 🙏 Credits

**Developed by:** Mobile Calendar Team  
**Version:** 1.0.0  
**Release Date:** November 11, 2025

---

**Made with ❤️ for WordPress & Mobile Calendar users**
