Version Description
- Support multiple file selection (within shortcut code, use comma-separated list of download IDs: download_id="1,2,3")
- Add more information in the download history EXPORT .csv file
- Added support for Download Monitor format code for the inline link that is displayed (within shortcut code, specify the format code: format="1")
- Allow overriding the default settings with the shortcode (i.e. within shortcode, use delivered_as="Inline Link" even though the general setting in admin panel is setup for "Both" -- options are "Inline Link", "Send Email", "Both")
- Updates to avoid potential conflicts with other plugins
- Added ability to customize subject line when emailing file download
Download this release
Release Info
Developer | ashokaggarwal |
Plugin | Email Before Download |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 2.0
- checkcurl.php +8 -0
- download.php +104 -0
- trunk/email-before-download.php → email-before-download.php +308 -59
- export.php +70 -0
- trunk/readme.txt → readme.txt +13 -4
- tags/0.5/trunk/screenshot-1.png → screenshot-1.png +0 -0
- tags/0.5/trunk/screenshot-2.png → screenshot-2.png +0 -0
- tags/0.5/trunk/screenshot-3.png → screenshot-3.png +0 -0
- tags/0.5/trunk/screenshot-4.png → screenshot-4.png +0 -0
- tags/0.5/trunk/screenshot-5.png → screenshot-5.png +0 -0
- tags/0.5/trunk/screenshot-6.png → screenshot-6.png +0 -0
- tags/0.5/trunk/email-before-download.php +0 -254
- tags/0.5/trunk/readme.txt +0 -94
- trunk/screenshot-1.png +0 -0
- trunk/screenshot-2.png +0 -0
- trunk/screenshot-3.png +0 -0
- trunk/screenshot-4.png +0 -0
- trunk/screenshot-5.png +0 -0
- trunk/screenshot-6.png +0 -0
checkcurl.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(function_exists('curl_init')){
|
3 |
+
echo 'cURL is enabled';
|
4 |
+
|
5 |
+
}
|
6 |
+
else
|
7 |
+
echo 'cURL is not enabled';
|
8 |
+
?>
|
download.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$wp_root = dirname(__FILE__) .'/../../../';
|
3 |
+
if(file_exists($wp_root . 'wp-load.php')) {
|
4 |
+
require_once($wp_root . "wp-load.php");
|
5 |
+
} else if(file_exists($wp_root . 'wp-config.php')) {
|
6 |
+
require_once($wp_root . "wp-config.php");
|
7 |
+
} else {
|
8 |
+
exit;
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
//get file id
|
13 |
+
$dId = $_REQUEST['dl'];
|
14 |
+
|
15 |
+
//
|
16 |
+
global $wpdb;
|
17 |
+
$table_item = $wpdb->prefix . "ebd_item";
|
18 |
+
$table_link = $wpdb->prefix . "ebd_link";
|
19 |
+
$ebd_link = $wpdb->get_row( "SELECT * FROM $table_link WHERE uid = '".$wpdb->escape($dId)."';" );
|
20 |
+
if($ebd_link->expire_time != NULL && $ebd_link->expire_time != 0 && $ebd_link->expire_time < time()){
|
21 |
+
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
22 |
+
wp_die( sprintf(__('The link you are trying to access is expired. <br/><br/><a href="%1$s"><strong>← Back to %2$s</strong></a>', "email-before-download"), get_bloginfo('url'), get_bloginfo('name')), __('The link you are trying to access is expired.',"email-before-download"));
|
23 |
+
}
|
24 |
+
|
25 |
+
if($ebd_link->selected_id != NULL && $ebd_link->selected_id != 0){
|
26 |
+
$dl = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($ebd_link->selected_id).";" );
|
27 |
+
$d = new downloadable_file($dl);
|
28 |
+
$file = $d->filename;
|
29 |
+
$wpdb->update( $table_link, array("is_downloaded"=>1), array("uid"=>$wpdb->escape($dId)) );
|
30 |
+
header("Location: $file");
|
31 |
+
exit(0);
|
32 |
+
}
|
33 |
+
$ebd_item = $wpdb->get_row( "SELECT * FROM $table_item WHERE id = ".$wpdb->escape($ebd_link->item_id).";" );
|
34 |
+
|
35 |
+
$file = '';
|
36 |
+
if($ebd_item->file){
|
37 |
+
$file = $ebd_item->file;
|
38 |
+
}
|
39 |
+
if($ebd_item->download_id){
|
40 |
+
$dl = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($ebd_item->download_id).";" );
|
41 |
+
$d = new downloadable_file($dl);
|
42 |
+
$file = $d->filename;
|
43 |
+
}
|
44 |
+
$wpdb->update( $table_link, array("is_downloaded"=>1), array("uid"=>$wpdb->escape($dId)) );
|
45 |
+
|
46 |
+
//Check if the cUrl functions are available and the url hide option is enabled.
|
47 |
+
//If not, just rederect to real file url.
|
48 |
+
$is_masked = get_option('email_before_download_hide');
|
49 |
+
//is the "hide" option overriden for the individual download
|
50 |
+
if($ebd_link->is_masked != NULL)
|
51 |
+
$is_masked = $ebd_link->is_masked == 'yes';
|
52 |
+
|
53 |
+
if ($is_masked && function_exists('curl_init')) {
|
54 |
+
$curl = curl_init();
|
55 |
+
$url = $file;
|
56 |
+
$options = array
|
57 |
+
(
|
58 |
+
CURLOPT_URL=>$url,
|
59 |
+
CURLOPT_HEADER=>true,
|
60 |
+
CURLOPT_RETURNTRANSFER=>true,
|
61 |
+
CURLOPT_FOLLOWLOCATION=>true,
|
62 |
+
);
|
63 |
+
curl_setopt_array($curl,$options);
|
64 |
+
$r = curl_exec ($curl);
|
65 |
+
$header_size = curl_getinfo($curl,CURLINFO_HEADER_SIZE);
|
66 |
+
$header = substr($r, 0, $header_size);
|
67 |
+
$body = substr( $r, $header_size );
|
68 |
+
|
69 |
+
curl_close ($curl);
|
70 |
+
// $my_headers = http_parse_headers ( $header );
|
71 |
+
$my_headers = parse_headers ( $header );
|
72 |
+
|
73 |
+
foreach($my_headers as $key=>$value){
|
74 |
+
header("$key: $value");
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
echo $body;
|
79 |
+
exit(0);
|
80 |
+
|
81 |
+
}
|
82 |
+
else {
|
83 |
+
header("Location: $file");
|
84 |
+
}
|
85 |
+
|
86 |
+
function parse_headers( $header )
|
87 |
+
{
|
88 |
+
$retVal = array();
|
89 |
+
$fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header));
|
90 |
+
foreach( $fields as $field ) {
|
91 |
+
if( preg_match('/([^:]+): (.+)/m', $field, $match) ) {
|
92 |
+
$match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1])));
|
93 |
+
if( isset($retVal[$match[1]]) ) {
|
94 |
+
$retVal[$match[1]] = array($retVal[$match[1]], $match[2]);
|
95 |
+
} else {
|
96 |
+
$retVal[$match[1]] = trim($match[2]);
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
return $retVal;
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
?>
|
trunk/email-before-download.php → email-before-download.php
RENAMED
@@ -17,16 +17,16 @@ contract, strict liability, or tort(including negligence or otherwise) arising i
|
|
17 |
this software, even if advised of the possibility of such damage.
|
18 |
|
19 |
For full license details see license.txt
|
20 |
-
============================================================================================================
|
21 |
-
*/
|
22 |
/*
|
23 |
-
* Init database tables
|
24 |
*/
|
25 |
|
26 |
global $wpdb;
|
27 |
|
28 |
$table_item = $wpdb->prefix . "ebd_item";
|
29 |
$table_link = $wpdb->prefix . "ebd_link";
|
|
|
30 |
|
31 |
if($wpdb->get_var("SHOW TABLES LIKE '$table_item'") != $table_item) {
|
32 |
|
@@ -49,13 +49,41 @@ if($wpdb->get_var("SHOW TABLES LIKE '$table_link'") != $table_link) {
|
|
49 |
is_downloaded smallint(3) NOT NULL default '0',
|
50 |
email VARCHAR(128) NOT NULL,
|
51 |
expire_time bigint(11),
|
52 |
-
|
53 |
-
|
|
|
|
|
54 |
UNIQUE KEY id (id)
|
55 |
);";
|
56 |
$wpdb->query($sql);
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
//Shortcode function
|
60 |
function emailreqtag_func($atts) {
|
61 |
extract(shortcode_atts(array(
|
@@ -63,33 +91,46 @@ function emailreqtag_func($atts) {
|
|
63 |
'contact_form_id' => NULL,
|
64 |
'title' => NULL,
|
65 |
'file' => NULL,
|
|
|
|
|
|
|
|
|
66 |
), $atts));
|
67 |
|
68 |
global $wpdb,$wp_dlm_root,$wp_dlm_db,$wp_dlm_db_taxonomies, $def_format, $dlm_url, $downloadurl, $downloadtype, $wp_dlm_db_meta;
|
69 |
|
70 |
$str = '';
|
71 |
-
|
72 |
//$title = '';
|
73 |
|
74 |
$url = '';
|
|
|
|
|
75 |
$table_item = $wpdb->prefix . "ebd_item";
|
76 |
if($download_id != NULL){
|
77 |
-
|
78 |
-
$
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
-
|
|
|
89 |
if (empty($ebd_item)){
|
90 |
$wpdb->insert( $table_item, array("download_id"=>$download_id, "title"=>$title) );
|
91 |
$download_id = $wpdb->insert_id;
|
92 |
-
$ebd_item = $wpdb->get_row( "SELECT * FROM $table_item WHERE
|
93 |
}
|
94 |
else $download_id = $ebd_item->id;
|
95 |
//update title if needed
|
@@ -116,8 +157,26 @@ function emailreqtag_func($atts) {
|
|
116 |
|
117 |
}
|
118 |
$contact_form = do_shortcode("[contact-form $contact_form_id \"$title\"]");
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
$contact_form = str_replace("</form>", $hf, $contact_form);
|
123 |
|
@@ -132,20 +191,51 @@ add_shortcode('emailreq', 'emailreqtag_func');
|
|
132 |
add_shortcode('email-download', 'emailreqtag_func');
|
133 |
|
134 |
/*Function that processes contact form 7, generates links, sends emails */
|
135 |
-
function
|
136 |
-
|
137 |
if(isset( $_POST['_wpcf7_download_id'] )){
|
138 |
global $wpdb,$wp_dlm_root,$wp_dlm_db,$wp_dlm_db_taxonomies, $def_format, $dlm_url, $downloadurl, $downloadtype, $wp_dlm_db_meta;
|
|
|
|
|
139 |
$table_item = $wpdb->prefix . "ebd_item";
|
140 |
$table_link = $wpdb->prefix . "ebd_link";
|
141 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
$dl = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($ebd_item->download_id).";" );
|
144 |
$d = new downloadable_file($dl);
|
145 |
|
146 |
-
$dId = $_POST['_wpcf7_download_id'];
|
147 |
|
148 |
|
|
|
|
|
149 |
$title = '';
|
150 |
//echo 'debug: ' . $ebd_item->id . ' ' . $ebd_item->title;
|
151 |
//print_r($ebd_item);
|
@@ -163,7 +253,68 @@ function process_email_form( $cf7 ) {
|
|
163 |
}
|
164 |
}
|
165 |
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
//generate unique id for the file (link)
|
168 |
$uid = md5(uniqid(rand(), true));
|
169 |
|
@@ -171,41 +322,95 @@ function process_email_form( $cf7 ) {
|
|
171 |
$expireAt = 0;
|
172 |
if(get_option('email_before_download_expire_time') != NULL && get_option('email_before_download_expire_time') != "0")
|
173 |
$expireAt = strtotime(get_option('email_before_download_expire_time'));
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
$cf7->posted_data['your-message'] = $title;
|
188 |
$cf7->mail['body'] = $cf7->mail['body'] ."\nThe downloaded file name: [your-message]";
|
189 |
|
190 |
}
|
191 |
|
|
|
192 |
|
193 |
-
$target = '_blank';
|
194 |
$target = get_option('email_before_download_link_target');
|
195 |
$html_before = get_option('email_before_download_html_before_link');
|
196 |
$html_after = get_option('email_before_download_html_after_link');
|
197 |
-
|
|
|
|
|
198 |
$message = '';
|
199 |
-
if(
|
200 |
-
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
-
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
//$title = "Click this link to download this file.";
|
204 |
-
$innerHtml = $html_before .
|
|
|
205 |
|
206 |
-
if(
|
207 |
-
|
208 |
-
if(
|
209 |
$dirs = wp_upload_dir();
|
210 |
$uploadpath = trailingslashit( $dirs['baseurl'] );
|
211 |
$absuploadpath = trailingslashit( $dirs['basedir'] );
|
@@ -219,13 +424,19 @@ function process_email_form( $cf7 ) {
|
|
219 |
}
|
220 |
$attachments = array($attachment);
|
221 |
}
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
-
else if (
|
227 |
-
|
228 |
-
if(
|
229 |
$dirs = wp_upload_dir();
|
230 |
$uploadpath = trailingslashit( $dirs['baseurl'] );
|
231 |
$absuploadpath = trailingslashit( $dirs['basedir'] );
|
@@ -239,15 +450,32 @@ function process_email_form( $cf7 ) {
|
|
239 |
}
|
240 |
$attachments = array($attachment);
|
241 |
}
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
244 |
$cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='$innerHtml'; \"";
|
245 |
}
|
246 |
-
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
|
|
248 |
return $cf7;
|
249 |
}
|
250 |
-
add_action( 'wpcf7_before_send_mail', '
|
251 |
|
252 |
add_action('admin_menu', 'ebd_plugin_menu');
|
253 |
|
@@ -278,9 +506,11 @@ function register_email_before_download_settings() {
|
|
278 |
register_setting( 'email-before-download-group', 'email_before_download_html_after_link' );
|
279 |
register_setting( 'email-before-download-group', 'email_before_download_send_email' );
|
280 |
register_setting( 'email-before-download-group', 'email_before_download_email_template' );
|
|
|
281 |
register_setting( 'email-before-download-group', 'email_before_download_expire_time' );
|
282 |
register_setting( 'email-before-download-group', 'email_before_download_hide' );
|
283 |
register_setting( 'email-before-download-group', 'email_before_download_attachment' );
|
|
|
284 |
|
285 |
}
|
286 |
|
@@ -397,8 +627,8 @@ vertical-align:top;
|
|
397 |
|
398 |
<tr valign="top" class="alert"><td colspan="2"><p class="alert">#8 through #9 only apply if you selected "Send Email" or "Both" as the Delivery Format in #1</p></td></tr>
|
399 |
<tr valign="top">
|
400 |
-
<th scope="row"><p>8. Email Template</p
|
401 |
-
<td><textarea cols="40" rows="10" name="email_before_download_email_template"
|
402 |
<i>You can use the following placeholders: [requesting_name], [file_url] and [file_name]. </i><br />
|
403 |
<i>So if you, for example, don't provide the [file_url] placeholder, the
|
404 |
<br />user will not receive any link. Here is an example of the template:<br /><br />
|
@@ -412,6 +642,14 @@ My Company name </b>
|
|
412 |
<br /><br /> Note. If you leave this field empty, an email containing only the file URL will be sent.
|
413 |
|
414 |
</i>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
</td>
|
416 |
</tr>
|
417 |
|
@@ -423,6 +661,17 @@ My Company name </b>
|
|
423 |
</p>
|
424 |
</td>
|
425 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
</table>
|
427 |
|
428 |
<p class="submit">
|
17 |
this software, even if advised of the possibility of such damage.
|
18 |
|
19 |
For full license details see license.txt
|
20 |
+
============================================================================================================ /
|
|
|
21 |
/*
|
22 |
+
* Init database tables
|
23 |
*/
|
24 |
|
25 |
global $wpdb;
|
26 |
|
27 |
$table_item = $wpdb->prefix . "ebd_item";
|
28 |
$table_link = $wpdb->prefix . "ebd_link";
|
29 |
+
$table_posted_data = $wpdb->prefix . "ebd_posted_data";
|
30 |
|
31 |
if($wpdb->get_var("SHOW TABLES LIKE '$table_item'") != $table_item) {
|
32 |
|
49 |
is_downloaded smallint(3) NOT NULL default '0',
|
50 |
email VARCHAR(128) NOT NULL,
|
51 |
expire_time bigint(11),
|
52 |
+
time_requested bigint(11),
|
53 |
+
uid varchar(255) NOT NULL,
|
54 |
+
selected_id BIGINT NOT NULL,
|
55 |
+
delivered_as varchar(255) NULL,
|
56 |
UNIQUE KEY id (id)
|
57 |
);";
|
58 |
$wpdb->query($sql);
|
59 |
}
|
60 |
|
61 |
+
// time_requested bigint(11),
|
62 |
+
//ALTER TABLE `wp_ebd_link` ADD `selected_id` VARCHAR( 128 ) NULL AFTER `uid` ;
|
63 |
+
if(!$wpdb->get_row("SHOW COLUMNS
|
64 |
+
FROM $table_link
|
65 |
+
LIKE 'selected_id'"))
|
66 |
+
$wpdb->query("ALTER TABLE `$table_link` ADD `selected_id` BIGINT NOT NULL ;");
|
67 |
+
//ALTER TABLE `wp_ebd_link` ADD `time_requested` BIGINT NOT NULL ;
|
68 |
+
if(!$wpdb->get_row("SHOW COLUMNS
|
69 |
+
FROM $table_link
|
70 |
+
LIKE 'time_requested'"))
|
71 |
+
$wpdb->query("ALTER TABLE `$table_link` ADD `time_requested` BIGINT NOT NULL ;");
|
72 |
+
|
73 |
+
if(!$wpdb->get_row("SHOW COLUMNS
|
74 |
+
FROM $table_link
|
75 |
+
LIKE 'is_masked'"))
|
76 |
+
$wpdb->query("ALTER TABLE `$table_link` ADD `is_masked` VARCHAR(4) NULL DEFAULT NULL;");
|
77 |
+
|
78 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_posted_data'") != $table_posted_data) {
|
79 |
+
|
80 |
+
$sql = "CREATE TABLE " . $table_posted_data . " (
|
81 |
+
time_requested bigint(20),
|
82 |
+
posted_data text(2000) NOT NULL,
|
83 |
+
UNIQUE KEY id (time_requested)
|
84 |
+
);";
|
85 |
+
$wpdb->query($sql);
|
86 |
+
}
|
87 |
//Shortcode function
|
88 |
function emailreqtag_func($atts) {
|
89 |
extract(shortcode_atts(array(
|
91 |
'contact_form_id' => NULL,
|
92 |
'title' => NULL,
|
93 |
'file' => NULL,
|
94 |
+
'format' => NULL,
|
95 |
+
'delivered_as' => NULL,
|
96 |
+
'masked'=>NULL,
|
97 |
+
'attachment'=>NULL,
|
98 |
), $atts));
|
99 |
|
100 |
global $wpdb,$wp_dlm_root,$wp_dlm_db,$wp_dlm_db_taxonomies, $def_format, $dlm_url, $downloadurl, $downloadtype, $wp_dlm_db_meta;
|
101 |
|
102 |
$str = '';
|
103 |
+
$chekboxes = "";
|
104 |
//$title = '';
|
105 |
|
106 |
$url = '';
|
107 |
+
$hf = '';
|
108 |
+
$dldArray = array();
|
109 |
$table_item = $wpdb->prefix . "ebd_item";
|
110 |
if($download_id != NULL){
|
111 |
+
$ebd_item = $wpdb->get_row( "SELECT * FROM $table_item WHERE download_id = '$download_id' " );
|
112 |
+
$dldArray = explode(",", $download_id);
|
113 |
+
$title_tmp = '';
|
114 |
+
foreach ($dldArray as $dl_id) {
|
115 |
+
$dl = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($dl_id).";" );
|
116 |
+
|
117 |
+
|
118 |
+
$d = new downloadable_file($dl);
|
119 |
+
|
120 |
+
if (!empty($d)) {
|
121 |
+
$date = date("jS M Y", strtotime($d->date));
|
122 |
+
if ($title == NULL || $title == '') $title_tmp .= $d->title . '|';
|
123 |
+
$url = $d->url;
|
124 |
+
$chekboxes .= '<br />' . $d->title. ' <input type="checkbox" name="ebd_downloads[]" value="'. $dl_id . '">';
|
125 |
+
}
|
126 |
+
|
127 |
}
|
128 |
+
if(count($title_tmp) > 0) $title = rtrim($title_tmp, '|');
|
129 |
+
// rtrim($title, '|');
|
130 |
if (empty($ebd_item)){
|
131 |
$wpdb->insert( $table_item, array("download_id"=>$download_id, "title"=>$title) );
|
132 |
$download_id = $wpdb->insert_id;
|
133 |
+
$ebd_item = $wpdb->get_row( "SELECT * FROM $table_item WHERE id = ".$wpdb->escape($download_id).";" );
|
134 |
}
|
135 |
else $download_id = $ebd_item->id;
|
136 |
//update title if needed
|
157 |
|
158 |
}
|
159 |
$contact_form = do_shortcode("[contact-form $contact_form_id \"$title\"]");
|
160 |
+
// add checkboxes if count is more than one
|
161 |
+
if (count($dldArray) > 1){
|
162 |
+
//$chekboxes $chekboxes
|
163 |
+
$contact_form = str_replace("<ebd />", $chekboxes, $contact_form);
|
164 |
+
}
|
165 |
+
else $contact_form = str_replace("<ebd />", "", $contact_form);
|
166 |
+
|
167 |
+
if($delivered_as != NULL)
|
168 |
+
$hf .= '<input type="hidden" name="delivered_as" value="' . $delivered_as. '" />';
|
169 |
+
//masked
|
170 |
+
if($masked != NULL)
|
171 |
+
$hf .= '<input type="hidden" name="masked" value="' . $masked. '" />';
|
172 |
+
|
173 |
+
if($attachment != NULL)
|
174 |
+
$hf .= '<input type="hidden" name="attachment" value="' . $attachment. '" />';
|
175 |
+
if($format != NULL)
|
176 |
+
$hf .= '<input type="hidden" name="format" value="' . $format. '" />';
|
177 |
+
|
178 |
+
|
179 |
+
$hf .= '<input type="hidden" name="_wpcf7_download_id" value="' . $download_id. '" /></form>';
|
180 |
|
181 |
$contact_form = str_replace("</form>", $hf, $contact_form);
|
182 |
|
191 |
add_shortcode('email-download', 'emailreqtag_func');
|
192 |
|
193 |
/*Function that processes contact form 7, generates links, sends emails */
|
194 |
+
function ebd_process_email_form( $cf7 ) {
|
|
|
195 |
if(isset( $_POST['_wpcf7_download_id'] )){
|
196 |
global $wpdb,$wp_dlm_root,$wp_dlm_db,$wp_dlm_db_taxonomies, $def_format, $dlm_url, $downloadurl, $downloadtype, $wp_dlm_db_meta;
|
197 |
+
|
198 |
+
//table names
|
199 |
$table_item = $wpdb->prefix . "ebd_item";
|
200 |
$table_link = $wpdb->prefix . "ebd_link";
|
201 |
+
$table_posted_data = $wpdb->prefix . "ebd_posted_data";
|
202 |
+
|
203 |
+
$delivered_as = get_option('email_before_download_send_email');
|
204 |
+
$use_attachments = get_option('email_before_download_attachment');
|
205 |
+
if(isset($_POST['delivered_as'])) $delivered_as = $_POST['delivered_as'];
|
206 |
+
if(isset($_POST['attachment'])) $use_attachments = trim($_POST['attachment']) == 'yes';
|
207 |
+
|
208 |
+
//get selected downloads
|
209 |
+
$dIds = $_POST['ebd_downloads'];
|
210 |
+
|
211 |
+
$dl_items = array();
|
212 |
+
$multipleLinks = '';
|
213 |
+
$message_mult = '';
|
214 |
+
$attachments = array();
|
215 |
+
$time_requested = time();
|
216 |
+
$target = '_blank';
|
217 |
|
218 |
+
//get all download monitor objects
|
219 |
+
if($dIds)
|
220 |
+
foreach($dIds as $id){
|
221 |
+
$dl_it = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($id).";" );
|
222 |
+
|
223 |
+
$dl_items[] = new downloadable_file($dl_it);
|
224 |
+
}
|
225 |
+
|
226 |
+
//get edb items: it's common for all
|
227 |
+
$dId = $_POST['_wpcf7_download_id'];
|
228 |
+
$ebd_item = $wpdb->get_row( "SELECT * FROM $table_item WHERE id = ".$wpdb->escape($dId).";" );
|
229 |
+
|
230 |
+
|
231 |
+
//get single download, multible are comma separated so the $dl for this will be NULL
|
232 |
$dl = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($ebd_item->download_id).";" );
|
233 |
$d = new downloadable_file($dl);
|
234 |
|
|
|
235 |
|
236 |
|
237 |
+
|
238 |
+
//variable for the title it wll be used only for the single downloads and the email subject
|
239 |
$title = '';
|
240 |
//echo 'debug: ' . $ebd_item->id . ' ' . $ebd_item->title;
|
241 |
//print_r($ebd_item);
|
253 |
}
|
254 |
}
|
255 |
|
256 |
+
$url = '';
|
257 |
+
//titles and urls for multiple
|
258 |
+
$titles = array();
|
259 |
+
$urls = array();
|
260 |
+
|
261 |
+
$innerHtml = '';
|
262 |
+
|
263 |
+
//if checkboxes were selected
|
264 |
+
if(count($dl_items) > 0){
|
265 |
+
foreach($dl_items as $dl_item){
|
266 |
+
//generate unique id for the file (link)
|
267 |
+
$uid = md5(uniqid(rand(), true));
|
268 |
+
|
269 |
+
//expiration date if needed if it's 0 or NULL the link will never expire
|
270 |
+
$expireAt = 0;
|
271 |
+
if(get_option('email_before_download_expire_time') != NULL && get_option('email_before_download_expire_time') != "0")
|
272 |
+
$expireAt = strtotime(get_option('email_before_download_expire_time'));
|
273 |
+
|
274 |
+
$link_data = array();
|
275 |
+
$link_data['uid'] = $uid;
|
276 |
+
$link_data['selected_id'] = $dl_item->id;
|
277 |
+
$link_data['expire_time'] = $expireAt;
|
278 |
+
$link_data['time_requested'] = $time_requested;
|
279 |
+
$link_data['email'] = $cf7->posted_data['your-email'];
|
280 |
+
$link_data['item_id'] = $_POST['_wpcf7_download_id'];
|
281 |
+
$link_data['delivered_as'] = $delivered_as;
|
282 |
+
if(isset($_POST['masked'])) $link_data['is_masked'] = $_POST['masked'];
|
283 |
+
$wpdb->insert( $table_link, $link_data );
|
284 |
+
|
285 |
+
//
|
286 |
+
$url = WP_PLUGIN_URL."/email-before-download/download.php?dl=".$uid;
|
287 |
+
$titles[] = $dl_item->title ;
|
288 |
+
$title = implode($titles, '|');
|
289 |
+
if(isset($_POST['format'])){
|
290 |
+
$link = do_shortcode('[download id="' . $dl_item->id. '" format="' .$_POST['format'].'"]');
|
291 |
+
$innerHtml .= $link . '<br />';
|
292 |
+
}
|
293 |
+
else
|
294 |
+
$innerHtml .= '<a class="icon-button download-icon" target="' . $target . '" href="' . $url .'"><span class="et-icon"><span>' . $dl_item->title . '</span></span></a><br clear="both" /> <br />' ;
|
295 |
+
|
296 |
+
// if(get_option('email_before_download_send_email') == 'Send Email' || get_option('email_before_download_send_email') == 'Both'){
|
297 |
+
// }
|
298 |
+
|
299 |
+
if($use_attachments){
|
300 |
+
$dirs = wp_upload_dir();
|
301 |
+
$uploadpath = trailingslashit( $dirs['baseurl'] );
|
302 |
+
$absuploadpath = trailingslashit( $dirs['basedir'] );
|
303 |
+
$attachment = NULL;
|
304 |
+
if ( $uploadpath && ( strstr ( $dl_item->filename, $uploadpath ) || strstr ( $dl_item->filename, $absuploadpath )) ) {
|
305 |
+
|
306 |
+
$file = str_replace( $uploadpath , "" , $dl_item->filename);
|
307 |
+
if(is_file($absuploadpath.$file)){
|
308 |
+
$attachment = $absuploadpath.$file;
|
309 |
+
}
|
310 |
+
}
|
311 |
+
$attachments[] = $attachment;
|
312 |
+
}
|
313 |
+
|
314 |
+
}
|
315 |
+
}
|
316 |
+
// single download for the download monitor file or file lnk
|
317 |
+
else if(!empty($dl) || !empty($ebd_item->file) ){
|
318 |
//generate unique id for the file (link)
|
319 |
$uid = md5(uniqid(rand(), true));
|
320 |
|
322 |
$expireAt = 0;
|
323 |
if(get_option('email_before_download_expire_time') != NULL && get_option('email_before_download_expire_time') != "0")
|
324 |
$expireAt = strtotime(get_option('email_before_download_expire_time'));
|
325 |
+
|
326 |
+
$link_data = array();
|
327 |
+
$link_data['uid'] = $uid;
|
328 |
+
$link_data['expire_time'] = $expireAt;
|
329 |
+
$link_data['time_requested'] = $time_requested;
|
330 |
+
$link_data['email'] = $cf7->posted_data['your-email'];
|
331 |
+
$link_data['item_id'] = $_POST['_wpcf7_download_id'];
|
332 |
+
$link_data['delivered_as'] = $delivered_as;
|
333 |
+
if(isset($_POST['masked'])) $link_data['is_masked'] = $_POST['masked'];
|
334 |
+
$wpdb->insert( $table_link, $link_data );
|
335 |
+
|
336 |
+
if(isset($_POST['format']) && $ebd_item->download_id != NULL){
|
337 |
+
$link = do_shortcode('[download id="' . $ebd_item->download_id. '" format="' .$_POST['format'].'"]');
|
338 |
+
$innerHtml .= $link . '<br />';
|
339 |
+
}
|
340 |
+
else {
|
341 |
+
$url = WP_PLUGIN_URL."/email-before-download/download.php?dl=".$uid;
|
342 |
+
$innerHtml = '<a class="icon-button download-icon" target="' . $target . '" href="' . $url .'"><span class="et-icon"><span>' . $title . '</span></span></a><br clear="both" /> <br />' ;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
//nothing is selected for the download
|
346 |
+
else {
|
347 |
+
//we don't sent an email and throw an error
|
348 |
+
$cf7->skip_mail = true;
|
349 |
+
//this message doesn't seem to appear but we leave it for now
|
350 |
+
$cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='You should select the files to dowload.'; \"";
|
351 |
+
$id = (int) $_POST['_wpcf7'];
|
352 |
+
$unit_tag = $_POST['_wpcf7_unit_tag'];
|
353 |
+
|
354 |
+
$items = array(
|
355 |
+
'mailSent' => false,
|
356 |
+
'into' => '#' . $unit_tag,
|
357 |
+
'captcha' => null );
|
358 |
+
//error message
|
359 |
+
$items['message'] = "Please select at least one of the documents";
|
360 |
+
$on_sent_ok = $cf7->additional_setting( 'on_sent_ok', false );
|
361 |
+
$items['onSentOk'] = $on_sent_ok;
|
362 |
+
$echo = json_encode( $items );
|
363 |
+
|
364 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
365 |
+
echo $echo;
|
366 |
+
die();
|
367 |
+
}
|
368 |
+
$cf7->posted_data['your-message'] = 'The downloaded file name(s): ' . $title;
|
369 |
+
if(strpos($cf7->mail['body'], "[your-message]") === false ){
|
370 |
$cf7->posted_data['your-message'] = $title;
|
371 |
$cf7->mail['body'] = $cf7->mail['body'] ."\nThe downloaded file name: [your-message]";
|
372 |
|
373 |
}
|
374 |
|
375 |
+
|
376 |
|
|
|
377 |
$target = get_option('email_before_download_link_target');
|
378 |
$html_before = get_option('email_before_download_html_before_link');
|
379 |
$html_after = get_option('email_before_download_html_after_link');
|
380 |
+
|
381 |
+
|
382 |
+
//if multiple files are downloaded ???
|
383 |
$message = '';
|
384 |
+
if(count($dl_items) > 0){
|
385 |
+
$email_template = get_option('email_before_download_email_template_mult');
|
386 |
+
if(strlen(trim($email_template)) > 0){
|
387 |
+
$message = str_replace(array('[requesting_name]', '[file_urls]'), array($cf7->posted_data['your-name'], $innerHtml), trim($email_template));
|
388 |
+
}
|
389 |
+
else $message = $innerHtml;
|
390 |
}
|
391 |
+
else {
|
392 |
+
$email_template = get_option('email_before_download_email_template');
|
393 |
+
if(strlen(trim($email_template)) > 0){
|
394 |
+
if(isset($_POST['format']) && $ebd_item->download_id != NULL)
|
395 |
+
$message = 'You requested: ' .$innerHtml;
|
396 |
+
else
|
397 |
+
$message = str_replace(array('[requesting_name]', '[file_url]', '[file_name]'), array($cf7->posted_data['your-name'], $url, $title), trim($email_template));
|
398 |
+
}
|
399 |
+
else {
|
400 |
+
if(isset($_POST['format']) && $ebd_item->download_id != NULL)
|
401 |
+
$message = 'You requested: ' .$innerHtml;
|
402 |
+
else
|
403 |
+
$message = '<a class="icon-button download-icon" target="' . $target . '" href="' . $url .'">' . $title . '</a>';
|
404 |
+
}
|
405 |
+
}
|
406 |
+
|
407 |
//$title = "Click this link to download this file.";
|
408 |
+
$innerHtml = $html_before . $innerHtml . $html_after;
|
409 |
+
|
410 |
|
411 |
+
if($delivered_as == 'Send Email') {
|
412 |
+
// $attachments = NULL;
|
413 |
+
if($use_attachments && count($dl_items) == 0) {
|
414 |
$dirs = wp_upload_dir();
|
415 |
$uploadpath = trailingslashit( $dirs['baseurl'] );
|
416 |
$absuploadpath = trailingslashit( $dirs['basedir'] );
|
424 |
}
|
425 |
$attachments = array($attachment);
|
426 |
}
|
427 |
+
if(count($attachments) == 0) $attachments = NULL;
|
428 |
+
$email_subject = get_option('email_before_download_subject');
|
429 |
+
if(strlen(trim($email_subject)) > 0){
|
430 |
+
$email_subject = str_replace('[files]', $title, $email_subject);
|
431 |
+
}
|
432 |
+
else $email_subject = 'Requested URL for the file(s): '. $title;
|
433 |
+
//email_before_download_subject
|
434 |
+
@wp_mail( $cf7->posted_data['your-email'], $email_subject , $message, "Content-Type: text/html\n", $attachments);
|
435 |
+
$cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='The link to the file(s) has been emailed to you.'; \"";
|
436 |
}
|
437 |
+
else if ($delivered_as == 'Both'){
|
438 |
+
//$attachments = NULL;
|
439 |
+
if($use_attachments && count($dl_items) == 0) {
|
440 |
$dirs = wp_upload_dir();
|
441 |
$uploadpath = trailingslashit( $dirs['baseurl'] );
|
442 |
$absuploadpath = trailingslashit( $dirs['basedir'] );
|
450 |
}
|
451 |
$attachments = array($attachment);
|
452 |
}
|
453 |
+
if(count($attachments) == 0) $attachments = NULL;
|
454 |
+
$email_subject = get_option('email_before_download_subject');
|
455 |
+
if(strlen(trim($email_subject)) > 0){
|
456 |
+
$email_subject = str_replace('[files]', $title, $email_subject);
|
457 |
+
}
|
458 |
+
else $email_subject = 'Requested URL for the file(s): '. $title;
|
459 |
+
@wp_mail( $cf7->posted_data['your-email'], $email_subject , $message, "Content-Type: text/html\n", $attachments);
|
460 |
$cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='$innerHtml'; \"";
|
461 |
}
|
462 |
+
else{
|
463 |
+
$cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='$innerHtml'; \"";
|
464 |
+
}
|
465 |
+
// save the extra form information into the xml
|
466 |
+
$xml = new SimpleXMLElement('<posted_data></posted_data>');
|
467 |
+
foreach ($cf7->posted_data as $key => $value){
|
468 |
+
$xml->addChild($key, $value);
|
469 |
+
}
|
470 |
+
$posted_data = array();
|
471 |
+
$posted_data['time_requested'] = $time_requested;
|
472 |
+
$posted_data['posted_data'] = $xml->asXML();
|
473 |
+
$wpdb->insert( $table_posted_data, $posted_data );
|
474 |
}
|
475 |
+
|
476 |
return $cf7;
|
477 |
}
|
478 |
+
add_action( 'wpcf7_before_send_mail', 'ebd_process_email_form' );
|
479 |
|
480 |
add_action('admin_menu', 'ebd_plugin_menu');
|
481 |
|
506 |
register_setting( 'email-before-download-group', 'email_before_download_html_after_link' );
|
507 |
register_setting( 'email-before-download-group', 'email_before_download_send_email' );
|
508 |
register_setting( 'email-before-download-group', 'email_before_download_email_template' );
|
509 |
+
register_setting( 'email-before-download-group', 'email_before_download_email_template_mult' );
|
510 |
register_setting( 'email-before-download-group', 'email_before_download_expire_time' );
|
511 |
register_setting( 'email-before-download-group', 'email_before_download_hide' );
|
512 |
register_setting( 'email-before-download-group', 'email_before_download_attachment' );
|
513 |
+
register_setting( 'email-before-download-group', 'email_before_download_subject' );
|
514 |
|
515 |
}
|
516 |
|
627 |
|
628 |
<tr valign="top" class="alert"><td colspan="2"><p class="alert">#8 through #9 only apply if you selected "Send Email" or "Both" as the Delivery Format in #1</p></td></tr>
|
629 |
<tr valign="top">
|
630 |
+
<th scope="row"><p>8. Email Template</p> 8.1 - single url</th>
|
631 |
+
<td><textarea cols="40" rows="10" name="email_before_download_email_template"><?php echo get_option('email_before_download_email_template'); ?> </textarea><br />
|
632 |
<i>You can use the following placeholders: [requesting_name], [file_url] and [file_name]. </i><br />
|
633 |
<i>So if you, for example, don't provide the [file_url] placeholder, the
|
634 |
<br />user will not receive any link. Here is an example of the template:<br /><br />
|
642 |
<br /><br /> Note. If you leave this field empty, an email containing only the file URL will be sent.
|
643 |
|
644 |
</i>
|
645 |
+
<br />
|
646 |
+
</td>
|
647 |
+
</tr>
|
648 |
+
<tr valign="top">
|
649 |
+
<th scope="row"> 8.2 - multiple urls</th>
|
650 |
+
<td>
|
651 |
+
<textarea cols="40" rows="10" name="email_before_download_email_template_mult"><?php echo get_option('email_before_download_email_template_mult'); ?> </textarea><br />
|
652 |
+
<i>You can use the following placeholders for multiple urls: [file_urls] </i><br />
|
653 |
</td>
|
654 |
</tr>
|
655 |
|
661 |
</p>
|
662 |
</td>
|
663 |
</tr>
|
664 |
+
|
665 |
+
<tr valign="top">
|
666 |
+
<th scope="row"><p>10. Email Subject</p></th>
|
667 |
+
<td><p><input type="test" size="40" name="email_before_download_subject" value="<?php echo get_option('email_before_download_subject'); ?>" />
|
668 |
+
<br />
|
669 |
+
<font size="-1"><i> If this field is left blank, the default subject is: "Requested URL for the file(s): < file titles >".</i><br />
|
670 |
+
<i>Note: When populating, you can use the following placeholder if you want the file titles to appear in the email subject: [files]. </i><br /></font>
|
671 |
+
</p>
|
672 |
+
</td>
|
673 |
+
</tr>
|
674 |
+
|
675 |
</table>
|
676 |
|
677 |
<p class="submit">
|
export.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//wordpress
|
3 |
+
define('WP_USE_THEMES', false);
|
4 |
+
$wp_root = dirname(__FILE__) .'/../../../';
|
5 |
+
if(file_exists($wp_root . 'wp-load.php')) {
|
6 |
+
require_once($wp_root . "wp-load.php");
|
7 |
+
} else if(file_exists($wp_root . 'wp-config.php')) {
|
8 |
+
require_once($wp_root . "wp-config.php");
|
9 |
+
} else {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
if ( !current_user_can('manage_options') ) {
|
14 |
+
exit(0);
|
15 |
+
}
|
16 |
+
|
17 |
+
global $wpdb,$wp_dlm_root, $wp_dlm_db;
|
18 |
+
$table_item = $wpdb->prefix . "ebd_item";
|
19 |
+
$table_link = $wpdb->prefix . "ebd_link";
|
20 |
+
$table_posted_data = $wpdb->prefix . "ebd_posted_data";
|
21 |
+
|
22 |
+
|
23 |
+
$sql = "SELECT l.item_id as item_id,
|
24 |
+
l.is_downloaded as is_downloaded,
|
25 |
+
l.email as email,
|
26 |
+
l.delivered_as as delivered_as,
|
27 |
+
i.file as filename,
|
28 |
+
i.download_id as download_id,
|
29 |
+
d.title as title,
|
30 |
+
p.posted_data as posted_data,
|
31 |
+
i.title as item_title,
|
32 |
+
l.time_requested as time_requested
|
33 |
+
from
|
34 |
+
$table_item i
|
35 |
+
left outer join
|
36 |
+
$table_link l
|
37 |
+
left outer join
|
38 |
+
$wp_dlm_db d
|
39 |
+
on l.selected_id = d.id
|
40 |
+
left outer join
|
41 |
+
$table_posted_data p
|
42 |
+
on l.time_requested = p.time_requested
|
43 |
+
on l.item_id = i.id
|
44 |
+
order by l.time_requested desc";
|
45 |
+
$downloads = $wpdb->get_results($sql);
|
46 |
+
|
47 |
+
$csv = "item_id,email,download_id,filename,item_title,time_requested,posted_data,delivered_as\n";
|
48 |
+
|
49 |
+
$clean_csv_search = array("\n","\r","\t", ",");
|
50 |
+
$clean_csv_replace = array(" "," "," ", ";");
|
51 |
+
|
52 |
+
if($downloads){
|
53 |
+
foreach($downloads as $d){
|
54 |
+
$csv .= $d->item_id . "," .
|
55 |
+
$d->email . "," .
|
56 |
+
str_replace(',', ';', $d->download_id ). "," .
|
57 |
+
$d->filename . "," .
|
58 |
+
$d->item_title . "," .
|
59 |
+
date("Y-m-d G:i", $d->time_requested). "," .
|
60 |
+
str_replace($clean_csv_search, $clean_csv_replace, $d->posted_data). "," .
|
61 |
+
$d->delivered_as . "\n" ;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
$size = strlen($csv);
|
66 |
+
header("Content-type: text/csv");
|
67 |
+
header("Content-Disposition: attachment; filename=download_log_" . date("Y-m-d") . ".csv; size=$size");
|
68 |
+
|
69 |
+
print $csv;
|
70 |
+
?>
|
trunk/readme.txt → readme.txt
RENAMED
@@ -12,7 +12,7 @@ Plugin homepage: http://www.mandsconsulting.com/products/wp-email-before-downloa
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
Email Before Download presents your users with a form where they submit information, like their name and email address, prior to receiving a download. This plugin integrates with the popular Contact Form 7 and Download Monitor plugins, allowing you to create any form you like and manage/monitor your file downloads. Prior to installing Email Before Download, please confirm each of these dependent plugins is already installed and working independently.
|
16 |
|
17 |
As an option, you can configure Email Before Download to:
|
18 |
|
@@ -38,7 +38,7 @@ Plugin homepage: [http://www.mandsconsulting.com/products/wp-email-before-downlo
|
|
38 |
|
39 |
== Installation ==
|
40 |
|
41 |
-
1. Download from http://wordpress.org/extend/plugins
|
42 |
1. Upload the entire email-before-download folder to the /wp-content/plugins/ directory.
|
43 |
1. Activate the plugin through the "Plugins" menu in WordPress.
|
44 |
1. Locate the "Email Before Download" menu item in your WordPress Admin panel under "Settings" to configure.
|
@@ -77,15 +77,24 @@ WordPress allows direct access to files in your upload directories using a direc
|
|
77 |
5. User will be required to enter valid data in accordance with Contact Form 7 validation rules.
|
78 |
6. Upon submission, user will either see a direct link below the form. (Note: there is also an option to only email the link to the user.)
|
79 |
|
|
|
80 |
== Changelog ==
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
= 1.0 =
|
83 |
* Added ability to export log in CSV format from admin settings page.
|
84 |
* Added ability to mask download file's URL if cURL is enabled.
|
85 |
* Added ability to expire the download link after a given timeframe.
|
86 |
* In addition to emailing a link to the file, added ability to email the file as an attachment.
|
87 |
-
* Added ability to
|
88 |
-
* Added ability to download files outside of Download Monitor.
|
89 |
|
90 |
= 0.5 =
|
91 |
* First release.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Email Before Download presents your users with a form where they submit information, like their name and email address, prior to receiving a download. This plugin integrates with the popular [Contact Form 7](http://bit.ly/dNzVJd) and [Download Monitor](http://bit.ly/ifff4y) plugins, allowing you to create any form you like and manage/monitor your file downloads. You can also EXPORT a list of users that have downloaded files from the plug-in's settings page. Prior to installing Email Before Download, please confirm each of these dependent plugins is already installed and working independently.
|
16 |
|
17 |
As an option, you can configure Email Before Download to:
|
18 |
|
38 |
|
39 |
== Installation ==
|
40 |
|
41 |
+
1. Download from [http://wordpress.org/extend/plugins/email-before-download/] (http://bit.ly/dF9AxV)
|
42 |
1. Upload the entire email-before-download folder to the /wp-content/plugins/ directory.
|
43 |
1. Activate the plugin through the "Plugins" menu in WordPress.
|
44 |
1. Locate the "Email Before Download" menu item in your WordPress Admin panel under "Settings" to configure.
|
77 |
5. User will be required to enter valid data in accordance with Contact Form 7 validation rules.
|
78 |
6. Upon submission, user will either see a direct link below the form. (Note: there is also an option to only email the link to the user.)
|
79 |
|
80 |
+
|
81 |
== Changelog ==
|
82 |
|
83 |
+
|
84 |
+
= 2.0 =
|
85 |
+
* Support multiple file selection (within shortcut code, use comma-separated list of download IDs: download_id="1,2,3")
|
86 |
+
* Add more information in the download history EXPORT .csv file
|
87 |
+
* Added support for Download Monitor format code for the inline link that is displayed (within shortcut code, specify the format code: format="1")
|
88 |
+
* Allow overriding the default settings with the shortcode (i.e. within shortcode, use delivered_as="Inline Link" even though the general setting in admin panel is setup for "Both" -- options are "Inline Link", "Send Email", "Both")
|
89 |
+
* Updates to avoid potential conflicts with other plugins
|
90 |
+
* Added ability to customize subject line when emailing file download
|
91 |
+
|
92 |
= 1.0 =
|
93 |
* Added ability to export log in CSV format from admin settings page.
|
94 |
* Added ability to mask download file's URL if cURL is enabled.
|
95 |
* Added ability to expire the download link after a given timeframe.
|
96 |
* In addition to emailing a link to the file, added ability to email the file as an attachment.
|
97 |
+
* Added ability to download files outside of Download Monitor (within shortcode, use file="http://mydomain.com/file.pdf" -- no need to include download_id="X" in this case).
|
|
|
98 |
|
99 |
= 0.5 =
|
100 |
* First release.
|
tags/0.5/trunk/screenshot-1.png → screenshot-1.png
RENAMED
File without changes
|
tags/0.5/trunk/screenshot-2.png → screenshot-2.png
RENAMED
File without changes
|
tags/0.5/trunk/screenshot-3.png → screenshot-3.png
RENAMED
File without changes
|
tags/0.5/trunk/screenshot-4.png → screenshot-4.png
RENAMED
File without changes
|
tags/0.5/trunk/screenshot-5.png → screenshot-5.png
RENAMED
File without changes
|
tags/0.5/trunk/screenshot-6.png → screenshot-6.png
RENAMED
File without changes
|
tags/0.5/trunk/email-before-download.php
DELETED
@@ -1,254 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Email Before Download
|
4 |
-
Plugin URI: http://www.mandsconsulting.com/
|
5 |
-
Description: This plugin seamlessly integrates two popular plugins (Contact Form 7 and Download Monitor) to create a simple shortcode for requesting an end-user to fill out a form before providing the download URL. You can use an existing Contact Form 7 form, where you might typically request contact information like an email address, but the questions in the form are completely up to you. Once the end user completes the form, you can choose to either show a link directly to the download or send an email with the direct link to the email provided in the contact form.
|
6 |
-
Author: M&S Consulting
|
7 |
-
Version: 0.5
|
8 |
-
Author URI: http://www.mandsconsulting.com
|
9 |
-
|
10 |
-
============================================================================================================
|
11 |
-
This software is provided "as is" and any express or implied warranties, including, but not limited to, the
|
12 |
-
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
|
13 |
-
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
|
14 |
-
consequential damages(including, but not limited to, procurement of substitute goods or services; loss of
|
15 |
-
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
|
16 |
-
contract, strict liability, or tort(including negligence or otherwise) arising in any way out of the use of
|
17 |
-
this software, even if advised of the possibility of such damage.
|
18 |
-
|
19 |
-
For full license details see license.txt
|
20 |
-
============================================================================================================
|
21 |
-
*/
|
22 |
-
|
23 |
-
function emailreqtag_func($atts) {
|
24 |
-
extract(shortcode_atts(array(
|
25 |
-
'download_id' => 'something',
|
26 |
-
'contact_form_id' => 'something else',
|
27 |
-
), $atts));
|
28 |
-
|
29 |
-
$dl = get_downloads('include='.$dowload_id.'&limit=5');
|
30 |
-
|
31 |
-
global $wpdb,$wp_dlm_root,$wp_dlm_db,$wp_dlm_db_taxonomies, $def_format, $dlm_url, $downloadurl, $downloadtype, $wp_dlm_db_meta;
|
32 |
-
$dl = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($download_id).";" );
|
33 |
-
$d = new downloadable_file($dl);
|
34 |
-
$str = '';
|
35 |
-
|
36 |
-
$title = '';
|
37 |
-
|
38 |
-
$url = '';
|
39 |
-
|
40 |
-
if (!empty($d)) {
|
41 |
-
$date = date("jS M Y", strtotime($d->date));
|
42 |
-
$title = $d->title;
|
43 |
-
$url = $d->url;
|
44 |
-
}
|
45 |
-
|
46 |
-
$contact_form = do_shortcode("[contact-form $contact_form_id \"$title\"]");
|
47 |
-
|
48 |
-
$hf = '<input type="hidden" name="_wpcf7_download_id" value="' . $download_id. '" /></form>';
|
49 |
-
|
50 |
-
$contact_form = str_replace("</form>", $hf, $contact_form);
|
51 |
-
|
52 |
-
$wrap_in_div = get_option('email_before_download_wrap_in_div');
|
53 |
-
$div_class = '';
|
54 |
-
if(strlen(trim($wrap_in_div)) > 0 ){
|
55 |
-
$div_class = 'class="' . trim($wrap_in_div) . '"';
|
56 |
-
}
|
57 |
-
return "<br/>" . $contact_form . '<div id="wpm_download_' . $download_id . '" ' . $div_class . ' style="display:none;"> </div> ';
|
58 |
-
}
|
59 |
-
add_shortcode('emailreq', 'emailreqtag_func');
|
60 |
-
add_shortcode('email-download', 'emailreqtag_func');
|
61 |
-
|
62 |
-
function process_email_form( $cf7 ) {
|
63 |
-
|
64 |
-
if(isset( $_POST['_wpcf7_download_id'] )){
|
65 |
-
global $wpdb,$wp_dlm_root,$wp_dlm_db,$wp_dlm_db_taxonomies, $def_format, $dlm_url, $downloadurl, $downloadtype, $wp_dlm_db_meta;
|
66 |
-
$dl = $wpdb->get_row( "SELECT * FROM $wp_dlm_db WHERE id = ".$wpdb->escape($_POST['_wpcf7_download_id']).";" );
|
67 |
-
$d = new downloadable_file($dl);
|
68 |
-
$dId = $_POST['_wpcf7_download_id'];
|
69 |
-
$cf7->posted_data['your-message'] = 'The downloaded file name: ' . $d->title;
|
70 |
-
if(strpos($cf7->mail['body'], "[your-message]") === false ){
|
71 |
-
$cf7->posted_data['your-message'] = $d->title;
|
72 |
-
$cf7->mail['body'] = $cf7->mail['body'] ."\nThe downloaded file name: [your-message]";
|
73 |
-
|
74 |
-
}
|
75 |
-
|
76 |
-
$title = '';
|
77 |
-
|
78 |
-
$url = '';
|
79 |
-
|
80 |
-
if (!empty($d)) {
|
81 |
-
$title = $d->title;
|
82 |
-
$url = $d->url;
|
83 |
-
}
|
84 |
-
$target = '_blank';
|
85 |
-
$target = get_option('email_before_download_link_target');
|
86 |
-
$html_before = get_option('email_before_download_html_before_link');
|
87 |
-
$html_after = get_option('email_before_download_html_after_link');
|
88 |
-
$email_template = get_option('email_before_download_email_template');
|
89 |
-
$message = '';
|
90 |
-
if(strlen(trim($email_template)) > 0){
|
91 |
-
$message = str_replace(array('[requesting_name]', '[file_url]', '[file_name]'), array($cf7->posted_data['your-name'], $url, $title), trim($email_template));
|
92 |
-
}
|
93 |
-
else $message = '<a class="icon-button download-icon" target="' . $target . '" href="' . $url .'">' . $title . '</a>';
|
94 |
-
|
95 |
-
$innerHtml = $html_before . '<a class="icon-button download-icon" target="' . $target . '" href="' . $url .'"><span class="et-icon"><span>' . $title . '</span></span></a><br clear="both" />' . $html_after;
|
96 |
-
|
97 |
-
if(get_option('email_before_download_send_email') == 'Send Email') {
|
98 |
-
@wp_mail( $cf7->posted_data['your-email'], 'Requested URL for the file: '. $title , $message, "Content-Type: text/html\n");
|
99 |
-
$cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='The link to the file has been emailed to you.'; \"";
|
100 |
-
}
|
101 |
-
else if (get_option('email_before_download_send_email') == 'Both'){
|
102 |
-
@wp_mail( $cf7->posted_data['your-email'], 'Requested URL for the file: '. $title , $message, "Content-Type: text/html\n");
|
103 |
-
$cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='$innerHtml'; \"";
|
104 |
-
}
|
105 |
-
else $cf7->additional_settings = "on_sent_ok: \"document.getElementById('wpm_download_$dId').style.display = 'inline'; document.getElementById('wpm_download_$dId').innerHTML='$innerHtml'; \"";
|
106 |
-
}
|
107 |
-
return $cf7;
|
108 |
-
}
|
109 |
-
add_action( 'wpcf7_before_send_mail', 'process_email_form' );
|
110 |
-
|
111 |
-
add_action('admin_menu', 'ebd_plugin_menu');
|
112 |
-
|
113 |
-
function ebd_plugin_menu() {
|
114 |
-
|
115 |
-
add_options_page('Email Before Download Options', 'Email Before Download', 'manage_options', 'email-before-download', 'email_before_download_options');
|
116 |
-
add_action( 'admin_init', 'register_email_before_download_settings' );
|
117 |
-
|
118 |
-
}
|
119 |
-
|
120 |
-
add_filter( 'plugin_action_links', 'ebd_plugin_action_links', 10, 2 );
|
121 |
-
|
122 |
-
function ebd_plugin_action_links( $links, $file ) {
|
123 |
-
if ( $file != plugin_basename( __FILE__ ))
|
124 |
-
return $links;
|
125 |
-
|
126 |
-
$settings_link = '<a href="options-general.php?page=email-before-download">' . __( 'Settings', 'email-before-download' ) . '</a>';
|
127 |
-
|
128 |
-
array_unshift( $links, $settings_link );
|
129 |
-
|
130 |
-
return $links;
|
131 |
-
}
|
132 |
-
|
133 |
-
function register_email_before_download_settings() {
|
134 |
-
register_setting( 'email-before-download-group', 'email_before_download_link_target' );
|
135 |
-
register_setting( 'email-before-download-group', 'email_before_download_wrap_in_div' );
|
136 |
-
register_setting( 'email-before-download-group', 'email_before_download_html_before_link' );
|
137 |
-
register_setting( 'email-before-download-group', 'email_before_download_html_after_link' );
|
138 |
-
register_setting( 'email-before-download-group', 'email_before_download_send_email' );
|
139 |
-
register_setting( 'email-before-download-group', 'email_before_download_email_template' );
|
140 |
-
|
141 |
-
}
|
142 |
-
|
143 |
-
function email_before_download_options() {
|
144 |
-
|
145 |
-
if (!current_user_can('manage_options')) {
|
146 |
-
wp_die( __('You do not have sufficient permissions to access this page.') );
|
147 |
-
}
|
148 |
-
|
149 |
-
?>
|
150 |
-
<style type="text/css">
|
151 |
-
.ebd th, .ebd td
|
152 |
-
{
|
153 |
-
vertical-align:top;
|
154 |
-
}
|
155 |
-
.ebd th
|
156 |
-
{
|
157 |
-
text-align: left;
|
158 |
-
padding-right:8px;
|
159 |
-
}
|
160 |
-
.ebd .alert
|
161 |
-
{
|
162 |
-
padding:8px;
|
163 |
-
font:bold 12pt Arial;
|
164 |
-
border:1px dashed red;
|
165 |
-
}
|
166 |
-
</style>
|
167 |
-
|
168 |
-
<div class="wrap">
|
169 |
-
<h2>Email Before Download Options</h2>
|
170 |
-
|
171 |
-
<form method="post" action="options.php">
|
172 |
-
<?php settings_fields( 'email-before-download-group' ); ?>
|
173 |
-
<table class="optiontable ebd">
|
174 |
-
<tr valign="top">
|
175 |
-
<th scope="row"><p>1. Delivery Format</p></th>
|
176 |
-
<td><p>
|
177 |
-
<select name="email_before_download_send_email">
|
178 |
-
<option value="Inline Link" <?php if(get_option('email_before_download_send_email') == 'Inline Link') echo 'selected="selected"'; ?> >Inline Link</option>
|
179 |
-
<option value="Send Email" <?php if(get_option('email_before_download_send_email') == 'Send Email') echo 'selected="selected"'; ?> >Send Email</option>
|
180 |
-
<option value="Both" <?php if(get_option('email_before_download_send_email') == 'Both') echo 'selected="selected"'; ?> >Both</option>
|
181 |
-
</select>
|
182 |
-
</p>
|
183 |
-
</td>
|
184 |
-
</tr>
|
185 |
-
|
186 |
-
<tr valign="top"><td colspan="2"><p class="alert">#2 through #5 only apply if you selected "Inline Link" or "Both" as the Deliver Format in #1</p></td></tr>
|
187 |
-
<tr valign="top">
|
188 |
-
<th scope="row"><p>2. Inline Link Target</p></th>
|
189 |
-
<td><p>
|
190 |
-
<select name="email_before_download_link_target">
|
191 |
-
<option value="_blank" <?php if(get_option('email_before_download_link_target') == '_blank') echo 'selected="selected"'; ?> >_blank</option>
|
192 |
-
<option value="_self" <?php if(get_option('email_before_download_link_target') == '_self') echo 'selected="selected"'; ?> >_self</option>
|
193 |
-
</select> <br />
|
194 |
-
<font size="-1"><i>If "_self" is selected link will open in the same browser window/tab, if "_blank" is selected the link will open in the new browser window/tab</i></font>
|
195 |
-
</p>
|
196 |
-
</td>
|
197 |
-
</tr>
|
198 |
-
|
199 |
-
<tr valign="top">
|
200 |
-
<th scope="row"><p>3. Inline Link Custom CSS</p></th>
|
201 |
-
<td><p><input type="text" size="40" name="email_before_download_wrap_in_div" value="<?php echo get_option('email_before_download_wrap_in_div'); ?>" />
|
202 |
-
<br /> <font size="-1"><i>CSS class used to render the div and the link (this is only used if you choose to display the link inline in #5)</i></font>
|
203 |
-
</td>
|
204 |
-
</tr>
|
205 |
-
|
206 |
-
<tr valign="top">
|
207 |
-
<th scope="row"><p>4. HTML Before Inline Link</p></th>
|
208 |
-
<td><p><input type="text" name="email_before_download_html_before_link" size="40" value="<?php echo get_option('email_before_download_html_before_link'); ?>" /><br />
|
209 |
-
<font size="-1"><i>HTML you want to be added before the link</i></font>
|
210 |
-
</p>
|
211 |
-
</td>
|
212 |
-
</tr>
|
213 |
-
|
214 |
-
<tr valign="top">
|
215 |
-
<th scope="row"><p>5. HTML After Inline Link</p></th>
|
216 |
-
<td> <p><input type="text" size="40" name="email_before_download_html_after_link" value="<?php echo get_option('email_before_download_html_after_link'); ?>" />
|
217 |
-
<br /><font size="-1"><i>HTML you want to be added after the link</i></font>
|
218 |
-
</p>
|
219 |
-
</td>
|
220 |
-
</tr>
|
221 |
-
|
222 |
-
<tr valign="top" class="alert"><td colspan="2"><p class="alert">#6 only applies if you selected "Send Email" or "Both" as the Deliver Format in #1</p></td></tr>
|
223 |
-
<tr valign="top">
|
224 |
-
<th scope="row"><p>6. Email Template</p></th>
|
225 |
-
<td><textarea cols="40" rows="10" name="email_before_download_email_template"> <?php echo get_option('email_before_download_email_template'); ?> </textarea><br />
|
226 |
-
<font size="-1"><i>You can use the following placeholders: [requesting_name], [file_url] and [file_name]. </i></font> <br />
|
227 |
-
<font size="-1"><i>The placeholders: [requesting_name], [file_url] and [file_name] are used to generate the link.
|
228 |
-
<br /> So if you, for example, don't provide the [file_url] placeholder
|
229 |
-
<br />user will not receive any link. Here is an example of the template: <br />
|
230 |
-
<b> Hello [requesting_name], <br />
|
231 |
-
|
232 |
-
Here is the download for <a href="[file_url]">[file_name]</a> that you requested.<br />
|
233 |
-
|
234 |
-
Sincerely,<br />
|
235 |
-
|
236 |
-
My Company name </b>
|
237 |
-
<br /> Note. If you leave this field empty, an email containing only the file URL will be sent.
|
238 |
-
|
239 |
-
</i>
|
240 |
-
</td>
|
241 |
-
</tr>
|
242 |
-
|
243 |
-
</table>
|
244 |
-
|
245 |
-
<p class="submit">
|
246 |
-
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
247 |
-
</p>
|
248 |
-
|
249 |
-
</form>
|
250 |
-
</div>
|
251 |
-
<?php
|
252 |
-
|
253 |
-
}
|
254 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tags/0.5/trunk/readme.txt
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
=== Plugin Name ===
|
2 |
-
Contributors: mandsconsulting
|
3 |
-
Donate link: http://www.mandsconsulting.com/
|
4 |
-
Tags: email, download
|
5 |
-
Requires at least: 3.x
|
6 |
-
Tested up to: 3.0.4
|
7 |
-
Stable tag: trunk
|
8 |
-
|
9 |
-
Email Before Download presents your users with a form where they submit information, like their name and email address, prior to receiving a download.
|
10 |
-
|
11 |
-
Plugin homepage: http://www.mandsconsulting.com/products/wp-email-before-download
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
Email Before Download presents your users with a form where they submit information, like their name and email address, prior to receiving a download. This plugin integrates with the popular Contact Form 7 and Download Monitor plugins, allowing you to create any form you like and manage/monitor your file downloads. Prior to installing Email Before Download, please confirm each of these dependent plugins is already installed and working independently.
|
16 |
-
|
17 |
-
As an option, you can configure Email Before Download to:
|
18 |
-
|
19 |
-
1. Display a link to your file directly under the contact form once it is submitted. This happens dynamically, inline of your post/page.
|
20 |
-
1. Send the user an email with a link to download your file.
|
21 |
-
1. Both #1 and #2
|
22 |
-
|
23 |
-
|
24 |
-
Usage
|
25 |
-
|
26 |
-
Note: You can see screenshots at [http://wordpress.org/extend/plugins/email-before-download/screenshots/](http://bit.ly/g4r1w2)
|
27 |
-
|
28 |
-
1. Create a contact form used by Email Before Download using Contact Form 7 and note the Contact Form ID
|
29 |
-
1. Upload a file using Download Monitor and note the Download ID
|
30 |
-
1. Navigate to the Post (or Page) you wish to include
|
31 |
-
1. Add the following short code using the IDs collected in the first two steps
|
32 |
-
[email-download download_id="X" contact_form_id="Y"]
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
Plugin homepage: [http://www.mandsconsulting.com/products/wp-email-before-download](http://www.mandsconsulting.com/products/wp-email-before-download)
|
37 |
-
|
38 |
-
|
39 |
-
== Installation ==
|
40 |
-
|
41 |
-
1. Download from http://wordpress.org/extend/plugins
|
42 |
-
1. Upload the entire email-before-download folder to the /wp-content/plugins/ directory.
|
43 |
-
1. Activate the plugin through the "Plugins" menu in WordPress.
|
44 |
-
1. Locate the "Email Before Download" menu item in your WordPress Admin panel under "Settings" to configure.
|
45 |
-
|
46 |
-
|
47 |
-
== Frequently Asked Questions ==
|
48 |
-
|
49 |
-
|
50 |
-
= What if I don't use the Contact Form 7 and/or Download Monintor Plugins? =
|
51 |
-
|
52 |
-
You will not be able to use this version of Email Before Download without these dependent plugins. If you have specific reasons to avoid using the dependent plugins, please contact us and let us know the reason so we can take it into consideration.
|
53 |
-
|
54 |
-
= Anything special I need to do with my contact form? =
|
55 |
-
|
56 |
-
If you decide to configure the Email Before Download option to send the user an email with a link to the download, then you will want to name the email field "your-email" as shown in the example screenshots. Outside of that, nothing special.
|
57 |
-
|
58 |
-
= What happens after the user completes the form? =
|
59 |
-
|
60 |
-
By default, the user is presented with a link to download their file. There is also an option to email a link to the file, which can be done instead of (or in addition to) displaying the link inline.
|
61 |
-
|
62 |
-
= Are you changing any of my file or directory permissions? =
|
63 |
-
|
64 |
-
WordPress allows direct access to any files in your upload directories using a direct URL and we do not change those permissions.
|
65 |
-
|
66 |
-
= So someone can still download my files directly without providing their email? =
|
67 |
-
|
68 |
-
Users generally do not have a desire to put in the work required to determine your direct upload filenames. This plugin provides a quick way to know who is downloading information that you might feel to be more premium content like whitepapers, images, etc. from sincere users who are visiting your site, with the understanding the user can share the file itself or the URL if they wish.
|
69 |
-
|
70 |
-
= What if I don't want the user to be able to share the file? =
|
71 |
-
|
72 |
-
We can't help you prevent a user from sharing a file they have downloaded with other people. We are however working on allowing you to set some options that will make sharing links a little more difficult. Also, there is a chance you fit more into the category of needing to charge for the content which is something this plugin does not currently address.
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
== Screenshots ==
|
77 |
-
|
78 |
-
1. Note the ID of a file you have uploaded to Download Monitor.
|
79 |
-
2. Note the ID of a contact form you have created using Contact Form 7.
|
80 |
-
3. Use the following shortcode in your page or post: [email-download download_id="X" contact_form_id="Y"].
|
81 |
-
4. Upon installation and use of the plugin on a post/page, an end-user will see your contact form.
|
82 |
-
5. User will be required to enter valid data in accordance with Contact Form 7 validation rules.
|
83 |
-
6. Upon submission, user will either see a direct link below the form. (Note: there is also an option to only email the link to the user.)
|
84 |
-
|
85 |
-
== Changelog ==
|
86 |
-
|
87 |
-
= 0.5 =
|
88 |
-
* First release.
|
89 |
-
|
90 |
-
== Upgrade Notice ==
|
91 |
-
|
92 |
-
= 0.5 =
|
93 |
-
First release.
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/screenshot-1.png
DELETED
Binary file
|
trunk/screenshot-2.png
DELETED
Binary file
|
trunk/screenshot-3.png
DELETED
Binary file
|
trunk/screenshot-4.png
DELETED
Binary file
|
trunk/screenshot-5.png
DELETED
Binary file
|
trunk/screenshot-6.png
DELETED
Binary file
|