=== TechArk Media Library Care ===
Contributors: gotechark
Tags: media, images, optimization, seo, cleanup
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.3.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Find unused media, detect duplicates, optimize images, and improve alt text with tools to scan, review, and clean your WordPress media library.

== Description ==

**TechArk Media Library Care — A healthier media library.**

Find unused media, detect duplicates, optimize images, and improve alt text with tools to scan, review, and clean your WordPress media library.

= Core Features =

* **Full Library Scan** — detects 6 core issue types in one pass
* **Unused Files** — images not referenced by any post, page, or widget
* **Duplicate Detection** — finds files with identical content regardless of filename
* **Unoptimized Images** — oversized dimensions or file sizes; converts to WebP
* **Broken Attachments** — media records with missing files on disk
* **Missing Alt Text** — accessibility and SEO gaps across your image library
* **Orphaned Files** — files on disk not registered in the media library
* **Image Optimization** — batch compress JPEG/PNG, resize, strip EXIF, convert to WebP
* **SEO Tab** — inline editor for alt text quality, image titles, and filename review
* **Scheduled Scans** — daily or weekly automated scans with email reports
* **Scan History** — tracks the last 50 scans with trend indicators
* **Export CSV** — export any issue list for offline review
* **Dashboard Widget** — at-a-glance health summary on the WP admin dashboard

= Who is it for? =

* Site owners who have accumulated years of uploaded media and want to reclaim disk space
* Developers and agencies managing multiple WordPress sites
* SEO teams who need to audit and fix image alt text at scale
* Performance engineers reducing page weight from oversized images

== Installation ==

1. Upload the `techark-media-library-care` folder to `/wp-content/plugins/`
2. Activate the plugin via **Plugins > Installed Plugins**
3. Navigate to **Media > Library Care**
4. Click **Run Full Scan** to analyze your library
5. Review issues under the **Issues**, **SEO**, and **Overview** tabs

== Frequently Asked Questions ==

= Are unused and orphaned results safe to delete? =
Results are review candidates. References created dynamically by themes, plugins, custom code, or external sites may not be detected. Back up your uploads and database, inspect each candidate, and select only files you have verified are unnecessary. Identical files can have separate references; deleting a duplicate does not rewrite those references.

= Will the plugin delete my files automatically? =
No. All deletions require explicit confirmation. The plugin identifies issues and lets you decide what to delete.

= Is there a backup when optimizing images? =
Yes. If "Keep Backup" is enabled in Settings, original files are backed up before optimization and can be restored individually.

= How long does a scan take? =
Typically a few seconds for libraries under 500 images. Large libraries depend on server resources and can exceed request time limits. The scan runs on your server and the browser waits for the result — keep the tab open until complete.

= Does it work on multisite? =
Both per-site and network activation are supported. Each site maintains its own scan results and settings. Network activation also initializes newly created sites.

= Can I automate scans without staying in the browser? =
Yes. Enable Scheduled Scans in the Settings tab to run daily or weekly via WordPress cron. Email reports are sent after each automated scan.

= What happens to data when I uninstall the plugin? =
All plugin-owned database tables and options are removed automatically when you delete the plugin via the WordPress admin.

= Does this work with external/cloud media (S3, offload)? =
The plugin reads attachment metadata from the WordPress database. Offloaded media may show as "broken" if local files have been removed. Full cloud support is on the roadmap.

== Screenshots ==

1. Overview tab — stat cards, recommendations, storage breakdown
2. Issues tab — paginated results with bulk actions
3. SEO tab — inline alt text and title editor
4. Settings tab — optimization, scheduled scans, thumbnail cleanup
5. Dashboard widget — at-a-glance health summary

== Changelog ==

= 1.3.3 =
* Use a distinctive plugin prefix and migrate existing scan data, settings, schedules, and attachment metadata.
* Keep compatibility metadata in the readme and improve AI request error handling.


= 1.3.2 =
* Renamed to TechArk Media Library Care with an updated tagline and description.
* Added network activation, new-site initialization, and complete per-site uninstall cleanup.
* Fixed scheduled reports skipping duplicate-only or optimization-only issues and test email reporting failures incorrectly.
* Added JavaScript translation support and a translation template; translated additional PHP display text and errors.
* Preserve zero dimension limits when reopening Settings.
* Allow retrying failed SEO requests and preserve other issue counts after bulk alt-text updates.
* Validated authenticated workflows on WordPress 7.1/PHP 8.2 and WordPress 6.0/PHP 7.4.


