=== AnyWareX Debug Switch ===
Contributors: anywarex
Tags: debug, debugging, debug log, developer tools
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A compact WordPress debugging control and debug.log viewer.

== Description ==
AnyWareX Debug Switch provides an administrator interface for enabling and disabling WordPress debugging, viewing debug.log, downloading or clearing the log, and reviewing a severity summary.

== Installation ==
1. Upload and activate the plugin.
2. Open AnyWareX Debug Switch.
3. Ensure all three standard debug constants are already defined in wp-config.php.
4. Back up wp-config.php externally and enable debugging only when needed.

== Usage and safety ==
1. Run Preflight to verify three existing single-line literal debug definitions before the WordPress bootstrap.
2. Choose Enable Debug or Disable Debug to preview the current and proposed values.
3. Explicitly confirm the displayed changes. The configuration is reread, its hash compared, and definitions revalidated before one write attempt.
4. If the file changed, the preview expired, or the configuration is unsupported, create a new preview after reviewing the issue.

Only the three debug boolean tokens are edited. Missing definitions are never inserted. Additional ordinary constants and independent plugin settings are supported; uncertain PHP constructs are rejected. Configuration editing requires the local direct WordPress filesystem and a regular non-symlink file.

Direct writes are not atomic. A partial write can damage wp-config.php and stop WordPress. There is no automatic retry or rollback. Keep an independent protected backup outside the web root and inspect write errors externally. The plugin lock serializes plugin requests, but cannot prevent external file changes. A crashed request may leave an editor lock; see README.md for administrator recovery.

Previews expire after ten minutes, are user/session/blog-bound, and contain metadata only. A new preview replaces that user's previous preview. No passwords, salts or configuration source are displayed or stored in preview metadata. Existing debug values and logs are not reverted by deactivation or uninstall.

Log Viewer, Summary, Download, Clear and Refresh remain available even when configuration editing is disabled. The managed log path is WP_CONTENT_DIR/debug.log. Protect logs at server level and disable debugging after use. WordPress.org review acceptance is not established by these changes.

== Changelog ==

= 1.0.1 =
* Added conservative PHP token analysis and original-position boolean edits.
* Added Preview / Confirm Changes with hash validation, one-use consent and an installation-wide writer lock.
* Disabled unconfirmed configuration writes and corrected all three runtime status values.
* Fixed action notices and AJAX errors; retained branding and log functions.
* Updated documentation, development-only regression tests and direct-write risk disclosures.

= 1.0.0 =
* Replaced Debug Switch SVG icons with PNG assets for the admin menu and page header.
* Preserved image aspect ratios and allowed the page header to wrap on narrow screens.
* Synchronized release metadata; debug switching logic is unchanged.

= 0.4.8 =
* Fixed post-action redirects to the dedicated Debug Switch admin page instead of the generic Tools page.
* Prevented the unintended Tools-page context after clearing the debug log and other admin actions.
* Updated version and release documentation.

= 0.4.7 =
* Replaced condensed administration JavaScript with fully readable, unminified source.
* No JavaScript build or minification tools are required.


= 0.4.6 =
* Removed development-only test files from the distribution package.
* No changes to runtime debug controls or admin interface.
* WordPress.org review issues concerning configuration and log writes remain open.

= 0.4.5 =
* Prominent warning listing individually missing debug constants and copyable definitions.
* Debug switching remains blocked for incomplete or ambiguous configurations.
* Not yet qualified for WordPress.org submission.

= 0.4.0 =
* Simplified switching of existing literal debug constants.
* Enqueued admin CSS/JS and improved status display.
* Not yet qualified for WordPress.org submission.

= 0.3.1 =
* Replaced remaining direct log/download/writability file operations with WordPress Filesystem API.
* Updated WordPress compatibility metadata.

= 0.3.0 =
* WordPress.org readiness update.
* Added WordPress.org metadata and GPL license declaration.
* Improved sanitization, escaping, naming and release packaging.
