WordPress Email Marketing Plugin – WP Email Capture - Version 1.8.2

Version Description

(18/01/10) = * Fixed a small bug that resulted in the display for [The plugin does not have a valid header.] * Fixed a small phpmail bug

Download this release

Release Info

Developer rhyswynne
Plugin Icon 128x128 WordPress Email Marketing Plugin – WP Email Capture
Version 1.8.2
Comparing to
See all releases

Version 1.8.2

inc/checks.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+
5
+ Validate an email address.
6
+
7
+ Provide email address (raw input)
8
+
9
+ Returns true if the email address has the email
10
+
11
+ address format and the domain exists.
12
+
13
+ */
14
+
15
+ if(!function_exists('checkdnsrr'))
16
+ {
17
+ function checkdnsrr($hostName, $recType = '')
18
+ {
19
+ if(!empty($hostName)) {
20
+ if( $recType == '' ) $recType = "MX";
21
+ exec("nslookup -type=$recType $hostName", $result);
22
+ // check each line to find the one that starts with the host
23
+ // name. If it exists then the function succeeded.
24
+ foreach ($result as $line) {
25
+ if(eregi("^$hostName",$line)) {
26
+ return true;
27
+ }
28
+ }
29
+ // otherwise there was no mail handler for the domain
30
+ return false;
31
+ }
32
+ return false;
33
+ }
34
+ }
35
+
36
+ function addLastCharacter($url)
37
+ {
38
+ $last = $url[strlen($url)-1];
39
+ if ($last != "/")
40
+ {
41
+ $url = $url . "/";
42
+ }
43
+ return $url;
44
+ }
45
+
46
+
47
+ function validEmail($email)
48
+
49
+ {
50
+
51
+ $isValid = true;
52
+
53
+ $atIndex = strrpos($email, "@");
54
+
55
+ if (is_bool($atIndex) && !$atIndex)
56
+
57
+ {
58
+
59
+ $isValid = false;
60
+
61
+ }
62
+
63
+ else
64
+
65
+ {
66
+
67
+ $domain = substr($email, $atIndex+1);
68
+
69
+ $local = substr($email, 0, $atIndex);
70
+
71
+ $localLen = strlen($local);
72
+
73
+ $domainLen = strlen($domain);
74
+
75
+ if ($localLen < 1 || $localLen > 64)
76
+
77
+ {
78
+
79
+ // local part length exceeded
80
+
81
+ $isValid = false;
82
+
83
+ }
84
+
85
+ else if ($domainLen < 1 || $domainLen > 255)
86
+
87
+ {
88
+
89
+ // domain part length exceeded
90
+
91
+ $isValid = false;
92
+
93
+ }
94
+
95
+ else if ($local[0] == '.' || $local[$localLen-1] == '.')
96
+
97
+ {
98
+
99
+ // local part starts or ends with '.'
100
+
101
+ $isValid = false;
102
+
103
+ }
104
+
105
+ else if (preg_match('/\\.\\./', $local))
106
+
107
+ {
108
+
109
+ // local part has two consecutive dots
110
+
111
+ $isValid = false;
112
+
113
+ }
114
+
115
+ else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain))
116
+
117
+ {
118
+
119
+ // character not valid in domain part
120
+
121
+ $isValid = false;
122
+
123
+ }
124
+
125
+ else if (preg_match('/\\.\\./', $domain))
126
+
127
+ {
128
+
129
+ // domain part has two consecutive dots
130
+
131
+ $isValid = false;
132
+
133
+ }
134
+
135
+ else if
136
+
137
+ (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
138
+
139
+ str_replace("\\\\","",$local)))
140
+
141
+ {
142
+
143
+ // character not valid in local part unless
144
+
145
+ // local part is quoted
146
+
147
+ if (!preg_match('/^"(\\\\"|[^"])+"$/',
148
+
149
+ str_replace("\\\\","",$local)))
150
+
151
+ {
152
+
153
+ $isValid = false;
154
+
155
+ }
156
+
157
+ }
158
+
159
+ if ($isValid && !(checkdnsrr($domain,"MX") ||
160
+
161
+ checkdnsrr($domain,"A")))
162
+
163
+ {
164
+
165
+ // domain not found in DNS
166
+
167
+ $isValid = false;
168
+
169
+ }
170
+
171
+ }
172
+
173
+ return $isValid;
174
+
175
+ }
176
+
177
+
178
+
179
+ ?>
inc/core.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/functions.php');
3
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/install.php');
4
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/pagedresults.php');
5
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/tabledata.php');
6
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/options.php');
7
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/exportcsv.php');
8
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/tempdata.php');
9
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/display.php');
10
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/process.php');
11
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/widget.php');
12
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/security.php');
13
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/dashboard.php');
14
+ require_once(WP_EMAIL_CAPTURE_PATH . '/inc/checks.php');
15
+ ?>
inc/dashboard.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wp_email_capture_dashboard_widget() {
4
+ // Display whatever it is you want to show
5
+ wp_email_capture_writetable(3, "<strong>Last Three Members To Join</strong><br/><br/>");
6
+ $tempemails = wp_email_capture_count_temp();
7
+ echo '<br/><br/><a name="list"></a><strong>Export</strong>';
8
+ echo '<form name="wp_email_capture_export" action="'. $_SERVER["REQUEST_URI"] . '#list" method="post">';
9
+ echo '<label>Use the button below to export your list as a CSV to use in software such as <a href="http://www.gospelrhys.co.uk/go/aweber.php" title="Email Marketing">Aweber</a>.</label>';
10
+ echo '<input type="hidden" name="wp_email_capture_export" />';
11
+ echo '<div class="submit"><input type="submit" value="Export List" /></div>';
12
+ echo "</form><br/><br/";
13
+ $tempemails = wp_email_capture_count_temp();
14
+ echo "<a name='truncate'></a><strong>Temporary e-mails</strong>\n";
15
+ echo '<form name="wp_email_capture_truncate" action="'. $_SERVER["REQUEST_URI"] . '#truncate" method="post">';
16
+ echo '<label>There are '. $tempemails . ' e-mail addresses that have been unconfirmed. Delete them to save space below.</label>';
17
+ echo '<input type="hidden" name="wp_email_capture_truncate"/>';
18
+ echo '<div class="submit"><input type="submit" value="Delete Unconfirmed e-mail Addresses" /></div>';
19
+ echo "</form>";
20
+
21
+ }
22
+
23
+ function wp_email_capture_add_dashboard_widgets() {
24
+ wp_add_dashboard_widget('wp_email_capture_dashboard_widget', 'WP Email Capture - At A Glance', 'wp_email_capture_dashboard_widget');
25
+ }
26
+
27
+
28
+ ?>
inc/display.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ function wp_email_capture_form($error = 0)
6
+
7
+ {
8
+
9
+ $url = get_option('home');
10
+ $url = addLastCharacter($url);
11
+
12
+ ?> <div id="wp_email_capture"><form name="wp_email_capture" method="post" action="<?php echo $url; ?>">
13
+
14
+ <?php if (isset($_GET["wp_email_capture_error"])) {
15
+
16
+ $error = sanitize($_GET["wp_email_capture_error"]);
17
+
18
+ echo "<div style='width:80%;background-color: #FFCCCC; margin: 5px;font-weight'>Error: ". $error ."</div>";
19
+
20
+ } ?>
21
+
22
+ <label class="wp-email-capture-name">Name:</label> <input name="wp-email-capture-name" type="text" class="wp-email-capture-name"><br/>
23
+
24
+ <label class="wp-email-capture-email">Email:</label> <input name="wp-email-capture-email" type="text" class="wp-email-capture-email"><br/>
25
+
26
+ <input type="hidden" name="wp_capture_action" value="1">
27
+
28
+ <input name="Submit" type="submit" value="Submit" class="wp-email-capture-submit">
29
+
30
+ </form></div>
31
+
32
+ <?php if (get_option("wp_email_capture_link") == 1) {
33
+
34
+ echo "<p style='font-size:10px;'>Powered by <a href='http://www.gospelrhys.co.uk/plugins/wordpress-plugins/wordpress-email-capture-plugin' target='_blank'>WP Email Capture</a></p>\n";
35
+
36
+ }
37
+
38
+ }
39
+
40
+
41
+
42
+ function wp_email_capture_form_page($error = 0)
43
+
44
+ {
45
+
46
+ $url = get_option('home');
47
+ $url = addLastCharacter($url);
48
+
49
+ $display .= "<div id='wp_email_capture_2'><form name='wp_email_capture_display' method='post' action='" . $url ."'>\n";
50
+
51
+ if (isset($_GET["wp_email_capture_error"])) {
52
+
53
+ $error = sanitize($_GET["wp_email_capture_error"]);
54
+
55
+ $display .= "<div style='width:80%;background-color: #FFCCCC; margin: 5px;font-weight'>Error: ". $error ."</div>\n";
56
+
57
+ }
58
+
59
+ $display .= "<label class='wp-email-capture-name'>Name:</label> <input name='wp-email-capture-name' type='text' class='wp-email-capture-name'><br/>\n";
60
+
61
+ $display .= "<label class='wp-email-capture-email'>Email:</label> <input name='wp-email-capture-email' type='text' class='wp-email-capture-email'><br/>\n";
62
+
63
+ $display .= "<input type='hidden' name='wp_capture_action' value='1'>\n";
64
+
65
+ $display .= "<input name='Submit' type='submit' value='Submit' class='wp-email-capture-submit'></form></div>\n";
66
+
67
+ if (get_option("wp_email_capture_link") == 1) {
68
+
69
+ $display .= "<p style='font-size:10px;'>Powered by <a href='http://www.gospelrhys.co.uk/plugins/wordpress-plugins/wordpress-email-capture-plugin' target='_blank'>WP Email Capture</a></p>\n";
70
+
71
+ }
72
+
73
+ return $display;
74
+
75
+ }
76
+
77
+
78
+
79
+ function wp_email_capture_display_form_in_post($content)
80
+
81
+ {
82
+
83
+ $get_form = wp_email_capture_form_page();
84
+
85
+ $content = str_replace("[wp_email_capture_form]", $get_form, $content);
86
+
87
+ return $content;
88
+
89
+ }
90
+
91
+
92
+
93
+
94
+
95
+ ?>
inc/exportcsv.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+
6
+
7
+ function wp_email_capture_export()
8
+
9
+ {
10
+
11
+ global $wpdb;
12
+
13
+
14
+
15
+ $csv_output .= "Name,Email";
16
+
17
+ $csv_output .= "\n";
18
+
19
+
20
+
21
+
22
+
23
+ $table_name = $wpdb->prefix . "wp_email_capture_registered_members";
24
+
25
+ $sql = "SELECT name, email FROM " . $table_name;
26
+
27
+ $results = $wpdb->get_results($wpdb->prepare($sql));
28
+
29
+ foreach ($results as $result) {
30
+
31
+ $csv_output .= $result->name ."," . $result->email ."\n";
32
+
33
+ }
34
+
35
+ $csv_output .= "Generated by WP Email Capture on " . date("Y-m-d_H-i");
36
+
37
+ $filename = $file."_".date("Y-m-d_H-i",time());
38
+
39
+ header("Content-type: application/vnd.ms-excel");
40
+
41
+ header("Content-disposition: csv" . date("Y-m-d") . ".csv");
42
+
43
+ header( "Content-disposition: filename=".$filename.".csv");
44
+
45
+ print $csv_output;
46
+
47
+ exit;
48
+
49
+ }
50
+
51
+
52
+
53
+ ?>
inc/functions.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function sanitize($string)
4
+
5
+ {
6
+
7
+ $string = mysql_real_escape_string($string);
8
+
9
+ $string = htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
10
+
11
+ return $string;
12
+
13
+ }
14
+
15
+
16
+
17
+ function checkIfPresent($email){
18
+
19
+ global $wpdb;
20
+
21
+ $table_name = $wpdb->prefix . "wp_email_capture_registered_members";
22
+
23
+ $sql = 'SELECT COUNT(*)
24
+
25
+ FROM '. $table_name . ' WHERE email = "'. $email .'"';
26
+
27
+ $prep = $wpdb->prepare($sql);
28
+
29
+ $result = $wpdb->get_var($prep);
30
+
31
+ if($result > 0)
32
+
33
+ {
34
+
35
+ return true;
36
+
37
+ }else{
38
+
39
+ return false;
40
+
41
+ }
42
+
43
+ }
44
+
45
+
46
+
47
+ ?>
inc/install.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ function wp_email_capture_install() {
6
+
7
+ global $wpdb;
8
+
9
+ global $wp_email_capture_db_version;
10
+
11
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
12
+
13
+ $wp_email_capture_db_version = "1.3";
14
+ add_option("wp_email_capture_db_version", $wp_email_capture_db_version);
15
+
16
+ $installed_ver = get_option("wp_email_capture_db_version");
17
+
18
+ if ($installed_ver != $wp_email_capture_db_version)
19
+ {
20
+
21
+ $table_name = $wpdb->prefix . "wp_email_capture_registered_members";
22
+
23
+ $sql = "CREATE TABLE " . $table_name . " (
24
+
25
+ id INT( 255 ) NOT NULL AUTO_INCREMENT ,
26
+
27
+ name TINYTEXT NOT NULL ,
28
+
29
+ email TEXT NOT NULL ,
30
+
31
+ pdate TEXT NOT NULL,
32
+
33
+ ip TEXT NOT NULL,
34
+
35
+ PRIMARY KEY (id)
36
+
37
+ );";
38
+
39
+ dbDelta($sql);
40
+
41
+
42
+ $table_name = $wpdb->prefix . "wp_email_capture_temp_members";
43
+
44
+
45
+
46
+
47
+
48
+ $sql = "CREATE TABLE " . $table_name . " (
49
+
50
+ id INT( 255 ) NOT NULL AUTO_INCREMENT ,
51
+
52
+ name TINYTEXT NOT NULL ,
53
+
54
+ email TEXT NOT NULL ,
55
+
56
+ pdate TEXT NOT NULL,
57
+
58
+ ip TEXT NOT NULL,
59
+
60
+ confirm_code TEXT NOT NULL,
61
+
62
+ PRIMARY KEY (id)
63
+
64
+ );";
65
+
66
+
67
+ dbDelta($sql);
68
+
69
+
70
+
71
+
72
+
73
+ }
74
+
75
+ update_option('wp_email_capture_link', 0);
76
+ update_option("wp_email_capture_db_version", $wp_email_capture_db_version);
77
+
78
+
79
+ }
80
+
81
+
82
+
83
+ ?>
inc/options.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wp_email_capture_menus() {
4
+
5
+ add_options_page('WP Email Capture Options', 'WP Email Capture', 8, 'wpemailcaptureoptions', 'wp_email_capture_options');
6
+
7
+ }
8
+
9
+
10
+
11
+ function wp_email_capture_options() {
12
+
13
+ echo '<div class="wrap">';
14
+
15
+ echo '<h2>WP Email Capture Options</h2>';
16
+
17
+ ?>
18
+
19
+ <h3>Recommendations</h3>
20
+
21
+ <p>We recommend <a href="http://www.gospelrhys.co.uk/go/aweber.php" title="Email Marketing">Aweber</a> to run your email campaigns. We have tested this plugin with it.
22
+
23
+ </p>
24
+
25
+ <table width="75%" border="0">
26
+
27
+ <tr>
28
+
29
+ <td><div style="text-align:center;">
30
+
31
+ <a href="http://www.gospelrhys.co.uk/go/aweber.php" title="Email Marketing">
32
+
33
+ <img src="http://www.aweber.com/banners/email_marketing_easy/726x90.gif" alt="AWeber - Email Marketing Made Easy" style="border:none;" /></a>
34
+
35
+ </div></td>
36
+
37
+ </tr>
38
+
39
+ </table>
40
+
41
+ <p>
42
+
43
+ <?php
44
+
45
+
46
+
47
+ echo '<h3>Options</h3>';
48
+
49
+ ?>
50
+
51
+
52
+
53
+ </p>
54
+
55
+ <form method="post" action="options.php">
56
+
57
+ <?php wp_nonce_field('update-options'); ?>
58
+
59
+ <?php settings_fields( 'wp-email-capture-group' ); ?>
60
+
61
+ <table class="form-table">
62
+
63
+ <tbody>
64
+
65
+ <tr valign="top">
66
+
67
+ <th scope="row" style="width:400px">Page to redirect to on sign up (full web address ie: http://www.domain.com/this-page/)</th>
68
+
69
+ <td><input type="text" name="wp_email_capture_signup" class="regular-text code" value="<?php echo get_option('wp_email_capture_signup'); ?>" /></td>
70
+
71
+ </tr>
72
+
73
+ <tr valign="top">
74
+
75
+ <th scope="row" style="width:400px"><label>Page to redirect to on confirmation of email address (full web address ie: http://www.domain.com/this-other-page/)</label></th>
76
+
77
+ <td><input type="text" name="wp_email_capture_redirection" class="regular-text code" value="<?php echo get_option('wp_email_capture_redirection'); ?>" /></td>
78
+
79
+ </tr>
80
+
81
+ <tr valign="top">
82
+
83
+ <th scope="row" style="width:400px"><label>From Which Email Address</label></th>
84
+
85
+ <td><input type="text" name="wp_email_capture_from" class="regular-text code" value="<?php echo get_option('wp_email_capture_from'); ?>" /></td>
86
+
87
+ </tr>
88
+
89
+ <tr valign="top">
90
+
91
+ <th scope="row" style="width:400px"><label>From Which Name</label></th>
92
+
93
+ <td><input type="text" name="wp_email_capture_from_name" class="regular-text code" value="<?php echo get_option('wp_email_capture_from_name'); ?>" /></td>
94
+
95
+ </tr>
96
+
97
+ <tr valign="top">
98
+
99
+ <th scope="row" style="width:400px">Subject of Email</th>
100
+
101
+ <td><input type="text" name="wp_email_capture_subject" class="regular-text code" value="<?php echo get_option('wp_email_capture_subject'); ?>" /></td>
102
+
103
+ </tr>
104
+
105
+ <tr valign="top">
106
+
107
+ <th scope="row" style="width:400px"><label>Body of Email<br>
108
+ (use %NAME% to use the form's &quot;Name&quot; field in their welcome email) </label></th>
109
+
110
+ <td><textarea name="wp_email_capture_body" style="width: 25em;"><?php echo get_option('wp_email_capture_body'); ?></textarea></td>
111
+
112
+ </tr>
113
+
114
+ <tr valign="top">
115
+ <th scope="row" style="width:400px">Use PHP's Internal Mail Function? (Only select if you are not receiving email - if you are Godaddy you will need to tick this).</th>
116
+ <td><input name="wp_email_capture_phpmail" type="checkbox" id="wp_email_capture_phpmail" value="1"
117
+
118
+ <?php
119
+
120
+ if (get_option('wp_email_capture_phpmail') == 1) { echo "checked"; } ?>
121
+
122
+ ></td>
123
+ </tr>
124
+ <tr valign="top">
125
+
126
+ <th scope="row" style="width:400px"><label>Link to us (optional, but appreciated)</label></th>
127
+
128
+ <td><input type="checkbox" name="wp_email_capture_link" value="1"
129
+
130
+ <?php
131
+
132
+ if (get_option('wp_email_capture_link') == 1) { echo "checked"; } ?>
133
+
134
+ ></td>
135
+
136
+ </tr>
137
+
138
+ </tbody>
139
+
140
+ </table>
141
+
142
+
143
+
144
+ <input type="hidden" name="action" value="update" />
145
+
146
+ <input type="hidden" name="page_options" value="wp_email_capture_redirection,wp_email_capture_from,wp_email_capture_subject,wp_email_capture_signup,wp_email_capture_body,wp_email_capture_from_name,wp_email_capture_link,wp_email_capture_phpmail" />
147
+
148
+ <p class="submit">
149
+
150
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
151
+
152
+ </p>
153
+
154
+ </form>
155
+
156
+
157
+
158
+ <?php
159
+
160
+ wp_email_capture_writetable();
161
+
162
+ echo '<a name="list"></a><h3>Export</h3>';
163
+
164
+ echo '<form name="wp_email_capture_export" action="'. $_SERVER["REQUEST_URI"] . '#list" method="post">';
165
+
166
+ echo '<label>Use the button below to export your list as a CSV to use in software such as <a href="http://www.gospelrhys.co.uk/go/aweber.php" title="Email Marketing">Aweber</a> or <a href="http://www.gospelrhys.co.uk/go/mailchimp.php">Mailchimp</a></label>';
167
+
168
+ echo '<input type="hidden" name="wp_email_capture_export" />';
169
+
170
+ echo '<div class="submit"><input type="submit" value="Export List" /></div>';
171
+
172
+ echo "</form>";
173
+
174
+ $tempemails = wp_email_capture_count_temp();
175
+
176
+ echo "<a name='truncate'></a><h3>Temporary e-mails</h3>\n";
177
+
178
+ echo '<form name="wp_email_capture_truncate" action="'. $_SERVER["REQUEST_URI"] . '#truncate" method="post">';
179
+
180
+ echo '<label>There are '. $tempemails . ' e-mail addresses that have been unconfirmed. Delete them to save space below.</label>';
181
+
182
+ echo '<input type="hidden" name="wp_email_capture_truncate"/>';
183
+
184
+ echo '<div class="submit"><input type="submit" value="Delete Unconfirmed e-mail Addresses" /></div>';
185
+
186
+ echo "</form>";
187
+
188
+ echo '</div>';
189
+ ?>
190
+ <h3>Donations</h3>
191
+
192
+ <p>If you like this plugin, please consider a small donation to help with future versions &amp; plugins. Donators are thanked on each specific plugin page!</p>
193
+
194
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
195
+ <input type="hidden" name="cmd" value="_s-xclick">
196
+ <input type="hidden" name="hosted_button_id" value="8590914">
197
+ <input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
198
+ <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
199
+ </form>
200
+
201
+
202
+
203
+ <?php }
204
+
205
+
206
+
207
+ function wp_email_capture_options_process() { // whitelist options
208
+
209
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_signup' );
210
+
211
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_redirection' );
212
+
213
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_from' );
214
+
215
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_subject' );
216
+
217
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_body' );
218
+
219
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_link');
220
+
221
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_from_name' );
222
+
223
+ register_setting( 'wp-email-capture-group', 'wp_email_capture_phpmail' );
224
+ if(isset($_REQUEST['wp_email_capture_export'])) {
225
+
226
+ wp_email_capture_export();
227
+
228
+ }
229
+
230
+
231
+ if(isset($_REQUEST['wp_email_capture_deleteid'])) {
232
+ $wpemaildeleteid = $_POST['wp_email_capture_deleteid'];
233
+ wp_email_capture_deleteid($wpemaildeleteid);
234
+ }
235
+
236
+
237
+ if(isset($_REQUEST['wp_email_capture_truncate'])) {
238
+
239
+
240
+
241
+ wp_email_capture_truncate();
242
+
243
+ }
244
+
245
+ }
246
+
247
+ ?>
inc/pagedresults.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ class MySQLPagedResultSet
6
+
7
+ {
8
+
9
+
10
+
11
+ var $results;
12
+
13
+ var $pageSize;
14
+
15
+ var $page;
16
+
17
+ var $row;
18
+
19
+
20
+
21
+ function MySQLPagedResultSet($query,$pageSize)
22
+
23
+ {
24
+
25
+
26
+
27
+ $resultpage = $_GET['resultpage'];
28
+
29
+
30
+
31
+ $this->results = mysql_query($query);
32
+
33
+ $this->pageSize = $pageSize;
34
+
35
+ if ((int)$resultpage <= 0) $resultpage = 1;
36
+
37
+ if ($resultpage > $this->getNumPages())
38
+
39
+ $resultpage = $this->getNumPages();
40
+
41
+ $this->setPageNum($resultpage);
42
+
43
+ }
44
+
45
+
46
+
47
+ function getNumPages()
48
+
49
+ {
50
+
51
+ if (!$this->results) return FALSE;
52
+
53
+
54
+
55
+ return ceil(mysql_num_rows($this->results) /
56
+
57
+ (float)$this->pageSize);
58
+
59
+ }
60
+
61
+
62
+
63
+ function setPageNum($pageNum)
64
+
65
+ {
66
+
67
+ if ($pageNum > $this->getNumPages() or
68
+
69
+ $pageNum <= 0) return FALSE;
70
+
71
+
72
+
73
+ $this->page = $pageNum;
74
+
75
+ $this->row = 0;
76
+
77
+ mysql_data_seek($this->results,($pageNum-1) * $this->pageSize);
78
+
79
+ }
80
+
81
+
82
+
83
+ function getPageNum()
84
+
85
+ {
86
+
87
+ return $this->page;
88
+
89
+ }
90
+
91
+
92
+
93
+ function isLastPage()
94
+
95
+ {
96
+
97
+ return ($this->page >= $this->getNumPages());
98
+
99
+ }
100
+
101
+
102
+
103
+ function isFirstPage()
104
+
105
+ {
106
+
107
+ return ($this->page <= 1);
108
+
109
+ }
110
+
111
+
112
+
113
+ function fetchArray()
114
+
115
+ {
116
+
117
+ if (!$this->results) return FALSE;
118
+
119
+ if ($this->row >= $this->pageSize) return FALSE;
120
+
121
+ $this->row++;
122
+
123
+ return mysql_fetch_array($this->results);
124
+
125
+ }
126
+
127
+
128
+
129
+ function getPageNav($queryvars = '')
130
+
131
+ {
132
+
133
+ $nav = '';
134
+
135
+ if (!$this->isFirstPage())
136
+
137
+ {
138
+
139
+ $nav .= "<a href=\"?resultpage=".
140
+
141
+ ($this->getPageNum()-1).'&'.$queryvars.'">Prev</a> ';
142
+
143
+ }
144
+
145
+ if ($this->getNumPages() > 1)
146
+
147
+ for ($i=1; $i<=$this->getNumPages(); $i++)
148
+
149
+ {
150
+
151
+ if ($i==$this->page)
152
+
153
+ $nav .= "$i ";
154
+
155
+ else
156
+
157
+ $nav .= "<a href=\"?resultpage={$i}&".
158
+
159
+ $queryvars."\">{$i}</a> ";
160
+
161
+ }
162
+
163
+ if (!$this->isLastPage())
164
+
165
+ {
166
+
167
+ $nav .= "<a href=\"?resultpage=".
168
+
169
+ ($this->getPageNum()+1).'&'.$queryvars.'">Next</a> ';
170
+
171
+ }
172
+
173
+
174
+
175
+ return $nav;
176
+
177
+ }
178
+
179
+ }
180
+
181
+
182
+
183
+ ?>
inc/process.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ function wp_email_capture_process()
6
+
7
+ {
8
+
9
+ if(isset($_REQUEST['wp_capture_action'])) {
10
+ wp_email_capture_signup();
11
+ }
12
+
13
+ if(isset($_GET['wp_email_confirm']) || isset($_REQUEST['wp_email_confirm'])) {
14
+ wp_capture_email_confirm();
15
+ }
16
+
17
+ }
18
+
19
+
20
+
21
+ function wp_email_capture_double_check_everything($name, $email)
22
+
23
+ {
24
+
25
+ if (wp_email_injection_chars($name) || wp_email_injection_chars($email) || wp_email_injection_chars($name) || wp_email_injection_chars($email))
26
+
27
+ {
28
+
29
+ return FALSE;
30
+
31
+ } else {
32
+
33
+ return TRUE;
34
+ }
35
+
36
+ }
37
+
38
+
39
+
40
+ function wp_email_capture_signup()
41
+
42
+ {
43
+
44
+ global $wpdb;
45
+
46
+
47
+
48
+ // Random confirmation code
49
+
50
+ $confirm_code=md5(uniqid(rand()));
51
+
52
+ $name = $_REQUEST['wp-email-capture-name'];
53
+
54
+ $email = $_REQUEST['wp-email-capture-email'];
55
+
56
+
57
+ if (!validEmail($email))
58
+
59
+ {
60
+
61
+ $url = $_SERVER['PHP_SELF'] . "?wp_email_capture_error=Not%20a%20valid%20email";
62
+
63
+ header("Location: $url");
64
+
65
+ die();
66
+
67
+ }
68
+
69
+
70
+
71
+ if (wp_email_capture_double_check_everything($name, $email))
72
+
73
+ {
74
+
75
+ // values sent from form
76
+
77
+ $name = sanitize($name);
78
+
79
+ $email= sanitize($email);
80
+
81
+ $name = wp_email_injection_test($name);
82
+
83
+ $email = wp_email_injection_test($email);
84
+
85
+ $name = wp_email_stripslashes($name);
86
+
87
+ $email = wp_email_stripslashes($email);
88
+
89
+ $referrer = sanitize($_SERVER['HTTP_REFERER']);
90
+
91
+ $ip = sanitize($_SERVER['REMOTE_ADDR']);
92
+
93
+ $date = date("Y-m-d H-i");
94
+
95
+ $sqlcheck = checkIfPresent($email);
96
+
97
+
98
+
99
+ if ($sqlcheck){
100
+
101
+
102
+
103
+ $url = $_SERVER['PHP_SELF'] . "?wp_email_capture_error=User%20already%20present";
104
+
105
+ header("Location: $url");
106
+
107
+ die();
108
+
109
+ }
110
+
111
+
112
+
113
+ // Insert data into database
114
+
115
+ $table_name = $wpdb->prefix . "wp_email_capture_temp_members";
116
+
117
+
118
+
119
+
120
+
121
+ $sql="INSERT INTO ".$table_name."(confirm_code, name, email, ip, pdate)VALUES('$confirm_code', '$name', '$email', '$ip', '$date')";
122
+
123
+ $result=$wpdb->query($wpdb->prepare($sql));
124
+
125
+
126
+
127
+ // if suceesfully inserted data into database, send confirmation link to email
128
+
129
+ if($result){
130
+
131
+
132
+
133
+ // ---------------- SEND MAIL FORM ----------------
134
+
135
+
136
+
137
+ // send e-mail to ...
138
+
139
+ $to=$email;
140
+
141
+ $siteurl = get_option('home');
142
+ $siteurl = addLastCharacter($siteurl);
143
+
144
+ // Your subject
145
+
146
+ $subject=get_option('wp_email_capture_subject');
147
+
148
+ // From
149
+ $header = "MIME-Version: 1.0\n" . "From: " . get_option('wp_email_capture_from_name') . " <" . get_option('wp_email_capture_from') . ">\n";
150
+ $header .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
151
+ // Your message
152
+
153
+ $message.= get_option('wp_email_capture_body') . "\n\n";
154
+
155
+ $message.= $siteurl ."?wp_email_confirm=1&wp_email_capture_passkey=$confirm_code";
156
+
157
+ $message .= "\n\n----\n";
158
+ $message .= "This is an automated message that is generated because somebody with the IP address of " . $ip ." (possibly you) on ". $date ." filled out the form on the following page " . $referrer . "\n";
159
+ $message .= "If you are sure this isn't you, please ignore this message, you will not be sent another message.";
160
+
161
+ $message = str_replace("%NAME%", $name, $message);
162
+
163
+ // send email (either using wp_mail or PHP Mail, depending on server configuration
164
+
165
+ $mailfunc = get_option('wp_email_capture_phpmail');
166
+ if ($mailfunc == "1")
167
+ {
168
+ mail($to,$subject,$message,$header);
169
+ $sentmail = true;
170
+ } else {
171
+ $sentmail = wp_mail($to,$subject,$message,$header);
172
+ }
173
+
174
+ }
175
+
176
+ }
177
+
178
+
179
+
180
+ // if not found
181
+
182
+ else {
183
+
184
+ echo "Not found your email in our database";
185
+
186
+ }
187
+
188
+
189
+
190
+ // if your email succesfully sent
191
+
192
+ if($sentmail){
193
+
194
+ $halfreg = get_option('wp_email_capture_signup');
195
+
196
+ header("Location: $halfreg");
197
+
198
+ die();
199
+
200
+ }
201
+
202
+ else {
203
+
204
+ $url = $_SERVER['PHP_SELF'] . "?wp_email_capture_error=Email%20unable%20to%20be%20sent";
205
+
206
+ header("Location: $url");
207
+
208
+ die();
209
+
210
+ //echo "<meta http-equiv='refresh' content='0;". $url . "?wp_email_capture_error=Email%20unable%20to%20be%sent'>";
211
+
212
+ }
213
+
214
+ }
215
+
216
+
217
+
218
+
219
+
220
+ function wp_capture_email_confirm()
221
+
222
+ {
223
+
224
+ global $wpdb;
225
+
226
+ // Passkey that got from link
227
+
228
+ $passkey=sanitize($_GET['wp_email_capture_passkey']);
229
+
230
+ $table_name = $wpdb->prefix . "wp_email_capture_temp_members";
231
+
232
+ $sql1="SELECT id FROM $table_name WHERE confirm_code ='$passkey'";
233
+
234
+ $result=$wpdb->get_var($wpdb->prepare($sql1));
235
+
236
+ if ($result != '')
237
+
238
+ {
239
+
240
+ $table_name2 = $wpdb->prefix . "wp_email_capture_registered_members";
241
+
242
+ $sql2="SELECT * FROM $table_name WHERE confirm_code ='$passkey'";
243
+
244
+ $rowresults = $wpdb->get_results($wpdb->prepare($sql2));
245
+
246
+ foreach ($rowresults as $rowresult) {
247
+
248
+ $name = $rowresult->name;
249
+
250
+ $email = $rowresult->email;
251
+
252
+ $ip = $rowresult->ip;
253
+ $pdate = $rowresult->pdate;
254
+
255
+ $sql3="INSERT INTO $table_name2(name, email, ip, pdate)VALUES('$name', '$email', '$ip','$pdate')";
256
+
257
+ $result3=$wpdb->query($wpdb->prepare($sql3));
258
+
259
+ }
260
+
261
+ }
262
+
263
+ else {
264
+
265
+ $url = $url . "?wp_email_capture_error=Wrong%20confirmation%20code";
266
+
267
+ header("Location: $url");
268
+
269
+ }
270
+
271
+ // if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
272
+
273
+
274
+
275
+ if($result3){
276
+
277
+ $sql4="DELETE FROM $table_name WHERE confirm_code = '$passkey'";
278
+
279
+ $result4=$wpdb->query($wpdb->prepare($sql4));
280
+
281
+ $fullreg = get_option('wp_email_capture_redirection');
282
+
283
+
284
+
285
+ //echo "<meta http-equiv='refresh' content='0;". $fullreg ."'>";
286
+
287
+ header("Location: $fullreg");
288
+
289
+ }
290
+
291
+
292
+
293
+
294
+
295
+ }
296
+
297
+
298
+
299
+
300
+
301
+ ?>
inc/security.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ /* Check for injection characters */
6
+
7
+ function wp_email_injection_chars($s) {
8
+
9
+ return (eregi("\r", $s) || eregi("\n", $s) || eregi("%0a", $s) || eregi("%0d", $s)) ? TRUE : FALSE;
10
+
11
+ }
12
+
13
+
14
+
15
+
16
+
17
+ /* Make output safe for the browser */
18
+
19
+ function wp_email_capture_bsafe($input) {
20
+
21
+ return htmlspecialchars(stripslashes($input));
22
+
23
+ }
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+ function wp_email_stripslashes($s) {
34
+
35
+ if (defined('TEMPLATEPATH') || (get_magic_quotes_gpc())) {
36
+
37
+ return stripslashes($s);
38
+
39
+ } else {
40
+
41
+ return $s;
42
+
43
+ }
44
+
45
+ }
46
+
47
+
48
+
49
+
50
+
51
+ function wp_email_injection_test($str) {
52
+
53
+ $tests = array("/bcc\:/i", "/Content\-Type\:/i", "/Mime\-Version\:/i", "/cc\:/i", "/from\:/i", "/to\:/i", "/Content\-Transfer\-Encoding\:/i");
54
+
55
+ return preg_replace($tests, "", $str);
56
+
57
+ }
58
+
59
+
60
+
61
+ ?>
inc/tabledata.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ function wp_email_capture_writetable($limit = 0, $header = '')
6
+
7
+ {
8
+
9
+ global $wpdb;
10
+
11
+ $table_name = $wpdb->prefix . "wp_email_capture_registered_members";
12
+
13
+ $sql = "SELECT id, name, email FROM " . $table_name;
14
+
15
+ if ($limit != 0) {
16
+
17
+ $sql .= " ORDER BY id DESC LIMIT 3";
18
+
19
+ }
20
+
21
+ $results = $wpdb->get_results($wpdb->prepare($sql));
22
+
23
+
24
+
25
+ if ($header == '') {
26
+
27
+ $header = "<h3>Members</h3>";
28
+
29
+ }
30
+
31
+ echo $header;
32
+
33
+ ?>
34
+
35
+ <table border="1">
36
+
37
+ <tr><td><strong>Name</strong></td><td colspan="2"><strong>Email</strong></td></tr>
38
+
39
+ <?php foreach ($results as $result) {
40
+ if ($limit == 0) {
41
+ $delid = wp_email_capture_formdelete($result->id, $result->email);
42
+ }
43
+ echo "<tr><td style='width: 300px;'>" . $result->name ."</td><td style='width: 300px;'>" . $result->email ."</td><td style='width: 300px;'>
44
+ ". $delid ."</td>
45
+
46
+ </tr>";
47
+
48
+ }
49
+
50
+ ?>
51
+
52
+ </table>
53
+
54
+ <?php
55
+
56
+ }
57
+
58
+
59
+ function wp_email_capture_formdelete($id, $email)
60
+ {
61
+ return "<form action='" . $_SERVER["REQUEST_URI"] . "#list' method='post'>
62
+ <input type='hidden' name='wp_email_capture_deleteid' value='". $id."'>
63
+ <input type='submit' value='Delete ". $email ."' style='width: 300px;'>
64
+ </form>";
65
+ }
66
+
67
+ function wp_email_capture_deleteid($id)
68
+ {
69
+ global $wpdb;
70
+
71
+ $table_name = $wpdb->prefix . "wp_email_capture_registered_members";
72
+
73
+ $sql = "DELETE FROM " . $table_name . " WHERE id = '" . $id ."'";
74
+
75
+ $result = $wpdb->query($wpdb->prepare($sql));
76
+
77
+ }
78
+ ?>
inc/tempdata.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wp_email_capture_truncate()
3
+ {
4
+ global $wpdb;
5
+ $table_name = $wpdb->prefix . "wp_email_capture_temp_members";
6
+ $sql = "TRUNCATE " . $table_name;
7
+ $result = $wpdb->query($wpdb->prepare($sql));
8
+ }
9
+ function wp_email_capture_count_temp()
10
+ {
11
+ global $wpdb;
12
+ $table_name = $wpdb->prefix . "wp_email_capture_temp_members";
13
+ $sql = 'SELECT COUNT(*)
14
+ FROM '. $table_name;
15
+ $prep = $wpdb->prepare($sql);
16
+ $result = $wpdb->get_var($prep);
17
+ return $result;
18
+ }
19
+ ?>
inc/widget.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wp_email_capture_widget_init() {
4
+
5
+
6
+
7
+ // Check to see required Widget API functions are defined...
8
+
9
+ if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') )
10
+
11
+ return; // ...and if not, exit gracefully from the script.
12
+
13
+
14
+
15
+ // This function prints the sidebar widget--the cool stuff!
16
+
17
+ function wp_email_capture_widget($args) {
18
+
19
+
20
+
21
+ // $args is an array of strings which help your widget
22
+
23
+ // conform to the active theme: before_widget, before_title,
24
+
25
+ // after_widget, and after_title are the array keys.
26
+
27
+ extract($args);
28
+
29
+
30
+
31
+ // Collect our widget's options, or define their defaults.
32
+
33
+ $options = get_option('wp_email_capture_widget');
34
+
35
+ $title = $options['title'];
36
+
37
+ $text = $options['text'];
38
+
39
+
40
+
41
+ // It's important to use the $before_widget, $before_title,
42
+
43
+ // $after_title and $after_widget variables in your output.
44
+
45
+ echo $before_widget;
46
+
47
+ echo $before_title . $title . $after_title;
48
+
49
+ echo $text;
50
+
51
+ wp_email_capture_form();
52
+
53
+ echo $after_widget;
54
+
55
+ }
56
+
57
+
58
+
59
+ // This is the function that outputs the form to let users edit
60
+
61
+ // the widget's title and so on. It's an optional feature, but
62
+
63
+ // we'll use it because we can!
64
+
65
+ function wp_email_capture_widget_control() {
66
+
67
+
68
+
69
+ // Collect our widget's options.
70
+
71
+ $options = get_option('wp_email_capture_widget');
72
+
73
+ $newoptions = get_option('wp_email_capture_widget');
74
+
75
+ // This is for handing the control form submission.
76
+
77
+ if ( $_POST['wp-email-capture-submit'] ) {
78
+
79
+ // Clean up control form submission options
80
+
81
+ $newoptions['title'] = strip_tags(stripslashes($_POST['wp-email-capture-title']));
82
+
83
+ $newoptions['text'] = strip_tags(stripslashes($_POST['wp-email-capture-text']));
84
+
85
+ }
86
+
87
+
88
+
89
+ // If original widget options do not match control form
90
+
91
+ // submission options, update them.
92
+
93
+ if ( $options != $newoptions ) {
94
+
95
+ $options = $newoptions;
96
+
97
+ update_option('wp_email_capture_widget', $options);
98
+
99
+ }
100
+
101
+
102
+
103
+ // Format options as valid HTML. Hey, why not.
104
+
105
+ $title = htmlspecialchars($options['title'], ENT_QUOTES);
106
+
107
+ $text = htmlspecialchars($options['text'], ENT_QUOTES);
108
+
109
+
110
+
111
+ // The HTML below is the control form for editing options.
112
+
113
+ ?>
114
+
115
+ <div>
116
+
117
+ <label for="wp-email-capture-title" style="line-height:35px;display:block;">Widget title: <input type="text" id="wp-email-capture-title" name="wp-email-capture-title" value="<?php echo $title; ?>" /></label>
118
+
119
+ <label for="wp-email-capture-text" style="line-height:35px;display:block;">Widget text: <input type="text" id="wp-email-capture-text" name="wp-email-capture-text" value="<?php echo $text; ?>" /></label>
120
+
121
+ <input type="hidden" name="wp-email-capture-submit" id="wp-email-capture-submit" value="1" />
122
+
123
+ </div>
124
+
125
+ <?php
126
+
127
+ // end of widget_mywidget_control()
128
+
129
+ }
130
+
131
+
132
+
133
+ // This registers the widget. About time.
134
+
135
+ register_sidebar_widget('WP Email Capture', 'wp_email_capture_widget');
136
+
137
+
138
+
139
+ // This registers the (optional!) widget control form.
140
+
141
+ register_widget_control('WP Email Capture', 'wp_email_capture_widget_control');
142
+
143
+ }
144
+
145
+
146
+
147
+ // Delays plugin execution until Dynamic Sidebar has loaded first.
148
+
149
+ add_action('plugins_loaded', 'wp_email_capture_widget_init');
150
+
151
+
152
+
153
+ ?>
readme.txt ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP Email Capture ===
2
+ Tags: email, marketing, capture, form, affiliates, mailing lists, email marketing, widget ready
3
+ Requires at least: 2.8
4
+ Tested up to: 2.9.1
5
+ Version: 1.8.2
6
+ Stable tag: 1.8.2
7
+ Contributors: rhyswynne
8
+ Donate link: http://www.gospelrhys.co.uk/donations/
9
+
10
+ Double opt-in form for building your email list. Define landing pages to distribute your ebooks & software.
11
+
12
+ == Description ==
13
+ This creates a 2 field form (Name & Email) for capturing emails. Email is double opt in, and allows you to forward opt in to services such as ebooks or software. When you are ready to begin your email marketing campaign, simply export the list into your chosen email marketing software or service.
14
+
15
+ Features:-
16
+
17
+ * Widget Ready.
18
+ * Uses Wordpress' internal wp_mail function for sending mail.
19
+ * Easily integrated with posts & pages.
20
+ * Dashboard Widget.
21
+ * Export data into CSV files, compatible with most major Email Marketing Programmes (including Aweber, Mailchimp, Groupmail, Constant Contact)
22
+ * Double opt in, so compatible with CAN-SPAM act.
23
+ * And completely free!
24
+
25
+ == Installation ==
26
+ Upload the plugin (unzipped) into `/wp-content/plugins/`.
27
+
28
+ Activate the plugin under the "Plugins" menu.
29
+
30
+ This plugin requires a lot of set up before using. You need the following:-
31
+
32
+ * A page for "Half Registration" (this page will be forwarded to when the form is just filled in, informs the users that they need to click on a link in the email.
33
+
34
+ * A page for "complete registration" (thanking them for their enquiry, links to download etc).
35
+
36
+ After having these, please then fill in the settings in the "Settings > WP Email Capture" form.
37
+
38
+ The form can be inserted into the site at any location. However, to put the form anywhere, insert the following code into your template
39
+
40
+ `<?php if (function_exists('wp_email_capture_form')) { wp_email_capture_form(); } ?>`
41
+
42
+ If you want to insert the form within a page, insert into any page the string `[wp_email_capture_form]`. It will be replaced with a simple form.
43
+
44
+ == Stylings ==
45
+ To style your form, you need to add to your CSS file the following ID declarations. `wp_email_capture` is for sidebar & template widgets, `wp_email_capture_2` is for on page forms.
46
+
47
+ `#wp_email_capture
48
+ {
49
+
50
+ }
51
+
52
+ #wp_email_capture label
53
+ {
54
+
55
+ }
56
+
57
+ #wp_email_capture input
58
+ {
59
+
60
+ }
61
+
62
+ #wp_email_capture_2
63
+ {
64
+
65
+ }
66
+
67
+ #wp_email_capture_2 label
68
+ {
69
+
70
+ }
71
+
72
+ #wp_email_capture_2 input
73
+ {
74
+
75
+ }`
76
+
77
+ == Screenshots ==
78
+ 1. It's appearance within the template
79
+ 2. The form within a post
80
+ 3. The Dashboard Widget
81
+
82
+ == Frequently Asked Questions ==
83
+
84
+ = Does this piece of software send out email? =
85
+ No. I feel that to do so would be counter productive, as sending out email could have a detrimental effect on your server. There are a number of services we recommend, such as Aweber, to send out lists built on WP Email Capture.
86
+
87
+ = Does it work with Wordpress MU? =
88
+ This plugin is unsupported for Wordpress MU. Some people have reported success in using it. Others haven't. I have been unable to figure out why (I've been unable to get it working for Wordpress MU).
89
+
90
+ = Does it work with [theme_name]? =
91
+ This plugin does use widgets, so probably yes :)
92
+
93
+ = How do I include the name in my emails I send to people? =
94
+ Wherever you put in %NAME% (spelt exactly like that, uppercase as well), it will be replaced with the name given by the user.
95
+
96
+ == Bugs/Suggestions ==
97
+ Please report any bugs to me (rhys@gospelrhys.co.uk)
98
+
99
+ == Donate ==
100
+ To donate to this plugin, please visit:
101
+
102
+ http://www.gospelrhys.co.uk/donations
103
+
104
+ == Change Log ==
105
+ = 1.8.2 (18/01/10) =
106
+ * Fixed a small bug that resulted in the display for [The plugin does not have a valid header.]
107
+ * Fixed a small phpmail bug
108
+
109
+ = 1.8.1 (13/01/10) =
110
+ * Included more information in sent mail including IP, Date & Referral Page
111
+
112
+
113
+ = 1.7.1 (04/11/09) & 1.7.2 (05/11/09) =
114
+ * Small bug fixes
115
+
116
+ = 1.7 (28/10/09) =
117
+ * Small issue with those using GoDaddy servers fixed, you can now set whether or not to use wp_mail or the internal mail function.
118
+
119
+ = 1.6 (18/10/09) =
120
+ * You can now delete people from the confirmed members list (requested update!)
121
+
122
+ = 1.5 (04/10/09) =
123
+ * Fixed small error on the error checking form.
124
+
125
+ = 1.4 (03/10/09) =
126
+ * Added a check for duplicate emails.
127
+
128
+ = 1.3 (30/09/09) =
129
+ * Added a new feature where you can mention the name of the recipient of the email within the email by using the %NAME% string.
130
+ * Better default title & text for the WP Email Capture Widget.
131
+ * Fixed a bug that dropped the last character of the "From" name.
132
+
133
+ = 1.2 (27/09/09) =
134
+ * Fixed errors with the programme when using non pretty permalinks (they now work now)
135
+ * Compatible with windows based PHP configurations (1.1 introduced a function that didn't work on windows boxes).
136
+
137
+ = 1.1 revision 2 (24/09/09) =
138
+ * Fixed compatability issue with All in One SEO.
139
+ * Blogs which are on a subdomain now can use the plugin (http://www.domian.com/wordpress/)
140
+
141
+ = 1.1 revision 1 (23/09/09) =
142
+ * Fixed small upgrade bug
143
+
144
+ = 1.1 (22/09/09) =
145
+ * Fixed short tag problem in tempdata.php
146
+ * Emails that are not valid emails aren't processed
147
+
148
+ = 1.0 RC 1 (17/09/09) =
149
+ * First Release!
150
+ * Dashboard Widget added.
151
+
152
+ = 0.4 (14/09/09) =
153
+ * Used more secure internal wp_mail class for sending out mail
154
+ * Implemented [wp_email_form] class for implementing plugin on form
155
+
156
+ = 0.3 (12/09/09) =
157
+ * Switch to headers, rather than meta refreshes for updating the page
158
+
159
+ = 0.2 (09/09/09) =
160
+ * Fixed small error in the plugin when using permalinks
161
+ * Implemented more security to the plugin
162
+
163
+ = 0.1 (07/09/09) =
164
+ * Plugin Launched