=== DashClean ===
Contributors: sandipdeveloper
Tags: admin, dashboard, cleanup, optimization, performance
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 2.0.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A WordPress admin optimization plugin. Clean the dashboard, control menus, optimize performance, and manage client experiences safely.

== Description ==

DashClean is a modular WordPress admin optimization plugin built for developers, agencies, and site owners who need a cleaner, faster, and more professional wp-admin experience.

Version 2.0.0 introduces a service-layer architecture with administrator protection, schema-aware settings migration, runtime discovery caching, and scalable user targeting — designed for client deployments and large WordPress installations.

= Core Capabilities =

* **Menu Cleaner** — Hide admin menu and submenu items by role or user.
* **Dashboard Widget Manager** — Remove all or specific dashboard widgets.
* **Admin Bar Cleaner** — Hide toolbar nodes for targeted users.
* **Notice Cleaner** — Suppress admin notices while optionally keeping critical errors.
* **Performance Optimization Tools** — Disable emojis, jQuery Migrate, header junk, and selectively dequeue frontend assets.
* **Role-Based Visibility Controls** — Apply cleaning rules to selected roles.
* **User-Specific Targeting** — Fine-tune restrictions to individual user accounts.
* **Preset Management System** — Apply Client or Developer templates; save custom snapshots.
* **Import / Export Settings** — Move configurations between sites with JSON backups.
* **Schema-Aware Settings Migration** — Automatic compatibility for legacy export files.
* **Runtime Discovery Cache System** — Reliable widget, admin bar, and asset inventories.
* **Safe Administrator Protection Layer** — Users with `manage_options` are never restricted.
* **AJAX User Search & Scalability** — Paginated user search for large sites (no bulk loading).
* **Multisite-Aware Cleanup Support** — Uninstall removes data across network sites.
* **Translation Ready** — Full text domain support with POT catalog included.

= Why DashClean =

Unlike heavy white-label plugins, DashClean uses a performance-first modular design. Optional modules load only when enabled. Settings are stored in a single option with schema versioning for safe upgrades.

Administrators always retain full access. Presets merge into existing configuration rather than wiping unrelated module settings.

== Installation ==

1. Upload the `dashclean` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Open **DashClean** in the admin sidebar to configure modules.
4. Visit the WordPress Dashboard once to populate the widget discovery cache.
5. Visit the site frontend once (with Performance enabled) to seed asset discovery.

== Frequently Asked Questions ==

= Is DashClean free? =

Yes. DashClean is open-source software released under the GPL v2 or later.

= Will this slow down my site? =

No. Disabled modules do not register hooks. Asset discovery uses hash-based transient writes to avoid per-request database churn. The Access tab uses AJAX search instead of loading full user lists.

= Can administrators be locked out? =

No. Version 2.0.0 includes an administrator protection layer. Users with the `manage_options` capability bypass all cleaner restrictions. The DashClean settings page remains accessible for recovery.

= Can I hide DashClean from clients? =

The DashClean settings menu requires `manage_options`. Non-administrator roles cannot access plugin settings by default. Use the Access module to apply cleaning rules to specific roles and users.

= Do presets overwrite my entire configuration? =

No. Starting in 2.0.0, applying a preset merges only the keys defined in that preset. Your existing Menu Cleaner, Dashboard, and other module settings outside the preset remain intact.

= Does DashClean work on multisite? =

Yes. Uninstall cleanup runs on all network sites. Configure each site independently through its own DashClean settings.

= Is DashClean translation ready? =

Yes. The plugin loads the `dashclean` text domain and includes a POT file in `/languages/`.

== Screenshots ==

1. The Dashboard Widgets cleaner.
2. Performance optimization settings.
3. Role-based visibility controls.

== Changelog ==

= 2.0.0 =
Major architecture and production hardening release.

**Added:**
* Administrator protection layer (`User_Access` service)
* Centralized User Targeting system (`User_Targeting` service)
* Schema migration framework with `schema_version` support
* Runtime discovery caching for dashboard widgets and admin bar nodes
* AJAX paginated user search for Access tab (20 results per request)
* Multisite uninstall cleanup across all network sites
* Translation loading via `load_plugin_textdomain()`
* Silence `index.php` files throughout plugin directories
* `dashclean_bypass_admin_protection` filter for extensibility

**Changed:**
* Preset application now merges preset keys into existing settings (preserves unrelated modules)
* Settings class refactored to pure data layer (controllers own nonce/lifecycle)
* Discovery system redesigned with hook-time collection and cached inventories
* Asset discovery optimized with hash-based transient write skipping
* User targeting centralized in single service (removed duplicated logic)
* Import/export upgraded with schema validation and migration path
* Custom preset snapshots saved from server-side persisted settings
* Discovery cache diff checks to prevent redundant option writes
* Improved selected-user display limits (up to 1,000 users)
* Strict admin tab whitelist validation

**Fixed:**
* Administrator lockout scenarios via menu hiding and direct URL blocking
* Preset configuration overwrite wiping unrelated module settings
* Nonce lifecycle inconsistencies for `active_preset` clearing
* Dashboard widget and admin bar discovery reliability on settings page
* Asset transient write inefficiency on every frontend page load
* Unlimited `get_users()` loading on Access tab
* Hardcoded JavaScript strings not passed through localization
* Presets master toggle outside form submission path
* Documentation inaccuracies (removed nonexistent "Blogger Mode" preset reference)
* Removed deprecated Role_Manager targeting method

**Security:**
* Protected administrators bypass all cleaner restrictions
* Improved import file path validation (no sanitization of filesystem tmp paths)
* Removed HTTP/`$_POST` concerns from Settings data layer

**Performance:**
* Eliminated unnecessary transient writes when asset inventory unchanged
* Removed rewrite flush on activation and deactivation
* Scalable user search replaces bulk role roster loading
* Reduced admin page load on large-user installations

**Developer:**
* New service-layer architecture (`User_Access`, `User_Targeting`, `Discovery`, `Schema`)
* Schema migration support for forward-compatible imports
* Cleaner module integrations via shared targeting service
* Improved maintainability and reduced code duplication
* Internal maintainability and final pre-release cleanup improvements

= 1.0.2 =
* Production hardening: administrator safety layer, preset merge fix, scalable user search
* Asset discovery hash-based transient writes
* Schema version support for import/export
* Cached dashboard widget and admin bar discovery
* Multisite uninstall support

= 1.0.1 =
* Corrected invalid Author URI
* Improved plugin header metadata
* Security and coding standards improvements
* Internal refactoring and cleanup

= 1.0.0 =
* Initial release
* Modular cleaners for Dashboard, Menu, and Admin Bar
* Performance optimizations
* Presets and data portability

== Upgrade Notice ==

= 2.0.0 =
Major production-hardening release. Introduces administrator protection safeguards, preset preservation improvements, schema-aware imports, discovery cache architecture, performance optimizations, and better scalability for large WordPress installations. Existing settings remain compatible and migrate automatically. No manual database steps required.

= 1.0.2 =
Production hardening update with administrator safety, preset fixes, and scalability improvements. Recommended for all users on 1.0.1 or earlier.