= 1.3.1 =
* Fixed the Poor Alt Quality panel remaining hidden when first opening or restoring the SEO tab.
* Preserved the gradient header and compact cards; unified SEO and Issues tabs, tables, inputs, buttons, Settings sections, and dialogs.
* Added accessible status announcements and keyboard focus management for settings and progress dialogs.
* Replaced destructive dashboard shortcuts with file review and selection.
* Protected WordPress scaled originals, image editor backups, symlinks, and shared registered thumbnails during cleanup.
* Revalidate orphaned candidates before deletion and enforce thumbnail upload-directory boundaries.
* Fixed issue pagination bounds, duplicate counter mapping, and multi-issue deletion counters.
* Export CSV in batches without the 9,999-row cutoff; preserve orphaned filenames and sizes.
* Escape notification text and rely on WordPress.org automatic translation loading.
* Checked dashboard rendering and issue queries on WordPress 7.1.

= 1.3.0 =
* Security: fixed CSV/Excel formula injection in the Export CSV feature
* Added full translation coverage for AJAX error messages (previously untranslated)
* Restored load_plugin_textdomain() call for translation support
* AI Alt Text API key is now masked in Settings instead of round-tripping in plaintext, with a new "Remove key" action
* Rebuilt admin stylesheet from the ground up — removed duplicate/legacy CSS layers, cut !important usage by over 70%, no visual changes intended
* Removed leftover inline styles in favor of stylesheet classes

= 1.2.1 =
* Improved WordPress.org plugin directory compatibility headers
* Tightened administrator-only access checks for scanner, settings, cleanup, and optimization actions
* Fixed scan history AJAX action compatibility
* Improved orphaned file import/delete path validation
* Added optimizer backup cleanup during uninstall
* Improved scheduled email escaping and scan query safety

= 1.2.0 =
* Added SEO tab with Poor Alt Quality, Missing Title, and Bad Filename panels
* Added inline alt text and title editor with per-row and bulk save
* Redesigned Overview tab — compact stat cards, color-coded recommendations, integrated storage metrics
* Fixed storage calculation bug where reclaimable bytes could exceed total reported size
* Added WebP coverage metric to storage overview
* Improved scan history: trend indicators, bumped retention to 50 entries
* Added uninstall cleanup (drops tables and options on plugin deletion)
* Added load_plugin_textdomain() for translation support

= 1.1.0 =
* Added Orphaned Files detection and import/delete actions
* Added Thumbnail Cleanup tool for unregistered image sizes
* Added Scheduled Scans with email notification
* Added Page Speed Impact analysis
* Added scan history with last 5 runs
* Improved duplicate detection to use file hash comparison

= 1.0.0 =
* Initial release
* Detects unused, duplicate, unoptimized, broken, and missing alt text files
* Bulk delete and optimize actions
* CSV export
* Dashboard widget

== External Services ==

The AI alt text feature (optional) sends image data to the Anthropic API to generate descriptive alt text using Claude. This only occurs when you explicitly click the lightbulb icon on a specific image — no data is sent automatically or during scans.

**What is transmitted:** The image file (base64-encoded, max 5 MB) and a text prompt are sent to Anthropic's API.

**When it is transmitted:** Only when a logged-in administrator manually triggers alt text generation for a specific image.

**Anthropic API:**

* Service: https://www.anthropic.com
* Terms of Use: https://www.anthropic.com/legal/commercial-terms
* Privacy Policy: https://www.anthropic.com/legal/privacy

You must supply your own Anthropic API key in the plugin Settings tab. Without a key, no data is ever sent.

== Upgrade Notice ==

= 1.3.2 =
Improves multisite lifecycle handling, translations, scheduled reports, and settings reliability.


= 1.3.0 =
Fixes a CSV export security issue and improves translation coverage. Recommended for all users.

= 1.2.1 =
Compatibility and security hardening update recommended for all users.

= 1.2.0 =
This release adds an SEO tab and fixes a storage size calculation bug. Recommended for all users.
