=== MameTech Chat Button ===
Contributors: monant
Tags: chat, whatsapp, click to chat, contact button, floating button
Requires at least: 5.0
Tested up to: 6.9
Stable tag: 2.1.3
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add a professional floating chat button to your website for WhatsApp and other messaging services with advanced features.

== Description ==

**MameTech Chat Button** is a professional WordPress plugin that adds a customizable floating contact button to your website for instant messaging services like WhatsApp, Telegram and others.

= Main Features =

* **Customizable Floating Button** - Position, size, colors fully configurable
* **Sidebar Widget** - Insert buttons in any widget area
* **Flexible Shortcode** - Use `[mametech_chat_button]` anywhere
* **Schedule Hours** - Show buttons only during working hours
* **Multiple Numbers** - Manage multiple contacts with interactive menu
* **Statistics Dashboard** - Track clicks with detailed tables
* **5 Preset Themes** - Default, Minimal, Gradient, Pulse, Dark
* **Customizable Tooltip** - Configurable hover message
* **100% Responsive** - Perfect on all devices
* **GDPR Compliant** - Privacy-friendly with tracking disable option

= Perfect For =

* E-commerce stores - Customer support and sales
* Professional services - Consultations and appointments
* Technical support - Multi-department helpdesk
* Agencies - Multiple contact points
* Hotels & Tourism - Bookings and information

= Widget & Shortcode =

Insert chat buttons in sidebars using the widget or anywhere in posts/pages using the shortcode:

`[mametech_chat_button phone="+1234567890" message="Hello!" text="Chat with us" size="large"]`

= Multiple Numbers =

Perfect for teams! Add multiple WhatsApp numbers for different departments (Sales, Support, Administration) and let users choose who to contact via an interactive menu.

= Schedule Hours =

Configure working hours for each day of the week. The button automatically shows/hides based on your schedule.

= Statistics =

Track button clicks with detailed statistics including:
* Total clicks
* Clicks per day (table view)
* Top 10 pages
* Privacy-friendly anonymous tracking

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/mametech-chat-button` directory, or install through the WordPress plugins screen
2. Activate the plugin through the 'Plugins' screen
3. Go to Chat Button > Settings to configure
4. Enter your phone number in international format (e.g., +1234567890)
5. Customize position, size, theme and save

== Frequently Asked Questions ==

= How do I format the phone number? =

Use international format: +[country code][number]
Examples: +393331234567 (Italy), +14155551234 (USA)

= Can I have multiple numbers for different departments? =

Yes! Go to Chat Button > Multiple Numbers and add contacts for Sales, Support, etc. Users will see an interactive menu to choose who to contact.

= How do I use the shortcode? =

Basic usage: `[mametech_chat_button]`

With parameters:
`[mametech_chat_button phone="+1234567890" message="Hello" text="Contact Us" size="large"]`

= Does it work on mobile devices? =

Yes! The plugin is fully responsive. On mobile, it opens the installed messaging app directly.

= Are statistics GDPR compliant? =

Yes. We only track anonymous data (clicks, timestamps, pages). No personally identifiable information. IPs are anonymized. You can disable tracking completely if needed.

= Can I customize colors and appearance? =

Yes! Choose from 5 preset themes or add custom CSS for complete control. The plugin follows WordPress best practices for easy customization.

= How do I set working hours? =

Go to Settings > Schedule tab. Enable schedule and set start/end times for each day of the week. The button will only appear during configured hours.

== Screenshots ==

1. Floating button on website frontend
2. Main settings panel with live preview
3. Multiple numbers configuration
4. Statistics dashboard
5. Schedule hours configuration
6. Widget in sidebar
7. Shortcode example

== Changelog ==

= 2.1.3 =
* Fixed: Statistics table auto-creation - now creates automatically if missing
* Fixed: Statistics now work even if activation hook failed
* Improved: Auto-repair mechanism for stats table
* Added: ensure_stats_table_exists() function for reliability

= 2.1.2 =
* Fixed: Shortcode documentation now shows correct name `[mametech_chat_button]`
* Fixed: CSS now loads for shortcode even when floating button is disabled
* Fixed: Auto-add +39 prefix to Italian phone numbers when missing
* Fixed: Preview button now displays WhatsApp icon correctly
* Improved: Better phone number validation and sanitization

= 2.1.1 =
* Fixed: Blank page after save/edit operations - removed problematic redirects
* Improved: Inline success messages instead of redirect-based messages
* Improved: Better UX - page stays loaded after operations
* All CRUD operations (Create, Read, Update, Delete) now work perfectly

= 2.1.0 =
* Fixed: Complete rewrite of numbers page rendering - removed orphaned HTML code
* Fixed: All add/edit/delete operations now work correctly with proper redirects
* Fixed: Edit functionality fully operational with form pre-population
* Improved: Clean code structure without duplicate wrappers
* Improved: Proper error handling and validation throughout
* This is a stable, production-ready release

= 2.0.9 =
* Fixed: Blank page content issue - removed duplicate div wrapper causing HTML rendering to fail
* Fixed: Numbers page now displays correctly in all scenarios
* Improved: Clean code structure for better maintainability

= 2.0.7 =
* Fixed: Blank page when editing non-existent number index
* Improved: Validation for edit parameter - redirects if index doesn't exist
* Improved: Better error handling for edge cases

= 2.0.6 =
* Security: Changed wp_redirect() to wp_safe_redirect() for better security
* Security: Added sanitization for $_GET['success'] parameter
* Fixed: Blank page after add/edit operations - now redirects correctly
* Improved: Better security practices throughout

= 2.0.5 =
* Added: Edit button for existing multiple numbers
* Fixed: Duplicate success messages when adding numbers
* Fixed: Proper redirect after add/edit/delete operations
* Improved: Department field now truly optional (can be left empty)
* Improved: Better UX with clear edit/cancel workflow

= 2.0.4 =
* Added: Customizable text for multiple numbers menu (Settings > Appearance)
* Fixed: Department field is now optional when adding numbers
* Fixed: Sanitization warning for phone number input
* Improved: Better validation for multiple numbers form

= 2.0.3 =
* Fixed: Button size settings now apply correctly
* Fixed: Dynamic CSS now loads at the right time
* Improved: Inline styles moved to wp_enqueue_scripts hook

= 2.0.2 =
* Fixed: Restored missing numbers_page() function
* Fixed: Multiple numbers page now works correctly

= 2.0.1 =
* Fixed: Removed all inline style and script tags
* Fixed: All CSS/JS now properly enqueued using WordPress standards
* Fixed: Added proper input sanitization
* Fixed: Improved code quality and WordPress.org compliance

= 2.0.0 =
* Initial release
* Floating button with full customization
* Sidebar widget
* Shortcode with parameters
* Weekly schedule programming
* Multiple numbers management
* Statistics dashboard
* 5 preset themes
* Customizable tooltip
* GDPR compliant
* 100% WordPress.org compliant

== Upgrade Notice ==

= 2.0.0 =
First stable release with all features.

== Additional Info ==

**Developed by:** Mario Merola - MameTech
**Website:** https://www.mametech.com
**Support:** For support, please visit the plugin support forum

= Privacy Policy =

This plugin tracks anonymous clicks only if statistics are enabled. No personally identifiable data is collected. IP addresses are anonymized. Fully GDPR compliant.

= Translations =

Currently available in:
* English (default)
* Italian (coming soon via translate.wordpress.org)

Help translate this plugin into your language!
