Newsletter Sign-Up - Version 2.0.2

Version Description

  • Improved: UI improvement, added some HTML5 to settings pages
  • Improved: Code improvement
  • Improved: Config extractor
Download this release

Release Info

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

Code changes from version 2.0.1 to 2.0.2

assets/css/admin.css CHANGED
@@ -4,10 +4,10 @@
4
 
5
  #nsu-sidebar > div{ margin-bottom:20px; }
6
 
7
- #nsu-admin li.dvk-email{ padding-left:25px; background:url("../img/email-icon.png") no-repeat left center; }
8
- #nsu-admin li.dvk-twitter{ padding-left:25px; background:url("../img/twitter-icon.png") no-repeat left center}
9
- #nsu-admin li.mc4wp{ padding-left:25px; background:url("../img/mailchimp-for-wp-icon.png") no-repeat left center; }
10
- #nsu-admin li.rfb{ padding-left:25px; background:url("../img/recent-facebook-posts-icon.png") no-repeat left center; }
 
11
 
12
- #nsu-donate-box{ border:2px solid green; background:#CFC; padding:0 20px; }
13
- #nsu-donate-box h3{ color:green; }
4
 
5
  #nsu-sidebar > div{ margin-bottom:20px; }
6
 
7
+ #nsu-admin li.has-icon { list-style:none; padding-left:25px; margin-left:-25px; background-position:left center; background-repeat: no-repeat; }
8
+ #nsu-admin li.dvk-email{ background-image:url("../img/email-icon.png"); }
9
+ #nsu-admin li.dvk-twitter{ background-image:url("../img/twitter-icon.png")}
10
+ #nsu-admin li.mc4wp{ background-image:url("../img/mailchimp-for-wp-icon.png"); }
11
+ #nsu-admin li.rfb{ background-image:url("../img/recent-facebook-posts-icon.png"); }
12
 
13
+ #nsu-donate-box{ background:#222; color:#eee; padding:20px; }
 
