=== Media Library File Download ===
Contributors: wplunadev
Tags: media, download, export, replace
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 2.0.1
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Download original media, export your library as a ZIP, and replace files while keeping their URLs. By WP Luna.

== Description ==

Media Library File Download adds practical file tools to your WordPress Media Library.

= Free features =

* Download an original file from its attachment details or edit screen.
* Export the complete media library you can manage as a ZIP.
* Replace a file with the same type and extension while preserving its attachment URL.
* Regenerate image sizes when replacing images.

Exports contain original local files, without generated image sizes or attachment metadata. Offloaded files that are unavailable locally cannot be exported. Archive creation requires the PHP ZIP extension and enough temporary disk space and request time for your library.

= Pro features =

* Download a selection of media files as a ZIP.
* Download directly from Media Library list rows and thumbnail controls.
* Import files selected with Google Picker into WordPress.
* Upload WordPress media to a Google Drive folder you choose.
* Remember your upload folder and review recent transfer results.
* Retry failed transfers and move your uploaded copies to Drive trash.

Google Drive access is limited to files you select and files this app creates. Choosing a folder does not authorize access to its existing contents. Select individual files to import them. Google Docs, Sheets, Slides, and Drawings import as PDFs; other Google-native file types and shortcuts are unsupported. Google export limits and your WordPress upload limits apply. Keep the transfer tab open until completion.

Pro requires a Freemius entitlement, including an eligible trial. Google Drive uses the WP Luna connection service and requires PHP OpenSSL. Each WordPress user clicks Connect Google Drive and signs in to their own Google account. Customers do not need a Google Cloud project or API credentials.

== Installation ==

1. Install and activate Media Library File Download.
2. Open Media > Media Download for library export and available Pro tools.
3. Open a media attachment's details to download or replace that file.

== Frequently Asked Questions ==

= Does replacement change my file URL? =
No. Replacement keeps the attachment ID and URL. The new file must have the same type and extension. Clear any external page or image caches if they continue showing an older image.

= Does exporting change my Media Library? =
No. Export creates a downloadable ZIP; it does not remove attachments.

= Can Pro browse or sync my entire Google Drive? =
No. You select files with Google Picker. A selected folder is an upload destination, not permission to read all its children. Transfers are started by you; there is no background synchronization.

= What happens when I disconnect Google? =
This WordPress user's authorization stored by the WP Luna service, local connection, chosen folder, and transfer history are removed. Existing files remain in WordPress and Google Drive. Revoke the app in your Google Account connections if you also want to remove Google's authorization.

== External services ==

Freemius provides licensing, updates, and optional account services. It communicates with Freemius according to the SDK's consent and licensing flow. See https://freemius.com/privacy/ and https://freemius.com/terms/.

In Pro, the WP Luna connection service handles Google sign-in and hosts Google Picker. When you connect or select files, your site sends its Freemius installation ID, site URL, a pseudonymous WordPress user identifier, and a signed request to WP Luna. The service verifies Pro entitlement with Freemius and stores encrypted Google authorization per site and WordPress user. Pending connection and selection requests expire after 10 minutes; unused connections expire after 90 days. Disconnect removes the stored connection. No Google client secret or refresh token is distributed with the plugin.

The service returns a short-lived Google access token to WordPress and selected file IDs and names from Picker. File contents transfer directly between WordPress and Google Drive. Imports request selected Drive files and metadata; uploads send chosen WordPress file contents, names, and destination IDs. The plugin stores an encrypted connection per WordPress user, a selected folder, and up to 50 recent transfer records. The free package does not load the Google integration. Google policies: https://policies.google.com/privacy and https://policies.google.com/terms.

== Changelog ==

= 2.0.1 =
* Clean rewrite under WP Luna authorship.
* Clear free and Pro package boundaries.
* Validated downloads, ZIP exports, and same-type file replacement.
* Pro file selection and Google Drive transfers using selected-file access.

= 1.4 =
* Previous public media-download release.
