# Theme & Extension Downloader

Download any installed WordPress plugin or theme as a ZIP file directly from your dashboard.

## Description

Theme & Extension Downloader is a simple utility plugin that allows WordPress administrators to download any installed plugin or theme as a ZIP file. This is useful for creating backups, migrating extensions between sites, or sharing custom plugins/themes with others.

The plugin integrates seamlessly into the WordPress admin, adding convenient download links under the Plugins and Appearance menus. You can download individual items or select multiple plugins/themes to download together in a single ZIP bundle.

**Perfect for:**
- Creating quick backups of specific plugins or themes
- Migrating extensions to staging or development sites
- Sharing custom-developed plugins with clients or team members
- Archiving plugins before updates

## Features

- **Download Individual Items** - One-click download for any installed plugin or theme
- **Bulk Downloads** - Select multiple items and download them together as a single ZIP
- **Seamless Integration** - Access from Plugins → Download Plugins or Appearance → Download Themes
- **Active/Inactive Status** - Easily see which extensions are currently active
- **Secure** - Admin-only access with nonce verification and capability checks

## Requirements

- WordPress 5.0 or higher
- PHP 7.4 or higher
- ZipArchive PHP extension (standard on most hosts)

## Installation

### Manual Installation

1. Download the plugin zip file
2. Go to **Plugins > Add New > Upload Plugin**
3. Choose the zip file and click **Install Now**
4. Activate the plugin

### From Source

1. Clone or download the repository
2. Upload the `theme-extension-downloader` folder to `/wp-content/plugins/`
3. Activate the plugin through the WordPress admin

## Quick Start

1. **Download a Plugin**
   - Go to **Plugins → Download Plugins**
   - Click the **Download** button next to any plugin
   - The plugin will download as a ZIP file

2. **Download a Theme**
   - Go to **Appearance → Download Themes**
   - Click the **Download** button next to any theme

3. **Bulk Download**
   - Use the checkboxes to select multiple items
   - Click **Download Selected**
   - All selected items will be bundled into a single ZIP file

## Screenshots

1. **Download Plugins Page** - List of all installed plugins with download buttons
2. **Download Themes Page** - List of all installed themes with download buttons
3. **Bulk Selection** - Select multiple items for combined download

## FAQ

### Can I download inactive plugins/themes?

Yes! You can download any installed plugin or theme, whether it's active or inactive.

### Where are the downloaded files saved?

Downloads are served directly to your browser as ZIP files. They're saved to your default downloads folder.

### What happens if I download multiple items?

When you select multiple plugins or themes and click "Download Selected", they're bundled together into a single ZIP file named `plugins-bundle-[date].zip` or `themes-bundle-[date].zip`.

### Is this plugin secure?

Yes. The plugin requires administrator privileges (`manage_options` capability) and uses WordPress nonces for all download requests. Additionally, it validates that requested items are actually installed extensions.

### Does it work with multisite?

The plugin works on individual sites within a multisite network. Network-wide functionality is not currently supported.

### Can I download mu-plugins?

Currently, the plugin only supports regular plugins and themes. Must-use plugins (mu-plugins) and drop-ins are not listed.

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for version history.

## Security

This plugin follows WordPress security best practices:

- Capability checks on all admin pages and downloads
- Nonce verification on all actions
- Input sanitization using `sanitize_text_field()` and `sanitize_file_name()`
- Output escaping using `esc_html()`, `esc_attr()`, and `esc_url()`
- Validation against installed extensions to prevent arbitrary file access
- Protected temporary download directory

## Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

GPL v2 or later - see [LICENSE](LICENSE) for details.

## Credits

Developed by [CHRS Interactive](https://www.chrsinteractive.com)