includes/NSU_Admin.php CHANGED
@@ -12,9 +12,9 @@ if (!class_exists('NSU_Admin')) {
12
  private $bp_active = FALSE;
13
  private $options = array();
14
 
15
- public function __construct() {
16
  $this->options = NSU::instance()->get_options();
17
-
18
  add_filter("plugin_action_links_{$this->filename}", array($this, 'add_settings_link'));
19
  add_action('admin_menu', array($this, 'add_option_page'));
20
  add_action('admin_init', array($this, 'settings_init'));
@@ -32,11 +32,11 @@ if (!class_exists('NSU_Admin')) {
32
 
33
  public function get_checkbox_compatible_plugins()
34
  {
35
-
36
  $checkbox_plugins = array(
37
  'comment_form' => "Comment form",
38
  "registration_form" => "Registration form"
39
- );
40
  if(is_multisite()) { $checkbox_plugins['ms_form'] = "MultiSite forms"; }
41
  if(class_exists("BuddyPress")) $checkbox_plugins['bp_form'] = "BuddyPress registration";
42
  if(class_exists('bbPress')) $checkbox_plugins['bbpress_forms'] = "bbPress";
@@ -47,7 +47,7 @@ if (!class_exists('NSU_Admin')) {
47
  {
48
  ?>
49
  <div class="updated">
50
- <p><strong>Newsletter Sign-Up Notice:</strong> You are using MailChimp, great! Consider switching to <a href="http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/">MailChimp for WordPress</a>, you will <strong>love</strong> it.
51
  It can be downloaded from the WordPress repository <a href="http://wordpress.org/plugins/mailchimp-for-wp/">here</a>. | <a href="?nsu-hide-mc4wp-notice=1">Hide Notice</a></p>
52
  </div>
53
  <?php
@@ -89,34 +89,34 @@ if (!class_exists('NSU_Admin')) {
89
  switch ($viewed_mp) {
90
 
91
  case 'mailchimp':
92
- if (empty($opts['email_id']))
93
- $opts['email_id'] = 'EMAIL';
94
- if (empty($opts['name_id']))
95
- $opts['name_id'] = 'NAME';
96
- break;
97
 
98
  case 'ymlp':
99
- if (empty($opts['email_id']))
100
- $opts['email_id'] = 'YMP0';
101
- break;
102
 
103
  case 'aweber':
104
- if (empty($opts['form_action']))
105
- $opts['form_action'] = 'http://www.aweber.com/scripts/addlead.pl';
106
- if (empty($opts['email_id']))
107
- $opts['email_id'] = 'email';
108
- if (empty($opts['name_id']))
109
- $opts['name_id'] = 'name';
110
- break;
111
 
112
  case 'icontact':
113
- if (empty($opts['email_id']))
114
- $opts['email_id'] = 'fields_email';
115
- break;
116
  }
117
  }
118
 
119
- require 'views/dashboard.php';
120
  }
121
 
122
  /**
@@ -125,7 +125,7 @@ if (!class_exists('NSU_Admin')) {
125
  public function options_page_checkbox_settings() {
126
  $tab = 'checkbox-settings';
127
  $opts = $this->options['checkbox'];
128
- require 'views/checkbox_settings.php';
129
  }
130
 
131
  /**
@@ -135,7 +135,7 @@ if (!class_exists('NSU_Admin')) {
135
  $tab = 'form-settings';
136
  $opts = $this->options['form'];
137
  $opts['mailinglist'] = $this->options['mailinglist'];
138
- require 'views/form_settings.php';
139
  }
140
 
141
  /**
@@ -143,72 +143,104 @@ if (!class_exists('NSU_Admin')) {
143
  */
144
  public function options_page_config_helper() {
145
  $tab = 'config-helper';
146
- if (isset($_POST['form'])) {
147
- $error = true;
148
 
149
- $form = $_POST['form'];
 
 
150
 
151
- // strip unneccessary tags
152
- $form = strip_tags($form, '<form><input><button>');
153
 
 
 
 
154
 
155
- preg_match_all("'<(.*?)>'si", $form, $matches);
 
 
 
 
156
 
157
- if (is_array($matches) && isset($matches[0])) {
158
- $matches = $matches[0];
159
- $html = stripslashes(join('', $matches));
160
 
161
- $clean_form = htmlspecialchars(str_replace(array('><', '<input'), array(">\n<", "\t<input"), $html), ENT_NOQUOTES);
 
 
 
 
 
 
 
 
 
 
162
 
163
- $doc = new DOMDocument();
164
- $doc->strictErrorChecking = FALSE;
165
- $doc->loadHTML($html);
166
- $xml = simplexml_import_dom($doc);
167
 
168
- if ($xml) {
169
- $result = true;
170
- $form = $xml->body->form;
171
 
172
- if ($form) {
173
- unset($error);
174
- $form_action = (isset($form['action'])) ? $form['action'] : 'Can\'t help you on this one..';
175
 
176
- if ($form->input) {
177
 
178
- $additional_data = array();
 
 
 
179
 
180
- /* Loop trough input fields */
181
- foreach ($form->input as $input) {
182
 
183
  // Check if this is a hidden field
184
- if ($input['type'] == 'hidden') {
185
- $additional_data[] = array($input['name'], $input['value']);
186
  // Check if this is the input field that is supposed to hold the EMAIL data
187
- } elseif (stripos($input['id'], 'email') !== FALSE || stripos($input['name'], 'email') !== FALSE) {
188
- $email_identifier = $input['name'];
189
 
190
  // Check if this is the input field that is supposed to hold the NAME data
191
- } elseif (stripos($input['id'], 'name') !== FALSE || stripos($input['name'], 'name') !== FALSE) {
192
- $name_identifier = $input['name'];
193
- }
194
- }
195
  }
196
- }
197
 
198
-
199
-
200
- // Correct value's
201
- if (!isset($email_identifier))
202
- $email_identifier = 'Can\'t help you on this one..';
203
- if (!isset($name_identifier))
204
- $name_identifier = 'Can\'t help you on this one. Not using name data?';
 
205
  }
 
 
 
 
 
 
 
 
206
  }
 
207
  }
208
 
209
- require 'views/config_helper.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  }
211
 
 
212
  /**
213
  * Adds the different menu pages
214
  */
12
  private $bp_active = FALSE;
13
  private $options = array();
14
 
15
+ public function __construct() {
16
  $this->options = NSU::instance()->get_options();
17
+
18
  add_filter("plugin_action_links_{$this->filename}", array($this, 'add_settings_link'));
19
  add_action('admin_menu', array($this, 'add_option_page'));
20
  add_action('admin_init', array($this, 'settings_init'));
32
 
33
  public function get_checkbox_compatible_plugins()
34
  {
35
+
36
  $checkbox_plugins = array(
37
  'comment_form' => "Comment form",
38
  "registration_form" => "Registration form"
39
+ );
40
  if(is_multisite()) { $checkbox_plugins['ms_form'] = "MultiSite forms"; }
41
  if(class_exists("BuddyPress")) $checkbox_plugins['bp_form'] = "BuddyPress registration";
42
  if(class_exists('bbPress')) $checkbox_plugins['bbpress_forms'] = "bbPress";
47
  {
48
  ?>
49
  <div class="updated">
50
+ <p><strong>Newsletter Sign-Up Notice:</strong> You are using MailChimp, great! Consider switching to <a href="http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/">MailChimp for WordPress</a>, you will <strong>love</strong> it.
51
  It can be downloaded from the WordPress repository <a href="http://wordpress.org/plugins/mailchimp-for-wp/">here</a>. | <a href="?nsu-hide-mc4wp-notice=1">Hide Notice</a></p>
52
  </div>
53
  <?php
89
  switch ($viewed_mp) {
90
 
91
  case 'mailchimp':
92
+ if (empty($opts['email_id']))
93
+ $opts['email_id'] = 'EMAIL';
94
+ if (empty($opts['name_id']))
95
+ $opts['name_id'] = 'NAME';
96
+ break;
97
 
98
  case 'ymlp':
99
+ if (empty($opts['email_id']))
100
+ $opts['email_id'] = 'YMP0';
101
+ break;
102
 
103
  case 'aweber':
104
+ if (empty($opts['form_action']))
105
+ $opts['form_action'] = 'http://www.aweber.com/scripts/addlead.pl';
106
+ if (empty($opts['email_id']))
107
+ $opts['email_id'] = 'email';
108
+ if (empty($opts['name_id']))
109
+ $opts['name_id'] = 'name';
110
+ break;
111
 
112
  case 'icontact':
113
+ if (empty($opts['email_id']))
114
+ $opts['email_id'] = 'fields_email';
115
+ break;
116
  }
117
  }
118
 
119
+ require_once NSU_PLUGIN_DIR . 'includes/views/dashboard.php';
120
  }
121
 
122
  /**
125
  public function options_page_checkbox_settings() {
126
  $tab = 'checkbox-settings';
127
  $opts = $this->options['checkbox'];
128
+ require_once NSU_PLUGIN_DIR . 'includes/views/checkbox_settings.php';
129
  }
130
 
131
  /**
135
  $tab = 'form-settings';
136
  $opts = $this->options['form'];
137
  $opts['mailinglist'] = $this->options['mailinglist'];
138
+ require_once NSU_PLUGIN_DIR . 'includes/views/form_settings.php';
139
  }
140
 
141
  /**
143
  */
144
  public function options_page_config_helper() {
145
  $tab = 'config-helper';
146
+
147
+ if (isset($_POST['form']) && !empty($_POST['form'])) {
148
 
149
+ $result = $this->extract_form_config($_POST['form']);
150
+
151
+ }
152
 
153
+ require_once NSU_PLUGIN_DIR . 'includes/views/config_helper.php';
154
+ }
155
 
156
+ private function extract_form_config($form_html) {
157
+ // strip unneccessary tags
158
+ $form = strip_tags($form_html, '<form><label><input><select><textarea><button>');
159
 
160
+ // set defaults
161
+ $form_action = '';
162
+ $email_name = 'Sorry, can\'t help you with this one.';
163
+ $name_name = 'Sorry, can\'t help you with this one.';
164
+ $additional_data = array();
165
 
166
+ preg_match_all("'<(.*?)>'si", $form, $matches);
 
 
167
 
168
+ if (is_array($matches) && isset($matches[0])) {
169
+ $matches = $matches[0];
170
+ $html = stripslashes(join('', $matches));
171
+ } else {
172
+ $html = $form;
173
+ }
174
+
175
+ $doc = new DOMDocument();
176
+ $doc->strictErrorChecking = FALSE;
177
+ $doc->loadHTML($html);
178
+ $xml = simplexml_import_dom($doc);
179
 
180
+ if ($xml) {
181
+ $form = $xml->body->form;
 
 
182
 
183
+ if ($form) {
 
 
184
 
185
+ $form_action = (isset($form['action'])) ? $form['action'] : 'Can\'t help you on this one..';
 
 
186
 
 
187
 
188
+ if ($form->input) {
189
+
190
+ /* Loop trough input fields */
191
+ foreach ($form->input as $input) {
192
 
 
 
193
 
194
  // Check if this is a hidden field
195
+ if ($input['type'] == 'hidden') {
196
+ $additional_data[] = array($input['name'], $input['value']);
197
  // Check if this is the input field that is supposed to hold the EMAIL data
198
+ } elseif (stripos($input['id'], 'email') !== FALSE || stripos($input['name'], 'email') !== FALSE) {
199
+ $email_name = $input['name'];
200
 
201
  // Check if this is the input field that is supposed to hold the NAME data
202
+ } elseif (stripos($input['id'], 'name') !== FALSE || stripos($input['name'], 'name') !== FALSE) {
203
+ $name_name = $input['name'];
 
 
204
  }
 
205
 
206
+ // remove input attributes
207
+ unset($input['id']);
208
+ unset($input['class']);
209
+ unset($input['style']);
210
+ unset($input['onfocus']);
211
+ unset($input['onblur']);
212
+ unset($input['size']);
213
+ }
214
  }
215
+
216
+ // remove form attributes
217
+ unset($form['target']);
218
+ unset($form['id']);
219
+ unset($form['name']);
220
+ unset($form['class']);
221
+ unset($form['onsubmit']);
222
+ unset($form['enctype']);
223
  }
224
+
225
  }
226
 
227
+ $doc->removeChild($doc->firstChild);
228
+ $doc->replaceChild($doc->firstChild->firstChild->firstChild, $doc->firstChild);
229
+
230
+ $simpler_form = $doc->saveHTML();
231
+ $simpler_form = str_replace(array('><', '<input'), array(">\n<", "\t<input"), $simpler_form);
232
+
233
+
234
+ return array(
235
+ 'simpler_form' => $simpler_form,
236
+ 'form_action' => $form_action,
237
+ 'email_name' => $email_name,
238
+ 'name_name' => $name_name,
239
+ 'additional_data' => $additional_data
240
+ );
241
  }
242
 
243
+
244
  /**
245
  * Adds the different menu pages
246
  */
includes/views/checkbox_settings.php CHANGED
@@ -1,57 +1,58 @@
1
  <div class="wrap" id="nsu-admin">
2
 
3
- <?php include_once 'parts/navigation.php'; ?>
4
 
5
  <h2>Newsletter Sign-Up :: Checkbox Settings</h2>
 
6
  <?php settings_errors(); ?>
7
 
8
  <div id="nsu-main">
9
 
10
-
11
-
12
  <form method="post" action="options.php" id="ns_settings_page">
13
  <?php settings_fields('nsu_checkbox_group'); ?>
14
  <table class="form-table">
15
- <tr valign="top"><th scope="row">Text to show after the checkbox</th>
 
16
  <td><input class="widefat" type="text" name="nsu_checkbox[text]" value="<?php echo esc_attr($opts['text']); ?>" /></td>
17
  </tr>
18
- <tr valign="top"><th scope="row">Redirect to this url after signing up <small>(leave empty for no redirect)</small></th>
19
- <td><input class="widefat" type="text" name="nsu_checkbox[redirect_to]" value="<?php echo esc_attr($opts['redirect_to']); ?>" />
20
-
 
21
  <small>In general, I don't recommend setting a redirect url for the sign-up checkbox. This will cause some serious confusion, since
22
  users expect to be redirected to the post they commented on.</small>
23
-
24
- </td>
25
  </tr>
26
- <tr valign="top"><th scope="row"><label for="ns_precheck_checkbox">Pre-check the checkbox?</label></th>
27
- <td><input type="checkbox" id="ns_precheck_checkbox" name="nsu_checkbox[precheck]" value="1" <?php checked($opts['precheck'], 1); ?> /></td>
28
- </tr>
29
- <tr valign="top">
30
- <th scope="row"><label for="do_css_reset">Do a CSS 'reset' on the checkbox.</label> <small>(check this if checkbox appears in a weird place)</small></th>
31
- <td><input type="checkbox" id="do_css_reset" name="nsu_checkbox[css_reset]" value="1" <?php checked($opts['css_reset'], 1); ?> /> </td>
32
- </tr>
33
- <tr valign="top"><th scope="row">Where to show the sign-up checkbox?</th>
34
- <td>
35
- <?php foreach($this->get_checkbox_compatible_plugins() as $code => $name) { ?>
36
- <input type="checkbox" id="add_to_<?php echo $code; ?>" name="nsu_checkbox[add_to_<?php echo $code; ?>]" value="1"<?php checked($opts['add_to_'.$code], '1'); ?> /> <label for="add_to_<?php echo $code; ?>"><?php echo $name; ?></label> &nbsp;
37
- <?php } ?>
38
- </td>
39
- </tr>
40
- <tr valign="top"><th scope="row"><label for="ns_cookie_hide">Hide the checkbox for users who used it to subscribe before?</label><small>(uses a cookie)</small></th>
41
- <td><input type="checkbox" id="ns_cookie_hide" name="nsu_checkbox[cookie_hide]" value="1"<?php
42
- if ($opts['cookie_hide'] == '1') {
43
- echo ' checked="checked"';
44
- }
45
- ?> /></td>
46
- </tr>
47
-
48
- </table>
49
-
50
- <?php submit_button(); ?>
51
-
52
- </form>
53
- </div>
54
-
55
- <?php require 'parts/sidebar.php'; ?>
56
-
57
- </div>
 
1
  <div class="wrap" id="nsu-admin">
2
 
3
+ <?php include_once NSU_PLUGIN_DIR . 'includes/views/parts/navigation.php'; ?>
4
 
5
  <h2>Newsletter Sign-Up :: Checkbox Settings</h2>
6
+
7
  <?php settings_errors(); ?>
8
 
9
  <div id="nsu-main">
10
 
 
 
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">
15
+ <th scope="row">Text to show after the checkbox</th>
16
  <td><input class="widefat" type="text" name="nsu_checkbox[text]" value="<?php echo esc_attr($opts['text']); ?>" /></td>
17
  </tr>
18
+ <tr valign="top">
19
+ <th scope="row">Redirect to this url after signing up <small>(leave empty or enter 0 (zero) for no redirect)</small></th>
20
+ <td>
21
+ <input class="widefat" type="text" name="nsu_checkbox[redirect_to]" value="<?php echo esc_attr($opts['redirect_to']); ?>" />
22
  <small>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.</small>
24
+ </td>
 
25
  </tr>
26
+ <tr valign="top">
27
+ <th scope="row">
28
+ <label for="ns_precheck_checkbox">Pre-check the checkbox?</label></th>
29
+ <td><input type="checkbox" id="ns_precheck_checkbox" name="nsu_checkbox[precheck]" value="1" <?php checked($opts['precheck'], 1); ?> /></td>
30
+ </tr>
31
+ <tr valign="top">
32
+ <th scope="row"><label for="do_css_reset">Do a CSS 'reset' on the checkbox.</label> <small>(check this if checkbox appears in a weird place)</small></th>
33
+ <td>
34
+ <input type="checkbox" id="do_css_reset" name="nsu_checkbox[css_reset]" value="1" <?php checked($opts['css_reset'], 1); ?> />
35
+ </td>
36
+ </tr>
37
+ <tr valign="top"><th scope="row">Where to show the sign-up checkbox?</th>
38
+ <td>
39
+ <?php foreach($this->get_checkbox_compatible_plugins() as $code => $name) { ?>
40
+ <input type="checkbox" id="add_to_<?php echo $code; ?>" name="nsu_checkbox[add_to_<?php echo $code; ?>]" value="1" <?php checked($opts['add_to_'.$code], '1'); ?> /> <label for="add_to_<?php echo $code; ?>"><?php echo $name; ?></label> &nbsp;
41
+ <?php } ?>
42
+ </td>
43
+ </tr>
44
+ <tr valign="top">
45
+ <th scope="row"><label for="ns_cookie_hide">Hide the checkbox for users who used it to subscribe before?</label><small>(uses a cookie)</small></th>
46
+ <td><input type="checkbox" id="ns_cookie_hide" name="nsu_checkbox[cookie_hide]" value="1" <?php checked($opts['cookie_hide'], 1); ?> /></td>
47
+ </tr>
48
+
49
+ </table>
50
+
51
+ <?php submit_button(); ?>
52
+
53
+ </form>
54
+ </div>
55
+
56
+ <?php include_once NSU_PLUGIN_DIR . 'includes/views/parts/sidebar.php'; ?>
57
+
58
+ </div>
includes/views/config_helper.php CHANGED
@@ -1,57 +1,61 @@
1
  <div class="wrap" id="nsu-admin">
2
 
3
 
4
- <?php include_once 'parts/navigation.php'; ?>
5
 
6
  <h2>Newsletter Sign-Up :: Config Extractor</h2>
7
 
8
 
9
  <div id="nsu-main">
10
- <?php if(isset($error)) { ?>
11
- <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>
 
12
  <?php } ?>
13
 
14
 
15
 
16
 
17
 
18
- <?php if(isset($result)) { ?>
19
  <table class="form-table">
20
  <tr valign="top">
21
  <th scope="row" style="font-weight:bold;">Form action:</th>
22
- <td><?php echo $form_action; ?></td>
23
  </tr>
24
  <tr valign="top">
25
  <th scope="row" style="font-weight:bold;">Email identifier:</th>
26
- <td><?php echo $email_identifier; ?></td>
27
  </tr>
28
  <tr valign="top">
29
  <th scope="row" style="font-weight:bold;">Name identifier:</th>
30
- <td><?php echo $name_identifier; ?></td>
31
- </tr>
32
- <?php if(isset($additional_data) && count($additional_data) > 0) { ?>
33
- <tr valign="top">
34
- <th scope="row" colspan="2" style="font-weight:bold;">Additional data ( name / value):</th>
35
- </tr>
36
- <?php foreach($additional_data as $data) { ?>
37
- <tr valign="top">
38
- <td><?php echo $data[0]; ?></th>
39
- <td><?php echo $data[1]; ?></td>
40
  </tr>
 
 
 
 
 
 
 
 
 
 
41
  <?php } ?>
42
- <?php } ?>
43
  </table>
44
 
45
  <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
46
  configure Newsletter Sign-up.</p>
 
47
  <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>
48
- <textarea class="widefat" rows="10"><?php echo esc_textarea($clean_form); ?></textarea>
49
 
50
  <?php } else { ?>
 
51
  <p>This tool was designed to help you extract the right configuration settings to make Newsletter Sign-Up work properly.</p>
52
  <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>
53
  <form method="post" action="" id="ns_settings_page">
54
- <textarea name="form" class="widefat" rows="10"></textarea>
55
 
56
  <p class="submit">
57
  <input type="submit" class="button-primary" style="margin:5px;" value="<?php _e('Extract') ?>" />
@@ -63,6 +67,6 @@
63
 
64
  </div>
65
 
66
- <?php require 'parts/sidebar.php'; ?>
67
 
68
  </div>
1
  <div class="wrap" id="nsu-admin">
2
 
3
 
4
+ <?php include_once NSU_PLUGIN_DIR . 'includes/views/parts/navigation.php'; ?>
5
 
6
  <h2>Newsletter Sign-Up :: Config Extractor</h2>
7
 
8
 
9
  <div id="nsu-main">
10
+
11
+ <?php if(isset($result) && !is_array($result)) { ?>
12
+ <div id="message" class="notice updated"><p>Oops, I couldn't make any sense of that. Are you sure you submitted a form snippet?</p></div>
13
  <?php } ?>
14
 
15
 
16
 
17
 
18
 
19
+ <?php if(isset($result) && is_array($result)) { ?>
20
  <table class="form-table">
21
  <tr valign="top">
22
  <th scope="row" style="font-weight:bold;">Form action:</th>
23
+ <td><?php echo $result['form_action']; ?></td>
24
  </tr>
25
  <tr valign="top">
26
  <th scope="row" style="font-weight:bold;">Email identifier:</th>
27
+ <td><?php echo $result['email_name']; ?></td>
28
  </tr>
29
  <tr valign="top">
30
  <th scope="row" style="font-weight:bold;">Name identifier:</th>
31
+ <td><?php echo $result['name_name']; ?></td>
 
 
 
 
 
 
 
 
 
32
  </tr>
33
+ <?php if(count($result['additional_data']) > 0) { ?>
34
+ <tr valign="top">
35
+ <th scope="row" colspan="2" style="font-weight:bold;">Additional data ( name / value):</th>
36
+ </tr>
37
+ <?php foreach($result['additional_data'] as $data) { ?>
38
+ <tr valign="top">
39
+ <td><?php echo $data[0]; ?></th>
40
+ <td><?php echo $data[1]; ?></td>
41
+ </tr>
42
+ <?php } ?>
43
  <?php } ?>
44
+
45
  </table>
46
 
47
  <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
48
  configure Newsletter Sign-up.</p>
49
+
50
  <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>
51
+ <textarea class="widefat" rows="10"><?php echo $result['simpler_form']; ?></textarea>
52
 
53
  <?php } else { ?>
54
+
55
  <p>This tool was designed to help you extract the right configuration settings to make Newsletter Sign-Up work properly.</p>
56
  <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>
57
  <form method="post" action="" id="ns_settings_page">
58
+ <textarea name="form" class="widefat" rows="10" placeholder="Copy paste your form code here." required></textarea>
59
 
60
  <p class="submit">
61
  <input type="submit" class="button-primary" style="margin:5px;" value="<?php _e('Extract') ?>" />
67
 
68
  </div>
69
 
70
+ <?php include_once NSU_PLUGIN_DIR . 'includes/views/parts/sidebar.php'; ?>
71
 
72
  </div>
includes/views/dashboard.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class="wrap" id="nsu-admin">
2
 
3
- <?php include_once 'parts/navigation.php'; ?>
4
 
5
  <h2>Newsletter Sign-Up :: Mailinglist Settings</h2>
6
  <?php settings_errors(); ?>
@@ -10,15 +10,13 @@
10
  <form method="post" action="options.php">
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')
@@ -33,37 +31,40 @@
33
  echo ' SELECTED'; ?> >PHPList</option>
34
  </select>
35
  </td>
36
- </tr>
37
 
38
  <?php if(isset($viewed_mp) && file_exists(dirname(__FILE__) . '/parts/rows-' . $viewed_mp . '.php')) require 'parts/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>
43
- <td><input size="50%" type="text" id="ns_form_action" name="nsu_mailinglist[form_action]" value="<?php echo $opts['form_action']; ?>" /></td>
 
44
  </tr>
45
- <tr valign="top"><th scope="row">E-mail identifier <span class="ns_small">name attribute of input field that holds the emailadress</span></th>
46
- <td><input size="50%" type="text" name="nsu_mailinglist[email_id]" value="<?php 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($opts['subscribe_with_name'] == '1') echo ' checked'; ?> /></td>
 
52
  </tr>
53
- <tr class="name_dependent" valign="top"<?php if($opts['subscribe_with_name'] != 1) echo 'style="display:none;"'; ?>><th scope="row">Name identifier <span class="ns_small">name attribute of input field that holds the name</span></th>
54
- <td><input size="25%" id="ns_name_id" type="text" name="nsu_mailinglist[name_id]" value="<?php echo $opts['name_id']; ?>" /></td>
 
55
  </tr>
56
  </tbody>
57
  </table>
58
- <p style="margin:10px;">
59
- 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.
60
- You can specify these additional fields here using name / value pairs so they will be sent along with every sign-up request.
61
  </p>
62
- <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>
63
  <table class="form-table">
64
- <tr valign="top">
65
- <th scope="column" style="font-weight:bold;">Name</th>
66
- <th scope="column" style="font-weight:bold;">Value</th>
67
  </tr>
68
  <?php
69
  $last_key = 0;
@@ -72,8 +73,8 @@
72
  foreach ($opts['extra_data'] as $key => $value) :
73
  ?>
74
  <tr valign="top">
75
- <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $key; ?>][name]" value="<?php echo $value['name']; ?>" /></td>
76
- <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $key; ?>][value]" value="<?php echo $value['value']; ?>" /></td>
77
  </tr>
78
  <?php
79
  $last_key = $key + 1;
@@ -81,22 +82,25 @@
81
  endif;
82
  ?>
83
  <tr valign="top">
84
- <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $last_key; ?>][name]" value="" /></td>
85
- <td><input size="50%" type="text" name="nsu_mailinglist[extra_data][<?php echo $last_key; ?>][value]" value="" /></td>
86
  </tr>
87
  </table>
88
- <p class="submit">
89
- <input type="submit" class="button-primary" style="margin:5px;" value="<?php _e('Save Changes') ?>" />
90
- </p>
 
 
 
91
  </form>
92
- <p class="nsu-tip">
93
- 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!
94
  </p>
95
 
96
  </div>
97
 
98
 
99
- <?php require 'parts/sidebar.php'; ?>
100
 
101
  </div>
102
  <br style="clear:both;" />
1
  <div class="wrap" id="nsu-admin">
2
 
3
+ <?php include_once NSU_PLUGIN_DIR . 'includes/views/parts/navigation.php'; ?>
4
 
5
  <h2>Newsletter Sign-Up :: Mailinglist Settings</h2>
6
  <?php settings_errors(); ?>
10
  <form method="post" action="options.php">
11
  <?php settings_fields('nsu_mailinglist_group'); ?>
12
 
13
+ <p>These settings are the most important, without them Newsletter Sign-Up can't do its job. Having trouble finding 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>
14
+
15
  <table class="form-table">
16
  <tr valign="top">
 
 
 
 
17
  <th scope="row">Select your mailinglist provider: </th>
18
  <td>
19
+ <select class="widefat" name="nsu_mailinglist[provider]" id="ns_mp_provider" onchange="document.location.href = 'admin.php?page=<?php echo $this->hook; ?>&mp=' + this.value">
20
  <option value="other"<?php if ($viewed_mp == NULL || $viewed_mp == 'other')
21
  echo ' SELECTED'; ?>>-- other / advanced</option>
22
  <option value="mailchimp"<?php if ($viewed_mp == 'mailchimp')
31
  echo ' SELECTED'; ?> >PHPList</option>
32
  </select>
33
  </td>
34
+ </tr>
35
 
36
  <?php if(isset($viewed_mp) && file_exists(dirname(__FILE__) . '/parts/rows-' . $viewed_mp . '.php')) require 'parts/rows-' . $viewed_mp . '.php'; ?>
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">
41
+ <th scope="row">Newsletter form action</th>
42
+ <td><input class="widefat" type="text" id="ns_form_action" name="nsu_mailinglist[form_action]" placeholder="Example: http://newsletter-service.com?action=subscribe&id=123" value="<?php echo esc_attr($opts['form_action']); ?>" /></td>
43
  </tr>
44
+ <tr valign="top">
45
+ <th scope="row">E-mail identifier<br /><small>name attribute of input field for the emailadress</small></th>
46
+ <td><input class="widefat" type="text" name="nsu_mailinglist[email_id]" placeholder="Example: EMAIL" value="<?php echo esc_attr($opts['email_id']); ?>"/></td>
47
  </tr>
48
  </tbody>
49
  <tbody>
50
+ <tr valign="top">
51
+ <th scope="row"><label for="subscribe_with_name">Subscribe with name?</label></th>
52
+ <td><input type="checkbox" id="subscribe_with_name" name="nsu_mailinglist[subscribe_with_name]" value="1" <?php checked($opts['subscribe_with_name'], 1); ?> /></td>
53
  </tr>
54
+ <tr class="name_dependent" valign="top" <?php if($opts['subscribe_with_name'] != 1) echo 'style="display:none;"'; ?>>
55
+ <th scope="row">Name identifier<br /><small>name attribute of input field that holds the name</small></th>
56
+ <td><input class="widefat" id="ns_name_id" type="text" name="nsu_mailinglist[name_id]" placeholder="Example: NAME" value="<?php echo esc_attr($opts['name_id']); ?>" /></td>
57
  </tr>
58
  </tbody>
59
  </table>
60
+ <p>
61
+ For some newsletter services you need to specify some additional fields, like a list ID or your account name. These fields are usually found as hidden fields in the HTML code of your sign-up forms.
62
+ You can specify these additional fields here using name / value pairs, they will be included in all sign-up requests made by the plugin.
63
  </p>
 
64
  <table class="form-table">
65
+ <tr valign="top" style="font-weight:bold;">
66
+ <th scope="column">Name</th>
67
+ <th scope="column">Value</th>
68
  </tr>
69
  <?php
70
  $last_key = 0;
73
  foreach ($opts['extra_data'] as $key => $value) :
74
  ?>
75
  <tr valign="top">
76
+ <td><input class="widefat" type="text" name="nsu_mailinglist[extra_data][<?php echo $key; ?>][name]" value="<?php echo $value['name']; ?>" /></td>
77
+ <td><input class="widefat" type="text" name="nsu_mailinglist[extra_data][<?php echo $key; ?>][value]" value="<?php echo $value['value']; ?>" /></td>
78
  </tr>
79
  <?php
80
  $last_key = $key + 1;
82
  endif;
83
  ?>
84
  <tr valign="top">
85
+ <td><input class="widefat" type="text" name="nsu_mailinglist[extra_data][<?php echo $last_key; ?>][name]" placeholder="Hidden field name" value="" /></td>
86
+ <td><input class="widefat" type="text" name="nsu_mailinglist[extra_data][<?php echo $last_key; ?>][value]" placeholder="Hidden field value" value="" /></td>
87
  </tr>
88
  </table>
89
+
90
+ <p class="help"><strong>Dynamic values:</strong> <code>{name}</code> and <code>{ip}</code> will be replaced by the name or IP address of the subscriber.</p>
91
+
92
+
93
+ <?php submit_button(); ?>
94
+
95
  </form>
96
+ <p>
97
+ <em>Having trouble finding the right configuration settings? Try the <a href="admin.php?page=newsletter-sign-up/config-helper">configuration extractor</a>.</em>
98
  </p>
99
 
100
  </div>
101
 
102
 
103
+ <?php include_once NSU_PLUGIN_DIR . 'includes/views/parts/sidebar.php'; ?>
104
 
105
  </div>
106
  <br style="clear:both;" />
includes/views/form_settings.php CHANGED
@@ -41,7 +41,7 @@
41
  <th scope="row">Text to replace the form with after a successful sign-up</th>
42
  <td colspan="2">
43
  <textarea class="widefat" rows="5" cols="50" name="nsu_form[text_after_signup]"><?php echo esc_textarea($opts['text_after_signup']); ?></textarea>
44
- <p><input id="nsu_form_wpautop" name="nsu_form[wpautop]" type="checkbox" value="1" <?php if($opts['wpautop'] == 1) echo 'checked'; ?> />&nbsp;<label for="nsu_form_wpautop"><?php _e('Automatically add paragraphs'); ?></label></p>
45
  </td>
46
  </tr>
47
 
41
  <th scope="row">Text to replace the form with after a successful sign-up</th>
42
  <td colspan="2">
43
  <textarea class="widefat" rows="5" cols="50" name="nsu_form[text_after_signup]"><?php echo esc_textarea($opts['text_after_signup']); ?></textarea>
44
+ <p><label><input id="nsu_form_wpautop" name="nsu_form[wpautop]" type="checkbox" value="1" <?php checked($opts['wpautop'], 1) ?> /> <?php _e('Automatically add paragraphs'); ?></label></p>
45
  </td>
46
  </tr>
47
 
includes/views/parts/rows-aweber.php CHANGED
@@ -1,5 +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>
1
  <tr valign="top">
2
+ <th scope="row"><label for="aweber_list_name" Aweber list name</th>
3
+ <td><input id="aweber_list_name" class="widefat" type="text" name="nsu_mailinglist[aweber_list_name]" value="<?php if (isset($opts['aweber_list_name']))
4
+ echo esc_attr($opts['aweber_list_name']); ?>" /></td>
5
+ </tr>
includes/views/parts/rows-mailchimp.php CHANGED
@@ -1,37 +1,37 @@
1
  <tr valign="top">
2
- <td colspan="3" style="font-weight:bold; font-style:italic;">I highly recommend switching to my newer plugin: <a href="http://wordpress.org/plugins/mailchimp-for-wp/">MailChimp for WordPress</a>. There is an awesome Lite version available for free from the WP repository, and an even more awesome <a href="http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/">Pro version from my website</a>.</td>
3
  </tr>
4
 
5
  <tr valign="top">
6
- <th scope="row"><label for="use_api">Use MailChimp API? <span class="ns_small">(recommended)</span></label></th>
7
- <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>
8
  </tr>
9
 
10
  <tbody class="api_rows" <?php if (!isset($opts['use_api']) || $opts['use_api'] != 1) echo ' style="display:none" '; ?>>
11
  <tr valign="top">
12
  <th scope="row">MailChimp API Key <a target="_blank" href="http://admin.mailchimp.com/account/api">(?)</a></th>
13
- <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>
14
  </tr>
15
  <tr valign="top">
16
  <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>
17
- <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>
18
  </tr>
19
  <tr valign="top">
20
  <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>
21
- <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>
22
  </tr>
23
  <tr valign="top">
24
  <th scope="row"><label for="mc_use_groupings">Add to group(s)? </label></th>
25
- <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>
26
  </tr>
27
  <tbody class="mc_groupings_rows" <?php if (!isset($opts['mc_use_groupings']) || $opts['mc_use_groupings'] != 1) echo ' style="display:none" '; ?>>
28
  <tr valign="top">
29
  <th scope="row">Grouping name</th>
30
- <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>
31
  </tr>
32
  <tr valign="top">
33
- <th scope="row">Groups <small class="nsu_small">(comma delimited list of interest groups to add to)</small></th>
34
- <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>
35
  </tr>
36
  </tbody>
37
  </tbody>
1
  <tr valign="top">
2
+ <td colspan="3"><strong>I highly recommend switching to my newer plugin: <a href="http://wordpress.org/plugins/mailchimp-for-wp/">MailChimp for WordPress</a>. You'll be up and running (again) in just a few minutes.</strong></td>
3
  </tr>
4
 
5
  <tr valign="top">
6
+ <th scope="row"><label for="use_api">Use MailChimp API?</label><br /><small>(recommended)</small></th>
7
+ <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>
8
  </tr>
9
 
10
  <tbody class="api_rows" <?php if (!isset($opts['use_api']) || $opts['use_api'] != 1) echo ' style="display:none" '; ?>>
11
  <tr valign="top">
12
  <th scope="row">MailChimp API Key <a target="_blank" href="http://admin.mailchimp.com/account/api">(?)</a></th>
13
+ <td><input class="widefat" 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>
14
  </tr>
15
  <tr valign="top">
16
  <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>
17
+ <td><input class="widefat" type="text" name="nsu_mailinglist[mc_list_id]" value="<?php if (isset($opts['mc_list_id'])) echo $opts['mc_list_id']; ?>"; /></td>
18
  </tr>
19
  <tr valign="top">
20
  <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>
21
+ <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'])) checked($opts['mc_no_double_optin'], 1); ?> /></td>
22
  </tr>
23
  <tr valign="top">
24
  <th scope="row"><label for="mc_use_groupings">Add to group(s)? </label></th>
25
+ <td><input type="checkbox" id="mc_use_groupings" name="nsu_mailinglist[mc_use_groupings]" value="1" <?php if(isset($opts['mc_use_groupings'])) checked($opts['mc_use_groupings'], 1); ?> /></td>
26
  </tr>
27
  <tbody class="mc_groupings_rows" <?php if (!isset($opts['mc_use_groupings']) || $opts['mc_use_groupings'] != 1) echo ' style="display:none" '; ?>>
28
  <tr valign="top">
29
  <th scope="row">Grouping name</th>
30
+ <td><input class="widefat" type="text" id="mc_groupings_name" name="nsu_mailinglist[mc_groupings_name]" value="<?php if (isset($opts['mc_groupings_name'])) echo esc_attr($opts['mc_groupings_name']); ?>" /></td>
31
  </tr>
32
  <tr valign="top">
33
+ <th scope="row">Groups <br /><small>(comma delimited list of interest groups to add to)</small></th>
34
+ <td><input class="widefat" type="text" name="nsu_mailinglist[mc_groupings_groups]" placeholder="Example: Group 1,Group 2,Group 3" value="<?php if (isset($opts['mc_groupings_groups'])) echo esc_attr($opts['mc_groupings_groups']); ?>"; /></td>
35
  </tr>
36
  </tbody>
37
  </tbody>
includes/views/parts/rows-phplist.php CHANGED
@@ -1,10 +1,5 @@
 
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>
1
+ <?php if(!isset($opts['phplist_list_id'])) $opts['phplist_list_id'] = 1; ?>
2
  <tr valign="top">
3
+ <th scope="row">PHPList list ID</th>
4
+ <td><input type="text" class="widefat" name="nsu_mailinglist[phplist_list_id]" value="<?php echo esc_attr($opts['phplist_list_id']); ?>" /></td>
5
+ </tr>
 
 
 
 
 
 
includes/views/parts/rows-ymlp.php CHANGED
@@ -1,23 +1,17 @@
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>
1
+ <tr valign="top">
2
+ <th scope="row"><label for="use_api">Use the YMLP API?<br /><small>(recommended)</small></label></th>
3
+ <td><input type="checkbox" id="use_api" name="nsu_mailinglist[use_api]" value="1" <?php if(isset($opts['use_api'])) checked($opts['use_api'], 1); ?> /></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">YMLP API Key <a target="_blank" href="http://www.ymlp.com/app/api.php">(?)</a></th>
8
+ <td><input class="widefat" type="text" id="ymlp_api_key" name="nsu_mailinglist[ymlp_api_key]" value="<?php if (isset($opts['ymlp_api_key'])) echo esc_attr($opts['ymlp_api_key']); ?>" /></td>
9
+ </tr>
10
+ <tr valign="top">
11
+ <th scope="row">YMLP Username</th>
12
+ <td><input class="widefat" type="text" id="ymlp_username" name="nsu_mailinglist[ymlp_username]" value="<?php if (isset($opts['ymlp_username'])) echo esc_attr($opts['ymlp_username']); ?>" /></td>
13
+ </tr>
14
+ <tr valign="top"><th scope="row">YMLP GroupID<br /><small>(starts at 1, check URL when 'viewing all contacts' in certain group)</small></th>
15
+ <td><input class="widefat" type="text" id="ymlp_groupid" name="nsu_mailinglist[ymlp_groupid]" value="<?php if (isset($opts['ymlp_groupid'])) echo esc_attr($opts['ymlp_groupid']); ?>" /></td>
16
+ </tr>
17
+ </tbody>
 
 
 
 
 
 
includes/views/parts/sidebar.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  <div id="nsu-donate-box">
4
  <h3>Donate $10, $20 or $50</h3>
5
- <p>If you like Newsletter Sign-Up and the free time I put into it, please consider donating a token of your appreciation.</p>
6
 
7
  <form class="donate" action="https://www.paypal.com/cgi-bin/webscr" method="post">
8
  <input type="hidden" name="cmd" value="_donations">
@@ -17,22 +17,23 @@
17
  </form>
18
 
19
  <p>Alternatively, you can: </p>
20
- <ul>
21
- <li><a href="http://wordpress.org/support/view/plugin-reviews/newsletter-sign-up?rate=5#postform" target="_blank">Give a 5&#9733; rating on WordPress.org</a></li>
22
  <li><a href="http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/" target="_blank">Blog about it and link to the plugin page</a></li>
23
- <li><a href="http://twitter.com/?status=I%20manage%20my%20%23WordPress%20sign-up%20forms%20using%20%40DannyvanKooten%20%27s%20Newsletter%20Sign-Up%20plugin%20and%20I%20love%20it%20-%20check%20it%20out!%20http%3A%2F%2Fwordpress.org%2Fplugins%2Fnewsletter-sign-up%2F" target="_blank">Tweet about Newsletter Sign-Up</a></li>
 
24
  </ul>
25
  </div>
26
 
27
  <div>
28
  <h3>Other WordPress plugins by Danny</h3>
29
- <ul class="">
30
- <li class="mc4wp"><a href="http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/">MailChimp for WordPress</a></li>
31
  <li><a href="http://dannyvankooten.com/wordpress-plugins/wysiwyg-widgets/">WYSIWYG Widgets</a></li>
32
- <li class="rfb"><a href="http://dannyvankooten.com/wordpress-plugins/recent-facebook-posts/">Recent Facebook Posts</a></li>
33
 
34
- <li class="dvk-email"><a href="http://dannyvankooten.com/newsletter/">Subscribe to Danny's newsletter</a> by e-mail</li>
35
- <li class="dvk-twitter">You should follow me on twitter <a href="http://twitter.com/dannyvankooten">here</a></li>
36
  </ul>
37
  </div>
38
 
2
 
3
  <div id="nsu-donate-box">
4
  <h3>Donate $10, $20 or $50</h3>
5
+ <p>If you like Newsletter Sign-Up, consider showing me a token of your appreciation.</p>
6
 
7
  <form class="donate" action="https://www.paypal.com/cgi-bin/webscr" method="post">
8
  <input type="hidden" name="cmd" value="_donations">
17
  </form>
18
 
19
  <p>Alternatively, you can: </p>
20
+ <ul class="ul-square">
21
+ <li><a href="http://wordpress.org/support/view/plugin-reviews/newsletter-sign-up?rate=5#postform" target="_blank">Give a &#9733;&#9733;&#9733;&#9733;&#9733; rating on WordPress.org</a></li>
22
  <li><a href="http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/" target="_blank">Blog about it and link to the plugin page</a></li>
23
+ <li><a href="http://twitter.com/?status=I%27m%20using%20the%20Newsletter%20Sign-Up%20%23WordPress%20plugin%20by%20%40DannyvanKooten%20on%20my%20website.%20Love%20it!%20http%3A%2F%2Fwordpress.org%2Fplugins%2Fnewsletter-sign-up%2F" target="_blank">Tweet about Newsletter Sign-Up</a></li>
24
+ <li><a href="http://wordpress.org/plugins/newsletter-sign-up/#compatibility">Vote "works" on the Wordpress.org plugin page</a>
25
  </ul>
26
  </div>
27
 
28
  <div>
29
  <h3>Other WordPress plugins by Danny</h3>
30
+ <ul class="ul-square">
31
+ <li class="has-icon mc4wp"><a href="http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/">MailChimp for WordPress</a></li>
32
  <li><a href="http://dannyvankooten.com/wordpress-plugins/wysiwyg-widgets/">WYSIWYG Widgets</a></li>
33
+ <li class="has-icon rfb"><a href="http://dannyvankooten.com/wordpress-plugins/recent-facebook-posts/">Recent Facebook Posts</a></li>
34
 
35
+ <li class="has-icon dvk-email"><a href="http://dannyvankooten.com/newsletter/">Subscribe to Danny's newsletter</a> by e-mail</li>
36
+ <li class="has-icon dvk-twitter">You should follow me on twitter: <a href="http://twitter.com/dannyvankooten">@Dannyvankooten</a></li>
37
  </ul>
38
  </div>
39
 
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: 2.0.1
7
  Author: Danny van Kooten
8
  Author URI: http://dannyvankooten.com
9
  License: GPL2
@@ -25,7 +25,7 @@ License: GPL2
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
- define('NSU_VERSION_NUMBER', "2.0.1");
29
  define("NSU_PLUGIN_DIR", plugin_dir_path(__FILE__));
30
 
31
  require_once NSU_PLUGIN_DIR . 'includes/NSU.php';
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: 2.0.2
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
+ define('NSU_VERSION_NUMBER', "2.0.2");
29
  define("NSU_PLUGIN_DIR", plugin_dir_path(__FILE__));
30
 
31
  require_once NSU_PLUGIN_DIR . 'includes/NSU.php';
readme.txt CHANGED
@@ -3,114 +3,99 @@ 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: 3.1
6
- Tested up to: 3.6
7
- Stable tag: 2.0.1
 
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 registration form
25
- * Easy customizable Newsletter Sign-Up Widget
26
  * Embed a sign-up form in your posts with a simple shortcode `[nsu-form]`.
27
  * Embed a sign-up form in your template files by calling `nsu_form();`
28
  * Use the MailChimp or YMLP API or any other third-party newsletter service.
29
  * Works with most major mailinglist services like Aweber, Constant Contact, iContact, etc.
30
  * Compatible with BuddyPress, MultiSite and bbPress.
31
- * Compatible with [WYSIWYG Widgets](http://dannyvankooten.com/wordpress-plugins/wysiwyg-widgets/) to allow easy widget text editing.
32
 
33
- **More info:**
34
 
 
35
  * [Newsletter Sign-Up for WordPress](http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/)
36
  * Check out more [WordPress plugins](http://dannyvankooten.com/wordpress-plugins/) by Danny van Kooten
37
- * You should follow [Danny on Twitter](http://twitter.com/DannyvanKooten) for lightning fast support and updates.
38
 
39
  = Sign-up checkboxes =
40
- 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.
41
- Signing up to your newsletter is as easy as ticking a checkbox!
42
 
43
- You can also add the sign-up checkbox to your BuddyPress registration form, your MultiSite sign-up forms or your bbPress new topic and new reply forms.
44
 
45
  = Sign-up forms =
46
- Another strength of NSU is the ability to create sign-up forms and easily embed those in multiple places. Newsletter Sign-Up comes with a sign-up form widget, a shortcode to use in your posts and/or pages and a function call to use in your template files. You can even choose to redirect the visitor to a certain page after signing-up, offering them exclusive content or a "thank you for signing up" message.
47
-
48
- = Using MailChimp or YMLP? Use their API's! =
49
- If you're using MailChimp or YMLP then you're in luck. Configuring is as easy as providing your API credentials so that Newsletter Sign-Up can work with the API of your newsletter provider.
50
-
51
- = Customizable =
52
- All generated forms come with common CSS classes and unique CSS identifiers so that you can easily style them to your likings.
53
-
54
- = Easy to setup =
55
- Configuring Newsletter Sign-Up has been made as easy as possible. With the Configuration Extractor that comes with Newsletter Sign-Up all you have to is provide your sign-up form HTML code, the configuration extractor
56
- tool will then analyze it and try to extract the right values for you.
57
 
 
58
 
59
  == Installation ==
60
 
61
  1. Upload the contents of newsletter-sign-up.zip to your plugins directory.
62
  1. Activate the plugin
63
  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/)
64
- 1. That's all. Watch your list grow!
65
- 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.
66
 
67
  == Frequently Asked Questions ==
68
 
69
  = What does this plugin do? =
70
 
71
- This plugin adds various way to your WP blog for visitors to subscribe to your third party newsletter service. What once started out as a simple 'Sign me up to your newsletter' checkbox at your comment form is now a
72
- superb e-mail address gatherer. This plugin respects double opt-in rules, it's all legit.
73
-
74
- = What is the shortcode to embed a sign-up form in my posts? =
75
-
76
- Its `[nsu-form]`.
77
 
78
- = Why does the checkbox not show up? =
79
 
80
- You're theme probably does not support the comment hook this plugin uses to add the checkbox to your comment form. You can manually place the checkbox
81
- by calling `<?php if(function_exists('nsu_checkbox')) nsu_checkbox(); ?>` inside the form tags of your comment form. Usually this file can be found in your theme folder as `comments.php`.
82
 
83
  = Where can I get the form action of my sign-up form? =
84
 
85
- Look at the source code of your sign-up form and check for `<form action="http://www.yourmailinglist.com/signup?a=asd123"`....
86
- The action attribute is what you need here.
87
 
88
  = Where can I get the email identifier of my sign-up form? =
89
 
90
- Take a look at the source code of your sign-up form and look for the input field that holds the email address. You'll need the NAME attribute of this input field, eg: `<input type="text" name="emailid"....` (in this case emailid is what you need)
91
 
92
  = Can I let my users subscribe with their name too? =
93
 
94
- Yes, it's possible. Just provide your name identifier (finding it is much like the email identifier) and the plugin will try to submit the user's name along with the request.
95
-
96
- = Can I also show a checkbox at the BuddyPress sign-up form? =
97
-
98
- Yes.
99
 
100
  = Can I show a sign-up form by calling a function in my template files? =
101
 
102
- Yes, use the following code snippet in your theme files to embed a sign-up form: `if(function_exists('nsu_form')) nsu_form();`
103
 
104
- For more questions and answers go have a look at my website regarding [Newsletter Sign-Up](http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/)
 
 
105
 
106
  == Screenshots ==
107
 
108
  1. The mailinglist configuration page of Newsletter Sign-Up in the WordPress admin panel.
109
  2. The form configuration page in the WP Admin panel.
110
- 3. The "sign-up" checkbox in action @ Twenty Eleven
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
114
  = 2.0.1 =
115
  * Fixed: not being able to uncheck "Use HTML 5" on form settings page
116
  * Added: compatibility with bbPress, you can now add a sign-up checkbox to the post new topic and post new reply forms.
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: 3.1
6
+ Tested up to: 3.6.1
7
+ Stable tag: 2.0.2
8
+ License: GPL2
9
 
10
+ Ultimate newsletter plugin. Works with 3rd-party newsletter services like Aweber and YMLP. includes sign-up checkboxes, widget forms and form shortcodes.
11
 
12
  == Description ==
13
 
14
  = Newsletter Sign-Up =
15
 
16
+ This plugin adds various sign-up methods to your WordPress website, like sign-up checkboxes in your comment form and a sign-up form to show in posts, pages or widget areas.
17
 
18
+ > MailChimp user? Use my newer plugin instead: [MailChimp for WordPress](http://wordpress.org/plugins/mailchimp-for-wp/).
19
 
20
+ This plugin works with *almost all* third-party email marketing services including MailChimp, ConstantContact, YMLP, Aweber, iContact, PHPList and Feedblitz. With the right configuration settings, you can make this plugin work with *any* newsletter service around.
 
21
 
22
  **Features:**
23
 
24
  * Add a "sign-up to our newsletter" checkbox to your comment form or registration form
25
+ * Easy customizable Newsletter Sign-Up Form Widget
26
  * Embed a sign-up form in your posts with a simple shortcode `[nsu-form]`.
27
  * Embed a sign-up form in your template files by calling `nsu_form();`
28
  * Use the MailChimp or YMLP API or any other third-party newsletter service.
29
  * Works with most major mailinglist services like Aweber, Constant Contact, iContact, etc.
30
  * Compatible with BuddyPress, MultiSite and bbPress.
 
31
 
32
+ **More information**
33
 
34
+ * [MailChimp for WordPress plugin](http://wordpress.org/plugins/mailchimp-for-wp/)]
35
  * [Newsletter Sign-Up for WordPress](http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/)
36
  * Check out more [WordPress plugins](http://dannyvankooten.com/wordpress-plugins/) by Danny van Kooten
37
+ * You should follow [@DannyvanKooten](http://twitter.com/DannyvanKooten) on Twitter
38
 
39
  = Sign-up checkboxes =
40
+ Most of your commenters will be interested in your newsletter as well. This plugin makes it extremely easie for them to subscribe to your mailinglist. With the sign-up checkbox, all they have to do is check it and the plugin will subscribe them to your mailinglist.
 
41
 
42
+ You can also add the sign-up checkbox to your WP registration form, your BuddyPress registration form, your MultiSite sign-up forms or your bbPress new topic and new reply forms.
43
 
44
  = Sign-up forms =
45
+ Easily configure a sign-up form and show it in various places on your website using the sign-up form widget, the `[nsu-form]` shortcode or the `nsu_form()` template function.
 
 
 
 
 
 
 
 
 
 
46
 
47
+ You can set your own messages and even choose to redirect the visitor to a certain page after signing-up.
48
 
49
  == Installation ==
50
 
51
  1. Upload the contents of newsletter-sign-up.zip to your plugins directory.
52
  1. Activate the plugin
53
  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/)
54
+ 1. That's all. You're done!
 
55
 
56
  == Frequently Asked Questions ==
57
 
58
  = What does this plugin do? =
59
 
60
+ This plugin adds various sign-up methods to your WordPress website, like a sign-up checkbox at your comment form and a sign-up form to show in various places like your posts, pages and widget areas.
 
 
 
 
 
61
 
62
+ = What is the shortcode to display a sign-up form in my posts or pages? =
63
 
64
+ `[nsu-form]`
 
65
 
66
  = Where can I get the form action of my sign-up form? =
67
 
68
+ Look at the source code of your sign-up form and check for `<form action="http://www.yourmailinglist.com/signup?a=asd123"...`. The action attribute is what you need here.
 
69
 
70
  = Where can I get the email identifier of my sign-up form? =
71
 
72
+ Take a look at the source code of your sign-up form and look for the input field for the email address. You'll need the `name` attribute of this input field, eg: `<input type="text" name="emailid"....`
73
 
74
  = Can I let my users subscribe with their name too? =
75
 
76
+ Yes. Just provide your name identifier (finding it is much like the email identifier) and the plugin will add the users' name to the sign-up request.
 
 
 
 
77
 
78
  = Can I show a sign-up form by calling a function in my template files? =
79
 
80
+ Yes, use the following code snippet in your theme files to display a sign-up form.
81
 
82
+ `if(function_exists('nsu_form')) nsu_form();`
83
+
84
+ For more questions and answers go have a look at the [Newsletter Sign-Up](http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/) page on my website.
85
 
86
  == Screenshots ==
87
 
88
  1. The mailinglist configuration page of Newsletter Sign-Up in the WordPress admin panel.
89
  2. The form configuration page in the WP Admin panel.
90
+ 3. The sign-up checkbox in the Twenty Eleven theme
91
 
92
  == Changelog ==
93
 
94
+ = 2.0.2 =
95
+ * Improved: UI improvement, added some HTML5 to settings pages
96
+ * Improved: Code improvement
97
+ * Improved: Config extractor
98
+
99
  = 2.0.1 =
100
  * Fixed: not being able to uncheck "Use HTML 5" on form settings page
101
  * Added: compatibility with bbPress, you can now add a sign-up checkbox to the post new topic and post new reply forms.