=== Dovi Pasted HTML Cleanup ===
Contributors: dovidev
Tags: html, cleanup, elementor, paste, formatting
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Strips pasted-in junk HTML (inline styles, spans, stray attributes) from posts, Elementor widgets and ACF fields on save, or in bulk.

== Description ==

This plugin improves HTML content hygiene by:

- Replacing `<b>`/`<i>` with semantic `<strong>`/`<em>` tags
- Removing inline styles, `class`, `id`, `aria-*`, and `data-*` attributes
- Flattening `<span>` tags while preserving inner text
- Cleaning up Elementor's `text-editor` widgets
- Running cleanup automatically on post save (for selected post types)
- Bulk-processing posts via the Tools menu
- Providing a real-time manual HTML cleanup tool in the admin

Useful for websites that have been copy-pasting styled HTML from other sources (like Word or Google Docs), or importing messy content from page builders.

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to Tools > HTML Cleanup to configure and run bulk cleanup or use the manual HTML cleaner.

== Changelog ==

= 1.0.9 =
* Renamed to Dovi Pasted HTML Cleanup.
* Admin CSS moved to an enqueued stylesheet; Tools page slug prefixed.

= 1.0.7 =
* Security: all AJAX handlers now require the manage_options capability in addition to the nonce.
* Security: manual cleaner input is bounded with wp_kses_post(); settings inputs are unslashed before sanitizing.
* Fix: update checker registered against the wrong class guard and never ran.
* Prepared for WordPress.org (Plugin Check clean).

= 1.0.6 =
* **Feature**: Added **Cleanup Scope** settings – users can now choose to clean:
  - Elementor Text Widgets
  - ACF / Other WYSIWYG fields
  - Generic meta keys (ending in `_content`, `_html`, etc.)
* **Feature**: Added **"Save Settings" buttons** for both Post Types and Cleanup Scope with live feedback
* **Enhancement**: **Preserves `<p>` tags and line breaks** while removing junk HTML (`<span>`, `style`, `class`, etc.)
* **Enhancement**: Manual HTML cleaner now has **Visual + Code tabs**, **auto-cleans on paste/type/blur**, and **copies result to clipboard**
* **Fix**: Bulk cleanup progress bar now accurately shows **0% → 100%**
* **Fix**: Fixed infinite loop risk in `save_post` using **priority 999 + direct DB update**
* **Fix**: Manual cleaner no longer throws `tinymce is not defined` – uses `wp_editor()` properly
* **Fix**: Elementor, ACF, and meta cleanup now work reliably
* **UI**: Completely redesigned Tools page with clean cards, better spacing, and professional layout
* **Code**: `count_posts_array()` is now a **static class method** (cleaner architecture)

= 1.0.4 =
* Uses WordPress’s wp.editor.initialize() (no “tinymce is not defined”)
* Works with the wp_editor() output from PHP
* Auto-cleans on paste / typing
* Button fallback
* Bulk-cleanup logic unchanged

= 1.0.3 =
* Mnor format cleanup
* Added Plugin Update Manager

= 1.0.1 =
* Feature: Tools page now includes a manual HTML cleanup tool (paste and clean instantly)
* Feature: AJAX checkbox controls for selecting which post types are affected
* Feature: Settings are saved live when checkboxes are toggled
* Enhancement: Elementor-style detection and cleanup based on `_elementor_edit_mode`

= 1.0 =
* Initial release with automatic HTML cleanup on post save
* Handles Elementor text widgets and classic content
* Includes a bulk processor with progress bar

== Usage ==

- Enable or disable cleanup by post type via the Tools > HTML Cleanup settings.
- Use the WYSIWYG cleaner to test and clean HTML manually.
- Click “Start Cleanup” to process all matching posts in batches via AJAX.
