# Email For Download PHP 7.0 Compatible version 1.0
## Collect emails for free download! 
Email For Download is an easy way to grow your email list offering free digital assets in return.

Add the shortcode in a post or a page to embed the form to be filled by the users who want to download your file(s). Great for promoting free digital assets on your site.

## How it works
* Install the plugin and enter the specific page in to the backend <your-domain>/wp-admin/admin.php?page=email_for_download_menu_page
* Upload the files you want distribute
* At this point you can simply add the shortcode in your desired position
* ... or you can set up other configurations, as:
* Choose the date/period you want to form to be displayed, simply addding a start and/or expiration date
* Set up a limited number of available downloads
* Choose the delivery method(via mail or via link in page)
* Enable the notifications if you want to informed each time your file has been downloaded
* Use the Messages tab to add your personal messages to the users
* Use the API to get the history from another application
* ... or use the CSV export inside the History tab to get your history and use it elsewhere.

## Features
* One form per site
* PDF/IMG/ZIP/JSON/CSV/TXT document allowed
* Protection on your files, no direct access via HTTP
* Shortcode for posts and pages
* Downloads History
* API with token GET Downloads History
* Export Downloads History in CSV
* Check email validity to prevent junk emails
* Receive a notification when someone download your file
* Set start date in which show your form
* Set expiration date for form 
* Set expiration date for link
* Limit the number of download
* Download link via mail or directly in page
* File validation on size and extension
* Input validation
* Honeypot technique instead of annoying captcha
* Ajax frontend (no page refresh)
* No registration required

## APIs
[GET]: <YOUR-DOMAIN>/wp-admin/admin-ajax.php?action=email_download_api_history_last_updload&t=<TOKEN-OF-LAST-UPLOAD>
~~~~
var data = {
	'action': 'email_download_api_history_last_updload',
	't': 'TOKEN OF LAST UPLOAD'
};
jQuery.post(ajaxurl, data, function(response) {
	console.log('Got this from the server: ', response);
});
~~~~

## What can you share with your users
* Cheat Sheet
* Interesting Case Study
* All-in-One Toolkit
* Handy Template
* Technical Drawing
* Persuasive Essay
* Bold Manifesto

## Installation
### To install the automatically
* Through WordPress admin, use the menu: Plugin > Add new
* Search for Mini Shopping Cart
* Click on install then click activate link

### To install the plugin manually
* Download and unzip the file mini-shopping-cart.zip
* Upload the /mini-shopping-cart directory to /wp-content/plugins/
* Activate the plugin through the Plugins menu in WordPress
* Click on  Email For Download on left menu
* Set up your plugin

## Design
Use the class below inside your CSS child theme to customize the style of the form:
* section#email_for_download{}

## Tested on
- PHP 7.1.20
- Apache/2.4.25 (Debian)
- WordPress Version from 4.8 to 5.3

## Change log
### 1.0.2
* Improved Check on Allowed Extensions
### 1.0
* 

## TODO
* Widget option
* Icons for files in template
* Check the user email againt to a list of allowed emails
* How many registered user downloaded the files?
* Prefilled input email for registered users

## License
GNU General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.en.html

## Author
* Author: Giuseppe Maccario
* Author URI: https://www.giuseppemaccario.com/
* Github URI: https://github.com/gmaccario/email-for-download