Version Description
- Improved CSS Reset for comment checkbox
Download this release
Release Info
Developer | DvanKooten |
Plugin | Newsletter Sign-Up |
Version | 1.7.9 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.7.9
- backend/NewsletterSignUpAdmin.php +21 -115
- backend/css/backend.css +20 -47
- backend/css/donate.css +0 -0
- backend/css/newsletter-sign-up-backend.css +0 -0
- backend/img/close.png +0 -0
- backend/img/email-icon.png +0 -0
- backend/img/icon.png +0 -0
- backend/img/overlay.png +0 -0
- backend/img/rss-icon.png +0 -0
- backend/img/twitter-icon.png +0 -0
- backend/js/backend.js +9 -0
- backend/js/donate.js +0 -0
- backend/views/checkbox_settings.php +1 -2
- backend/views/config_helper.php +1 -2
- backend/views/dashboard.php +11 -9
- backend/views/form_settings.php +1 -2
- backend/views/rows-aweber.php +5 -0
- backend/views/rows-mailchimp.php +32 -0
- backend/views/rows-phplist.php +10 -0
- backend/views/rows-ymlp.php +23 -0
- frontend/NewsletterSignUp.php +128 -79
- frontend/NewsletterSignUpWidget.php +2 -2
- frontend/css/newsletter-sign-up.php +3 -5
- newsletter-sign-up.php +1 -9
- readme.txt +52 -13
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.jpg +0 -0
backend/NewsletterSignUpAdmin.php
CHANGED
@@ -200,109 +200,26 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
200 |
require 'views/config_helper.php';
|
201 |
}
|
202 |
|
203 |
-
/**
|
204 |
-
* Show the rows that are unique for some mailinglist providers (i.e. MC API or YMLP API)
|
205 |
-
* @param string $mailinglist The mailinglist provider that is being viewed
|
206 |
-
*/
|
207 |
-
function mailinglist_specific_rows($mailinglist) {
|
208 |
-
$opts = get_option('nsu_mailinglist');
|
209 |
-
|
210 |
-
switch ($mailinglist) {
|
211 |
-
|
212 |
-
case 'mailchimp':
|
213 |
-
?>
|
214 |
-
<tr valign="top">
|
215 |
-
<th scope="row"><label for="use_api">Use MailChimp API? <span class="ns_small">(recommended)</span></label></th>
|
216 |
-
<td><input type="checkbox" id="use_api" name="nsu_mailinglist[use_api]" value="1"<?php
|
217 |
-
if (isset($opts['use_api']) && $opts['use_api'] == '1') {
|
218 |
-
echo ' checked="checked"';
|
219 |
-
}
|
220 |
-
?> /></td>
|
221 |
-
</tr>
|
222 |
-
<tbody class="api_rows" <?php if (!isset($opts['use_api']) || $opts['use_api'] != 1)
|
223 |
-
echo ' style="display:none" '; ?>>
|
224 |
-
<tr valign="top"><th scope="row">MailChimp API Key <a target="_blank" href="http://admin.mailchimp.com/account/api">(?)</a></th>
|
225 |
-
<td><input size="50%" type="text" id="mc_api_key" name="nsu_mailinglist[mc_api_key]" value="<?php if (isset($opts['mc_api_key']))
|
226 |
-
echo $opts['mc_api_key']; ?>" /></td>
|
227 |
-
</tr>
|
228 |
-
<tr valign="top"><th scope="row">MailChimp List ID <a href="http://www.mailchimp.com/kb/article/how-can-i-find-my-list-id" target="_blank">(?)</a></th>
|
229 |
-
<td><input size="50%" type="text" name="nsu_mailinglist[mc_list_id]" value="<?php if (isset($opts['mc_list_id']))
|
230 |
-
echo $opts['mc_list_id']; ?>" /></td>
|
231 |
-
</tr>
|
232 |
-
</tbody>
|
233 |
-
<?php
|
234 |
-
break;
|
235 |
-
|
236 |
-
case 'ymlp':
|
237 |
-
?>
|
238 |
-
<tr valign="top"><th scope="row"><label for="use_api">Use the YMLP API? <span class="ns_small">(recommended)</span></label></th>
|
239 |
-
<td><input type="checkbox" id="use_api" name="nsu_mailinglist[use_api]" value="1"<?php
|
240 |
-
if (isset($opts['use_api']) && $opts['use_api'] == '1') {
|
241 |
-
echo ' checked="checked"';
|
242 |
-
}
|
243 |
-
?> /></td>
|
244 |
-
</tr>
|
245 |
-
|
246 |
-
<tbody class="api_rows"<?php if (!isset($opts['use_api']) || $opts['use_api'] != 1)
|
247 |
-
echo ' style="display:none" '; ?>>
|
248 |
-
<tr valign="top"><th scope="row">YMLP API Key <a target="_blank" href="http://www.ymlp.com/app/api.php">(?)</a></th>
|
249 |
-
<td><input size="50%" type="text" id="ymlp_api_key" name="nsu_mailinglist[ymlp_api_key]" value="<?php if (isset($opts['ymlp_api_key']))
|
250 |
-
echo $opts['ymlp_api_key']; ?>" /></td>
|
251 |
-
</tr>
|
252 |
-
<tr valign="top"><th scope="row">YMLP Username</th>
|
253 |
-
<td><input size="50%" type="text" id="ymlp_username" name="nsu_mailinglist[ymlp_username]" value="<?php if (isset($opts['ymlp_username']))
|
254 |
-
echo $opts['ymlp_username']; ?>" /></td>
|
255 |
-
</tr>
|
256 |
-
<tr valign="top"><th scope="row">YMLP GroupID<span class="ns_small">(starts at 1, check URL when 'viewing all contacts' in certain group)</span></th>
|
257 |
-
<td><input size="50%" type="text" id="ymlp_groupid" name="nsu_mailinglist[ymlp_groupid]" value="<?php if (isset($opts['ymlp_groupid']))
|
258 |
-
echo $opts['ymlp_groupid']; ?>" /></td>
|
259 |
-
</tr>
|
260 |
-
</tbody>
|
261 |
-
<?php
|
262 |
-
break;
|
263 |
-
|
264 |
-
case 'phplist':
|
265 |
-
?>
|
266 |
-
<tr valign="top">
|
267 |
-
<th scope="row">PHPList list ID</th>
|
268 |
-
<td><input size="2" type="text" name="nsu_mailinglist[phplist_list_id]" value="<?php
|
269 |
-
if (isset($opts['phplist_list_id'])) {
|
270 |
-
echo $opts['phplist_list_id'];
|
271 |
-
} else {
|
272 |
-
echo 1;
|
273 |
-
};
|
274 |
-
?>" /></td>
|
275 |
-
</tr>
|
276 |
-
<?php
|
277 |
-
break;
|
278 |
-
|
279 |
-
case 'aweber':
|
280 |
-
?>
|
281 |
-
<tr valign="top">
|
282 |
-
<th scope="row">Aweber list name</th>
|
283 |
-
<td><input size="25%" type="text" name="nsu_mailinglist[aweber_list_name]" value="<?php if (isset($opts['aweber_list_name']))
|
284 |
-
echo $opts['aweber_list_name']; ?>" /></td>
|
285 |
-
</tr>
|
286 |
-
<?php
|
287 |
-
break;
|
288 |
-
}
|
289 |
-
}
|
290 |
-
|
291 |
/**
|
292 |
* Renders a donate box
|
293 |
*/
|
294 |
function donate_box() {
|
295 |
-
$content = '
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
306 |
$this->postbox($this->hook . '-donatebox', 'Donate $10, $20 or $50!', $content);
|
307 |
}
|
308 |
|
@@ -322,6 +239,7 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
322 |
}
|
323 |
$content .= '<li class="dvk-rss"><a href="http://dannyvankooten.com/feed/">Subscribe to my RSS feed</a></li>';
|
324 |
$content .= '<li class="dvk-email"><a href="http://dannyvankooten.com/newsletter/">Subscribe by email</a></li>';
|
|
|
325 |
$content .= '</ul><br style="clear:both;" />';
|
326 |
} else {
|
327 |
$content = '<p>No updates..</p>';
|
@@ -329,25 +247,13 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
329 |
$this->postbox($this->hook . '-latestpostbox', 'Latest blog posts..', $content);
|
330 |
}
|
331 |
|
332 |
-
/**
|
333 |
-
* Renders a box with options on how to show your appreciations
|
334 |
-
*/
|
335 |
-
function likebox() {
|
336 |
-
$content = '<p>Consider the following options, please:</p>
|
337 |
-
<ul>
|
338 |
-
<li><a href="http://DannyvanKooten.com/donate/" target="_blank">Buy me a beer</a></li>
|
339 |
-
<li><a href="http://wordpress.org/extend/plugins/' . $this->hook . '/" target="_blank">Give it a good rating on WordPress.org.</a></li>
|
340 |
-
<li>Tell others about this plugin.</li>
|
341 |
-
</ul>';
|
342 |
-
$this->postbox($this->hook . '-likebox', 'Like this plugin?', $content);
|
343 |
-
}
|
344 |
|
345 |
/**
|
346 |
* Renders a box with a link to the support forums for NSU
|
347 |
*/
|
348 |
function support_box() {
|
349 |
$content = '<p>Are you having trouble setting-up ' . $this->shortname . ', experiencing an error or got a great idea on how to improve it?</p><p>Please, post
|
350 |
-
your question or tip in the <a target="_blank" href="http://wordpress.org/tags/' . $this->hook . '">
|
351 |
$this->postbox($this->hook . '-support-box', "Looking for support?", $content);
|
352 |
}
|
353 |
|
@@ -360,9 +266,9 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
360 |
*/
|
361 |
function postbox($id, $title, $content) {
|
362 |
?>
|
363 |
-
<div id="<?php echo $id; ?>" class="
|
364 |
-
|
365 |
-
<h3 class="hndle"
|
366 |
<div class="inside">
|
367 |
<?php echo $content; ?>
|
368 |
</div>
|
200 |
require 'views/config_helper.php';
|
201 |
}
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
/**
|
204 |
* Renders a donate box
|
205 |
*/
|
206 |
function donate_box() {
|
207 |
+
$content = '
|
208 |
+
<p>I spent countless hours developing this plugin for <b>FREE</b>. If you like it, consider donating a token of your appreciation.</p>
|
209 |
+
|
210 |
+
<form id="dvk_donate" action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
211 |
+
<input type="hidden" name="cmd" value="_s-xclick">
|
212 |
+
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhvcNAQcEoIIHSDCCB0QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYC6fx9lo/sj3VITn0dRXZoS1YpT1zy5NYLr2PaIYO22Uu621UovTyJGKw8sW2Rb9rrxPewnGxlGxG4+9BRc90Zr+Un4YwpYiIvtKt+WVDGVoBtg7OScJuIqi7d8v9QZGptBMMB7UL3hPRxpX0lhnY2SJhOH9kU/eICTgQS5bk6lzTELMAkGBSsOAwIaBQAwgdQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIO3CyWPKvJaeAgbDpFEfsNO8gKQeOYlqjpwZqmYU98uH2FWwwcCdtbpmPF55gGPtrxBGktvkRXUZscUP4zdFIffRR3klWS57ZhAPDeaYGf+pH5xsnU5VrbPoWJ4vdjdLx3LBrp/AOgAaKR80pIdlkjOl0Wzt9YCJNitbRW2bZYNJ0FrpB/6837u2oJmPR3JEhCR5EEN9nS8IhAtytp55QzMxHdUdXLiWcBMUc5Zj1QL9Eg6mBcvurKtFTT6CCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwUdO3fxEzEtcnI7ZKZL412XvZPugoni7i7D7prCe0AtaHTc97CYgm7NsAtJyxNLixmhLV8pyIEaiHXWAh8fPKW+R017+EmXrr9EaquPmsVvTywAAE1PMNOKqo2kl4Gxiz9zZqIajOm1fZGWcGS0f5JQ2kBqNbvbg2/Za+GJ/qwUCAwEAAaOB7jCB6zAdBgNVHQ4EFgQUlp98u8ZvF71ZP1LXChvsENZklGswgbsGA1UdIwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTExMTEyMDE1MDU1OFowIwYJKoZIhvcNAQkEMRYEFKUYvFfX67/j6OWp2xNHCzlnvaWtMA0GCSqGSIb3DQEBAQUABIGAmkdQThWqpFg5yey9B7qHAvZRLqejrpGtFoc/XiLFiMGmJbs/IXn7j5VDfGC+J0bAYtX2dnrlSoeDvISHM3aNCOSNiWexwlxBmZG0sYjtcVh/JHfP+Pe7DWG9awUwJPHETMuZxCQaCbpiQETZ8DRfJrWTJjWdasVJBAqHkrnnvvU=-----END PKCS7-----">
|
213 |
+
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
214 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1">
|
215 |
+
</form>
|
216 |
+
|
217 |
+
<p>Or you can: </p>
|
218 |
+
<ul>
|
219 |
+
<li><a href="http://wordpress.org/extend/plugins/newsletter-sign-up/">Give a 5★ rating on WordPress.org</a></li>
|
220 |
+
<li><a href="'.$this->plugin_url.'">Blog about it and link to the plugin page</a></li>
|
221 |
+
<li style="vertical-align:bottom;"><a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$this->plugin_url.'" data-text="Showing my appreciation to @DannyvanKooten for his #WordPress plugin: '.$this->shortname.'" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></li>
|
222 |
+
</ul>';
|
223 |
$this->postbox($this->hook . '-donatebox', 'Donate $10, $20 or $50!', $content);
|
224 |
}
|
225 |
|
239 |
}
|
240 |
$content .= '<li class="dvk-rss"><a href="http://dannyvankooten.com/feed/">Subscribe to my RSS feed</a></li>';
|
241 |
$content .= '<li class="dvk-email"><a href="http://dannyvankooten.com/newsletter/">Subscribe by email</a></li>';
|
242 |
+
$content .= '<li class="dvk-twitter">You should follow me on twitter <a href="http://twitter.com/dannyvankooten">here</a></li>';
|
243 |
$content .= '</ul><br style="clear:both;" />';
|
244 |
} else {
|
245 |
$content = '<p>No updates..</p>';
|
247 |
$this->postbox($this->hook . '-latestpostbox', 'Latest blog posts..', $content);
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
/**
|
252 |
* Renders a box with a link to the support forums for NSU
|
253 |
*/
|
254 |
function support_box() {
|
255 |
$content = '<p>Are you having trouble setting-up ' . $this->shortname . ', experiencing an error or got a great idea on how to improve it?</p><p>Please, post
|
256 |
+
your question or tip in the <a target="_blank" href="http://wordpress.org/tags/' . $this->hook . '">support forums</a> on WordPress.org. This is so that others can benefit from this too.</p>';
|
257 |
$this->postbox($this->hook . '-support-box', "Looking for support?", $content);
|
258 |
}
|
259 |
|
266 |
*/
|
267 |
function postbox($id, $title, $content) {
|
268 |
?>
|
269 |
+
<div id="<?php echo $id; ?>" class="dvk-box">
|
270 |
+
|
271 |
+
<h3 class="hndle"><?php echo $title; ?></h3>
|
272 |
<div class="inside">
|
273 |
<?php echo $content; ?>
|
274 |
</div>
|
backend/css/backend.css
CHANGED
@@ -1,51 +1,23 @@
|
|
1 |
-
.dvk-box
|
2 |
-
|
3 |
-
}
|
|
|
|
|
|
|
4 |
|
5 |
-
.dvk-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
.
|
10 |
-
list-style:
|
11 |
-
|
12 |
-
}
|
13 |
-
.dvk-
|
14 |
-
margin:0;
|
15 |
-
margin-bottom:4px;
|
16 |
-
}
|
17 |
-
li.dvk-rss-item{
|
18 |
-
margin-left:-16px;
|
19 |
-
padding-left:25px;
|
20 |
-
background:url(http://static.dannyvankooten.com/images/dvk-16x16.png) no-repeat left center;
|
21 |
-
list-style:none;
|
22 |
-
}
|
23 |
-
li.dvk-rss{
|
24 |
-
margin-top:10px;
|
25 |
-
margin-left:-16px;
|
26 |
-
float:left;
|
27 |
-
padding-left:25px;
|
28 |
-
background:url(http://static.dannyvankooten.com/images/rss-icon.png) no-repeat left center;
|
29 |
-
list-style:none;
|
30 |
-
}
|
31 |
-
li.dvk-email{
|
32 |
-
margin:10px 0 0 10px;
|
33 |
-
float:left;
|
34 |
-
padding-left:25px;
|
35 |
-
background:url(http://static.dannyvankooten.com/images/email-icon.png) no-repeat left center;
|
36 |
-
list-style:none;
|
37 |
-
}
|
38 |
-
.postbox .inside{
|
39 |
-
padding:0 10px;
|
40 |
-
}
|
41 |
|
42 |
-
.dvk-box b,.dvk-box strong{
|
43 |
-
font-weight:bold;
|
44 |
-
}
|
45 |
|
46 |
-
#ns_settings_page input[type=text]{
|
47 |
-
width:75%;
|
48 |
-
}
|
49 |
|
50 |
span.ns_small{
|
51 |
font-style:italic;
|
@@ -67,5 +39,6 @@ span.ns_small{
|
|
67 |
html,body{ height:auto !important; position:relative; }
|
68 |
.nsu-textarea{ width:100% !important; min-height:150px; }
|
69 |
|
70 |
-
#newsletter-sign-up-donatebox{ border:2px solid
|
71 |
-
#newsletter-sign-up-donatebox h3{
|
|
1 |
+
.dvk-box{ margin-bottom:20px; }
|
2 |
+
.dvk-box h3{ font-family:sans-serif; font-weight:bold; }
|
3 |
+
.dvk-box div.inside{ padding:0 10px 10px; font-size:13px; }
|
4 |
+
.dvk-box p,.dvk-box ul, .dvk-box input{ margin:3px 0 7px; }
|
5 |
+
.dvk-box ul{ list-style:square; margin-left:20px; }
|
6 |
+
.dvk-box li{ margin:0; margin-bottom:4px; }
|
7 |
|
8 |
+
li.dvk-rss-item{ margin-left:-16px; padding-left:25px;
|
9 |
+
background:url(http://static.dannyvankooten.com/images/dvk-16x16.png) no-repeat left center; list-style:none;
|
10 |
+
}
|
11 |
+
li.dvk-rss{ margin-top:10px; margin-left:-16px;
|
12 |
+
float:left; padding-left:25px; background:url("../img/rss-icon.png") no-repeat left center;
|
13 |
+
list-style:none; }
|
14 |
+
li.dvk-email{ margin:10px 0 0 10px; float:left; padding-left:25px; background:url("../img/email-icon.png") no-repeat left center;
|
15 |
+
list-style:none; }
|
16 |
+
li.dvk-twitter{ clear:both; margin:10px 0 0 -16px; float:left; list-style:none; padding-left:25px; background:url("../img/twitter-icon.png") no-repeat left center}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
.dvk-box b,.dvk-box strong{ font-weight:bold; }
|
|
|
|
|
19 |
|
20 |
+
#ns_settings_page input[type=text]{ width:75%; }
|
|
|
|
|
21 |
|
22 |
span.ns_small{
|
23 |
font-style:italic;
|
39 |
html,body{ height:auto !important; position:relative; }
|
40 |
.nsu-textarea{ width:100% !important; min-height:150px; }
|
41 |
|
42 |
+
#newsletter-sign-up-donatebox{ border:2px solid green; background:#CFC; }
|
43 |
+
#newsletter-sign-up-donatebox h3{ color:green; }
|
44 |
+
#newsletter-sign-up-donatebox li{ line-height:22px; }
|
backend/css/donate.css
CHANGED
File without changes
|
backend/css/newsletter-sign-up-backend.css
CHANGED
File without changes
|
backend/img/close.png
CHANGED
File without changes
|
backend/img/email-icon.png
ADDED
Binary file
|
backend/img/icon.png
CHANGED
File without changes
|
backend/img/overlay.png
CHANGED
File without changes
|
backend/img/rss-icon.png
ADDED
Binary file
|
backend/img/twitter-icon.png
ADDED
Binary file
|
backend/js/backend.js
CHANGED
@@ -2,6 +2,7 @@ jQuery(document).ready(function(){
|
|
2 |
|
3 |
var api_rows = jQuery("tbody.api_rows");
|
4 |
var form_rows = jQuery("tbody.form_rows");
|
|
|
5 |
var name_dependent_rows = jQuery('tr.name_dependent');
|
6 |
|
7 |
jQuery("#use_api").change(function(){
|
@@ -13,6 +14,14 @@ jQuery(document).ready(function(){
|
|
13 |
form_rows.show();
|
14 |
}
|
15 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
jQuery("#subscribe_with_name").change(function(){
|
18 |
if(jQuery(this).attr('checked')) {
|
2 |
|
3 |
var api_rows = jQuery("tbody.api_rows");
|
4 |
var form_rows = jQuery("tbody.form_rows");
|
5 |
+
var mc_groupings_rows = jQuery("tbody.mc_groupings_rows");
|
6 |
var name_dependent_rows = jQuery('tr.name_dependent');
|
7 |
|
8 |
jQuery("#use_api").change(function(){
|
14 |
form_rows.show();
|
15 |
}
|
16 |
});
|
17 |
+
|
18 |
+
jQuery("#mc_use_groupings").change(function(){
|
19 |
+
if(jQuery(this).attr('checked')) {
|
20 |
+
mc_groupings_rows.show();
|
21 |
+
} else {
|
22 |
+
mc_groupings_rows.hide();
|
23 |
+
}
|
24 |
+
});
|
25 |
|
26 |
jQuery("#subscribe_with_name").change(function(){
|
27 |
if(jQuery(this).attr('checked')) {
|
backend/js/donate.js
CHANGED
File without changes
|
backend/views/checkbox_settings.php
CHANGED
@@ -87,11 +87,10 @@ if (isset($opts['cookie_hide']) && $opts['cookie_hide'] == '1') {
|
|
87 |
</div>
|
88 |
</div>
|
89 |
</div></div></div></div>
|
90 |
-
<div class="postbox-container" style="width:
|
91 |
<div class="metabox-holder">
|
92 |
<div class="meta-box-sortables">
|
93 |
<?php
|
94 |
-
$this->likebox();
|
95 |
$this->donate_box();
|
96 |
$this->latest_posts();
|
97 |
$this->support_box();
|
87 |
</div>
|
88 |
</div>
|
89 |
</div></div></div></div>
|
90 |
+
<div class="postbox-container" style="width:33%; float:right; margin-right:1%;">
|
91 |
<div class="metabox-holder">
|
92 |
<div class="meta-box-sortables">
|
93 |
<?php
|
|
|
94 |
$this->donate_box();
|
95 |
$this->latest_posts();
|
96 |
$this->support_box();
|
backend/views/config_helper.php
CHANGED
@@ -62,11 +62,10 @@
|
|
62 |
</div>
|
63 |
|
64 |
</div></div></div></div>
|
65 |
-
<div class="postbox-container" style="width:
|
66 |
<div class="metabox-holder">
|
67 |
<div class="meta-box-sortables">
|
68 |
<?php
|
69 |
-
$this->likebox();
|
70 |
$this->donate_box();
|
71 |
$this->latest_posts();
|
72 |
$this->support_box();
|
62 |
</div>
|
63 |
|
64 |
</div></div></div></div>
|
65 |
+
<div class="postbox-container" style="width:33%; float:right; margin-right:1%;">
|
66 |
<div class="metabox-holder">
|
67 |
<div class="meta-box-sortables">
|
68 |
<?php
|
|
|
69 |
$this->donate_box();
|
70 |
$this->latest_posts();
|
71 |
$this->support_box();
|
backend/views/dashboard.php
CHANGED
@@ -34,7 +34,9 @@
|
|
34 |
</select>
|
35 |
</td>
|
36 |
</tr>
|
37 |
-
|
|
|
|
|
38 |
<tbody class="form_rows"<?php if (isset($viewed_mp) && in_array($viewed_mp, array('mailchimp', 'ymlp')) && isset($opts['use_api']) && $opts['use_api'] == 1)
|
39 |
echo ' style="display:none" '; ?>>
|
40 |
<tr valign="top"><th scope="row">Newsletter form action</th>
|
@@ -63,6 +65,7 @@
|
|
63 |
For some newsletter services you need to specify some additional static data, like a list ID or your account name. These fields are usually found as hidden fields in your sign-up form's HTML code.
|
64 |
You can specify these additional fields here using name / value pairs so they will be sent along with every sign-up request.
|
65 |
</p>
|
|
|
66 |
<table class="form-table">
|
67 |
<tr valign="top">
|
68 |
<th scope="column" style="font-weight:bold;">Name</th>
|
@@ -97,15 +100,14 @@ endif;
|
|
97 |
</p>
|
98 |
</div>
|
99 |
</div></div></div></div></div>
|
100 |
-
<div class="postbox-container" style="width:
|
101 |
<div class="metabox-holder">
|
102 |
<div class="meta-box-sortables">
|
103 |
-
<?php
|
104 |
-
$this->
|
105 |
-
$this->
|
106 |
-
$this->
|
107 |
-
|
108 |
-
?>
|
109 |
</div>
|
110 |
</div>
|
111 |
</div>
|
@@ -130,7 +132,7 @@ $this->support_box();
|
|
130 |
|
131 |
</td>
|
132 |
<td>
|
133 |
-
<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo $this->plugin_url; ?>" data-text="Showing my appreciation to @DannyvanKooten for his
|
134 |
</td>
|
135 |
</tr>
|
136 |
</table>
|
34 |
</select>
|
35 |
</td>
|
36 |
</tr>
|
37 |
+
|
38 |
+
<?php if(isset($viewed_mp) && file_exists(dirname(__FILE__).'/rows-' . $viewed_mp . '.php')) require dirname(__FILE__). '/rows-' . $viewed_mp . '.php'; ?>
|
39 |
+
|
40 |
<tbody class="form_rows"<?php if (isset($viewed_mp) && in_array($viewed_mp, array('mailchimp', 'ymlp')) && isset($opts['use_api']) && $opts['use_api'] == 1)
|
41 |
echo ' style="display:none" '; ?>>
|
42 |
<tr valign="top"><th scope="row">Newsletter form action</th>
|
65 |
For some newsletter services you need to specify some additional static data, like a list ID or your account name. These fields are usually found as hidden fields in your sign-up form's HTML code.
|
66 |
You can specify these additional fields here using name / value pairs so they will be sent along with every sign-up request.
|
67 |
</p>
|
68 |
+
<p>If you use <em>%%NAME%%</em> or <em>%%IP%%</em> in the value fields it will be replaced by respectively the actual name or IP address of the subscriber.</p>
|
69 |
<table class="form-table">
|
70 |
<tr valign="top">
|
71 |
<th scope="column" style="font-weight:bold;">Name</th>
|
100 |
</p>
|
101 |
</div>
|
102 |
</div></div></div></div></div>
|
103 |
+
<div class="postbox-container" style="width:33%; float:right; margin-right:1%;">
|
104 |
<div class="metabox-holder">
|
105 |
<div class="meta-box-sortables">
|
106 |
+
<?php
|
107 |
+
$this->donate_box();
|
108 |
+
$this->latest_posts();
|
109 |
+
$this->support_box();
|
110 |
+
?>
|
|
|
111 |
</div>
|
112 |
</div>
|
113 |
</div>
|
132 |
|
133 |
</td>
|
134 |
<td>
|
135 |
+
<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo $this->plugin_url; ?>" data-text="Showing my appreciation to @DannyvanKooten for his awesome #WordPress plugin: <?php echo $this->shortname; ?>" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
|
136 |
</td>
|
137 |
</tr>
|
138 |
</table>
|
backend/views/form_settings.php
CHANGED
@@ -87,11 +87,10 @@
|
|
87 |
</form>
|
88 |
<br style="clear:both;" />
|
89 |
</div></div></div></div></div></div>
|
90 |
-
<div class="postbox-container" style="width:
|
91 |
<div class="metabox-holder">
|
92 |
<div class="meta-box-sortables">
|
93 |
<?php
|
94 |
-
$this->likebox();
|
95 |
$this->donate_box();
|
96 |
$this->latest_posts();
|
97 |
$this->support_box();
|
87 |
</form>
|
88 |
<br style="clear:both;" />
|
89 |
</div></div></div></div></div></div>
|
90 |
+
<div class="postbox-container" style="width:33%; float:right; margin-right:1%;">
|
91 |
<div class="metabox-holder">
|
92 |
<div class="meta-box-sortables">
|
93 |
<?php
|
|
|
94 |
$this->donate_box();
|
95 |
$this->latest_posts();
|
96 |
$this->support_box();
|
backend/views/rows-aweber.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<tr valign="top">
|
2 |
+
<th scope="row">Aweber list name</th>
|
3 |
+
<td><input size="25%" type="text" name="nsu_mailinglist[aweber_list_name]" value="<?php if (isset($opts['aweber_list_name']))
|
4 |
+
echo $opts['aweber_list_name']; ?>" /></td>
|
5 |
+
</tr>
|
backend/views/rows-mailchimp.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<tr valign="top">
|
2 |
+
<th scope="row"><label for="use_api">Use MailChimp API? <span class="ns_small">(recommended)</span></label></th>
|
3 |
+
<td><input type="checkbox" id="use_api" name="nsu_mailinglist[use_api]" value="1"<?php if (isset($opts['use_api']) && $opts['use_api'] == '1') { echo ' checked="checked"'; } ?> /></td>
|
4 |
+
</tr>
|
5 |
+
<tbody class="api_rows" <?php if (!isset($opts['use_api']) || $opts['use_api'] != 1) echo ' style="display:none" '; ?>>
|
6 |
+
<tr valign="top">
|
7 |
+
<th scope="row">MailChimp API Key <a target="_blank" href="http://admin.mailchimp.com/account/api">(?)</a></th>
|
8 |
+
<td><input size="50%" type="text" id="mc_api_key" name="nsu_mailinglist[mc_api_key]" value="<?php if(isset($opts['mc_api_key'])) echo $opts['mc_api_key']; ?>" /></td>
|
9 |
+
</tr>
|
10 |
+
<tr valign="top">
|
11 |
+
<th scope="row">MailChimp List ID <a href="http://www.mailchimp.com/kb/article/how-can-i-find-my-list-id" target="_blank">(?)</a></th>
|
12 |
+
<td><input size="50%" type="text" name="nsu_mailinglist[mc_list_id]" value="<?php if (isset($opts['mc_list_id'])) echo $opts['mc_list_id']; ?>"; /></td>
|
13 |
+
</tr>
|
14 |
+
<tr valign="top">
|
15 |
+
<th scope="row"><label title="Prevents your users from having to confirm their emailaddress. Make sure you comply with the CAN SPAM act." for="mc_prevent_double_optin">Prevent double opt-in?</label></th>
|
16 |
+
<td><input type="checkbox" id="mc_prevent_double_optin" name="nsu_mailinglist[mc_no_double_optin]" value="1"<?php if (isset($opts['mc_no_double_optin']) && $opts['mc_no_double_optin'] == '1') { echo ' checked="checked"'; } ?> /></td>
|
17 |
+
</tr>
|
18 |
+
<tr valign="top">
|
19 |
+
<th scope="row"><label for="mc_use_groupings">Add to group(s)? </label></th>
|
20 |
+
<td><input type="checkbox" id="mc_use_groupings" name="nsu_mailinglist[mc_use_groupings]" value="1"<?php if (isset($opts['mc_use_groupings']) && $opts['mc_use_groupings'] == '1') { echo ' checked="checked"'; } ?> /></td>
|
21 |
+
</tr>
|
22 |
+
<tbody class="mc_groupings_rows" <?php if (!isset($opts['mc_use_groupings']) || $opts['mc_use_groupings'] != 1) echo ' style="display:none" '; ?>>
|
23 |
+
<tr valign="top">
|
24 |
+
<th scope="row">Grouping name</th>
|
25 |
+
<td><input size="50%" type="text" id="mc_groupings_name" name="nsu_mailinglist[mc_groupings_name]" value="<?php if (isset($opts['mc_groupings_name'])) echo $opts['mc_groupings_name']; ?>" /></td>
|
26 |
+
</tr>
|
27 |
+
<tr valign="top">
|
28 |
+
<th scope="row">Groups <small class="nsu_small">(comma delimited list of interest groups to add to)</small></th>
|
29 |
+
<td><input size="50%" type="text" name="nsu_mailinglist[mc_groupings_groups]" value="<?php if (isset($opts['mc_groupings_groups'])) echo $opts['mc_groupings_groups']; ?>"; /></td>
|
30 |
+
</tr>
|
31 |
+
</tbody>
|
32 |
+
</tbody>
|
backend/views/rows-phplist.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<tr valign="top">
|
2 |
+
<th scope="row">PHPList list ID</th>
|
3 |
+
<td><input size="2" type="text" name="nsu_mailinglist[phplist_list_id]" value="<?php
|
4 |
+
if (isset($opts['phplist_list_id'])) {
|
5 |
+
echo $opts['phplist_list_id'];
|
6 |
+
} else {
|
7 |
+
echo 1;
|
8 |
+
};
|
9 |
+
?>" /></td>
|
10 |
+
</tr>
|
backend/views/rows-ymlp.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<tr valign="top"><th scope="row"><label for="use_api">Use the YMLP API? <span class="ns_small">(recommended)</span></label></th>
|
2 |
+
<td><input type="checkbox" id="use_api" name="nsu_mailinglist[use_api]" value="1"<?php
|
3 |
+
if (isset($opts['use_api']) && $opts['use_api'] == '1') {
|
4 |
+
echo ' checked="checked"';
|
5 |
+
}
|
6 |
+
?> /></td>
|
7 |
+
</tr>
|
8 |
+
|
9 |
+
<tbody class="api_rows"<?php if (!isset($opts['use_api']) || $opts['use_api'] != 1)
|
10 |
+
echo ' style="display:none" '; ?>>
|
11 |
+
<tr valign="top"><th scope="row">YMLP API Key <a target="_blank" href="http://www.ymlp.com/app/api.php">(?)</a></th>
|
12 |
+
<td><input size="50%" type="text" id="ymlp_api_key" name="nsu_mailinglist[ymlp_api_key]" value="<?php if (isset($opts['ymlp_api_key']))
|
13 |
+
echo $opts['ymlp_api_key']; ?>" /></td>
|
14 |
+
</tr>
|
15 |
+
<tr valign="top"><th scope="row">YMLP Username</th>
|
16 |
+
<td><input size="50%" type="text" id="ymlp_username" name="nsu_mailinglist[ymlp_username]" value="<?php if (isset($opts['ymlp_username']))
|
17 |
+
echo $opts['ymlp_username']; ?>" /></td>
|
18 |
+
</tr>
|
19 |
+
<tr valign="top"><th scope="row">YMLP GroupID<span class="ns_small">(starts at 1, check URL when 'viewing all contacts' in certain group)</span></th>
|
20 |
+
<td><input size="50%" type="text" id="ymlp_groupid" name="nsu_mailinglist[ymlp_groupid]" value="<?php if (isset($opts['ymlp_groupid']))
|
21 |
+
echo $opts['ymlp_groupid']; ?>" /></td>
|
22 |
+
</tr>
|
23 |
+
</tbody>
|
frontend/NewsletterSignUp.php
CHANGED
@@ -6,7 +6,7 @@ class NewsletterSignUp {
|
|
6 |
private $no_of_forms = 0;
|
7 |
private $showed_checkbox = FALSE;
|
8 |
private static $instance;
|
9 |
-
|
10 |
|
11 |
public function __construct()
|
12 |
{
|
@@ -39,6 +39,24 @@ class NewsletterSignUp {
|
|
39 |
|
40 |
return self::$instance;
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
/**
|
44 |
* Add all the various WP filters and actions
|
@@ -53,22 +71,19 @@ class NewsletterSignUp {
|
|
53 |
add_shortcode('newsletter-sign-up-form',array(&$this,'form_shortcode'));
|
54 |
add_shortcode('nsu-form',array(&$this,'form_shortcode'));
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
$enqueue = false;
|
59 |
// Load CSS to reset the checkbox' position?
|
60 |
if(isset($this->options['checkbox']['css_reset']) && $this->options['checkbox']['css_reset'] == 1) {
|
61 |
-
|
62 |
-
$enqueue = true;
|
63 |
}
|
64 |
// Load CSS to reset label and input fields for the sign-up form?
|
65 |
if(isset($this->options['form']['load_form_css']) && $this->options['form']['load_form_css'] == 1) {
|
66 |
-
|
67 |
-
$enqueue = true;
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
|
73 |
// Add to comment form? If so, add necessary actions. Try to add automatically.
|
74 |
if(isset($this->options['checkbox']['add_to_comment_form']) && $this->options['checkbox']['add_to_comment_form'] == 1) {
|
@@ -105,48 +120,49 @@ class NewsletterSignUp {
|
|
105 |
*/
|
106 |
function check_for_form_submit()
|
107 |
{
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
if(isset($_POST['nsu_submit']))
|
114 |
{
|
115 |
$email = (isset($_POST['nsu_email'])) ? $_POST['nsu_email'] : '';
|
116 |
-
$
|
117 |
|
118 |
-
if(isset($this->options['mailinglist']['subscribe_with_name']) && $this->options['mailinglist']['subscribe_with_name'] == 1 && isset($opts['name_required']) && $opts['name_required'] == 1 && empty($
|
119 |
$errors['name-field'] = 'Please fill in the name field.';
|
120 |
}
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
}
|
127 |
|
128 |
-
|
129 |
-
|
130 |
|
131 |
-
|
132 |
-
|
|
|
|
|
133 |
}
|
134 |
return;
|
135 |
}
|
136 |
|
137 |
|
138 |
/**
|
139 |
-
* Output the checkbox
|
|
|
140 |
*/
|
141 |
public function output_checkbox()
|
142 |
{
|
143 |
-
|
144 |
-
|
|
|
145 |
if(isset($opts['cookie_hide']) && $opts['cookie_hide'] == 1 && isset($_COOKIE['ns_subscriber'])) $this->showed_checkbox = TRUE;
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
|
151 |
?>
|
152 |
<p id="ns-checkbox">
|
@@ -158,7 +174,7 @@ class NewsletterSignUp {
|
|
158 |
<?php
|
159 |
|
160 |
$this->showed_checkbox = true;
|
161 |
-
|
162 |
}
|
163 |
|
164 |
/**
|
@@ -183,7 +199,7 @@ class NewsletterSignUp {
|
|
183 |
/**
|
184 |
* Send the post data to the newsletter service, mimic form request
|
185 |
*/
|
186 |
-
function send_post_data($email, $
|
187 |
{
|
188 |
$opts = $this->options['mailinglist'];
|
189 |
// when not using api and no form action has been given, abandon.
|
@@ -203,8 +219,13 @@ class NewsletterSignUp {
|
|
203 |
$request_uri .= "&Username=" . $opts['ymlp_username'];
|
204 |
$request_uri .= "&Email=" . $email;
|
205 |
$request_uri .= "&GroupID=" . $opts['ymlp_groupid'];
|
206 |
-
$request_uri .= $this->add_additional_data(array('format' => 'query_string', 'api' => 'ymlp'));
|
207 |
$result = wp_remote_get($request_uri);
|
|
|
|
|
|
|
|
|
|
|
208 |
break;
|
209 |
|
210 |
/* Send data using the MailChimp API */
|
@@ -213,28 +234,37 @@ class NewsletterSignUp {
|
|
213 |
'apikey' => $opts['mc_api_key'],
|
214 |
'id' => $opts['mc_list_id'],
|
215 |
'email_address' => $email,
|
216 |
-
'double_optin' => TRUE,
|
217 |
'merge_vars' => array(
|
218 |
'OPTIN_TIME' => date('Y-M-D H:i:s')
|
219 |
)
|
220 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
/* Subscribe with name? If so, add name to merge_vars array */
|
223 |
if(isset($opts['subscribe_with_name']) && $opts['subscribe_with_name'] == 1) {
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
$request['merge_vars'][$opts['name_id']] = $
|
229 |
}
|
230 |
// Add any set additional data to merge_vars array
|
231 |
-
$request['merge_vars'] = array_merge($request['merge_vars']
|
232 |
|
233 |
$result = wp_remote_post(
|
234 |
'http://'.substr($opts['mc_api_key'],-3).'.api.mailchimp.com/1.3/?output=php&method=listSubscribe',
|
235 |
array( 'body' => json_encode($request))
|
236 |
-
);
|
237 |
-
|
|
|
|
|
|
|
238 |
|
239 |
break;
|
240 |
|
@@ -248,7 +278,7 @@ class NewsletterSignUp {
|
|
248 |
);
|
249 |
|
250 |
// Subscribe with name? Add to $post_data array.
|
251 |
-
if(isset($opts['subscribe_with_name']) && $opts['subscribe_with_name'] == 1) $post_data[$opts['name_id']] = $
|
252 |
|
253 |
// Add list specific data
|
254 |
switch($opts['provider']) {
|
@@ -264,33 +294,38 @@ class NewsletterSignUp {
|
|
264 |
$post_data['list['.$opts['phplist_list_id'].']'] = 'signup';
|
265 |
$post_data['subscribe'] = "Subscribe";
|
266 |
$post_data["htmlemail"] = "1";
|
267 |
-
$post_data['emailconfirm'] = $
|
268 |
$post_data['makeconfirmed']='0';
|
269 |
break;
|
270 |
|
271 |
}
|
272 |
|
273 |
-
$post_data = array_merge($post_data
|
274 |
|
275 |
$result = wp_remote_post($opts['form_action'],
|
276 |
array( 'body' => $post_data )
|
277 |
);
|
|
|
|
|
|
|
|
|
278 |
|
279 |
}
|
280 |
|
281 |
// store a cookie, if preferred by site owner
|
282 |
if(isset($opts['cookie_hide']) && $opts['cookie_hide'] == 1) @setcookie('ns_subscriber',TRUE,time() + 9999999);
|
283 |
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
|
293 |
}
|
|
|
294 |
|
295 |
/**
|
296 |
* Returns array with additional data names as key, values as value.
|
@@ -298,20 +333,23 @@ class NewsletterSignUp {
|
|
298 |
*/
|
299 |
function add_additional_data($args = array())
|
300 |
{
|
301 |
-
|
302 |
$defaults = array(
|
303 |
'format' => 'array',
|
304 |
'api' => NULL
|
305 |
);
|
306 |
|
307 |
$args = wp_parse_args( $args, $defaults );
|
308 |
-
|
309 |
if($args['format'] == 'query_string') {
|
310 |
|
311 |
$add_data = "";
|
312 |
if(isset($opts['extra_data']) && is_array($opts['extra_data'])) {
|
313 |
foreach($opts['extra_data'] as $key => $value) {
|
314 |
-
if($args['api'] == 'ymlp') $value['name'] = str_replace('YMP','Field'
|
|
|
|
|
|
|
315 |
$add_data .= "&".$value['name']."=".$value['value'];
|
316 |
}
|
317 |
}
|
@@ -321,10 +359,12 @@ class NewsletterSignUp {
|
|
321 |
$add_data = array();
|
322 |
if(isset($opts['extra_data']) && is_array($opts['extra_data'])) {
|
323 |
foreach($opts['extra_data'] as $key => $value) {
|
|
|
|
|
324 |
$add_data[$value['name']] = $value['value'];
|
325 |
}
|
326 |
}
|
327 |
-
|
328 |
return $add_data;
|
329 |
}
|
330 |
|
@@ -348,10 +388,10 @@ class NewsletterSignUp {
|
|
348 |
/**
|
349 |
* Perform the sign-up for users that registered trough a MultiSite register form
|
350 |
* This function differs because of the need to grab the emailadress from the user using get_userdata
|
351 |
-
|
352 |
* @param int $user_id The ID of the new user
|
353 |
* @param $a No idea, seriously.
|
354 |
-
|
355 |
* @param array $meta The meta values that belong to this user, holds the value of our 'newsletter-sign-up' checkbox.
|
356 |
*/
|
357 |
function grab_email_from_ms_blog_signup($blog_id, $user_id, $a, $b ,$meta){
|
@@ -360,9 +400,9 @@ class NewsletterSignUp {
|
|
360 |
$user_info = get_userdata($user_id);
|
361 |
|
362 |
$email = $user_info->user_email;
|
363 |
-
$
|
364 |
|
365 |
-
$this->send_post_data($email,$
|
366 |
}
|
367 |
|
368 |
/**
|
@@ -376,17 +416,17 @@ class NewsletterSignUp {
|
|
376 |
|
377 |
// gather emailadress from user who WordPress registered
|
378 |
$email = $_POST['user_email'];
|
379 |
-
$
|
380 |
|
381 |
} elseif(isset($_POST['signup_email'])) {
|
382 |
|
383 |
// gather emailadress from user who BuddyPress registered
|
384 |
$email = $_POST['signup_email'];
|
385 |
-
$
|
386 |
|
387 |
} else { return; }
|
388 |
|
389 |
-
$this->send_post_data($email,$
|
390 |
}
|
391 |
|
392 |
/**
|
@@ -407,9 +447,9 @@ class NewsletterSignUp {
|
|
407 |
if($comment->comment_karma != 0) return;
|
408 |
|
409 |
$email = $comment->comment_author_email;
|
410 |
-
$
|
411 |
|
412 |
-
$this->send_post_data($email
|
413 |
}
|
414 |
|
415 |
/**
|
@@ -431,7 +471,7 @@ class NewsletterSignUp {
|
|
431 |
*/
|
432 |
public function output_form($echo = true)
|
433 |
{
|
434 |
-
|
435 |
$opts = $this->options;
|
436 |
$additional_fields = '';
|
437 |
$output = '';
|
@@ -442,7 +482,7 @@ class NewsletterSignUp {
|
|
442 |
/* Set up form variables for API usage or normal form */
|
443 |
if(isset($opts['mailinglist']['use_api']) && $opts['mailinglist']['use_api'] == 1) {
|
444 |
|
445 |
-
/* Using API, send form request to
|
446 |
$form_action = "";
|
447 |
$email_id = 'nsu_email';
|
448 |
$name_id = 'nsu_name';
|
@@ -459,22 +499,27 @@ class NewsletterSignUp {
|
|
459 |
|
460 |
}
|
461 |
|
462 |
-
|
|
|
463 |
if(isset($opts['mailinglist']['extra_data']) && is_array($opts['mailinglist']['extra_data'])) :
|
|
|
464 |
foreach($opts['mailinglist']['extra_data'] as $ed) :
|
|
|
|
|
465 |
$additional_fields .= "<input type=\"hidden\" name=\"{$ed['name']}\" value=\"{$ed['value']}\" />";
|
466 |
endforeach;
|
|
|
467 |
endif;
|
468 |
|
469 |
$email_label = (!empty($opts['form']['email_label'])) ? $opts['form']['email_label'] : 'E-mail:';
|
470 |
$name_label = (!empty($opts['form']['name_label'])) ? $opts['form']['name_label'] : 'Name:';
|
471 |
|
472 |
-
|
473 |
-
|
474 |
|
475 |
$submit_button = (!empty($opts['form']['submit_button'])) ? $opts['form']['submit_button'] : __('Sign-Up');
|
476 |
|
477 |
-
|
478 |
$text_after_signup = (isset($opts['form']['wpautop']) && $opts['form']['wpautop'] == 1) ? wpautop(wptexturize($text_after_signup)) : $text_after_signup;
|
479 |
|
480 |
|
@@ -483,14 +528,18 @@ class NewsletterSignUp {
|
|
483 |
|
484 |
$output .= "<form class=\"nsu-form\" id=\"nsu-form-$formno\" action=\"$form_action\" method=\"post\">";
|
485 |
if(isset($opts['mailinglist']['subscribe_with_name']) && $opts['mailinglist']['subscribe_with_name'] == 1) {
|
486 |
-
$output .= "<p><label for=\"nsu-name-$formno\">$name_label</label><input class=\"nsu-field\" id=\"nsu-name-$formno\" type=\"text\" name=\"$name_id\" value=\"$name_value\"
|
487 |
-
|
488 |
-
|
|
|
|
|
489 |
}
|
490 |
|
491 |
-
$output .= "<p><label for=\"nsu-email-$formno\">$email_label</label><input class=\"nsu-field\" id=\"nsu-email-$formno\" type=\"text\" name=\"$email_id\" value=\"$email_value\"
|
492 |
-
|
493 |
-
|
|
|
|
|
494 |
$output .= $additional_fields;
|
495 |
$output .= "<p><input type=\"submit\" id=\"nsu-submit-$formno\" class=\"nsu-submit\" name=\"nsu_submit\" value=\"$submit_button\" /></p>";
|
496 |
$output .= "</form>";
|
@@ -505,7 +554,7 @@ class NewsletterSignUp {
|
|
505 |
echo $output;
|
506 |
}
|
507 |
|
508 |
-
|
509 |
|
510 |
}
|
511 |
}
|
6 |
private $no_of_forms = 0;
|
7 |
private $showed_checkbox = FALSE;
|
8 |
private static $instance;
|
9 |
+
private $validation_errors = array();
|
10 |
|
11 |
public function __construct()
|
12 |
{
|
39 |
|
40 |
return self::$instance;
|
41 |
}
|
42 |
+
|
43 |
+
public function enqueue_styles()
|
44 |
+
{
|
45 |
+
// Build stylesheet url --------------
|
46 |
+
$stylesheet_opts = '?';
|
47 |
+
|
48 |
+
// Load CSS to reset the checkbox' position?
|
49 |
+
if(isset($this->options['checkbox']['css_reset']) && $this->options['checkbox']['css_reset'] == 1) {
|
50 |
+
$stylesheet_opts .= 'checkbox_reset=1&';
|
51 |
+
}
|
52 |
+
|
53 |
+
// Load CSS to reset label and input fields for the sign-up form?
|
54 |
+
if(isset($this->options['form']['load_form_css']) && $this->options['form']['load_form_css'] == 1) {
|
55 |
+
$stylesheet_opts .= 'form_css=1&';
|
56 |
+
}
|
57 |
+
|
58 |
+
wp_enqueue_style('ns_checkbox_style', plugins_url("/frontend/css/newsletter-sign-up.php$stylesheet_opts", dirname(__FILE__)));
|
59 |
+
}
|
60 |
|
61 |
/**
|
62 |
* Add all the various WP filters and actions
|
71 |
add_shortcode('newsletter-sign-up-form',array(&$this,'form_shortcode'));
|
72 |
add_shortcode('nsu-form',array(&$this,'form_shortcode'));
|
73 |
|
74 |
+
$enqueue = false;
|
75 |
+
|
|
|
76 |
// Load CSS to reset the checkbox' position?
|
77 |
if(isset($this->options['checkbox']['css_reset']) && $this->options['checkbox']['css_reset'] == 1) {
|
78 |
+
$enqueue = true;
|
|
|
79 |
}
|
80 |
// Load CSS to reset label and input fields for the sign-up form?
|
81 |
if(isset($this->options['form']['load_form_css']) && $this->options['form']['load_form_css'] == 1) {
|
82 |
+
$enqueue = true;
|
|
|
83 |
}
|
84 |
|
85 |
+
// Only enqueue stylesheet if asked to by user.
|
86 |
+
if($enqueue) { add_action('wp_enqueue_scripts', array(&$this, 'enqueue_styles')); }
|
87 |
|
88 |
// Add to comment form? If so, add necessary actions. Try to add automatically.
|
89 |
if(isset($this->options['checkbox']['add_to_comment_form']) && $this->options['checkbox']['add_to_comment_form'] == 1) {
|
120 |
*/
|
121 |
function check_for_form_submit()
|
122 |
{
|
123 |
+
$opts = $this->options['form'];
|
124 |
+
$errors = array();
|
|
|
|
|
125 |
|
126 |
if(isset($_POST['nsu_submit']))
|
127 |
{
|
128 |
$email = (isset($_POST['nsu_email'])) ? $_POST['nsu_email'] : '';
|
129 |
+
$name = (isset($_POST['nsu_name'])) ? $_POST['nsu_name'] : '';
|
130 |
|
131 |
+
if(isset($this->options['mailinglist']['subscribe_with_name']) && $this->options['mailinglist']['subscribe_with_name'] == 1 && isset($opts['name_required']) && $opts['name_required'] == 1 && empty($name)) {
|
132 |
$errors['name-field'] = 'Please fill in the name field.';
|
133 |
}
|
134 |
|
135 |
+
if(empty($email)) {
|
136 |
+
$errors['email-field'] = 'Please fill in the email address field.';
|
137 |
+
} elseif(!is_email($email)) {
|
138 |
+
$errors['email-field'] = 'Please enter a valid email address.';
|
139 |
}
|
140 |
|
141 |
+
$this->validation_errors = $errors;
|
|
|
142 |
|
143 |
+
if(count($this->validation_errors) == 0) {
|
144 |
+
$this->send_post_data($email,$name,'form');
|
145 |
+
}
|
146 |
+
|
147 |
}
|
148 |
return;
|
149 |
}
|
150 |
|
151 |
|
152 |
/**
|
153 |
+
* Output the checkbox
|
154 |
+
* Function can only run once.
|
155 |
*/
|
156 |
public function output_checkbox()
|
157 |
{
|
158 |
+
$opts = $this->options['checkbox'];
|
159 |
+
|
160 |
+
// If using option to hide checkbox for subscribers and cookie is set, set instance variable showed_checkbox to true so checkbox won't show.
|
161 |
if(isset($opts['cookie_hide']) && $opts['cookie_hide'] == 1 && isset($_COOKIE['ns_subscriber'])) $this->showed_checkbox = TRUE;
|
162 |
|
163 |
+
// User could have rendered the checkbox by manually adding 'the hook 'ns_comment_checkbox()' to their comment form
|
164 |
+
// If so, abandon function.
|
165 |
+
if($this->showed_checkbox) return false;
|
166 |
|
167 |
?>
|
168 |
<p id="ns-checkbox">
|
174 |
<?php
|
175 |
|
176 |
$this->showed_checkbox = true;
|
177 |
+
return true;
|
178 |
}
|
179 |
|
180 |
/**
|
199 |
/**
|
200 |
* Send the post data to the newsletter service, mimic form request
|
201 |
*/
|
202 |
+
function send_post_data($email, $name = '', $type = 'checkbox')
|
203 |
{
|
204 |
$opts = $this->options['mailinglist'];
|
205 |
// when not using api and no form action has been given, abandon.
|
219 |
$request_uri .= "&Username=" . $opts['ymlp_username'];
|
220 |
$request_uri .= "&Email=" . $email;
|
221 |
$request_uri .= "&GroupID=" . $opts['ymlp_groupid'];
|
222 |
+
$request_uri .= $this->add_additional_data(array('format' => 'query_string', 'api' => 'ymlp', 'email' => $email, 'name' => $name));
|
223 |
$result = wp_remote_get($request_uri);
|
224 |
+
|
225 |
+
if(isset($_POST['_nsu_debug']) || isset($_GET['_nsu_debug'])) {
|
226 |
+
var_dump($result); die();
|
227 |
+
}
|
228 |
+
|
229 |
break;
|
230 |
|
231 |
/* Send data using the MailChimp API */
|
234 |
'apikey' => $opts['mc_api_key'],
|
235 |
'id' => $opts['mc_list_id'],
|
236 |
'email_address' => $email,
|
237 |
+
'double_optin' => (isset($opts['mc_no_double_optin']) && $opts['mc_no_double_optin'] == 1) ? FALSE : TRUE,
|
238 |
'merge_vars' => array(
|
239 |
'OPTIN_TIME' => date('Y-M-D H:i:s')
|
240 |
)
|
241 |
);
|
242 |
+
|
243 |
+
if(isset($opts['mc_use_groupings']) && $opts['mc_use_groupings'] == 1 && !empty($opts['mc_groupings_name'])) {
|
244 |
+
$request['merge_vars']['GROUPINGS'] = array(
|
245 |
+
array( 'name' => $opts['mc_groupings_name'], 'groups' => $opts['mc_groupings_groups'] )
|
246 |
+
);
|
247 |
+
}
|
248 |
|
249 |
/* Subscribe with name? If so, add name to merge_vars array */
|
250 |
if(isset($opts['subscribe_with_name']) && $opts['subscribe_with_name'] == 1) {
|
251 |
+
// Try to provide values for First and Lastname fields
|
252 |
+
// These can be overridden, of just ignored by mailchimp.
|
253 |
+
$request['merge_vars']['FNAME'] = substr($name, 0, strpos($name,' '));
|
254 |
+
$request['merge_vars']['LNAME'] = substr($name,strpos($name,' '));
|
255 |
+
$request['merge_vars'][$opts['name_id']] = $name;
|
256 |
}
|
257 |
// Add any set additional data to merge_vars array
|
258 |
+
$request['merge_vars'] = array_merge($request['merge_vars'], $this->add_additional_data(array('email' => $email, 'name' => $name)));
|
259 |
|
260 |
$result = wp_remote_post(
|
261 |
'http://'.substr($opts['mc_api_key'],-3).'.api.mailchimp.com/1.3/?output=php&method=listSubscribe',
|
262 |
array( 'body' => json_encode($request))
|
263 |
+
);
|
264 |
+
|
265 |
+
if(isset($_POST['_nsu_debug']) || isset($_GET['_nsu_debug'])) {
|
266 |
+
var_dump($result); die();
|
267 |
+
}
|
268 |
|
269 |
break;
|
270 |
|
278 |
);
|
279 |
|
280 |
// Subscribe with name? Add to $post_data array.
|
281 |
+
if(isset($opts['subscribe_with_name']) && $opts['subscribe_with_name'] == 1) $post_data[$opts['name_id']] = $name;
|
282 |
|
283 |
// Add list specific data
|
284 |
switch($opts['provider']) {
|
294 |
$post_data['list['.$opts['phplist_list_id'].']'] = 'signup';
|
295 |
$post_data['subscribe'] = "Subscribe";
|
296 |
$post_data["htmlemail"] = "1";
|
297 |
+
$post_data['emailconfirm'] = $email;
|
298 |
$post_data['makeconfirmed']='0';
|
299 |
break;
|
300 |
|
301 |
}
|
302 |
|
303 |
+
$post_data = array_merge($post_data, $this->add_additional_data(array_merge(array('email' => $email, 'name' => $name), $post_data)));
|
304 |
|
305 |
$result = wp_remote_post($opts['form_action'],
|
306 |
array( 'body' => $post_data )
|
307 |
);
|
308 |
+
|
309 |
+
if(isset($_POST['_nsu_debug']) || isset($_GET['_nsu_debug'])) {
|
310 |
+
var_dump($result); die();
|
311 |
+
}
|
312 |
|
313 |
}
|
314 |
|
315 |
// store a cookie, if preferred by site owner
|
316 |
if(isset($opts['cookie_hide']) && $opts['cookie_hide'] == 1) @setcookie('ns_subscriber',TRUE,time() + 9999999);
|
317 |
|
318 |
+
// Check if we should redirect to a given page
|
319 |
+
if($type == 'form' && isset($this->options['form']['redirect_to']) && strlen($this->options['form']['redirect_to']) > 6) {
|
320 |
+
wp_redirect( $this->options['form']['redirect_to']);
|
321 |
+
exit;
|
322 |
+
} elseif($type == 'checkbox' && isset($this->options['checkbox']['redirect_to']) && strlen($this->options['checkbox']['redirect_to']) > 6) {
|
323 |
+
wp_redirect( $this->options['checkbox']['redirect_to']);
|
324 |
+
exit;
|
325 |
+
}
|
326 |
|
327 |
}
|
328 |
+
|
329 |
|
330 |
/**
|
331 |
* Returns array with additional data names as key, values as value.
|
333 |
*/
|
334 |
function add_additional_data($args = array())
|
335 |
{
|
336 |
+
$opts = $this->options['mailinglist'];
|
337 |
$defaults = array(
|
338 |
'format' => 'array',
|
339 |
'api' => NULL
|
340 |
);
|
341 |
|
342 |
$args = wp_parse_args( $args, $defaults );
|
343 |
+
|
344 |
if($args['format'] == 'query_string') {
|
345 |
|
346 |
$add_data = "";
|
347 |
if(isset($opts['extra_data']) && is_array($opts['extra_data'])) {
|
348 |
foreach($opts['extra_data'] as $key => $value) {
|
349 |
+
if($args['api'] == 'ymlp') $value['name'] = str_replace('YMP','Field', $value['name']);
|
350 |
+
|
351 |
+
$value['value'] = str_replace("%%NAME%%", $args['name'], $value['value']);
|
352 |
+
$value['value'] = str_replace("%%IP%%", $_SERVER['REMOTE_ADDR'], $value['value']);
|
353 |
$add_data .= "&".$value['name']."=".$value['value'];
|
354 |
}
|
355 |
}
|
359 |
$add_data = array();
|
360 |
if(isset($opts['extra_data']) && is_array($opts['extra_data'])) {
|
361 |
foreach($opts['extra_data'] as $key => $value) {
|
362 |
+
$value['value'] = str_replace("%%NAME%%", $args['name'], $value['value']);
|
363 |
+
$value['value'] = str_replace("%%IP%%", $_SERVER['REMOTE_ADDR'], $value['value']);
|
364 |
$add_data[$value['name']] = $value['value'];
|
365 |
}
|
366 |
}
|
367 |
+
|
368 |
return $add_data;
|
369 |
}
|
370 |
|
388 |
/**
|
389 |
* Perform the sign-up for users that registered trough a MultiSite register form
|
390 |
* This function differs because of the need to grab the emailadress from the user using get_userdata
|
391 |
+
* @param int $blog_id The id of the new blow
|
392 |
* @param int $user_id The ID of the new user
|
393 |
* @param $a No idea, seriously.
|
394 |
+
* @param $b No idea, seriously.
|
395 |
* @param array $meta The meta values that belong to this user, holds the value of our 'newsletter-sign-up' checkbox.
|
396 |
*/
|
397 |
function grab_email_from_ms_blog_signup($blog_id, $user_id, $a, $b ,$meta){
|
400 |
$user_info = get_userdata($user_id);
|
401 |
|
402 |
$email = $user_info->user_email;
|
403 |
+
$name = $user_info->first_name;
|
404 |
|
405 |
+
$this->send_post_data($email,$name);
|
406 |
}
|
407 |
|
408 |
/**
|
416 |
|
417 |
// gather emailadress from user who WordPress registered
|
418 |
$email = $_POST['user_email'];
|
419 |
+
$name = $_POST['user_login'];
|
420 |
|
421 |
} elseif(isset($_POST['signup_email'])) {
|
422 |
|
423 |
// gather emailadress from user who BuddyPress registered
|
424 |
$email = $_POST['signup_email'];
|
425 |
+
$name = $_POST['signup_username'];
|
426 |
|
427 |
} else { return; }
|
428 |
|
429 |
+
$this->send_post_data($email,$name);
|
430 |
}
|
431 |
|
432 |
/**
|
447 |
if($comment->comment_karma != 0) return;
|
448 |
|
449 |
$email = $comment->comment_author_email;
|
450 |
+
$name = $comment->comment_author;
|
451 |
|
452 |
+
$this->send_post_data($email, $name);
|
453 |
}
|
454 |
|
455 |
/**
|
471 |
*/
|
472 |
public function output_form($echo = true)
|
473 |
{
|
474 |
+
$errors = $this->validation_errors;
|
475 |
$opts = $this->options;
|
476 |
$additional_fields = '';
|
477 |
$output = '';
|
482 |
/* Set up form variables for API usage or normal form */
|
483 |
if(isset($opts['mailinglist']['use_api']) && $opts['mailinglist']['use_api'] == 1) {
|
484 |
|
485 |
+
/* Using API, send form request to ANY page */
|
486 |
$form_action = "";
|
487 |
$email_id = 'nsu_email';
|
488 |
$name_id = 'nsu_name';
|
499 |
|
500 |
}
|
501 |
|
502 |
+
/* Set up additional fields */
|
503 |
+
|
504 |
if(isset($opts['mailinglist']['extra_data']) && is_array($opts['mailinglist']['extra_data'])) :
|
505 |
+
$additional_fields = '<div class="hidden">';
|
506 |
foreach($opts['mailinglist']['extra_data'] as $ed) :
|
507 |
+
if($ed['value'] == '%%NAME%%') continue;
|
508 |
+
$ed['value'] = str_replace("%%IP%%", $_SERVER['REMOTE_ADDR'], $ed['value']);
|
509 |
$additional_fields .= "<input type=\"hidden\" name=\"{$ed['name']}\" value=\"{$ed['value']}\" />";
|
510 |
endforeach;
|
511 |
+
$additional_fields .= "</div>";
|
512 |
endif;
|
513 |
|
514 |
$email_label = (!empty($opts['form']['email_label'])) ? $opts['form']['email_label'] : 'E-mail:';
|
515 |
$name_label = (!empty($opts['form']['name_label'])) ? $opts['form']['name_label'] : 'Name:';
|
516 |
|
517 |
+
$email_value = (!empty($opts['form']['email_default_value'])) ? $opts['form']['email_default_value'] : '';
|
518 |
+
$name_value = (!empty($opts['form']['name_default_value'])) ? $opts['form']['name_default_value'] : '';
|
519 |
|
520 |
$submit_button = (!empty($opts['form']['submit_button'])) ? $opts['form']['submit_button'] : __('Sign-Up');
|
521 |
|
522 |
+
$text_after_signup = (!empty($opts['form']['text_after_signup'])) ? $opts['form']['text_after_signup'] : 'Thanks for signing up to our newsletter. Please check your inbox to confirm your email address.';
|
523 |
$text_after_signup = (isset($opts['form']['wpautop']) && $opts['form']['wpautop'] == 1) ? wpautop(wptexturize($text_after_signup)) : $text_after_signup;
|
524 |
|
525 |
|
528 |
|
529 |
$output .= "<form class=\"nsu-form\" id=\"nsu-form-$formno\" action=\"$form_action\" method=\"post\">";
|
530 |
if(isset($opts['mailinglist']['subscribe_with_name']) && $opts['mailinglist']['subscribe_with_name'] == 1) {
|
531 |
+
$output .= "<p><label for=\"nsu-name-$formno\">$name_label</label><input class=\"nsu-field\" id=\"nsu-name-$formno\" type=\"text\" name=\"$name_id\" value=\"$name_value\" ";
|
532 |
+
if($name_value) $output .= "onblur=\"if(!this.value) this.value = '$name_value';\" onfocus=\"if(this.value == '$name_value') this.value=''\" ";
|
533 |
+
$output .= "/>";
|
534 |
+
if(isset($errors['name-field'])) $output .= '<span class="nsu-error error notice">'.$errors['name-field'].'</span>';
|
535 |
+
$output .= "</p>";
|
536 |
}
|
537 |
|
538 |
+
$output .= "<p><label for=\"nsu-email-$formno\">$email_label</label><input class=\"nsu-field\" id=\"nsu-email-$formno\" type=\"text\" name=\"$email_id\" value=\"$email_value\" ";
|
539 |
+
if($email_value) $output .= "onblur=\"if(!this.value) this.value = '$email_value';\" onfocus=\"if(this.value == '$email_value') this.value = ''\" ";
|
540 |
+
$output .= "/>";
|
541 |
+
if(isset($errors['email-field'])) $output .= '<span class="nsu-error error notice">'.$errors['email-field'].'</span>';
|
542 |
+
$output .= "</p>";
|
543 |
$output .= $additional_fields;
|
544 |
$output .= "<p><input type=\"submit\" id=\"nsu-submit-$formno\" class=\"nsu-submit\" name=\"nsu_submit\" value=\"$submit_button\" /></p>";
|
545 |
$output .= "</form>";
|
554 |
echo $output;
|
555 |
}
|
556 |
|
557 |
+
return $output;
|
558 |
|
559 |
}
|
560 |
}
|
frontend/NewsletterSignUpWidget.php
CHANGED
@@ -83,8 +83,8 @@ if(!class_exists('NewsletterSignUpWidget')) {
|
|
83 |
<p>
|
84 |
You can further configure the sign-up form at the <a href="admin.php?page=newsletter-sign-up/form-settings">Newsletter Sign-Up configuration page</a>.
|
85 |
</p>
|
86 |
-
|
87 |
-
|
88 |
<?php
|
89 |
}
|
90 |
|
83 |
<p>
|
84 |
You can further configure the sign-up form at the <a href="admin.php?page=newsletter-sign-up/form-settings">Newsletter Sign-Up configuration page</a>.
|
85 |
</p>
|
86 |
+
|
87 |
+
<p style="border: 2px solid green; background: #CFC; padding:5px; ">I spent countless hours developing this plugin for FREE (unlike many other Newsletter plugins). If you like it, consider <a href="http://dannyvankooten.com/donate/">donating $10, $20 or $50</a> as a token of your appreciation.</p>
|
88 |
<?php
|
89 |
}
|
90 |
|
frontend/css/newsletter-sign-up.php
CHANGED
@@ -2,10 +2,8 @@
|
|
2 |
|
3 |
if (isset($_GET['checkbox_reset']) && $_GET['checkbox_reset'] == 1) { ?>
|
4 |
p#ns-checkbox{ clear:both; display:block; }
|
5 |
-
|
6 |
-
#ns-checkbox
|
7 |
-
|
8 |
-
#ns-checkbox label{ display:inline-block; }
|
9 |
<?php }
|
10 |
if (isset($_GET['form_css']) && $_GET['form_css'] == 1) { ?>
|
11 |
.nsu-form { margin:10px 0; }
|
@@ -13,7 +11,7 @@ if (isset($_GET['form_css']) && $_GET['form_css'] == 1) { ?>
|
|
13 |
.nsu-form p,.nsu-text-before-form,.nsu-text-after-form{ clear:both; display:block; margin:5px 0; }
|
14 |
.nsu-text-before-form ul,nsu-text-after-form ul,.nsu-text-before-form ol,nsu-text-after-form ol{ margin-left:15px; }
|
15 |
|
16 |
-
.nsu-form label{display:block; font-weight:bold; }
|
17 |
.nsu-form input{ padding:2px; display:block; color:#999; }
|
18 |
.nsu-form input:focus, .nsu-form input:active{ color:#000; }
|
19 |
|
2 |
|
3 |
if (isset($_GET['checkbox_reset']) && $_GET['checkbox_reset'] == 1) { ?>
|
4 |
p#ns-checkbox{ clear:both; display:block; }
|
5 |
+
p#ns-checkbox input{ margin:0 5px 0 0; display:inline-block; width:13px; height:13px; }
|
6 |
+
p#ns-checkbox label{ display:inline-block; }
|
|
|
|
|
7 |
<?php }
|
8 |
if (isset($_GET['form_css']) && $_GET['form_css'] == 1) { ?>
|
9 |
.nsu-form { margin:10px 0; }
|
11 |
.nsu-form p,.nsu-text-before-form,.nsu-text-after-form{ clear:both; display:block; margin:5px 0; }
|
12 |
.nsu-text-before-form ul,nsu-text-after-form ul,.nsu-text-before-form ol,nsu-text-after-form ol{ margin-left:15px; }
|
13 |
|
14 |
+
.nsu-form label{ display:block; font-weight:bold; }
|
15 |
.nsu-form input{ padding:2px; display:block; color:#999; }
|
16 |
.nsu-form input:focus, .nsu-form input:active{ color:#000; }
|
17 |
|
newsletter-sign-up.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Newsletter Sign-Up
|
4 |
Plugin URI: http://DannyvanKooten.com/wordpress-plugins/newsletter-sign-up/
|
5 |
Description: Adds various ways for your visitors to sign-up to your mailinglist (checkbox, widget, form)
|
6 |
-
Version: 1.
|
7 |
Author: Danny van Kooten
|
8 |
Author URI: http://DannyvanKooten.com
|
9 |
License: GPL2
|
@@ -25,14 +25,6 @@ License: GPL2
|
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
28 |
-
/*
|
29 |
-
TO DO
|
30 |
-
|
31 |
-
* Add %%NAME%% to use in additional data
|
32 |
-
* Add %%IP%% to use in additional data
|
33 |
-
|
34 |
-
*/
|
35 |
-
|
36 |
require('frontend/NewsletterSignUpWidget.php');
|
37 |
require('frontend/NewsletterSignUp.php');
|
38 |
|
3 |
Plugin Name: Newsletter Sign-Up
|
4 |
Plugin URI: http://DannyvanKooten.com/wordpress-plugins/newsletter-sign-up/
|
5 |
Description: Adds various ways for your visitors to sign-up to your mailinglist (checkbox, widget, form)
|
6 |
+
Version: 1.7.9
|
7 |
Author: Danny van Kooten
|
8 |
Author URI: http://DannyvanKooten.com
|
9 |
License: GPL2
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
require('frontend/NewsletterSignUpWidget.php');
|
29 |
require('frontend/NewsletterSignUp.php');
|
30 |
|
readme.txt
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
=== Plugin Name ===
|
2 |
Contributors: DvanKooten
|
3 |
Donate link: http://dannyvankooten.com/donate/
|
4 |
-
Tags: newsletter,sign-up,mailchimp,aweber,newsletter signup,checkbox,ymlp,email,
|
5 |
Requires at least: 2.7
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
-
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
= Newsletter Sign-Up =
|
14 |
|
15 |
-
Boost your mailinglist size with this newsletter plugin! This plugin adds various ways for your visitors to subscribe to your third-party newsletter
|
16 |
-
|
|
|
17 |
|
18 |
This plugin currently supports the following newsletter providers but is not limited to those: MailChimp, YMLP, Aweber, iContact, PHPList, Feedblitz.
|
19 |
You can practically use the plugin for EVERY newsletter provider that's around if you use the right configuration settings.
|
20 |
|
21 |
**Features:**
|
22 |
|
23 |
-
* Add a "sign-up to our newsletter" checkbox to your comment form or register form (including
|
24 |
-
*
|
25 |
-
* Embed a
|
26 |
* Embed a sign-up form in your template files by calling `nsu_signup_form();`
|
27 |
* Use the MailChimp or YMLP API or any other third party newsletter provider.
|
28 |
* Works with most major mailinglist services because of the form mimicing feature.
|
@@ -30,9 +31,9 @@ You can practically use the plugin for EVERY newsletter provider that's around i
|
|
30 |
|
31 |
**More info:**
|
32 |
|
33 |
-
* [Newsletter Sign-Up](http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/)
|
34 |
-
* Check out more [WordPress plugins](http://dannyvankooten.com/wordpress-plugins/) by
|
35 |
-
* [
|
36 |
|
37 |
= "Sign me up" checkbox =
|
38 |
One of the things NSU does is adding a "Sign me up to your newsletter checkbox" to your comment and registration forms. Most visitors who care to comment are willing to subscribe to your newsletter too.
|
@@ -57,7 +58,7 @@ tool will then analyze it and try to extract the right values for you.
|
|
57 |
|
58 |
1. Upload the contents of newsletter-sign-up.zip to your plugins directory.
|
59 |
1. Activate the plugin
|
60 |
-
1. Specify your newsletter service settings. For more info head over to: [
|
61 |
1. That's all. Watch your list grow!
|
62 |
1. Optional: Install [WYSIWYG Widgets](http://dannyvankooten.com/wordpress-plugins/wysiwyg-widgets/) if you want to be able to easily edit the widget's form text.
|
63 |
|
@@ -108,6 +109,44 @@ For more questions and answers go have a look at my website regarding [Newslette
|
|
108 |
|
109 |
== Changelog ==
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
= 1.6.1 =
|
112 |
* Fixed notice on frontend when e-mail field not filled in
|
113 |
* Fixed provided values for First and Lastname field for MailChimp when using both.
|
1 |
=== Plugin Name ===
|
2 |
Contributors: DvanKooten
|
3 |
Donate link: http://dannyvankooten.com/donate/
|
4 |
+
Tags: newsletter,sign-up,mailchimp,aweber,newsletter signup,checkbox,ymlp,email,phplist,icontact,mailinglist,checkbox,form widget,widget,newsletter widget,subscribe widget,form shortcode,mailchimp api
|
5 |
Requires at least: 2.7
|
6 |
+
Tested up to: 3.5
|
7 |
+
Stable tag: 1.7.9
|
8 |
|
9 |
+
The ultimate Newsletter plugin! Works with third-party newsletter services like MailChimp. Sign-up checkboxes, widget forms, shortcodes, it's all in there.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
= Newsletter Sign-Up =
|
14 |
|
15 |
+
Boost your mailinglist size with this newsletter plugin! This plugin adds various ways for your visitors to subscribe to your third-party newsletter. Newsletter Sign-Up is most known for it's "Sign-up to our newsletter" checkbox at the WordPress comment form.
|
16 |
+
|
17 |
+
**Notice for MailChimp users**: consider using [MailChimp for WordPress](http://wordpress.org/plugins/mailchimp-for-wp/), my newer plugin.
|
18 |
|
19 |
This plugin currently supports the following newsletter providers but is not limited to those: MailChimp, YMLP, Aweber, iContact, PHPList, Feedblitz.
|
20 |
You can practically use the plugin for EVERY newsletter provider that's around if you use the right configuration settings.
|
21 |
|
22 |
**Features:**
|
23 |
|
24 |
+
* Add a "sign-up to our newsletter" checkbox to your comment form or register form (including BP and MS)
|
25 |
+
* Easy customizable Newsletter Sign-Up Widget
|
26 |
+
* Embed a sign-up form in your posts with a simple shortcode `[newsletter-sign-up-form]`.
|
27 |
* Embed a sign-up form in your template files by calling `nsu_signup_form();`
|
28 |
* Use the MailChimp or YMLP API or any other third party newsletter provider.
|
29 |
* Works with most major mailinglist services because of the form mimicing feature.
|
31 |
|
32 |
**More info:**
|
33 |
|
34 |
+
* [Newsletter Sign-Up for WordPress](http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/)
|
35 |
+
* Check out more [WordPress plugins](http://dannyvankooten.com/wordpress-plugins/) by Danny van Kooten
|
36 |
+
* You should follow [Danny on Twitter](http://twitter.com/DannyvanKooten) for lightning fast support and updates.
|
37 |
|
38 |
= "Sign me up" checkbox =
|
39 |
One of the things NSU does is adding a "Sign me up to your newsletter checkbox" to your comment and registration forms. Most visitors who care to comment are willing to subscribe to your newsletter too.
|
58 |
|
59 |
1. Upload the contents of newsletter-sign-up.zip to your plugins directory.
|
60 |
1. Activate the plugin
|
61 |
+
1. Specify your newsletter service settings. For more info head over to: [Newsletter Sign-Up for WordPress](http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/)
|
62 |
1. That's all. Watch your list grow!
|
63 |
1. Optional: Install [WYSIWYG Widgets](http://dannyvankooten.com/wordpress-plugins/wysiwyg-widgets/) if you want to be able to easily edit the widget's form text.
|
64 |
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 1.7.9 =
|
113 |
+
* Improved CSS Reset for comment checkbox
|
114 |
+
|
115 |
+
= 1.7.8 =
|
116 |
+
* Improved enqueue call to load stylesheet on frontend
|
117 |
+
* Fixed notice after submitting widget form (undefined variable $name)
|
118 |
+
* Fixed %%IP%% value in widget form
|
119 |
+
* Added debugging option. When `_nsu_debug` is in the POST or GET data it will echo the result of the sign-up request.
|
120 |
+
|
121 |
+
= 1.7.7 =
|
122 |
+
* Improved Improved HTML output for forms
|
123 |
+
* Improved code indentation
|
124 |
+
* Added OnBlur attribute to form input's. Default value now reappears after losing focus (while empty).
|
125 |
+
* Added replacement value's for additional data (`%%NAME%%` and `%%IP%%`)
|
126 |
+
|
127 |
+
= 1.7.6 =
|
128 |
+
* Fixed: The plugin now works with PHPList again. Thanks ryanjlaw.
|
129 |
+
|
130 |
+
= 1.7.5 =
|
131 |
+
* Fixed: Hidden inputs are now wrapped by a block element too, so the form output validates as XHTML 1.0 STRICT.
|
132 |
+
|
133 |
+
= 1.7.4 =
|
134 |
+
* Added: Ability to turn off double opt-in (MailChimp API users only).
|
135 |
+
* Improved: Various CSS improvements
|
136 |
+
|
137 |
+
= 1.7.3 =
|
138 |
+
* Fixed: Actual fix for previous two plugin updates. My bad, sorry everone.
|
139 |
+
|
140 |
+
= 1.7.2 =
|
141 |
+
* Fixed: Bug after submitting comment or registration form.
|
142 |
+
|
143 |
+
= 1.7.1 =
|
144 |
+
* Fixed: Bug where you coudln't configure mailinglist specific settings (like MC API).
|
145 |
+
|
146 |
+
= 1.7 =
|
147 |
+
* Added: add subscribers to certain interest group(s) (limited to 1 grouping at the moment). (MailChimp API users only)
|
148 |
+
* Improvement: Slightly better code readability
|
149 |
+
|
150 |
= 1.6.1 =
|
151 |
* Fixed notice on frontend when e-mail field not filled in
|
152 |
* Fixed provided values for First and Lastname field for MailChimp when using both.
|
screenshot-1.jpg
CHANGED
File without changes
|
screenshot-2.jpg
CHANGED
File without changes
|
screenshot-3.jpg
CHANGED
File without changes
|