=== Speedx - Maintenance Mode ===
Contributors: roicecz
Donate link: https://buymeacoffee.com/speedx
Tags: maintenance, coming soon, maintenance mode, construction, under construction
Requires at least: 6.8
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 9.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

This minimalist plugin allows administrators to activate maintenance mode with fully customizable HTML and CSS.

== Description ==
This minimalistic plugin allows administrators to activate maintenance mode with fully customizable HTML and CSS. The plugin allows you to unlock access to maintenance mode with a simple passcode/password. After entering the passcode correctly, the visitor will see the full version of the site without having to have a user account. The input password can be secured using Google reCaptcha.

### Key Features:
- **Customizable Maintenance Page:** Set the page title and content using the built-in WordPress WYSIWYG editor. Easily add media from your website's media library.
- **Advanced Customization:** Insert custom CSS styles, analytics codes, and additional scripts in various sections of the page.
- **User Access Control:** Unauthenticated visitors will see the maintenance mode page, while all logged-in users with the "Visitor" role or higher will have full access to the website.
- **Enter using a simple password:** Visitors can unlock the site using a simple password and see it without the maintenance mode page. No user account is required for this unlocking in the Wordpress system. 

This plugin provides a simple yet powerful way to create a personalized maintenance mode page while maintaining full control over its design and functionality.

== Installation ==
1. Upload the plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. Configure the settings under **Settings > Maintenance Mode**.

== Frequently Asked Questions ==
= Who can see the maintenance mode page? =
Only **non-logged-in visitors** will see the maintenance mode page. Logged-in users with the "Visitor" role or higher will be able to access the full website.

= Can I customize the maintenance mode page? =
Yes! You can fully customize the page using the **WordPress WYSIWYG editor**, including adding custom HTML, CSS, and media.

= Does this plugin affect logged-in users? =
No, logged-in users with sufficient permissions will see the regular website without the maintenance page.

== External Services ==
This plugin uses Google reCAPTCHA to enhance security and prevent automated bots from bypassing the maintenance mode restriction.

### What data is sent and when?
When a user submits the unlock form, the plugin sends the following data to Google's reCAPTCHA API:
- The user's reCAPTCHA response token.
- The user's IP address (sent automatically by Google's API).
- The action associated with the reCAPTCHA verification.

### Why is this data sent?
The data is required for Google reCAPTCHA to assess the likelihood that the form submission is performed by a human user. The plugin uses this verification to help prevent automated access attempts.

### Where is the data sent?
The data is transmitted to **Google's reCAPTCHA servers** for verification.

### Privacy and Terms of Service
For more details about how Google handles this data, please refer to:
- [Google reCAPTCHA Terms of Service](https://policies.google.com/terms)
- [Google Privacy Policy](https://policies.google.com/privacy)


== Screenshots ==
1. **Basic settings Page** - Overview of the plugin's basic settings. Editing the maintenance mode page with WYSIWYG editor.
2. **Detailed settings** - Editing custom CSS styles, analytics codes, and additional scripts.
3. **Password settings page** - Entry password and security settings page.
4. **Frontend Example** - What visitors see when maintenance mode is active.

== Changelog ==
= 9.1 (2025-05-19)
* Moved the setcookie() call into the init action hook to prevent "headers already sent" warnings.
* Added a check in the Google reCAPTCHA JavaScript to verify the presence of the spx1mm_submit element before binding the event. This prevents console errors after successful form submission.
* Handled the definition of the DONOTCACHEPAGE constant to prevent an error if it is already defined by another plugin.
* Added Tags: construction, under construction to the readme.txt file.
* Tested the plugin with WordPress 6.8.1

= 9 (2025-03-11) =
* Fixed loading of inline JavaScript to registered handle script with wp_add_inline_script function.
* Adjusted registration of scripts for Google reCaptcha to match the wp_enqueue_script requirement at most. 
* Modified loading language mutations with init instead of plugins_loaded. Loading of language mutations will be removed when the plugin is approved for the official repository. 
* Unified version of tested version of wordpress in readme.txt and speedx-maintenance-mode.php

= 8 (2025-03-10) =
* Fixed incorrect numbering of towers in Tested up to.
* Added feature to globally disable cache on power up and fill in Maintenance Mode input password.
* Modified labels and texting in plugin settings.
* Added text for information about the external Google reCaptcha service.
* Renamed text domain according to the assigned spx-maintenance-mode → speedx-maintenance-mode slug.
* Checked all input and output values and added missing validation functions.
* Added custom sanitizer class for escaping input and output values.
* Comprehensively changed the perfix including values in the database from spx_mm_ to spx1mm_ to change the probability of conflict with another plugin.
* Checking the names of all functions and filling in any missing spx1mm_ prefix.
* Added validation of translation input values.
* Revised plugin directory and main plugin file to match the assigned slug.
* Replaced date() function with gmdate()
* Removed php termination tag from additional files.
* Modified admin bar item generation to match data validation.
* Modified loading of content from the database to properly sanitize the data while preserving the formatting and ordering of the Wp WYSIWYG editor.

Translated with DeepL.com (free version)

= 7 (2025-02-20) =
* Fixed an error in evaluating conditions for a cleanly installed plugin that does not yet have any data in the database.

= 6 (2025-02-18) =
* Added verification of the existence of cookies before processing them.
* Added initialization of global variable for errors before data processing.
* Modified Google reCaptcha processing after form submission and updated the action to a more accurate model to make the obtained ranking as accurate as possible. Added error reporting to system log with recaptcha validation status, after more accurate debugging.
* Added option to set reCaptcha score.
* Added information and safety instructions.

= 5 (2025-02-17) =
* Added function for unlocking maintenance mode using an entry code. Plus addition of several layers of security against input code testing.
* Added feature to display maintenance mode status in admin bar.
* Updated default css style for input screen.
* Fixed loading default values for input screen settings.
* Added custom error trapping and display.
* Separated code to clear plugin cache into custom php file.

= 4 (2025-02-04) =
* Modified cache clearing function for cache plugins. Split into individual conditions with custom checking of the availability of the cleaning functions.
* Default HTML page content split into multiple separate text sections for the translation system.
* The system for loading default values has been redesigned.

= 3 (2025-01-31) =
* Added full English translation.
* Added tab memory when saving data in a specific tab.
* Added a field for the page title.
* Refactored the HTML structure of the output template.
* Fixed the ability to save empty values.
* Separated value storage based on the active tab to prevent interference between tabs.
* Improved the visual layout of the plugin settings page.
* Cleaned up development notes in the code and prepared for publication.

= 2 (2025-01-29) =
* Updated the toggle switch design for enabling/disabling maintenance mode.
* Updated the UI and split the main settings page into "Basic Settings" and "Advanced Settings" tabs.
* Added a heading to the information section, including a default text.
* Implemented a translation system and initial translations.
* Added custom CSS and JavaScript scripts.
* Added a function to clear the cache for commonly used caching plugins.

= 1 (2025-01-16) =
* Initial release of the plugin with basic functionality.

== Screenshots ==
1. assets/screenshot-1.png
2. assets/screenshot-2.png
3. assets/screenshot-3.png
4. assets/screenshot-4.png

== Donations ==
If you find this plugin useful, consider buying me a coffee:  
[Donate here](https://buymeacoffee.com/speedx)