Newsletter Sign-Up - Version 1.6.1

Version Description

  • Fixed notice on frontend when e-mail field not filled in
  • Fixed provided values for First and Lastname field for MailChimp when using both.
Download this release

Release Info

Developer DvanKooten
Plugin Icon wp plugin Newsletter Sign-Up
Version 1.6.1
Comparing to
See all releases

Version 1.6.1

backend/NewsletterSignUpAdmin.php ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!class_exists('NewsletterSignUpAdmin')) {
3
+
4
+ class NewsletterSignUpAdmin {
5
+
6
+ private $hook = 'newsletter-sign-up';
7
+ private $longname = 'Newsletter Sign-Up';
8
+ private $shortname = 'Newsletter Sign-Up';
9
+ private $plugin_url = 'http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/';
10
+ private $filename = 'newsletter-sign-up/newsletter-sign-up.php';
11
+ private $accesslvl = 'manage_options';
12
+ private $icon_url = '';
13
+ private $bp_active = FALSE;
14
+ private $actions = array();
15
+
16
+ function __construct() {
17
+
18
+ // If coming from older version of NSU, transfer settings to work with new settings architecture.
19
+ $this->transfer_settings();
20
+
21
+ $this->icon_url = plugins_url('/backend/img/icon.png', dirname(__FILE__));
22
+
23
+ add_filter("plugin_action_links_{$this->filename}", array(&$this, 'add_settings_link'));
24
+ add_action('admin_menu', array(&$this, 'add_option_page'));
25
+ add_action('admin_init', array(&$this, 'settings_init'));
26
+
27
+ // add dashboard widget hook
28
+ add_action('wp_dashboard_setup', array(&$this, 'widget_setup'));
29
+
30
+ // register function to remove options upon deactivation
31
+ register_deactivation_hook($this->filename, array(&$this, 'remove_options'));
32
+
33
+
34
+ /* Only do stuff on admin page of this plugin */
35
+ if (isset($_GET['page']) && stripos($_GET['page'], $this->hook) !== FALSE) {
36
+ add_action("admin_print_styles", array(&$this, 'add_admin_styles'));
37
+ add_action("admin_print_scripts", array(&$this, 'add_admin_scripts'));
38
+ }
39
+
40
+
41
+ add_action('bp_include', array(&$this, 'set_bp_active'));
42
+ }
43
+
44
+ /**
45
+ * If buddypress is loaded, set buddypress_active to TRUE
46
+ */
47
+ function set_bp_active() {
48
+ $this->bp_active = TRUE;
49
+ }
50
+
51
+ /**
52
+ * Enqueue the necessary stylesheets
53
+ */
54
+ function add_admin_styles() {
55
+ wp_enqueue_style($this->hook . '_css', plugins_url('/backend/css/backend.css', dirname(__FILE__)));
56
+ }
57
+
58
+ /**
59
+ * Enqueue the necessary admin scripts
60
+ */
61
+ function add_admin_scripts() {
62
+ wp_enqueue_script(array('jquery', 'dashboard', 'postbox'));
63
+ wp_enqueue_script('ns_admin_js', plugins_url('/backend/js/backend.js', dirname(__FILE__)));
64
+ }
65
+
66
+ /**
67
+ * The default settings page
68
+ */
69
+ function options_page_default() {
70
+ $opts = get_option('nsu_mailinglist');
71
+
72
+ $viewed_mp = NULL;
73
+ if (!empty($_GET['mp']))
74
+ $viewed_mp = $_GET['mp'];
75
+ elseif (empty($_GET['mp']) && isset($opts['provider']))
76
+ $viewed_mp = $opts['provider'];
77
+ if (!in_array($viewed_mp, array('mailchimp', 'icontact', 'aweber', 'phplist', 'ymlp', 'other')))
78
+ $viewed_mp = NULL;
79
+
80
+ // Fill in some predefined values if options not set or set for other newsletter service
81
+ if (!isset($opts['provider']) || $opts['provider'] != $viewed_mp) {
82
+ switch ($viewed_mp) {
83
+
84
+ case 'mailchimp':
85
+ if (empty($opts['email_id']))
86
+ $opts['email_id'] = 'EMAIL';
87
+ if (empty($opts['name_id']))
88
+ $opts['name_id'] = 'NAME';
89
+ break;
90
+
91
+ case 'ymlp':
92
+ if (empty($opts['email_id']))
93
+ $opts['email_id'] = 'YMP0';
94
+ break;
95
+
96
+ case 'aweber':
97
+ if (empty($opts['form_action']))
98
+ $opts['form_action'] = 'http://www.aweber.com/scripts/addlead.pl';
99
+ if (empty($opts['email_id']))
100
+ $opts['email_id'] = 'email';
101
+ if (empty($opts['name_id']))
102
+ $opts['name_id'] = 'name';
103
+ break;
104
+
105
+ case 'icontact':
106
+ if (empty($opts['email_id']))
107
+ $opts['email_id'] = 'fields_email';
108
+ break;
109
+ }
110
+ }
111
+
112
+ require 'views/dashboard.php';
113
+ }
114
+
115
+ /**
116
+ * The admin page for managing checkbox settings
117
+ */
118
+ function options_page_checkbox_settings() {
119
+ $opts = get_option('nsu_checkbox');
120
+ require 'views/checkbox_settings.php';
121
+ }
122
+
123
+ /**
124
+ * The admin page for managing form settings
125
+ */
126
+ function options_page_form_settings() {
127
+ $opts = get_option('nsu_form');
128
+ $opts['mailinglist'] = get_option('nsu_mailinglist');
129
+ require 'views/form_settings.php';
130
+ }
131
+
132
+ /**
133
+ * The page for the configuration extractor
134
+ */
135
+ function options_page_config_helper() {
136
+
137
+ if (isset($_POST['form'])) {
138
+ $error = true;
139
+
140
+ $form = $_POST['form'];
141
+
142
+ // strip unneccessary tags
143
+ $form = strip_tags($form, '<form><input><button>');
144
+
145
+
146
+ preg_match_all("'<(.*?)>'si", $form, $matches);
147
+
148
+ if (is_array($matches) && isset($matches[0])) {
149
+ $matches = $matches[0];
150
+ $html = stripslashes(join('', $matches));
151
+
152
+ $clean_form = htmlspecialchars(str_replace(array('><', '<input'), array(">\n<", "\t<input"), $html), ENT_NOQUOTES);
153
+
154
+ $doc = new DOMDocument();
155
+ $doc->strictErrorChecking = FALSE;
156
+ $doc->loadHTML($html);
157
+ $xml = simplexml_import_dom($doc);
158
+
159
+ if ($xml) {
160
+ $result = true;
161
+ $form = $xml->body->form;
162
+
163
+ if ($form) {
164
+ unset($error);
165
+ $form_action = (isset($form['action'])) ? $form['action'] : 'Can\'t help you on this one..';
166
+
167
+ if ($form->input) {
168
+
169
+ $additional_data = array();
170
+
171
+ /* Loop trough input fields */
172
+ foreach ($form->input as $input) {
173
+
174
+ // Check if this is a hidden field
175
+ if ($input['type'] == 'hidden') {
176
+ $additional_data[] = array($input['name'], $input['value']);
177
+ // Check if this is the input field that is supposed to hold the EMAIL data
178
+ } elseif (stripos($input['id'], 'email') !== FALSE || stripos($input['name'], 'email') !== FALSE) {
179
+ $email_identifier = $input['name'];
180
+
181
+ // Check if this is the input field that is supposed to hold the NAME data
182
+ } elseif (stripos($input['id'], 'name') !== FALSE || stripos($input['name'], 'name') !== FALSE) {
183
+ $name_identifier = $input['name'];
184
+ }
185
+ }
186
+ }
187
+ }
188
+
189
+
190
+
191
+ // Correct value's
192
+ if (!isset($email_identifier))
193
+ $email_identifier = 'Can\'t help you on this one..';
194
+ if (!isset($name_identifier))
195
+ $name_identifier = 'Can\'t help you on this one. Not using name data?';
196
+ }
197
+ }
198
+ }
199
+
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 = '<p>This plugin cost me countless hours of work. If you use it, please donate a token of your appreciation!</p>
296
+ <center>
297
+ <form id="dvk_donate" action="https://www.paypal.com/cgi-bin/webscr" method="post">
298
+ <input type="hidden" name="cmd" value="_s-xclick">
299
+ <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhvcNAQcEoIIHSDCCB0QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYC6fx9lo/sj3VITn0dRXZoS1YpT1zy5NYLr2PaIYO22Uu621UovTyJGKw8sW2Rb9rrxPewnGxlGxG4+9BRc90Zr+Un4YwpYiIvtKt+WVDGVoBtg7OScJuIqi7d8v9QZGptBMMB7UL3hPRxpX0lhnY2SJhOH9kU/eICTgQS5bk6lzTELMAkGBSsOAwIaBQAwgdQGCSqGSIb3DQEHATA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AJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTExMTEyMDE1MDU1OFowIwYJKoZIhvcNAQkEMRYEFKUYvFfX67/j6OWp2xNHCzlnvaWtMA0GCSqGSIb3DQEBAQUABIGAmkdQThWqpFg5yey9B7qHAvZRLqejrpGtFoc/XiLFiMGmJbs/IXn7j5VDfGC+J0bAYtX2dnrlSoeDvISHM3aNCOSNiWexwlxBmZG0sYjtcVh/JHfP+Pe7DWG9awUwJPHETMuZxCQaCbpiQETZ8DRfJrWTJjWdasVJBAqHkrnnvvU=-----END PKCS7-----
300
+ ">
301
+ <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!">
302
+ <img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1">
303
+ </form>
304
+
305
+ </center>';
306
+ $this->postbox($this->hook . '-donatebox', 'Donate $10, $20 or $50!', $content);
307
+ }
308
+
309
+ /**
310
+ * Renders a box with the latests posts from DannyvanKooten.com
311
+ */
312
+ function latest_posts() {
313
+ require_once(ABSPATH . WPINC . '/rss.php');
314
+ if ($rss = fetch_rss('http://feeds.feedburner.com/dannyvankooten')) {
315
+ $content = '<ul>';
316
+ $rss->items = array_slice($rss->items, 0, 5);
317
+
318
+ foreach ((array) $rss->items as $item) {
319
+ $content .= '<li class="dvk-rss-item">';
320
+ $content .= '<a target="_blank" href="' . clean_url($item['link'], $protocolls = null, 'display') . '">' . $item['title'] . '</a> ';
321
+ $content .= '</li>';
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>';
328
+ }
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 . '">Support forums</a> on WordPress.org</p>';
351
+ $this->postbox($this->hook . '-support-box', "Looking for support?", $content);
352
+ }
353
+
354
+ /**
355
+ * Output's the necessary HTML formatting for a postbox
356
+ *
357
+ * @param string $id
358
+ * @param string $title
359
+ * @param string $content
360
+ */
361
+ function postbox($id, $title, $content) {
362
+ ?>
363
+ <div id="<?php echo $id; ?>" class="postbox dvk-box">
364
+ <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br></div>
365
+ <h3 class="hndle"><span><?php echo $title; ?></span></h3>
366
+ <div class="inside">
367
+ <?php echo $content; ?>
368
+ </div>
369
+ </div>
370
+ <?php
371
+ }
372
+
373
+ /**
374
+ * Renders the DvK.com dashboard widget on the admin homepage.
375
+ */
376
+ function dashboard_widget() {
377
+ $options = get_option('dvkdbwidget');
378
+ if (isset($_POST['dvk_removedbwidget'])) {
379
+ $options['dontshow'] = true;
380
+ update_option('dvkdbwidget', $options);
381
+ }
382
+
383
+ if (isset($options['dontshow']) && $options['dontshow']) {
384
+ echo "If you reload, this widget will be gone and never appear again, unless you decide to delete the database option 'dvkdbwidget'.";
385
+ return;
386
+ }
387
+
388
+ require_once(ABSPATH . WPINC . '/rss.php');
389
+ if ($rss = fetch_rss('http://feeds.feedburner.com/dannyvankooten')) {
390
+ echo '<div class="rss-widget">';
391
+ echo '<a href="http://dannyvankooten.com/" title="Go to DannyvanKooten.com"><img src="http://static.dannyvankooten.com/images/dvk-64x64.png" class="alignright" alt="DannyvanKooten.com"/></a>';
392
+ echo '<ul>';
393
+ $rss->items = array_slice($rss->items, 0, 3);
394
+ foreach ((array) $rss->items as $item) {
395
+ echo '<li>';
396
+ echo '<a target="_blank" class="rsswidget" href="' . clean_url($item['link'], $protocolls = null, 'display') . '">' . $item['title'] . '</a> ';
397
+ echo '<span class="rss-date">' . date('F j, Y', strtotime($item['pubdate'])) . '</span>';
398
+ echo '<div class="rssSummary">' . $this->text_limit($item['summary'], 250) . '</div>';
399
+ echo '</li>';
400
+ }
401
+ echo '</ul>';
402
+ echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
403
+ echo '<a target="_blank" style="margin-right:10px;" href="http://feeds.feedburner.com/dannyvankooten"><img src="' . get_bloginfo('wpurl') . '/wp-includes/images/rss.png" alt=""/> Subscribe by RSS</a>';
404
+ echo '<a target="_blank" href="http://dannyvankooten.com/newsletter/"><img src="http://static.dannyvankooten.com/images/email-icon.png" alt=""/> Subscribe by email</a>';
405
+ echo '<form class="alignright" method="post"><input type="hidden" name="dvk_removedbwidget" value="true"/><input title="Remove this widget" type="submit" value=" X "/></form>';
406
+ echo '</div>';
407
+ echo '</div>';
408
+ }
409
+ }
410
+
411
+ /**
412
+ * Function that is hooked, adds the DvK.com dashboard widget.
413
+ */
414
+ function widget_setup() {
415
+ $options = get_option('dvkdbwidget');
416
+ if (!$options['dontshow'])
417
+ wp_add_dashboard_widget('dvk_db_widget', 'Latest posts on DannyvanKooten.com', array(&$this, 'dashboard_widget'));
418
+ }
419
+
420
+ function text_limit($text, $limit, $finish = '...') {
421
+ if (strlen($text) > $limit) {
422
+ $text = substr($text, 0, $limit);
423
+ $text = substr($text, 0, - ( strlen(strrchr($text, ' ')) ));
424
+ $text .= $finish;
425
+ }
426
+ return $text;
427
+ }
428
+
429
+ /**
430
+ * Adds the different menu pages
431
+ */
432
+ function add_option_page() {
433
+ add_menu_page($this->longname, "Newsl. Sign-up", $this->accesslvl, $this->hook, array(&$this, 'options_page_default'), $this->icon_url);
434
+ add_submenu_page($this->hook, "Newsletter Sign-Up :: Mailinglist Settings", "List Settings", $this->accesslvl, $this->hook, array($this, 'options_page_default'));
435
+ add_submenu_page($this->hook, "Newsletter Sign-Up :: Checkbox Settings", "Checkbox Settings", $this->accesslvl, $this->hook . '/checkbox-settings', array($this, 'options_page_checkbox_settings'));
436
+ add_submenu_page($this->hook, "Newsletter Sign-Up :: Form Settings", "Form Settings", $this->accesslvl, $this->hook . '/form-settings', array($this, 'options_page_form_settings'));
437
+ add_submenu_page($this->hook, "Newsletter Sign-Up :: Configuration Extractor", "Config Extractor", $this->accesslvl, $this->hook . '/config-helper', array($this, 'options_page_config_helper'));
438
+ }
439
+
440
+ /**
441
+ * Adds the settings link on the plugin's overview page
442
+ * @param array $links Array containing all the settings links for the various plugins.
443
+ * @return array The new array containing all the settings links
444
+ */
445
+ function add_settings_link($links) {
446
+ $settings_link = '<a href="admin.php?page=' . $this->hook . '">Settings</a>';
447
+ array_unshift($links, $settings_link);
448
+ return $links;
449
+ }
450
+
451
+ /**
452
+ * Check how long the plugin has been used
453
+ * If used for over 30 days, show a pop-up asking for a tweet or donation.
454
+ */
455
+ function check_usage_time() {
456
+ $opts = get_option('nsu');
457
+ if (isset($_GET['dontshowpopup']) && $_GET['dontshowpopup'] == 1) {
458
+ $opts['dontshowpopup'] = 1;
459
+ update_option('nsu', $opts);
460
+ }
461
+ if (!isset($opts['date_installed'])) {
462
+ // set installed_time to now, so we can show pop-up in 30 days
463
+ $opts['date_installed'] = strtotime('now');
464
+ update_option('nsu', $opts);
465
+ } elseif ((!isset($opts['dontshowpopup']) || $opts['dontshowpopup'] != 1) && $opts['date_installed'] < strtotime('-30 days')) {
466
+ // plugin has been installed for over 30 days
467
+ $this->actions['show_donate_box'] = true;
468
+ wp_enqueue_style('dvk_donate', plugins_url('/backend/css/donate.css', dirname(__FILE__)));
469
+ wp_enqueue_script('dvk_donate', plugins_url('/backend/js/donate.js', dirname(__FILE__)));
470
+ }
471
+ }
472
+
473
+ /**
474
+ * Registers the settings using WP Settings API.
475
+ */
476
+ function settings_init() {
477
+ register_setting('nsu_group', 'nsu', array(&$this, 'validate_options'));
478
+ register_setting('nsu_form_group', 'nsu_form', array(&$this, 'validate_form_options'));
479
+ register_setting('nsu_mailinglist_group', 'nsu_mailinglist', array(&$this, 'validate_mailinglist_options'));
480
+ register_setting('nsu_checkbox_group', 'nsu_checkbox', array(&$this, 'validate_checkbox_options'));
481
+ }
482
+
483
+ /**
484
+ * Transfer settings from old optionname for backwards compatibility
485
+ */
486
+ private function transfer_settings() {
487
+ if (($old_options = get_option('ns_options')) != false && get_option('nsu') == false) {
488
+
489
+ $nsu = array(
490
+ 'date_installed' => (isset($old_options['date_installed'])) ? $old_options['date_installed'] : strtotime('now'),
491
+ 'dontshowpopup' => (isset($old_options['dontshowpopup'])) ? $old_options['dontshowpopup'] : 0,
492
+ 'load_widget_styles' => (isset($old_options['load_widget_styles'])) ? $old_options['load_widget_styles'] : 0
493
+ );
494
+
495
+ // new form option holder
496
+ $nsu_form = $old_options['form'];
497
+
498
+ // new checkbox option holder
499
+ $nsu_checkbox = array(
500
+ 'text' => (isset($old_options['checkbox_text'])) ? $old_options['checkbox_text'] : 'Sign me up for the newsletter.',
501
+ 'precheck' => (isset($old_options['precheck_checkbox'])) ? $old_options['precheck_checkbox'] : 0,
502
+ 'add_to_comment_form' => (isset($old_options['add_to_comment_form'])) ? $old_options['add_to_comment_form'] : 0,
503
+ 'add_to_registration_form' => (isset($old_options['add_to_reg_form'])) ? $old_options['add_to_reg_form'] : 0,
504
+ 'add_to_buddypress_form' => (isset($old_options['add_to_bp_form'])) ? $old_options['add_to_bp_form'] : 0,
505
+ 'add_to_multisite_form' => (isset($old_options['add_to_ms_form'])) ? $old_options['add_to_ms_form'] : 0,
506
+ 'css_reset' => (isset($old_options['do_css_reset'])) ? $old_options['do_css_reset'] : 0,
507
+ 'cookie_hide' => (isset($old_options['cookie_hide'])) ? $old_options['cookie_hide'] : 0,
508
+ );
509
+
510
+ $nsu_mailinglist = array(
511
+ 'provider' => (isset($old_options['email_service'])) ? $old_options['email_service'] : '',
512
+ 'use_api' => (isset($old_options['use_api'])) ? $old_options['use_api'] : 0,
513
+ 'mc_api_key' => (isset($old_options['api_key'])) ? $old_options['api_key'] : '',
514
+ 'mc_list_id' => (isset($old_options['list_id'])) ? $old_options['list_id'] : '',
515
+ 'ymlp_api_key' => (isset($old_options['ymlp_api_key'])) ? $old_options['ymlp_api_key'] : '',
516
+ 'ymlp_username' => (isset($old_options['ymlp_username'])) ? $old_options['ymlp_username'] : '',
517
+ 'ymlp_groupid' => (isset($old_options['ymlp_groupid'])) ? $old_options['ymlp_groupid'] : '',
518
+ 'aweber_list_name' => (isset($old_options['aweber_list_name'])) ? $old_options['aweber_list_name'] : '',
519
+ 'phplist_list_id' => (isset($old_options['phplist_list_id'])) ? $old_options['phplist_list_id'] : '',
520
+ 'form_action' => (isset($old_options['form_action'])) ? $old_options['form_action'] : '',
521
+ 'email_id' => (isset($old_options['email_id'])) ? $old_options['email_id'] : '',
522
+ 'subscribe_with_name' => (isset($old_options['subscribe_with_name'])) ? $old_options['subscribe_with_name'] : 0,
523
+ 'name_id' => (isset($old_options['name_id'])) ? $old_options['name_id'] : '',
524
+ 'extra_data' => $old_options['extra_data']
525
+ );
526
+
527
+ delete_option('nsu');
528
+ delete_option('nsu_form');
529
+ delete_option('nsu_checkbox');
530
+ delete_option('nsu_mailinglist');
531
+
532
+ add_option('nsu', $nsu);
533
+ add_option('nsu_form', $nsu_form);
534
+ add_option('nsu_checkbox', $nsu_checkbox);
535
+ add_option('nsu_mailinglist', $nsu_mailinglist);
536
+
537
+ //delete_option('ns_options');
538
+ }
539
+ }
540
+
541
+ /**
542
+ * Removes the options from database, this function is hooked to deactivation of NSU.
543
+ */
544
+ function remove_options() {
545
+ // old option name
546
+ delete_option('ns_options');
547
+
548
+ // new option names
549
+ delete_option('nsu');
550
+ delete_option('nsu_form');
551
+ delete_option('nsu_checkbox');
552
+ delete_option('nsu_mailinglist');
553
+ }
554
+
555
+ /**
556
+ * Validate the submitted options
557
+ * @param array $options The submitted options
558
+ */
559
+ public function validate_options($options) {
560
+ return $options;
561
+ }
562
+
563
+ public function validate_form_options($options) {
564
+ $options['text_after_signup'] = strip_tags($options['text_after_signup'], '<a><b><strong><i><img><em><br><p><ul><li><ol>');
565
+
566
+ // redirect to url should start with http
567
+ if(isset($options['redirect_to']) && substr($options['redirect_to'],0,4) != 'http') {
568
+ $options['redirect_to'] = '';
569
+ }
570
+
571
+ return $options;
572
+ }
573
+
574
+ public function validate_mailinglist_options($options) {
575
+ if (is_array($options['extra_data'])) {
576
+ foreach ($options['extra_data'] as $key => $value) {
577
+ if (empty($value['name']))
578
+ unset($options['extra_data'][$key]);
579
+ }
580
+ }
581
+
582
+ return $options;
583
+ }
584
+
585
+ public function validate_checkbox_options($options) {
586
+ return $options;
587
+ }
588
+
589
+ }
590
+
591
+ }
backend/css/backend.css ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .dvk-box div.inside{
2
+ padding:10px;
3
+ }
4
+
5
+ .dvk-box p,.dvk-box ul{
6
+ margin:0;
7
+ margin-bottom:5px;
8
+ }
9
+ .dvk-box ul{
10
+ list-style:square;
11
+ margin-left:20px;
12
+ }
13
+ .dvk-box li{
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;
52
+ font-size:10px;
53
+ display:block;
54
+ margin:2px 0;
55
+ }
56
+
57
+ #dvk-avatar{
58
+ vertical-align:top;
59
+ margin-right:10px;
60
+ display:inline-block;
61
+ height:32px;
62
+ width:32px;
63
+ background:url(http://static.dannyvankooten.com/images/dvk-avatar.png) no-repeat;
64
+ }
65
+
66
+ .nsu-tip{ font-size: 11px; font-style:italic; }
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 #0099ff; }
71
+ #newsletter-sign-up-donatebox h3{ font-weight:bold; color:#0099ff; }
backend/css/donate.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #dvk-donate-box{
2
+ display:none;
3
+ background:url(../img/overlay.png);
4
+ position:absolute;
5
+ left:0; top:0;
6
+ width:100%;
7
+ height:100%;
8
+ z-index:999;
9
+ }
10
+
11
+ #dvk-donate-box-content{
12
+ position:fixed;
13
+ left:50%;
14
+ top:50%;
15
+ width:300px;
16
+ height:220px;
17
+ padding:10px 25px;
18
+ margin-left:-175px;
19
+ margin-top:-135px;
20
+ background:white;
21
+ border:1px solid #DFDFDF;
22
+ -moz-border-radius: 6px;
23
+ -khtml-border-radius: 6px;
24
+ -webkit-border-radius: 6px;
25
+ border-radius: 6px;
26
+ }
27
+
28
+ #dvk-donate-box img.dvk-close{
29
+ position:absolute;
30
+ right:10px; top:10px;
31
+ cursor:pointer;
32
+ }
33
+ #dvk-donate-box a.dvk-dontshow{
34
+ font-size:10px;
35
+ position:absolute;
36
+ right:10px;
37
+ bottom:10px;
38
+ }
backend/css/newsletter-sign-up-backend.css ADDED
File without changes
backend/img/close.png ADDED
Binary file
backend/img/icon.png ADDED
Binary file
backend/img/overlay.png ADDED
Binary file
backend/js/backend.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 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(){
8
+ if(jQuery(this).attr('checked')) {
9
+ api_rows.show();
10
+ form_rows.hide();
11
+ } else {
12
+ api_rows.hide();
13
+ form_rows.show();
14
+ }
15
+ });
16
+
17
+ jQuery("#subscribe_with_name").change(function(){
18
+ if(jQuery(this).attr('checked')) {
19
+ name_dependent_rows.show();
20
+ } else {
21
+ name_dependent_rows.hide();
22
+ }
23
+ });
24
+
25
+ });
backend/js/donate.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('#dvk-donate-box').fadeIn();
3
+
4
+ jQuery('img.dvk-close').click(function() {
5
+ jQuery('#dvk-donate-box').fadeOut();
6
+ });
7
+ });
backend/views/checkbox_settings.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap" id="<?php echo $this->hook; ?>">
2
+ <h2><a href="http://dannyvankooten.com/" target="_blank"><span id="dvk-avatar"></span></a>Newsletter Sign-Up :: Checkbox Settings</h2>
3
+ <div class="postbox-container" style="width:65%;">
4
+ <div class="metabox-holder">
5
+ <div class="meta-box-sortables">
6
+
7
+ <div class="postbox">
8
+ <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br></div>
9
+ <h3 class="hndle"><span>Checkbox Settings</span></h3>
10
+ <div class="inside">
11
+ <form method="post" action="options.php" id="ns_settings_page">
12
+ <?php settings_fields('nsu_checkbox_group'); ?>
13
+ <table class="form-table">
14
+ <tr valign="top"><th scope="row">Text to show after the checkbox</th>
15
+ <td><input size="50%" type="text" name="nsu_checkbox[text]" value="<?php if (isset($opts['text']))
16
+ echo $opts['text']; ?>" /></td>
17
+ </tr>
18
+ <tr valign="top"><th scope="row">Redirect to this url after signing up <span class="ns_small">(leave empty for no redirect)</span></th>
19
+ <td><input size="50%" type="text" name="nsu_checkbox[redirect_to]" value="<?php if (isset($opts['redirect_to']))
20
+ echo $opts['redirect_to']; ?>" />
21
+ <br />
22
+ <p class="nsu-tip">In general, I don't recommend setting a redirect url for the sign-up checkbox. This will cause some serious confusion, since
23
+ users expect to be redirected to the post they commented on.</p>
24
+
25
+ </td>
26
+ </tr>
27
+ <tr valign="top"><th scope="row"><label for="ns_precheck_checkbox">Pre-check the checkbox?</label></th>
28
+ <td><input type="checkbox" id="ns_precheck_checkbox" name="nsu_checkbox[precheck]" value="1"<?php
29
+ if (isset($opts['precheck']) && $opts['precheck'] == '1') {
30
+ echo ' checked="checked"';
31
+ }
32
+ ?> /></td>
33
+ </tr>
34
+ <tr valign="top">
35
+ <th scope="row"><label for="do_css_reset">Do a CSS 'reset' on the checkbox.</label> <span class="ns_small">(check this if checkbox appears in a weird place)</span></th>
36
+ <td><input type="checkbox" id="do_css_reset" name="nsu_checkbox[css_reset]" value="1"<?php
37
+ if (isset($opts['css_reset']) && $opts['css_reset'] == '1') {
38
+ echo ' checked="checked"';
39
+ }
40
+ ?> /> </td>
41
+ </tr>
42
+ <tr valign="top"><th scope="row">Where to show the sign-up checkbox?</th>
43
+ <td>
44
+ <input type="checkbox" id="add_to_comment_form" name="nsu_checkbox[add_to_comment_form]" value="1"<?php
45
+ if (isset($opts['add_to_comment_form']) && $opts['add_to_comment_form'] == '1') {
46
+ echo ' checked="checked"';
47
+ }
48
+ ?> /> <label for="add_to_comment_form">WordPress comment form</label><br />
49
+ <input type="checkbox" id="add_to_reg_form" name="nsu_checkbox[add_to_registration_form]" value="1"<?php
50
+ if (isset($opts['add_to_registration_form']) && $opts['add_to_registration_form'] == '1') {
51
+ echo ' checked="checked"';
52
+ }
53
+ ?> /> <label for="add_to_reg_form">WordPress registration form</label><br />
54
+ <?php if ($this->bp_active == TRUE) { ?>
55
+ <input type="checkbox" id="add_to_bp_form" name="nsu_checkbox[add_to_buddypress_form]" value="1"<?php
56
+ if (isset($opts['add_to_buddypress_form']) && $opts['add_to_buddypress_form'] == '1') {
57
+ echo ' checked="checked"';
58
+ }
59
+ ?> /> <label for="add_to_bp_form">BuddyPress registration form</label><br />
60
+ <?php
61
+ }
62
+ if (defined('MULTISITE') && MULTISITE == TRUE) {
63
+ ?>
64
+ <input type="checkbox" id="add_to_ms_form" name="nsu_checkbox[add_to_multisite_form]" value="1"<?php
65
+ if (isset($opts['add_to_multisite_form']) && $opts['add_to_multisite_form'] == '1') {
66
+ echo ' checked="checked"';
67
+ }
68
+ ?> /> <label for="add_to_ms_form">MultiSite registration form</label><br />
69
+ <?php } ?>
70
+ </td>
71
+ </tr>
72
+ <tr valign="top"><th scope="row"><label for="ns_cookie_hide">Hide the checkbox for users who used it to subscribe before?</label><span class="ns_small">(uses a cookie)</span></th>
73
+ <td><input type="checkbox" id="ns_cookie_hide" name="nsu_checkbox[cookie_hide]" value="1"<?php
74
+ if (isset($opts['cookie_hide']) && $opts['cookie_hide'] == '1') {
75
+ echo ' checked="checked"';
76
+ }
77
+ ?> /></td>
78
+ </tr>
79
+
80
+ </table>
81
+
82
+ <p class="submit">
83
+ <input type="submit" class="button-primary" style="margin:5px;" value="<?php _e('Save Changes') ?>" />
84
+ </p>
85
+
86
+ </form>
87
+ </div>
88
+ </div>
89
+ </div></div></div></div>
90
+ <div class="postbox-container" style="width:30%;">
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();
98
+ ?>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ <?php if (isset($this->actions['show_donate_box']) && $this->actions['show_donate_box']) { ?>
104
+ <div id="dvk-donate-box">
105
+ <div id="dvk-donate-box-content">
106
+ <img width="16" height="16" class="dvk-close" src="<?php echo plugins_url('/backend/img/close.png', dirname(__FILE__)); ?>" alt="X">
107
+ <h3>Support me</h3>
108
+ <p>I noticed you've been using <?php echo $this->shortname; ?> for at least 30 days, would you like to show me a token of your appreciation by buying me a beer or tweet about <?php echo $this->shortname; ?>?</p>
109
+
110
+ <table>
111
+ <tr>
112
+ <td>
113
+ <form id="dvk_donate" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
114
+ <input type="hidden" name="cmd" value="_s-xclick">
115
+ <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHXwYJKoZIhvcNAQcEoIIHUDCCB0wCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBOMPEtv/d1bI/dUG7UNKcjjVUn0vCJS1w6Fd6UMroOPEoSgLU5oOMDoppheoWYdE/bH3OuErp4hCqBwrr8vfYQqKzgfEwkTxjQDpzVNFv2ZoolR1BMZiLQC4BOjeb5ka5BZ4yhPV9gwBuzVxOX9Wp39xZowf/dGQwtMLvELWBeajELMAkGBSsOAwIaBQAwgdwGCSqGSIb3DQEHATAUBggqhk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BkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTEwMzIyMTk1NDE5WjAjBgkqhkiG9w0BCQQxFgQUtsSVMgG+S1YSrJGQGg0FYPkKr9owDQYJKoZIhvcNAQEBBQAEgYBYm+Yupu9nSZYSiw8slPF0jr8Tflv1UX34830zGPjS5kN2rAjXt6M825OX/rotc4rEyuLNRg0nG6svrQnT/uPXpAa+JbduwSSzrNRQXwwRmemj/eHCB2ESR62p1X+ZCnMZ9acZpOVT4W1tdDeKdU+7e+qbx8XEU3EY09g4O4H7QA==-----END PKCS7-----">
116
+ <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
117
+ <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/nl_NL/i/scr/pixel.gif" width="1" height="1">
118
+ </form>
119
+ </td>
120
+ <td>
121
+ <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 awsome #WordPress plugin: <?php echo $this->shortname; ?>" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
122
+ </td>
123
+ </tr>
124
+ </table>
125
+ <a class="dvk-dontshow" href="options-general.php?page=<?php echo $this->hook ?>&dontshowpopup=1">(do not show me this pop-up again)</a>
126
+ </div>
127
+ </div>
128
+ <?php } ?>
backend/views/config_helper.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap" id="<?php echo $this->hook; ?>">
2
+
3
+ <?php if(isset($error)) { ?>
4
+ <div id="message" class="notice error"><p>Oops, I couldn't make any sense of that. Are you sure you submitted a form snippet?</p></div>
5
+ <?php } ?>
6
+
7
+ <h2><a href="http://dannyvankooten.com/" target="_blank"><span id="dvk-avatar"></span></a>Newsletter Sign-Up :: Config Extractor</h2>
8
+ <div class="postbox-container" style="width:65%;">
9
+ <div class="metabox-holder">
10
+ <div class="meta-box-sortables">
11
+ <div class="postbox">
12
+ <h3 class="hndle"><span>Newsletter Sign-Up :: Config Extractor</span></h3>
13
+ <div class="inside">
14
+
15
+
16
+ <?php if(isset($result)) { ?>
17
+ <table class="form-table">
18
+ <tr valign="top">
19
+ <th scope="row" style="font-weight:bold;">Form action:</th>
20
+ <td><?php echo $form_action; ?></td>
21
+ </tr>
22
+ <tr valign="top">
23
+ <th scope="row" style="font-weight:bold;">Email identifier:</th>
24
+ <td><?php echo $email_identifier; ?></td>
25
+ </tr>
26
+ <tr valign="top">
27
+ <th scope="row" style="font-weight:bold;">Name identifier:</th>
28
+ <td><?php echo $name_identifier; ?></td>
29
+ </tr>
30
+ <?php if(isset($additional_data) && count($additional_data) > 0) { ?>
31
+ <tr valign="top">
32
+ <th scope="row" colspan="2" style="font-weight:bold;">Additional data ( name / value):</th>
33
+ </tr>
34
+ <?php foreach($additional_data as $data) { ?>
35
+ <tr valign="top">
36
+ <td><?php echo $data[0]; ?></th>
37
+ <td><?php echo $data[1]; ?></td>
38
+ </tr>
39
+ <?php } ?>
40
+ <?php } ?>
41
+ </table>
42
+
43
+ <p>The above settings are there to help you, though they may not be right. Check out <a href="http://dannyvankooten.com/571/configuring-newsletter-sign-up-the-definitive-guide/">this post on my blog</a> for more information on how to manually
44
+ configure Newsletter Sign-up.</p>
45
+ <p>The form code below is a stripped down version of your sign-up form which will make it easier for you to extract the right values. Please also use this form when asking for support.</p>
46
+ <textarea class="nsu-textarea"><?php echo $clean_form; ?></textarea>
47
+
48
+ <?php } else { ?>
49
+ <p>This tool was designed to help you extract the right configuration settings to make NSU work properly.</p>
50
+ <p>Please copy and paste a sign-up form you would normally embed on a HTML page in the textarea below and hit the extract button. The NSU Config Tool will then try to extract the right configuration settings for you. </p>
51
+ <form method="post" action="" id="ns_settings_page">
52
+ <textarea name="form" class="nsu-textarea"></textarea>
53
+
54
+ <p class="submit">
55
+ <input type="submit" class="button-primary" style="margin:5px;" value="<?php _e('Extract') ?>" />
56
+ </p>
57
+
58
+
59
+ </form>
60
+ <?Php } ?>
61
+ </div>
62
+ </div>
63
+
64
+ </div></div></div></div>
65
+ <div class="postbox-container" style="width:30%;">
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();
73
+ ?>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
backend/views/dashboard.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap" id="<?php echo $this->hook; ?>">
2
+ <h2><a href="http://dannyvankooten.com/" target="_blank"><span id="dvk-avatar"></span></a>Newsletter Sign-Up :: Mailinglist Settings</h2>
3
+ <div class="postbox-container" style="width:65%;">
4
+ <div class="metabox-holder">
5
+ <div class="meta-box-sortables">
6
+ <div class="postbox">
7
+ <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br></div>
8
+ <h3 class="hndle"><span>Mailinglist Settings</span></span></h3>
9
+ <div class="inside">
10
+ <form method="post" action="options.php" id="ns_settings_page">
11
+ <?php settings_fields('nsu_mailinglist_group'); ?>
12
+
13
+ <table class="form-table">
14
+ <tr valign="top">
15
+ <td colspan="2"><p>These settings are the most important since without these Newsletter Sign-Up can't do it's job. Having trouble finding
16
+ the right configuration settings? Have a look at <a href="http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/">this post on my blog</a> or try the <a href="admin.php?page=newsletter-sign-up/config-helper">configuration extractor</a>.</p></td>
17
+ </tr>
18
+ <tr valign="top">
19
+ <th scope="row">Select your mailinglist provider: </th>
20
+ <td>
21
+ <select name="nsu_mailinglist[provider]" id="ns_mp_provider" onchange="document.location.href = 'admin.php?page=<?php echo $this->hook; ?>&mp=' + this.value">
22
+ <option value="other"<?php if ($viewed_mp == NULL || $viewed_mp == 'other')
23
+ echo ' SELECTED'; ?>>-- other / advanced</option>
24
+ <option value="mailchimp"<?php if ($viewed_mp == 'mailchimp')
25
+ echo ' SELECTED'; ?> >MailChimp</option>
26
+ <option value="ymlp"<?php if ($viewed_mp == 'ymlp')
27
+ echo ' SELECTED'; ?> >YMLP</option>
28
+ <option value="icontact"<?php if ($viewed_mp == 'icontact')
29
+ echo ' SELECTED'; ?> >iContact</option>
30
+ <option value="aweber"<?php if ($viewed_mp == 'aweber')
31
+ echo ' SELECTED'; ?> >Aweber</option>
32
+ <option value="phplist"<?php if ($viewed_mp == 'phplist')
33
+ echo ' SELECTED'; ?> >PHPList</option>
34
+ </select>
35
+ </td>
36
+ </tr>
37
+ <?php $this->mailinglist_specific_rows($viewed_mp); ?>
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>
41
+ <td><input size="50%" type="text" id="ns_form_action" name="nsu_mailinglist[form_action]" value="<?php if (isset($opts['form_action']))
42
+ echo $opts['form_action']; ?>" /></td>
43
+ </tr>
44
+ <tr valign="top"><th scope="row">E-mail identifier <span class="ns_small">name attribute of input field that holds the emailadress</span></th>
45
+ <td><input size="50%" type="text" name="nsu_mailinglist[email_id]" value="<?php if (isset($opts['email_id']))
46
+ echo $opts['email_id']; ?>"/></td>
47
+ </tr>
48
+ </tbody>
49
+ <tbody>
50
+ <tr valign="top"><th scope="row"><label for="subscribe_with_name">Subscribe with name?</label></th>
51
+ <td><input type="checkbox" id="subscribe_with_name" name="nsu_mailinglist[subscribe_with_name]" value="1"<?php if (isset($opts['subscribe_with_name']) && $opts['subscribe_with_name'] == '1') {
52
+ echo ' checked="checked"';
53
+ } ?> /></td>
54
+ </tr>
55
+ <tr class="name_dependent" valign="top"<?php if (!isset($opts['subscribe_with_name']) || $opts['subscribe_with_name'] != 1)
56
+ echo 'style="display:none;"'; ?>><th scope="row">Name identifier <span class="ns_small">name attribute of input field that holds the name</span></th>
57
+ <td><input size="25%" id="ns_name_id" type="text" name="nsu_mailinglist[name_id]" value="<?php if (isset($opts['name_id']))
58
+ echo $opts['name_id']; ?>" /></td>
59
+ </tr>
60
+ </tbody>
61
+ </table>
62
+ <p style="margin:10px;">
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>
69
+ <th scope="column" style="font-weight:bold;">Value</th>
70
+ </tr>
71
+ <?php
72
+ $last_key = 0;
73
+
74
+ if (isset($opts['extra_data']) && is_array($opts['extra_data'])) :
75
+ foreach ($opts['extra_data'] as $key => $value) :
76
+ ?>
77
+ <tr valign="top">
78
+ <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $key; ?>][name]" value="<?php echo $value['name']; ?>" /></td>
79
+ <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $key; ?>][value]" value="<?php echo $value['value']; ?>" /></td>
80
+ </tr>
81
+ <?php
82
+ $last_key = $key + 1;
83
+ endforeach;
84
+ endif;
85
+ ?>
86
+ <tr valign="top">
87
+ <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $last_key; ?>][name]" value="" /></td>
88
+ <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $last_key; ?>][value]" value="" /></td>
89
+ </tr>
90
+ </table>
91
+ <p class="submit">
92
+ <input type="submit" class="button-primary" style="margin:5px;" value="<?php _e('Save Changes') ?>" />
93
+ </p>
94
+ </form>
95
+ <p class="nsu-tip">
96
+ Having trouble finding the right configuration settings? Try the <a href="admin.php?page=newsletter-sign-up/config-helper">configuration extractor</a>, it's there to help you!
97
+ </p>
98
+ </div>
99
+ </div></div></div></div></div>
100
+ <div class="postbox-container" style="width:30%;">
101
+ <div class="metabox-holder">
102
+ <div class="meta-box-sortables">
103
+ <?php
104
+ $this->likebox();
105
+ $this->donate_box();
106
+ $this->latest_posts();
107
+ $this->support_box();
108
+ ?>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ <?php if (isset($this->actions['show_donate_box']) && $this->actions['show_donate_box']) { ?>
114
+ <div id="dvk-donate-box">
115
+ <div id="dvk-donate-box-content">
116
+ <img width="16" height="16" class="dvk-close" src="<?php echo plugins_url('/backend/img/close.png', dirname(__FILE__)); ?>" alt="X">
117
+ <h3>Support me</h3>
118
+ <p>I noticed you've been using <?php echo $this->shortname; ?> for at least 30 days, would you like to show me a token of your appreciation by buying me a beer or tweet about <?php echo $this->shortname; ?>?</p>
119
+
120
+ <table>
121
+ <tr>
122
+ <td>
123
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
124
+ <input type="hidden" name="cmd" value="_s-xclick">
125
+ <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhvcNAQcEoIIHSDCCB0QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYC6fx9lo/sj3VITn0dRXZoS1YpT1zy5NYLr2PaIYO22Uu621UovTyJGKw8sW2Rb9rrxPewnGxlGxG4+9BRc90Zr+Un4YwpYiIvtKt+WVDGVoBtg7OScJuIqi7d8v9QZGptBMMB7UL3hPRxpX0lhnY2SJhOH9kU/eICTgQS5bk6lzTELMAkGBSsOAwIaBQAwgdQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIO3CyWPKvJaeAgbDpFEfsNO8gKQeOYlqjpwZqmYU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gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTExMTEyMDE1MDU1OFowIwYJKoZIhvcNAQkEMRYEFKUYvFfX67/j6OWp2xNHCzlnvaWtMA0GCSqGSIb3DQEBAQUABIGAmkdQThWqpFg5yey9B7qHAvZRLqejrpGtFoc/XiLFiMGmJbs/IXn7j5VDfGC+J0bAYtX2dnrlSoeDvISHM3aNCOSNiWexwlxBmZG0sYjtcVh/JHfP+Pe7DWG9awUwJPHETMuZxCQaCbpiQETZ8DRfJrWTJjWdasVJBAqHkrnnvvU=-----END PKCS7-----
126
+ ">
127
+ <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!">
128
+ <img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1">
129
+ </form>
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 awsome #WordPress plugin: <?php echo $this->shortname; ?>" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
134
+ </td>
135
+ </tr>
136
+ </table>
137
+ <a class="dvk-dontshow" href="options-general.php?page=<?php echo $this->hook ?>&dontshowpopup=1">(do not show me this pop-up again)</a>
138
+ </div>
139
+ </div>
140
+ <?php } ?>
backend/views/form_settings.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap" id="<?php echo $this->hook; ?>">
2
+ <h2><a href="http://dannyvankooten.com/" target="_blank"><span id="dvk-avatar"></span></a>Newsletter Sign-Up :: Form Settings</h2>
3
+ <div class="postbox-container" style="width:65%;">
4
+ <div class="metabox-holder">
5
+ <div class="meta-box-sortables">
6
+ <div class="postbox">
7
+ <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br></div>
8
+ <h3 class="hndle" id="nsu-form-settings"><span>Form Settings</span></h3>
9
+ <div class="inside">
10
+
11
+ <form method="post" action="options.php" id="ns_settings_page">
12
+ <?php settings_fields('nsu_form_group'); ?>
13
+ <table class="form-table">
14
+ <tr valign="top">
15
+ <td colspan="2"><p>Custome your Sign-up form by providing your own values for the different labels, input fields and buttons of the sign-up form. </p></td>
16
+ </tr>
17
+ <tr valign="top">
18
+ <th scope="row">E-mail label</th>
19
+ <td><input size="50%" type="text" name="nsu_form[email_label]" value="<?php if (isset($opts['email_label']))
20
+ echo $opts['email_label']; ?>" /></td>
21
+ </tr>
22
+ <tr valign="top">
23
+ <th scope="row">E-mail default value</th>
24
+ <td><input size="50%" type="text" name="nsu_form[email_default_value]" value="<?php if(isset($opts['email_default_value'])) echo $opts['email_default_value']; ?>" /></td>
25
+ </tr>
26
+ <tr valign="top" class="name_dependent" <?php if (!isset($opts['mailinglist']['subscribe_with_name']) || $opts['mailinglist']['subscribe_with_name'] != 1)
27
+ echo 'style="display:none;"'; ?>><th scope="row">Name label <span class="ns_small">(if using subscribe with name)</span></th>
28
+ <td>
29
+ <input size="50%" type="text" name="nsu_form[name_label]" value="<?php if (isset($opts['name_label']))
30
+ echo $opts['name_label']; ?>" /><br />
31
+ <input type="checkbox" id="name_required" name="nsu_form[name_required]" value="1"<?php if (isset($opts['name_required']) && $opts['name_required'] == '1') {
32
+ echo ' checked="checked"';
33
+ } ?> />
34
+ <label for="name_required">Name is a required field?</label>
35
+ </td>
36
+
37
+ </tr>
38
+ <tr valign="top" class="name_dependent" <?php if (!isset($opts['mailinglist']['subscribe_with_name']) || $opts['mailinglist']['subscribe_with_name'] != 1)
39
+ echo 'style="display:none;"'; ?>>
40
+ <th scope="row">Name default value</th>
41
+ <td>
42
+ <input size="50%" type="text" name="nsu_form[name_default_value]" value="<?php if (isset($opts['name_default_value']))
43
+ echo $opts['name_default_value']; ?>" />
44
+ </td>
45
+
46
+ </tr>
47
+ <tr valign="top"><th scope="row">Submit button value</th>
48
+ <td><input size="50%" type="text" name="nsu_form[submit_button]" value="<?php if (isset($opts['submit_button']))
49
+ echo $opts['submit_button']; ?>" /></td>
50
+ </tr>
51
+ <tr valign="top"><th scope="row">Text to replace the form with after a successful sign-up</th>
52
+ <td>
53
+ <textarea style="width:100%;" rows="5" cols="50" name="nsu_form[text_after_signup]"><?php if (isset($opts['text_after_signup']))
54
+ echo $opts['text_after_signup']; ?></textarea>
55
+ <p><input id="nsu_form_wpautop" name="nsu_form[wpautop]" type="checkbox" value="1" <?php if (isset($opts['wpautop']) && $opts['wpautop'] == 1)
56
+ echo 'checked'; ?> />&nbsp;<label for="nsu_form_wpautop"><?php _e('Automatically add paragraphs'); ?></label></p>
57
+ </td>
58
+ </tr>
59
+
60
+ <?php if(isset($opts['mailinglist']['use_api']) && $opts['mailinglist']['use_api'] == 1) { ?>
61
+ <tr valign="top"><th scope="row">Redirect to this url after signing up <span class="ns_small">(leave empty for no redirect)</span></th>
62
+ <td><input size="50%" type="text" name="nsu_form[redirect_to]" value="<?php if (isset($opts['redirect_to']))
63
+ echo $opts['redirect_to']; ?>" /></td>
64
+ </tr>
65
+ <?php } ?>
66
+
67
+ <tr valign="top"><th scope="row"><label for="ns_load_form_styles">Load some default CSS</label><span class="ns_small">(check this for some default styling of the labels and input fields)</span></th>
68
+ <td><input type="checkbox" id="ns_load_form_styles" name="nsu_form[load_form_css]" value="1" <?php if (isset($opts['load_form_css']) && $opts['load_form_css'] == 1)
69
+ echo 'CHECKED'; ?> /></td>
70
+ </tr>
71
+ </table>
72
+ <p class="submit">
73
+ <input type="submit" class="button-primary" style="margin:5px;" value="<?php _e('Save Changes') ?>" />
74
+ </p>
75
+
76
+ <?php
77
+ $tips = array(
78
+ 'You can embed a sign-up form in your posts and pages by
79
+ using the shortcode <b><em>[nsu-form]</em></b> or by calling <b><em>&lt;?php if(function_exists(\'nsu_signup_form\')) nsu_signup_form(); ?&gt;</em></b> from your template files.',
80
+ 'Using Newsletter Sign-Up Widget? You can alternatively install <a target="_blank" href="http://wordpress.org/extend/plugins/wysiwyg-widgets/">WYSIWYG Widgets</a> and use the NSU form shortcode <strong>[nsu-form]</strong> to render a sign-up form in your widget area\'s. This allows
81
+ easier customizing'
82
+ );
83
+ $random_key = array_rand($tips);
84
+ ?>
85
+ <p class="nsu-tip">Tip: <?php echo $tips[$random_key]; ?></p>
86
+
87
+ </form>
88
+ <br style="clear:both;" />
89
+ </div></div></div></div></div></div>
90
+ <div class="postbox-container" style="width:30%;">
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();
98
+ ?>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ <?php if (isset($this->actions['show_donate_box']) && $this->actions['show_donate_box']) { ?>
104
+ <div id="dvk-donate-box">
105
+ <div id="dvk-donate-box-content">
106
+ <img width="16" height="16" class="dvk-close" src="<?php echo plugins_url('/backend/img/close.png', dirname(__FILE__)); ?>" alt="X">
107
+ <h3>Support me</h3>
108
+ <p>I noticed you've been using <?php echo $this->shortname; ?> for at least 30 days, would you like to show me a token of your appreciation by buying me a beer or tweet about <?php echo $this->shortname; ?>?</p>
109
+
110
+ <table>
111
+ <tr>
112
+ <td>
113
+ <form id="dvk_donate" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
114
+ <input type="hidden" name="cmd" value="_s-xclick">
115
+ <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHXwYJKoZIhvcNAQcEoIIHUDCCB0wCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBOMPEtv/d1bI/dUG7UNKcjjVUn0vCJS1w6Fd6UMroOPEoSgLU5oOMDoppheoWYdE/bH3OuErp4hCqBwrr8vfYQqKzgfEwkTxjQDpzVNFv2ZoolR1BMZiLQC4BOjeb5ka5BZ4yhPV9gwBuzVxOX9Wp39xZowf/dGQwtMLvELWBeajELMAkGBSsOAwIaBQAwgdwGCSqGSIb3DQEHATAUBggqhkiG9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CBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTEwMzIyMTk1NDE5WjAjBgkqhkiG9w0BCQQxFgQUtsSVMgG+S1YSrJGQGg0FYPkKr9owDQYJKoZIhvcNAQEBBQAEgYBYm+Yupu9nSZYSiw8slPF0jr8Tflv1UX34830zGPjS5kN2rAjXt6M825OX/rotc4rEyuLNRg0nG6svrQnT/uPXpAa+JbduwSSzrNRQXwwRmemj/eHCB2ESR62p1X+ZCnMZ9acZpOVT4W1tdDeKdU+7e+qbx8XEU3EY09g4O4H7QA==-----END PKCS7-----">
116
+ <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
117
+ <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/nl_NL/i/scr/pixel.gif" width="1" height="1">
118
+ </form>
119
+ </td>
120
+ <td>
121
+ <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 awsome #WordPress plugin: <?php echo $this->shortname; ?>" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
122
+ </td>
123
+ </tr>
124
+ </table>
125
+ <a class="dvk-dontshow" href="options-general.php?page=<?php echo $this->hook ?>&dontshowpopup=1">(do not show me this pop-up again)</a>
126
+ </div>
127
+ </div>
128
+ <?php } ?>
frontend/NewsletterSignUp.php ADDED
@@ -0,0 +1,512 @@