=== Berestov Element Scheduler ===
Contributors: andreyberestov
Donate link: https://www.myetherwallet.com/#send/0x37385DA1388F2921583d4750FB44Def7D76cAb23
Tags: scheduler, replacement, insert, rotation, contacts
Requires at least: 4.8
Tested up to: 7.0
Requires PHP: 7.0
Stable tag: 1.0.34
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Schedule frontend element replacements by day, parity, or persistent rules.

== Description ==

Berestov Element Scheduler replaces the inner HTML of selected frontend elements by schedule.

It can match a parent element by class or ID and replace everything inside that parent with the value you define.

Supported schedule groups:

* Weekdays
* Odd and even month days
* Odd and even ISO weeks
* Persistent replacement

Features:

* Unlimited rules
* Search by class or ID
* Class mode works across all matched elements
* Multiple different rules per schedule slot
* Duplicate prevention inside the same slot
* Server-side, JavaScript, or Auto replacement mode
* UTC offset based switching
* Drag and drop schedule UI
* Translation-ready admin UI

Use cases:

* Rotate phone numbers
* Schedule banners
* Switch promo blocks
* Replace HTML snippets by schedule

Days without a rule stay unchanged.

Security

* Capability checks and nonce validation for all administrative actions.
* Strict sanitization and option whitelisting for all saved settings.
* Only explicitly allowed configuration fields are accepted.
* HTML output follows WordPress capability rules (unfiltered_html).
* The plugin does not contact external services or third-party APIs.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins screen in WordPress.
3. Open `E Scheduler` in the admin menu.
4. Create one or more rules.
5. Drag rules into the required schedule box.
6. Save settings.

== Frequently Asked Questions ==

= Does it replace only plain text? =

No. It can replace the full inner HTML of the matched parent element.

= If I use class mode, does it replace every matched element? =

Yes. Class mode replaces all frontend elements that contain the selected class.

= Can one slot contain many rules? =

Yes. Each slot can contain many different rules, but the same rule cannot be added twice to the same slot.

= What happens if one rule is assigned to several schedule groups? =

The rule becomes active when any assigned condition matches. It is applied once per request.

= Which mode should I use? =

Server-side mode uses PHP replacement only and avoids visual flicker. JavaScript mode is suitable for sites that use full page caching. Auto mode prefers server-side output and lets JavaScript correct stale cached markup when needed.

== Screenshots ==

1. Global settings and rules list.
2. Weekday calendar with drag and drop.
3. Expanded rule editor.
4. Parity and persistent schedule boxes.

== Changelog ==

= 1.0.34 =
* Removes literal \n tail markers from Auto footer script output.
* Adds a W3C Validator hint for DOM-sensitive homepages.


= 1.0.33 =
* Adds checker-friendly probe token handling and refines DOM rewrite debug highlighting.
* Reorders the replacement mode help text to match the current mode order.


= 1.0.31 =
Uses a short-lived internal probe token for DOM checks and makes JavaScript the default mode.

= 1.0.30 =
* Simplifies DOM rewrite compatibility checks to compare the full home page skeleton using div/nav/ul/menu tags only.
* Adds a small debug view to the DOM rewrite help tip showing before/after structure sequences.

= 1.0.29 =
* Switches DOM compatibility checks to a cache-resistant POST probe.
* Reduces false positives on cached sites during dry detection.

= 1.0.28 =
* Limits DOM rewrite compatibility updates to the dry settings probe only.
* Prevents runtime requests from overwriting the compatibility status.

= 1.0.27 =
* Refreshes DOM rewrite compatibility checks on each settings page load and runs them in a dry pass without applying active rules.
* Adds small help tips for Site charset, mbstring, and DOM rewrite compatibility.

= 1.0.26 =
* Improves DOM rewrite compatibility detection by comparing full document structure (tag skeleton) on the home page.
* More reliably detects themes sensitive to DOM normalization and safely restricts them to JavaScript mode.
* Refines environment checks and removes intermediate detection logic for a cleaner and more stable behavior.

= 1.0.15 =
* Restored readable UTF-8 page source in server/auto mode after DOM-based replacement by decoding numeric entities in serialized HTML.

= 1.0.14 =
* Switched DOM HTML loading to a UTF-8-safe path that avoids injecting an XML preamble into serialized Server and Auto output.
* Preserved the existing replacement flow while reducing the chance of malformed cached page source.
* Reconfirmed compatibility with WordPress 4.8+.

= 1.0.13 =
* Tightened full-document output cleanup after DOM serialization to remove stray XML preambles before cached HTML is served.
* Reconfirmed compatibility with WordPress 4.8+.

= 1.0.12 =
* Switched head and JavaScript footer runtime script delivery to WordPress script APIs.
* Preserved Auto mode footer injection flow for cached-page recovery and dual delivery behavior.

= 1.0.11 =
* Confirmed the renamed build does not register legacy custom REST routes.
* Paired frontend output buffering with an explicit shutdown close path.
* Moved inline client payload and runner output through late escaping.
* Synced the plugin version metadata after the rename.

= 1.0.9 =
* Fixed JavaScript and Auto mode time context calculation so schedule switching follows the configured plugin GMT offset without applying the browser timezone twice.
* Keeps Server mode schedule context unchanged.

= 1.0.8 =
* Restored JavaScript mode after 1.0.7 by removing the escaping change that stripped inline client scripts.
* Kept the menu label and readme security summary.

= 1.0.7 =
* Escaped inline client payload and runner output to satisfy WordPress coding standards checks.
* Renamed the admin menu label to E Scheduler.
* Added a short security summary to the readme.

= 1.0.6 =
* Kept Server mode PHP-only by registering client payload and runner hooks only for JavaScript and Auto modes.
* Clarified admin and readme mode descriptions so Server and Auto stay conceptually distinct.

= 1.0.5 =
* Added a stronger inline payload and runner fallback between head and footer for JavaScript and Auto modes.
* Kept Server mode unchanged.

= 1.0.4 =
* Rebased JavaScript replacement on the stable 1.0.0 approach and added full schedule data for cache-safe client-side evaluation.
* Fixed JavaScript time context calculation so browser timezone differences do not break schedules that use the plugin GMT offset.
* Stabilized Auto mode by reapplying current rules in the browser using the same client-side schedule engine.

= 1.0.3 =
* Restored working JavaScript replacement while keeping schedule evaluation inside the browser for cached pages.
* Simplified the JavaScript schedule engine so active rules are computed directly from saved rules and schedule groups.
* Kept Auto mode cache-safe by restoring server-replaced markup only when the current active rule set differs from the cached markup.

= 1.0.2 =
* Fixed a JavaScript mode regression where client-side replacement could stop applying.
* Added a safe fallback that preserves same-context JavaScript replacement while keeping cached-page schedule correction.
* Hardened Auto mode behavior for cached pages.

= 1.0.1 =
* Made JavaScript mode schedule-aware on cached pages by evaluating rules in the browser.
* Added Auto mode with server-side output plus JavaScript correction for stale cached markup.
* Refined admin mode descriptions for caching-related behavior.

= 1.0.0 =
* Added current-slot markers for weekday and parity schedules.
* Fixed persistent replacement activation.
* Final repo-ready release.

= 0.2.0 =
* Added a compact wallet reveal button in the admin footer.
* Refined the readme tags, upgrade notice, and wording.

= 0.1.7 =
* Clarified rule editor labels for parent matching and inner content replacement.

= 0.1.5 =
* Added persistent replacement schedule box.
* Added automatic "(copy)" suffix to copied rules.
* Kept duplicate-safe rule activation across overlapping schedule groups.
* Refined button styling and admin footer donation note.
* Fixed plugin checker issues around textdomain loading, nonce flow, and translators comments.

= 0.1.3 =
* Added support for multiple different rules per weekday.
* Prevented duplicate placement of the same rule inside one day.
* Kept class replacement working across all matched elements.
* Updated calendar UI for multi-rule days.
* Updated readme and translation template.

= 0.1.2 =
* Added translation template.
* Improved rule drag and drop behavior.
* Added compact collapsed rule layout.
* Added per-rule save buttons.
* Added rule removal from the calendar.
* Polished admin UI and readme.

= 0.1.1 =
* Initial public build.

== Upgrade Notice ==

= 1.0.34 =
Refines Auto footer output and adds a validator hint for DOM-sensitive homepages.


= 1.0.33 =
Small polish release for probe checks, mode help text, and DOM rewrite debug output.


= 1.0.31 =
Uses a short-lived internal probe token for DOM checks and makes JavaScript the default mode.

= 1.0.30 =
Refines DOM rewrite compatibility detection and adds a small before/after debug view.

= 1.0.29 =
* Uses a cache-resistant probe for DOM compatibility checks.

= 1.0.28 =
* Limits DOM rewrite compatibility updates to the dry settings probe only.

= 1.0.27 =
* Refreshes DOM rewrite compatibility checks on each settings page load and runs them in a dry pass without applying active rules.

= 1.0.26 =
* Improved detection of themes sensitive to DOM rewriting. Server-side and Auto modes are now more safely limited to compatible environments to prevent layout issues.

= 1.0.15 =
* Restores readable UTF-8 page source in server/auto mode after DOM-based replacement.

= 1.0.14 =
* Improves UTF-8 document loading in Server and Auto mode to prevent stray XML preambles from appearing in cached page source.

= 1.0.13 =
* Cleans serialized Server and Auto output more strictly to prevent stray XML preambles in cached HTML and reconfirms WordPress 4.8+ support.

= 1.0.12 =
* Moves runtime script delivery to WordPress script APIs while preserving existing Server, JavaScript, and Auto behavior.

= 1.0.11 =
* Confirms the renamed build has no legacy custom REST namespace and adds reviewer-requested frontend buffering and late escaping fixes.

= 1.0.10 =
* Replaces GMT wording with UTC in the settings UI and clarifies the schedule offset description.

= 1.0.9 =
* Fixes JavaScript and Auto mode schedule switching when the configured plugin GMT offset should control the active day.

= 1.0.8 =
* Restores working JavaScript and Auto mode client scripts after the 1.0.7 escaping change.

= 1.0.7 =
* Fixes frontend output escaping checks, updates the menu label, and adds a short security summary to the readme.

= 1.0.6 =
* Keeps Server mode PHP-only and clarifies the distinction between Server and Auto.

= 1.0.4 =
* Rebuilds JavaScript scheduling on top of the stable 1.0.0 behavior and fixes timezone-safe cached-page replacement.

= 1.0.3 =
* Restores working JavaScript replacement on cached pages and stabilizes Auto mode correction.

= 1.0.2 =
* Fixes a JavaScript mode regression and improves Auto mode reliability on cached pages.

= 1.0.1 =
* Adds cache-aware JavaScript scheduling and the new Auto mode for stale cached pages.
