Version Description
- Improved: automatic guessing of first and last names.
- Removed backwards compatibility for v1.6 and below
- Removed unnecessary code, options, etc..
- Improved: Code clean-up
- Changed links to show your appreciation for this plugin.
Download this release
Release Info
Developer | DvanKooten |
Plugin | Newsletter Sign-Up |
Version | 1.8.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.9 to 1.8.1
- backend/NewsletterSignUpAdmin.php +50 -206
- backend/css/donate.css +0 -38
- backend/js/donate.js +0 -7
- backend/views/checkbox_settings.php +11 -39
- backend/views/dashboard.php +6 -40
- backend/views/form_settings.php +18 -56
- backend/views/rows-mailchimp.php +12 -0
- frontend/NewsletterSignUp.php +108 -103
- frontend/css/newsletter-sign-up.php +2 -2
- newsletter-sign-up.php +2 -11
- readme.txt +16 -4
backend/NewsletterSignUpAdmin.php
CHANGED
@@ -11,63 +11,44 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
11 |
private $accesslvl = 'manage_options';
|
12 |
private $icon_url = '';
|
13 |
private $bp_active = FALSE;
|
14 |
-
private $
|
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(
|
24 |
-
add_action('admin_menu', array(
|
25 |
-
add_action('admin_init', array(
|
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(
|
32 |
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
add_action("admin_print_scripts", array(&$this, 'add_admin_scripts'));
|
38 |
-
}
|
39 |
-
|
40 |
|
41 |
-
|
|
|
|
|
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 =
|
71 |
|
72 |
$viewed_mp = NULL;
|
73 |
if (!empty($_GET['mp']))
|
@@ -78,7 +59,7 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
78 |
$viewed_mp = NULL;
|
79 |
|
80 |
// Fill in some predefined values if options not set or set for other newsletter service
|
81 |
-
if (
|
82 |
switch ($viewed_mp) {
|
83 |
|
84 |
case 'mailchimp':
|
@@ -115,24 +96,24 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
115 |
/**
|
116 |
* The admin page for managing checkbox settings
|
117 |
*/
|
118 |
-
function options_page_checkbox_settings() {
|
119 |
-
$opts =
|
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 =
|
128 |
-
$opts['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;
|
@@ -203,22 +184,27 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
203 |
/**
|
204 |
* Renders a donate box
|
205 |
*/
|
206 |
-
function donate_box() {
|
207 |
$content = '
|
208 |
<p>I spent countless hours developing this plugin for <b>FREE</b>. If you like it, consider donating a token of your appreciation.</p>
|
209 |
|
210 |
-
<form
|
211 |
-
<input type="hidden" name="cmd" value="
|
212 |
-
<input type="hidden" name="
|
|
|
|
|
|
|
|
|
|
|
213 |
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
214 |
<img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1">
|
215 |
</form>
|
216 |
|
217 |
-
<p>
|
218 |
<ul>
|
219 |
-
<li><a href="http://wordpress.org/
|
220 |
-
<li><a href="
|
221 |
-
<li
|
222 |
</ul>';
|
223 |
$this->postbox($this->hook . '-donatebox', 'Donate $10, $20 or $50!', $content);
|
224 |
}
|
@@ -226,7 +212,7 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
226 |
/**
|
227 |
* Renders a box with the latests posts from DannyvanKooten.com
|
228 |
*/
|
229 |
-
function latest_posts() {
|
230 |
require_once(ABSPATH . WPINC . '/rss.php');
|
231 |
if ($rss = fetch_rss('http://feeds.feedburner.com/dannyvankooten')) {
|
232 |
$content = '<ul>';
|
@@ -251,7 +237,7 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
251 |
/**
|
252 |
* Renders a box with a link to the support forums for NSU
|
253 |
*/
|
254 |
-
function support_box() {
|
255 |
$content = '<p>Are you having trouble setting-up ' . $this->shortname . ', experiencing an error or got a great idea on how to improve it?</p><p>Please, post
|
256 |
your question or tip in the <a target="_blank" href="http://wordpress.org/tags/' . $this->hook . '">support forums</a> on WordPress.org. This is so that others can benefit from this too.</p>';
|
257 |
$this->postbox($this->hook . '-support-box', "Looking for support?", $content);
|
@@ -264,7 +250,7 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
264 |
* @param string $title
|
265 |
* @param string $content
|
266 |
*/
|
267 |
-
function postbox($id, $title, $content) {
|
268 |
?>
|
269 |
<div id="<?php echo $id; ?>" class="dvk-box">
|
270 |
|
@@ -276,67 +262,11 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
276 |
<?php
|
277 |
}
|
278 |
|
279 |
-
/**
|
280 |
-
* Renders the DvK.com dashboard widget on the admin homepage.
|
281 |
-
*/
|
282 |
-
function dashboard_widget() {
|
283 |
-
$options = get_option('dvkdbwidget');
|
284 |
-
if (isset($_POST['dvk_removedbwidget'])) {
|
285 |
-
$options['dontshow'] = true;
|
286 |
-
update_option('dvkdbwidget', $options);
|
287 |
-
}
|
288 |
-
|
289 |
-
if (isset($options['dontshow']) && $options['dontshow']) {
|
290 |
-
echo "If you reload, this widget will be gone and never appear again, unless you decide to delete the database option 'dvkdbwidget'.";
|
291 |
-
return;
|
292 |
-
}
|
293 |
-
|
294 |
-
require_once(ABSPATH . WPINC . '/rss.php');
|
295 |
-
if ($rss = fetch_rss('http://feeds.feedburner.com/dannyvankooten')) {
|
296 |
-
echo '<div class="rss-widget">';
|
297 |
-
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>';
|
298 |
-
echo '<ul>';
|
299 |
-
$rss->items = array_slice($rss->items, 0, 3);
|
300 |
-
foreach ((array) $rss->items as $item) {
|
301 |
-
echo '<li>';
|
302 |
-
echo '<a target="_blank" class="rsswidget" href="' . clean_url($item['link'], $protocolls = null, 'display') . '">' . $item['title'] . '</a> ';
|
303 |
-
echo '<span class="rss-date">' . date('F j, Y', strtotime($item['pubdate'])) . '</span>';
|
304 |
-
echo '<div class="rssSummary">' . $this->text_limit($item['summary'], 250) . '</div>';
|
305 |
-
echo '</li>';
|
306 |
-
}
|
307 |
-
echo '</ul>';
|
308 |
-
echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
|
309 |
-
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>';
|
310 |
-
echo '<a target="_blank" href="http://dannyvankooten.com/newsletter/"><img src="http://static.dannyvankooten.com/images/email-icon.png" alt=""/> Subscribe by email</a>';
|
311 |
-
echo '<form class="alignright" method="post"><input type="hidden" name="dvk_removedbwidget" value="true"/><input title="Remove this widget" type="submit" value=" X "/></form>';
|
312 |
-
echo '</div>';
|
313 |
-
echo '</div>';
|
314 |
-
}
|
315 |
-
}
|
316 |
-
|
317 |
-
/**
|
318 |
-
* Function that is hooked, adds the DvK.com dashboard widget.
|
319 |
-
*/
|
320 |
-
function widget_setup() {
|
321 |
-
$options = get_option('dvkdbwidget');
|
322 |
-
if (!$options['dontshow'])
|
323 |
-
wp_add_dashboard_widget('dvk_db_widget', 'Latest posts on DannyvanKooten.com', array(&$this, 'dashboard_widget'));
|
324 |
-
}
|
325 |
-
|
326 |
-
function text_limit($text, $limit, $finish = '...') {
|
327 |
-
if (strlen($text) > $limit) {
|
328 |
-
$text = substr($text, 0, $limit);
|
329 |
-
$text = substr($text, 0, - ( strlen(strrchr($text, ' ')) ));
|
330 |
-
$text .= $finish;
|
331 |
-
}
|
332 |
-
return $text;
|
333 |
-
}
|
334 |
-
|
335 |
/**
|
336 |
* Adds the different menu pages
|
337 |
*/
|
338 |
-
function add_option_page() {
|
339 |
-
add_menu_page($this->longname, "Newsl. Sign-up", $this->accesslvl, $this->hook, array(
|
340 |
add_submenu_page($this->hook, "Newsletter Sign-Up :: Mailinglist Settings", "List Settings", $this->accesslvl, $this->hook, array($this, 'options_page_default'));
|
341 |
add_submenu_page($this->hook, "Newsletter Sign-Up :: Checkbox Settings", "Checkbox Settings", $this->accesslvl, $this->hook . '/checkbox-settings', array($this, 'options_page_checkbox_settings'));
|
342 |
add_submenu_page($this->hook, "Newsletter Sign-Up :: Form Settings", "Form Settings", $this->accesslvl, $this->hook . '/form-settings', array($this, 'options_page_form_settings'));
|
@@ -348,111 +278,25 @@ if (!class_exists('NewsletterSignUpAdmin')) {
|
|
348 |
* @param array $links Array containing all the settings links for the various plugins.
|
349 |
* @return array The new array containing all the settings links
|
350 |
*/
|
351 |
-
function add_settings_link($links) {
|
352 |
$settings_link = '<a href="admin.php?page=' . $this->hook . '">Settings</a>';
|
353 |
array_unshift($links, $settings_link);
|
354 |
return $links;
|
355 |
}
|
356 |
|
357 |
-
/**
|
358 |
-
* Check how long the plugin has been used
|
359 |
-
* If used for over 30 days, show a pop-up asking for a tweet or donation.
|
360 |
-
*/
|
361 |
-
function check_usage_time() {
|
362 |
-
$opts = get_option('nsu');
|
363 |
-
if (isset($_GET['dontshowpopup']) && $_GET['dontshowpopup'] == 1) {
|
364 |
-
$opts['dontshowpopup'] = 1;
|
365 |
-
update_option('nsu', $opts);
|
366 |
-
}
|
367 |
-
if (!isset($opts['date_installed'])) {
|
368 |
-
// set installed_time to now, so we can show pop-up in 30 days
|
369 |
-
$opts['date_installed'] = strtotime('now');
|
370 |
-
update_option('nsu', $opts);
|
371 |
-
} elseif ((!isset($opts['dontshowpopup']) || $opts['dontshowpopup'] != 1) && $opts['date_installed'] < strtotime('-30 days')) {
|
372 |
-
// plugin has been installed for over 30 days
|
373 |
-
$this->actions['show_donate_box'] = true;
|
374 |
-
wp_enqueue_style('dvk_donate', plugins_url('/backend/css/donate.css', dirname(__FILE__)));
|
375 |
-
wp_enqueue_script('dvk_donate', plugins_url('/backend/js/donate.js', dirname(__FILE__)));
|
376 |
-
}
|
377 |
-
}
|
378 |
-
|
379 |
/**
|
380 |
* Registers the settings using WP Settings API.
|
381 |
*/
|
382 |
-
function settings_init() {
|
383 |
-
register_setting('
|
384 |
-
register_setting('
|
385 |
-
register_setting('
|
386 |
-
register_setting('nsu_checkbox_group', 'nsu_checkbox', array(&$this, 'validate_checkbox_options'));
|
387 |
-
}
|
388 |
-
|
389 |
-
/**
|
390 |
-
* Transfer settings from old optionname for backwards compatibility
|
391 |
-
*/
|
392 |
-
private function transfer_settings() {
|
393 |
-
if (($old_options = get_option('ns_options')) != false && get_option('nsu') == false) {
|
394 |
-
|
395 |
-
$nsu = array(
|
396 |
-
'date_installed' => (isset($old_options['date_installed'])) ? $old_options['date_installed'] : strtotime('now'),
|
397 |
-
'dontshowpopup' => (isset($old_options['dontshowpopup'])) ? $old_options['dontshowpopup'] : 0,
|
398 |
-
'load_widget_styles' => (isset($old_options['load_widget_styles'])) ? $old_options['load_widget_styles'] : 0
|
399 |
-
);
|
400 |
-
|
401 |
-
// new form option holder
|
402 |
-
$nsu_form = $old_options['form'];
|
403 |
-
|
404 |
-
// new checkbox option holder
|
405 |
-
$nsu_checkbox = array(
|
406 |
-
'text' => (isset($old_options['checkbox_text'])) ? $old_options['checkbox_text'] : 'Sign me up for the newsletter.',
|
407 |
-
'precheck' => (isset($old_options['precheck_checkbox'])) ? $old_options['precheck_checkbox'] : 0,
|
408 |
-
'add_to_comment_form' => (isset($old_options['add_to_comment_form'])) ? $old_options['add_to_comment_form'] : 0,
|
409 |
-
'add_to_registration_form' => (isset($old_options['add_to_reg_form'])) ? $old_options['add_to_reg_form'] : 0,
|
410 |
-
'add_to_buddypress_form' => (isset($old_options['add_to_bp_form'])) ? $old_options['add_to_bp_form'] : 0,
|
411 |
-
'add_to_multisite_form' => (isset($old_options['add_to_ms_form'])) ? $old_options['add_to_ms_form'] : 0,
|
412 |
-
'css_reset' => (isset($old_options['do_css_reset'])) ? $old_options['do_css_reset'] : 0,
|
413 |
-
'cookie_hide' => (isset($old_options['cookie_hide'])) ? $old_options['cookie_hide'] : 0,
|
414 |
-
);
|
415 |
-
|
416 |
-
$nsu_mailinglist = array(
|
417 |
-
'provider' => (isset($old_options['email_service'])) ? $old_options['email_service'] : '',
|
418 |
-
'use_api' => (isset($old_options['use_api'])) ? $old_options['use_api'] : 0,
|
419 |
-
'mc_api_key' => (isset($old_options['api_key'])) ? $old_options['api_key'] : '',
|
420 |
-
'mc_list_id' => (isset($old_options['list_id'])) ? $old_options['list_id'] : '',
|
421 |
-
'ymlp_api_key' => (isset($old_options['ymlp_api_key'])) ? $old_options['ymlp_api_key'] : '',
|
422 |
-
'ymlp_username' => (isset($old_options['ymlp_username'])) ? $old_options['ymlp_username'] : '',
|
423 |
-
'ymlp_groupid' => (isset($old_options['ymlp_groupid'])) ? $old_options['ymlp_groupid'] : '',
|
424 |
-
'aweber_list_name' => (isset($old_options['aweber_list_name'])) ? $old_options['aweber_list_name'] : '',
|
425 |
-
'phplist_list_id' => (isset($old_options['phplist_list_id'])) ? $old_options['phplist_list_id'] : '',
|
426 |
-
'form_action' => (isset($old_options['form_action'])) ? $old_options['form_action'] : '',
|
427 |
-
'email_id' => (isset($old_options['email_id'])) ? $old_options['email_id'] : '',
|
428 |
-
'subscribe_with_name' => (isset($old_options['subscribe_with_name'])) ? $old_options['subscribe_with_name'] : 0,
|
429 |
-
'name_id' => (isset($old_options['name_id'])) ? $old_options['name_id'] : '',
|
430 |
-
'extra_data' => $old_options['extra_data']
|
431 |
-
);
|
432 |
-
|
433 |
-
delete_option('nsu');
|
434 |
-
delete_option('nsu_form');
|
435 |
-
delete_option('nsu_checkbox');
|
436 |
-
delete_option('nsu_mailinglist');
|
437 |
-
|
438 |
-
add_option('nsu', $nsu);
|
439 |
-
add_option('nsu_form', $nsu_form);
|
440 |
-
add_option('nsu_checkbox', $nsu_checkbox);
|
441 |
-
add_option('nsu_mailinglist', $nsu_mailinglist);
|
442 |
-
|
443 |
-
//delete_option('ns_options');
|
444 |
-
}
|
445 |
}
|
446 |
|
447 |
/**
|
448 |
* Removes the options from database, this function is hooked to deactivation of NSU.
|
449 |
*/
|
450 |
-
|
451 |
-
// old option name
|
452 |
-
delete_option('ns_options');
|
453 |
-
|
454 |
-
// new option names
|
455 |
-
delete_option('nsu');
|
456 |
delete_option('nsu_form');
|
457 |
delete_option('nsu_checkbox');
|
458 |
delete_option('nsu_mailinglist');
|
11 |
private $accesslvl = 'manage_options';
|
12 |
private $icon_url = '';
|
13 |
private $bp_active = FALSE;
|
14 |
+
private $options = array();
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
public function __construct(NewsletterSignUp $NSU) {
|
17 |
+
$this->options = $NSU->getOptions();
|
18 |
$this->icon_url = plugins_url('/backend/img/icon.png', dirname(__FILE__));
|
19 |
|
20 |
+
add_filter("plugin_action_links_{$this->filename}", array($this, 'add_settings_link'));
|
21 |
+
add_action('admin_menu', array($this, 'add_option_page'));
|
22 |
+
add_action('admin_init', array($this, 'settings_init'));
|
|
|
|
|
|
|
23 |
|
24 |
// register function to remove options upon deactivation
|
25 |
+
register_deactivation_hook($this->filename, array($this, 'remove_options'));
|
26 |
|
27 |
+
add_action( 'admin_enqueue_scripts', array($this, 'load_css_and_js') );
|
28 |
+
add_action('bp_include', array($this, 'set_bp_active'));
|
29 |
+
}
|
30 |
|
31 |
+
public function load_css_and_js($hook)
|
32 |
+
{
|
33 |
+
if(!stripos($hook, $this->hook)) { return false; }
|
|
|
|
|
|
|
34 |
|
35 |
+
wp_enqueue_style($this->hook, plugins_url('/backend/css/backend.css', dirname(__FILE__)));
|
36 |
+
wp_enqueue_script(array('jquery', 'dashboard', 'postbox'));
|
37 |
+
wp_enqueue_script($this->hook, plugins_url('/backend/js/backend.js', dirname(__FILE__)));
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
* If buddypress is loaded, set buddypress_active to TRUE
|
42 |
*/
|
43 |
+
public function set_bp_active() {
|
44 |
$this->bp_active = TRUE;
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
/**
|
48 |
* The default settings page
|
49 |
*/
|
50 |
+
public function options_page_default() {
|
51 |
+
$opts = $this->options['mailinglist'];
|
52 |
|
53 |
$viewed_mp = NULL;
|
54 |
if (!empty($_GET['mp']))
|
59 |
$viewed_mp = NULL;
|
60 |
|
61 |
// Fill in some predefined values if options not set or set for other newsletter service
|
62 |
+
if ($opts['provider'] != $viewed_mp) {
|
63 |
switch ($viewed_mp) {
|
64 |
|
65 |
case 'mailchimp':
|
96 |
/**
|
97 |
* The admin page for managing checkbox settings
|
98 |
*/
|
99 |
+
public function options_page_checkbox_settings() {
|
100 |
+
$opts = $this->options['checkbox'];
|
101 |
require 'views/checkbox_settings.php';
|
102 |
}
|
103 |
|
104 |
/**
|
105 |
* The admin page for managing form settings
|
106 |
*/
|
107 |
+
public function options_page_form_settings() {
|
108 |
+
$opts = $this->options['form'];
|
109 |
+
$opts['mailinglist'] = $this->options['mailinglist'];
|
110 |
require 'views/form_settings.php';
|
111 |
}
|
112 |
|
113 |
/**
|
114 |
* The page for the configuration extractor
|
115 |
*/
|
116 |
+
public function options_page_config_helper() {
|
117 |
|
118 |
if (isset($_POST['form'])) {
|
119 |
$error = true;
|
184 |
/**
|
185 |
* Renders a donate box
|
186 |
*/
|
187 |
+
public function donate_box() {
|
188 |
$content = '
|
189 |
<p>I spent countless hours developing this plugin for <b>FREE</b>. If you like it, consider donating a token of your appreciation.</p>
|
190 |
|
191 |
+
<form class="donate" action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
192 |
+
<input type="hidden" name="cmd" value="_donations">
|
193 |
+
<input type="hidden" name="business" value="AP87UHXWPNBBU">
|
194 |
+
<input type="hidden" name="lc" value="US">
|
195 |
+
<input type="hidden" name="item_name" value="Danny van Kooten">
|
196 |
+
<input type="hidden" name="item_number" value="Newsletter Sign-Up">
|
197 |
+
<input type="hidden" name="currency_code" value="USD">
|
198 |
+
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
|
199 |
<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!">
|
200 |
<img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1">
|
201 |
</form>
|
202 |
|
203 |
+
<p>Alternatively, you can: </p>
|
204 |
<ul>
|
205 |
+
<li><a href="http://wordpress.org/support/view/plugin-reviews/newsletter-sign-up?rate=5#postform" target="_blank">Give a 5★ rating on WordPress.org</a></li>
|
206 |
+
<li><a href="http://dannyvankooten.com/wordpress-plugins/newsletter-sign-up/" target="_blank">Blog about it and link to the plugin page</a></li>
|
207 |
+
<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>
|
208 |
</ul>';
|
209 |
$this->postbox($this->hook . '-donatebox', 'Donate $10, $20 or $50!', $content);
|
210 |
}
|
212 |
/**
|
213 |
* Renders a box with the latests posts from DannyvanKooten.com
|
214 |
*/
|
215 |
+
public function latest_posts() {
|
216 |
require_once(ABSPATH . WPINC . '/rss.php');
|
217 |
if ($rss = fetch_rss('http://feeds.feedburner.com/dannyvankooten')) {
|
218 |
$content = '<ul>';
|
237 |
/**
|
238 |
* Renders a box with a link to the support forums for NSU
|
239 |
*/
|
240 |
+
public function support_box() {
|
241 |
$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
|
242 |
your question or tip in the <a target="_blank" href="http://wordpress.org/tags/' . $this->hook . '">support forums</a> on WordPress.org. This is so that others can benefit from this too.</p>';
|
243 |
$this->postbox($this->hook . '-support-box', "Looking for support?", $content);
|
250 |
* @param string $title
|
251 |
* @param string $content
|
252 |
*/
|
253 |
+
public function postbox($id, $title, $content) {
|
254 |
?>
|
255 |
<div id="<?php echo $id; ?>" class="dvk-box">
|
256 |
|
262 |
<?php
|
263 |
}
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
/**
|
266 |
* Adds the different menu pages
|
267 |
*/
|
268 |
+
public function add_option_page() {
|
269 |
+
add_menu_page($this->longname, "Newsl. Sign-up", $this->accesslvl, $this->hook, array($this, 'options_page_default'), $this->icon_url);
|
270 |
add_submenu_page($this->hook, "Newsletter Sign-Up :: Mailinglist Settings", "List Settings", $this->accesslvl, $this->hook, array($this, 'options_page_default'));
|
271 |
add_submenu_page($this->hook, "Newsletter Sign-Up :: Checkbox Settings", "Checkbox Settings", $this->accesslvl, $this->hook . '/checkbox-settings', array($this, 'options_page_checkbox_settings'));
|
272 |
add_submenu_page($this->hook, "Newsletter Sign-Up :: Form Settings", "Form Settings", $this->accesslvl, $this->hook . '/form-settings', array($this, 'options_page_form_settings'));
|
278 |
* @param array $links Array containing all the settings links for the various plugins.
|
279 |
* @return array The new array containing all the settings links
|
280 |
*/
|
281 |
+
public function add_settings_link($links) {
|
282 |
$settings_link = '<a href="admin.php?page=' . $this->hook . '">Settings</a>';
|
283 |
array_unshift($links, $settings_link);
|
284 |
return $links;
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
/**
|
288 |
* Registers the settings using WP Settings API.
|
289 |
*/
|
290 |
+
public function settings_init() {
|
291 |
+
register_setting('nsu_form_group', 'nsu_form', array($this, 'validate_form_options'));
|
292 |
+
register_setting('nsu_mailinglist_group', 'nsu_mailinglist', array($this, 'validate_mailinglist_options'));
|
293 |
+
register_setting('nsu_checkbox_group', 'nsu_checkbox', array($this, 'validate_checkbox_options'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
|
296 |
/**
|
297 |
* Removes the options from database, this function is hooked to deactivation of NSU.
|
298 |
*/
|
299 |
+
public function remove_options() {
|
|
|
|
|
|
|
|
|
|
|
300 |
delete_option('nsu_form');
|
301 |
delete_option('nsu_checkbox');
|
302 |
delete_option('nsu_mailinglist');
|
backend/css/donate.css
DELETED
@@ -1,38 +0,0 @@
|
|
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/js/donate.js
DELETED
@@ -1,7 +0,0 @@
|
|
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
CHANGED
@@ -12,12 +12,10 @@
|
|
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
|
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
|
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>
|
@@ -26,15 +24,15 @@
|
|
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 (
|
30 |
-
echo ' 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 (
|
38 |
echo ' checked="checked"';
|
39 |
}
|
40 |
?> /> </td>
|
@@ -42,18 +40,18 @@
|
|
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 (
|
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 (
|
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 (
|
57 |
echo ' checked="checked"';
|
58 |
}
|
59 |
?> /> <label for="add_to_bp_form">BuddyPress registration form</label><br />
|
@@ -62,7 +60,7 @@
|
|
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 (
|
66 |
echo ' checked="checked"';
|
67 |
}
|
68 |
?> /> <label for="add_to_ms_form">MultiSite registration form</label><br />
|
@@ -71,7 +69,7 @@ if (defined('MULTISITE') && MULTISITE == TRUE) {
|
|
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 (
|
75 |
echo ' checked="checked"';
|
76 |
}
|
77 |
?> /></td>
|
@@ -98,30 +96,4 @@ $this->support_box();
|
|
98 |
</div>
|
99 |
</div>
|
100 |
</div>
|
101 |
-
</div>
|
102 |
-
<?php if (isset($this->actions['show_donate_box']) && $this->actions['show_donate_box']) { ?>
|
103 |
-
<div id="dvk-donate-box">
|
104 |
-
<div id="dvk-donate-box-content">
|
105 |
-
<img width="16" height="16" class="dvk-close" src="<?php echo plugins_url('/backend/img/close.png', dirname(__FILE__)); ?>" alt="X">
|
106 |
-
<h3>Support me</h3>
|
107 |
-
<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>
|
108 |
-
|
109 |
-
<table>
|
110 |
-
<tr>
|
111 |
-
<td>
|
112 |
-
<form id="dvk_donate" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
113 |
-
<input type="hidden" name="cmd" value="_s-xclick">
|
114 |
-
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----">
|
115 |
-
<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!">
|
116 |
-
<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/nl_NL/i/scr/pixel.gif" width="1" height="1">
|
117 |
-
</form>
|
118 |
-
</td>
|
119 |
-
<td>
|
120 |
-
<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>
|
121 |
-
</td>
|
122 |
-
</tr>
|
123 |
-
</table>
|
124 |
-
<a class="dvk-dontshow" href="options-general.php?page=<?php echo $this->hook ?>&dontshowpopup=1">(do not show me this pop-up again)</a>
|
125 |
-
</div>
|
126 |
-
</div>
|
127 |
-
<?php } ?>
|
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 echo $opts['text']; ?>" /></td>
|
|
|
16 |
</tr>
|
17 |
<tr valign="top"><th scope="row">Redirect to this url after signing up <span class="ns_small">(leave empty for no redirect)</span></th>
|
18 |
+
<td><input size="50%" type="text" name="nsu_checkbox[redirect_to]" value="<?php echo $opts['redirect_to']; ?>" />
|
|
|
19 |
<br />
|
20 |
<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
|
21 |
users expect to be redirected to the post they commented on.</p>
|
24 |
</tr>
|
25 |
<tr valign="top"><th scope="row"><label for="ns_precheck_checkbox">Pre-check the checkbox?</label></th>
|
26 |
<td><input type="checkbox" id="ns_precheck_checkbox" name="nsu_checkbox[precheck]" value="1"<?php
|
27 |
+
if ($opts['precheck'] == '1') {
|
28 |
+
echo ' checked';
|
29 |
}
|
30 |
?> /></td>
|
31 |
</tr>
|
32 |
<tr valign="top">
|
33 |
<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>
|
34 |
<td><input type="checkbox" id="do_css_reset" name="nsu_checkbox[css_reset]" value="1"<?php
|
35 |
+
if ($opts['css_reset'] == '1') {
|
36 |
echo ' checked="checked"';
|
37 |
}
|
38 |
?> /> </td>
|
40 |
<tr valign="top"><th scope="row">Where to show the sign-up checkbox?</th>
|
41 |
<td>
|
42 |
<input type="checkbox" id="add_to_comment_form" name="nsu_checkbox[add_to_comment_form]" value="1"<?php
|
43 |
+
if ($opts['add_to_comment_form'] == '1') {
|
44 |
echo ' checked="checked"';
|
45 |
}
|
46 |
?> /> <label for="add_to_comment_form">WordPress comment form</label><br />
|
47 |
<input type="checkbox" id="add_to_reg_form" name="nsu_checkbox[add_to_registration_form]" value="1"<?php
|
48 |
+
if ($opts['add_to_registration_form'] == '1') {
|
49 |
echo ' checked="checked"';
|
50 |
}
|
51 |
?> /> <label for="add_to_reg_form">WordPress registration form</label><br />
|
52 |
<?php if ($this->bp_active == TRUE) { ?>
|
53 |
<input type="checkbox" id="add_to_bp_form" name="nsu_checkbox[add_to_buddypress_form]" value="1"<?php
|
54 |
+
if ($opts['add_to_buddypress_form'] == '1') {
|
55 |
echo ' checked="checked"';
|
56 |
}
|
57 |
?> /> <label for="add_to_bp_form">BuddyPress registration form</label><br />
|
60 |
if (defined('MULTISITE') && MULTISITE == TRUE) {
|
61 |
?>
|
62 |
<input type="checkbox" id="add_to_ms_form" name="nsu_checkbox[add_to_multisite_form]" value="1"<?php
|
63 |
+
if ($opts['add_to_multisite_form'] == '1') {
|
64 |
echo ' checked="checked"';
|
65 |
}
|
66 |
?> /> <label for="add_to_ms_form">MultiSite registration form</label><br />
|
69 |
</tr>
|
70 |
<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>
|
71 |
<td><input type="checkbox" id="ns_cookie_hide" name="nsu_checkbox[cookie_hide]" value="1"<?php
|
72 |
+
if ($opts['cookie_hide'] == '1') {
|
73 |
echo ' checked="checked"';
|
74 |
}
|
75 |
?> /></td>
|
96 |
</div>
|
97 |
</div>
|
98 |
</div>
|
99 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backend/views/dashboard.php
CHANGED
@@ -40,24 +40,18 @@
|
|
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
|
44 |
-
echo $opts['form_action']; ?>" /></td>
|
45 |
</tr>
|
46 |
<tr valign="top"><th scope="row">E-mail identifier <span class="ns_small">name attribute of input field that holds the emailadress</span></th>
|
47 |
-
<td><input size="50%" type="text" name="nsu_mailinglist[email_id]" value="<?php
|
48 |
-
echo $opts['email_id']; ?>"/></td>
|
49 |
</tr>
|
50 |
</tbody>
|
51 |
<tbody>
|
52 |
<tr valign="top"><th scope="row"><label for="subscribe_with_name">Subscribe with name?</label></th>
|
53 |
-
<td><input type="checkbox" id="subscribe_with_name" name="nsu_mailinglist[subscribe_with_name]" value="1"<?php if
|
54 |
-
echo ' checked="checked"';
|
55 |
-
} ?> /></td>
|
56 |
</tr>
|
57 |
-
<tr class="name_dependent" valign="top"<?php if
|
58 |
-
|
59 |
-
<td><input size="25%" id="ns_name_id" type="text" name="nsu_mailinglist[name_id]" value="<?php if (isset($opts['name_id']))
|
60 |
-
echo $opts['name_id']; ?>" /></td>
|
61 |
</tr>
|
62 |
</tbody>
|
63 |
</table>
|
@@ -111,32 +105,4 @@ endif;
|
|
111 |
</div>
|
112 |
</div>
|
113 |
</div>
|
114 |
-
</div>
|
115 |
-
<?php if (isset($this->actions['show_donate_box']) && $this->actions['show_donate_box']) { ?>
|
116 |
-
<div id="dvk-donate-box">
|
117 |
-
<div id="dvk-donate-box-content">
|
118 |
-
<img width="16" height="16" class="dvk-close" src="<?php echo plugins_url('/backend/img/close.png', dirname(__FILE__)); ?>" alt="X">
|
119 |
-
<h3>Support me</h3>
|
120 |
-
<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>
|
121 |
-
|
122 |
-
<table>
|
123 |
-
<tr>
|
124 |
-
<td>
|
125 |
-
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
126 |
-
<input type="hidden" name="cmd" value="_s-xclick">
|
127 |
-
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----
|
128 |
-
">
|
129 |
-
<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!">
|
130 |
-
<img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1">
|
131 |
-
</form>
|
132 |
-
|
133 |
-
</td>
|
134 |
-
<td>
|
135 |
-
<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo $this->plugin_url; ?>" data-text="Showing my appreciation to @DannyvanKooten for his awesome #WordPress plugin: <?php echo $this->shortname; ?>" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
|
136 |
-
</td>
|
137 |
-
</tr>
|
138 |
-
</table>
|
139 |
-
<a class="dvk-dontshow" href="options-general.php?page=<?php echo $this->hook ?>&dontshowpopup=1">(do not show me this pop-up again)</a>
|
140 |
-
</div>
|
141 |
-
</div>
|
142 |
-
<?php } ?>
|
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>
|
105 |
</div>
|
106 |
</div>
|
107 |
</div>
|
108 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backend/views/form_settings.php
CHANGED
@@ -16,57 +16,43 @@
|
|
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
|
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
|
25 |
</tr>
|
26 |
-
<tr valign="top" class="name_dependent" <?php if
|
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
|
30 |
-
|
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
|
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
|
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
|
54 |
-
|
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'; ?> /> <label for="nsu_form_wpautop"><?php _e('Automatically add paragraphs'); ?></label></p>
|
57 |
</td>
|
58 |
</tr>
|
59 |
|
60 |
-
<?php if(
|
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
|
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
|
69 |
-
echo 'CHECKED'; ?> /></td>
|
70 |
</tr>
|
71 |
</table>
|
72 |
<p class="submit">
|
@@ -76,9 +62,11 @@
|
|
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>[
|
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 |
?>
|
@@ -98,30 +86,4 @@ $this->support_box();
|
|
98 |
</div>
|
99 |
</div>
|
100 |
</div>
|
101 |
-
</div>
|
102 |
-
<?php if (isset($this->actions['show_donate_box']) && $this->actions['show_donate_box']) { ?>
|
103 |
-
<div id="dvk-donate-box">
|
104 |
-
<div id="dvk-donate-box-content">
|
105 |
-
<img width="16" height="16" class="dvk-close" src="<?php echo plugins_url('/backend/img/close.png', dirname(__FILE__)); ?>" alt="X">
|
106 |
-
<h3>Support me</h3>
|
107 |
-
<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>
|
108 |
-
|
109 |
-
<table>
|
110 |
-
<tr>
|
111 |
-
<td>
|
112 |
-
<form id="dvk_donate" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
113 |
-
<input type="hidden" name="cmd" value="_s-xclick">
|
114 |
-
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----">
|
115 |
-
<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!">
|
116 |
-
<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/nl_NL/i/scr/pixel.gif" width="1" height="1">
|
117 |
-
</form>
|
118 |
-
</td>
|
119 |
-
<td>
|
120 |
-
<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>
|
121 |
-
</td>
|
122 |
-
</tr>
|
123 |
-
</table>
|
124 |
-
<a class="dvk-dontshow" href="options-general.php?page=<?php echo $this->hook ?>&dontshowpopup=1">(do not show me this pop-up again)</a>
|
125 |
-
</div>
|
126 |
-
</div>
|
127 |
-
<?php } ?>
|
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 echo $opts['email_label']; ?>" /></td>
|
|
|
20 |
</tr>
|
21 |
<tr valign="top">
|
22 |
<th scope="row">E-mail default value</th>
|
23 |
+
<td><input size="50%" type="text" name="nsu_form[email_default_value]" value="<?php echo $opts['email_default_value']; ?>" /></td>
|
24 |
</tr>
|
25 |
+
<tr valign="top" class="name_dependent" <?php if($opts['mailinglist']['subscribe_with_name'] != 1) echo 'style="display:none;"'; ?>><th scope="row">Name label <span class="ns_small">(if using subscribe with name)</span></th>
|
|
|
26 |
<td>
|
27 |
+
<input size="50%" type="text" name="nsu_form[name_label]" value="<?php echo $opts['name_label']; ?>" /><br />
|
28 |
+
<input type="checkbox" id="name_required" name="nsu_form[name_required]" value="1"<?php if($opts['name_required'] == '1') { echo ' checked'; } ?> />
|
|
|
|
|
|
|
29 |
<label for="name_required">Name is a required field?</label>
|
30 |
</td>
|
31 |
|
32 |
</tr>
|
33 |
+
<tr valign="top" class="name_dependent" <?php if($opts['mailinglist']['subscribe_with_name'] != 1) echo 'style="display:none;"'; ?>>
|
|
|
34 |
<th scope="row">Name default value</th>
|
35 |
+
<td><input size="50%" type="text" name="nsu_form[name_default_value]" value="<?php echo $opts['name_default_value']; ?>" /></td>
|
|
|
|
|
|
|
36 |
|
37 |
</tr>
|
38 |
<tr valign="top"><th scope="row">Submit button value</th>
|
39 |
+
<td><input size="50%" type="text" name="nsu_form[submit_button]" value="<?php echo $opts['submit_button']; ?>" /></td>
|
|
|
40 |
</tr>
|
41 |
<tr valign="top"><th scope="row">Text to replace the form with after a successful sign-up</th>
|
42 |
<td>
|
43 |
+
<textarea style="width:100%;" rows="5" cols="50" name="nsu_form[text_after_signup]"><?php echo $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'; ?> /> <label for="nsu_form_wpautop"><?php _e('Automatically add paragraphs'); ?></label></p>
|
|
|
|
|
45 |
</td>
|
46 |
</tr>
|
47 |
|
48 |
+
<?php if($opts['mailinglist']['use_api'] == 1) { ?>
|
49 |
<tr valign="top"><th scope="row">Redirect to this url after signing up <span class="ns_small">(leave empty for no redirect)</span></th>
|
50 |
+
<td><input size="50%" type="text" name="nsu_form[redirect_to]" value="<?php echo $opts['redirect_to']; ?>" /></td>
|
|
|
51 |
</tr>
|
52 |
<?php } ?>
|
53 |
|
54 |
<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>
|
55 |
+
<td><input type="checkbox" id="ns_load_form_styles" name="nsu_form[load_form_css]" value="1" <?php if($opts['load_form_css'] == 1) echo 'checked'; ?> /></td>
|
|
|
56 |
</tr>
|
57 |
</table>
|
58 |
<p class="submit">
|
62 |
<?php
|
63 |
$tips = array(
|
64 |
'You can embed a sign-up form in your posts and pages by
|
65 |
+
using the shortcode <b><em>[newsletter-sign-up-form]</em></b> or by calling <b><em><?php if(function_exists(\'nsu_signup_form\')) nsu_signup_form(); ?></em></b> from your template files.',
|
66 |
'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
|
67 |
+
easier customizing',
|
68 |
+
'When testing, make sure to test with an email address that is not already on your e-mail list.',
|
69 |
+
'Using Newsletter Sign-Up with MailChimp? Consider switching to <a href="http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/">MailChimp for WordPress</a>'
|
70 |
);
|
71 |
$random_key = array_rand($tips);
|
72 |
?>
|
86 |
</div>
|
87 |
</div>
|
88 |
</div>
|
89 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
backend/views/rows-mailchimp.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
<th scope="row"><label for="use_api">Use MailChimp API? <span class="ns_small">(recommended)</span></label></th>
|
3 |
<td><input type="checkbox" id="use_api" name="nsu_mailinglist[use_api]" value="1"<?php if (isset($opts['use_api']) && $opts['use_api'] == '1') { echo ' checked="checked"'; } ?> /></td>
|
4 |
</tr>
|
|
|
5 |
<tbody class="api_rows" <?php if (!isset($opts['use_api']) || $opts['use_api'] != 1) echo ' style="display:none" '; ?>>
|
6 |
<tr valign="top">
|
7 |
<th scope="row">MailChimp API Key <a target="_blank" href="http://admin.mailchimp.com/account/api">(?)</a></th>
|
@@ -30,3 +31,14 @@
|
|
30 |
</tr>
|
31 |
</tbody>
|
32 |
</tbody>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<th scope="row"><label for="use_api">Use MailChimp API? <span class="ns_small">(recommended)</span></label></th>
|
3 |
<td><input type="checkbox" id="use_api" name="nsu_mailinglist[use_api]" value="1"<?php if (isset($opts['use_api']) && $opts['use_api'] == '1') { echo ' checked="checked"'; } ?> /></td>
|
4 |
</tr>
|
5 |
+
|
6 |
<tbody class="api_rows" <?php if (!isset($opts['use_api']) || $opts['use_api'] != 1) echo ' style="display:none" '; ?>>
|
7 |
<tr valign="top">
|
8 |
<th scope="row">MailChimp API Key <a target="_blank" href="http://admin.mailchimp.com/account/api">(?)</a></th>
|
31 |
</tr>
|
32 |
</tbody>
|
33 |
</tbody>
|
34 |
+
|
35 |
+
<tr valign="top" style="display:block;">
|
36 |
+
<td colspan="2">
|
37 |
+
<div id="setting-error-settings_updated" class="updated settings-error">
|
38 |
+
<p>
|
39 |
+
<strong>Notice:</strong> You are using MailChimp, great! Consider switching to my newer plugin called <a href="http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/">MailChimp for WordPress</a> which, surprisingly, focuses solely on MailChimp users.
|
40 |
+
It can be downloaded from the WordPress repository <a href="http://wordpress.org/plugins/mailchimp-for-wp/">here</a>.
|
41 |
+
</p>
|
42 |
+
</div>
|
43 |
+
</td>
|
44 |
+
</tr>
|
frontend/NewsletterSignUp.php
CHANGED
@@ -10,22 +10,70 @@ class NewsletterSignUp {
|
|
10 |
|
11 |
public function __construct()
|
12 |
{
|
13 |
-
$
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
-
|
17 |
-
private function get_options() {
|
18 |
-
$this->options = get_option('nsu');
|
19 |
-
$this->options['form'] = get_option('nsu_form');
|
20 |
-
$this->options['mailinglist'] = get_option('nsu_mailinglist');
|
21 |
-
$this->options['checkbox'] = get_option('nsu_checkbox');
|
22 |
-
}
|
23 |
|
24 |
/**
|
25 |
-
|
26 |
* @return type
|
27 |
*/
|
28 |
-
function register_widget()
|
29 |
{
|
30 |
return register_widget('NewsletterSignUpWidget');
|
31 |
}
|
@@ -42,83 +90,29 @@ class NewsletterSignUp {
|
|
42 |
|
43 |
public function enqueue_styles()
|
44 |
{
|
|
|
|
|
45 |
// Build stylesheet url --------------
|
46 |
$stylesheet_opts = '?';
|
47 |
|
48 |
// Load CSS to reset the checkbox' position?
|
49 |
-
if(
|
50 |
$stylesheet_opts .= 'checkbox_reset=1&';
|
51 |
}
|
52 |
|
53 |
// Load CSS to reset label and input fields for the sign-up form?
|
54 |
-
if(
|
55 |
$stylesheet_opts .= 'form_css=1&';
|
56 |
}
|
57 |
|
58 |
-
wp_enqueue_style('ns_checkbox_style', plugins_url("/frontend/css/newsletter-sign-up.php$stylesheet_opts", dirname(__FILE__)));
|
59 |
}
|
60 |
|
61 |
-
/**
|
62 |
-
* Add all the various WP filters and actions
|
63 |
-
*/
|
64 |
-
function add_hooks()
|
65 |
-
{
|
66 |
-
// widget hooks
|
67 |
-
add_action('widgets_init',array(&$this,'register_widget'));
|
68 |
-
add_action('init',array(&$this,'check_for_form_submit'));
|
69 |
-
|
70 |
-
// register the shortcode which can be used to output sign-up form
|
71 |
-
add_shortcode('newsletter-sign-up-form',array(&$this,'form_shortcode'));
|
72 |
-
add_shortcode('nsu-form',array(&$this,'form_shortcode'));
|
73 |
-
|
74 |
-
$enqueue = false;
|
75 |
-
|
76 |
-
// Load CSS to reset the checkbox' position?
|
77 |
-
if(isset($this->options['checkbox']['css_reset']) && $this->options['checkbox']['css_reset'] == 1) {
|
78 |
-
$enqueue = true;
|
79 |
-
}
|
80 |
-
// Load CSS to reset label and input fields for the sign-up form?
|
81 |
-
if(isset($this->options['form']['load_form_css']) && $this->options['form']['load_form_css'] == 1) {
|
82 |
-
$enqueue = true;
|
83 |
-
}
|
84 |
-
|
85 |
-
// Only enqueue stylesheet if asked to by user.
|
86 |
-
if($enqueue) { add_action('wp_enqueue_scripts', array(&$this, 'enqueue_styles')); }
|
87 |
-
|
88 |
-
// Add to comment form? If so, add necessary actions. Try to add automatically.
|
89 |
-
if(isset($this->options['checkbox']['add_to_comment_form']) && $this->options['checkbox']['add_to_comment_form'] == 1) {
|
90 |
-
add_action('thesis_hook_after_comment_box',array(&$this,'output_checkbox'),20);
|
91 |
-
add_action('comment_form',array(&$this,'output_checkbox'),20);
|
92 |
-
add_action('comment_approved_',array(&$this,'grab_email_from_comment'),10,1);
|
93 |
-
add_action('comment_post', array(&$this,'grab_email_from_comment'), 50, 2);
|
94 |
-
}
|
95 |
-
|
96 |
-
// If add_to_reg_form is ticked, add corresponding actions
|
97 |
-
if(isset($this->options['checkbox']['add_to_registration_form']) && $this->options['checkbox']['add_to_registration_form'] == 1) {
|
98 |
-
add_action('register_form',array(&$this,'output_checkbox'),20);
|
99 |
-
add_action('register_post',array(&$this,'grab_email_from_wp_signup'), 50);
|
100 |
-
}
|
101 |
-
|
102 |
-
// If add_to_bp_form is ticked, add BuddyPress actions
|
103 |
-
if(isset($this->options['checkbox']['add_to_buddypress_form']) && $this->options['checkbox']['add_to_buddypress_form'] == 1) {
|
104 |
-
add_action('bp_before_registration_submit_buttons',array(&$this,'output_checkbox'),20);
|
105 |
-
add_action('bp_complete_signup',array(&$this,'grab_email_from_wp_signup'),20);
|
106 |
-
}
|
107 |
-
|
108 |
-
// If running a MultiSite, add to registration form and add actions.
|
109 |
-
if(isset($this->options['checkbox']['add_to_multisite_form']) && $this->options['checkbox']['add_to_multisite_form'] == 1) {
|
110 |
-
add_action('signup_extra_fields',array(&$this,'output_checkbox'),20);
|
111 |
-
add_action('signup_blogform',array(&$this,'add_hidden_checkbox'),20);
|
112 |
-
add_filter('add_signup_meta',array(&$this,'add_checkbox_to_usermeta'));
|
113 |
-
add_action('wpmu_activate_blog',array(&$this,'grab_email_from_ms_blog_signup'),20,5);
|
114 |
-
add_action('wpmu_activate_user',array(&$this,'grab_email_from_ms_user_signup'),20,3);
|
115 |
-
}
|
116 |
-
}
|
117 |
|
118 |
/**
|
119 |
* Check if ANY Newsletter Sign-Up form has been submitted.
|
120 |
*/
|
121 |
-
function check_for_form_submit()
|
122 |
{
|
123 |
$opts = $this->options['form'];
|
124 |
$errors = array();
|
@@ -128,7 +122,7 @@ class NewsletterSignUp {
|
|
128 |
$email = (isset($_POST['nsu_email'])) ? $_POST['nsu_email'] : '';
|
129 |
$name = (isset($_POST['nsu_name'])) ? $_POST['nsu_name'] : '';
|
130 |
|
131 |
-
if(
|
132 |
$errors['name-field'] = 'Please fill in the name field.';
|
133 |
}
|
134 |
|
@@ -141,7 +135,7 @@ class NewsletterSignUp {
|
|
141 |
$this->validation_errors = $errors;
|
142 |
|
143 |
if(count($this->validation_errors) == 0) {
|
144 |
-
$this->send_post_data($email
|
145 |
}
|
146 |
|
147 |
}
|
@@ -158,7 +152,7 @@ class NewsletterSignUp {
|
|
158 |
$opts = $this->options['checkbox'];
|
159 |
|
160 |
// If using option to hide checkbox for subscribers and cookie is set, set instance variable showed_checkbox to true so checkbox won't show.
|
161 |
-
if(
|
162 |
|
163 |
// User could have rendered the checkbox by manually adding 'the hook 'ns_comment_checkbox()' to their comment form
|
164 |
// If so, abandon function.
|
@@ -166,9 +160,9 @@ class NewsletterSignUp {
|
|
166 |
|
167 |
?>
|
168 |
<p id="ns-checkbox">
|
169 |
-
<input value="1" id="nsu_checkbox" type="checkbox" name="newsletter-signup-do" <?php if(
|
170 |
<label for="nsu_checkbox">
|
171 |
-
<?php
|
172 |
</label>
|
173 |
</p>
|
174 |
<?php
|
@@ -201,14 +195,15 @@ class NewsletterSignUp {
|
|
201 |
*/
|
202 |
function send_post_data($email, $name = '', $type = 'checkbox')
|
203 |
{
|
204 |
-
|
|
|
205 |
// when not using api and no form action has been given, abandon.
|
206 |
if(empty($opts['use_api']) && empty($opts['form_action'])) return;
|
207 |
|
208 |
$post_data = array();
|
209 |
|
210 |
/* Are we using API? */
|
211 |
-
if(
|
212 |
|
213 |
switch($opts['provider']) {
|
214 |
|
@@ -250,8 +245,18 @@ class NewsletterSignUp {
|
|
250 |
if(isset($opts['subscribe_with_name']) && $opts['subscribe_with_name'] == 1) {
|
251 |
// Try to provide values for First and Lastname fields
|
252 |
// These can be overridden, of just ignored by mailchimp.
|
253 |
-
$
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
$request['merge_vars'][$opts['name_id']] = $name;
|
256 |
}
|
257 |
// Add any set additional data to merge_vars array
|
@@ -278,7 +283,7 @@ class NewsletterSignUp {
|
|
278 |
);
|
279 |
|
280 |
// Subscribe with name? Add to $post_data array.
|
281 |
-
if(
|
282 |
|
283 |
// Add list specific data
|
284 |
switch($opts['provider']) {
|
@@ -313,17 +318,18 @@ class NewsletterSignUp {
|
|
313 |
}
|
314 |
|
315 |
// store a cookie, if preferred by site owner
|
316 |
-
if(
|
317 |
|
318 |
// Check if we should redirect to a given page
|
319 |
-
if($type == 'form' &&
|
320 |
wp_redirect( $this->options['form']['redirect_to']);
|
321 |
exit;
|
322 |
-
} elseif($type == 'checkbox' &&
|
323 |
wp_redirect( $this->options['checkbox']['redirect_to']);
|
324 |
exit;
|
325 |
}
|
326 |
-
|
|
|
327 |
}
|
328 |
|
329 |
|
@@ -375,7 +381,7 @@ class NewsletterSignUp {
|
|
375 |
* @param string $password : the password, we don't actually use this
|
376 |
* @param array $meta : the meta values that belong to this user, holds the value of our 'newsletter-sign-up' checkbox.
|
377 |
*/
|
378 |
-
function grab_email_from_ms_user_signup($user_id, $password = NULL,$meta = NULL){
|
379 |
if(!isset($meta['newsletter-signup-do']) || $meta['newsletter-signup-do'] != 1) return;
|
380 |
$user_info = get_userdata($user_id);
|
381 |
|
@@ -394,7 +400,7 @@ class NewsletterSignUp {
|
|
394 |
* @param $b No idea, seriously.
|
395 |
* @param array $meta The meta values that belong to this user, holds the value of our 'newsletter-sign-up' checkbox.
|
396 |
*/
|
397 |
-
function grab_email_from_ms_blog_signup($blog_id, $user_id, $a, $b ,$meta){
|
398 |
|
399 |
if(!isset($meta['newsletter-signup-do']) || $meta['newsletter-signup-do'] != 1) return;
|
400 |
$user_info = get_userdata($user_id);
|
@@ -402,7 +408,7 @@ class NewsletterSignUp {
|
|
402 |
$email = $user_info->user_email;
|
403 |
$name = $user_info->first_name;
|
404 |
|
405 |
-
$this->send_post_data($email
|
406 |
}
|
407 |
|
408 |
/**
|
@@ -434,7 +440,7 @@ class NewsletterSignUp {
|
|
434 |
* @param int $cid : the ID of the comment
|
435 |
* @param object $comment : the comment object, optionally
|
436 |
*/
|
437 |
-
function grab_email_from_comment($cid,$comment = NULL)
|
438 |
{
|
439 |
if($_POST['newsletter-signup-do'] != 1) return;
|
440 |
|
@@ -459,7 +465,7 @@ class NewsletterSignUp {
|
|
459 |
* @param string $content Not used
|
460 |
* @return string Form HTML-code
|
461 |
*/
|
462 |
-
function form_shortcode($atts = null,$content = null)
|
463 |
{
|
464 |
return $this->output_form(false);
|
465 |
}
|
@@ -472,7 +478,7 @@ class NewsletterSignUp {
|
|
472 |
public function output_form($echo = true)
|
473 |
{
|
474 |
$errors = $this->validation_errors;
|
475 |
-
$opts = $this->
|
476 |
$additional_fields = '';
|
477 |
$output = '';
|
478 |
|
@@ -480,10 +486,10 @@ class NewsletterSignUp {
|
|
480 |
$formno = $this->no_of_forms;
|
481 |
|
482 |
/* Set up form variables for API usage or normal form */
|
483 |
-
if(
|
484 |
|
485 |
/* Using API, send form request to ANY page */
|
486 |
-
$form_action =
|
487 |
$email_id = 'nsu_email';
|
488 |
$name_id = 'nsu_name';
|
489 |
|
@@ -493,7 +499,7 @@ class NewsletterSignUp {
|
|
493 |
$form_action = $opts['mailinglist']['form_action'];
|
494 |
$email_id = $opts['mailinglist']['email_id'];
|
495 |
|
496 |
-
if(
|
497 |
$name_id = $opts['mailinglist']['name_id'];
|
498 |
}
|
499 |
|
@@ -511,23 +517,22 @@ class NewsletterSignUp {
|
|
511 |
$additional_fields .= "</div>";
|
512 |
endif;
|
513 |
|
514 |
-
$email_label =
|
515 |
-
$name_label =
|
516 |
-
|
517 |
-
$email_value = (!empty($opts['form']['email_default_value'])) ? $opts['form']['email_default_value'] : '';
|
518 |
-
$name_value = (!empty($opts['form']['name_default_value'])) ? $opts['form']['name_default_value'] : '';
|
519 |
|
520 |
-
|
|
|
|
|
521 |
|
522 |
-
$text_after_signup =
|
523 |
-
$text_after_signup = (
|
524 |
|
525 |
|
526 |
|
527 |
if(!isset($_POST['nsu_submit']) || count($errors) > 0) { //form has not been submitted yet
|
528 |
|
529 |
$output .= "<form class=\"nsu-form\" id=\"nsu-form-$formno\" action=\"$form_action\" method=\"post\">";
|
530 |
-
if(
|
531 |
$output .= "<p><label for=\"nsu-name-$formno\">$name_label</label><input class=\"nsu-field\" id=\"nsu-name-$formno\" type=\"text\" name=\"$name_id\" value=\"$name_value\" ";
|
532 |
if($name_value) $output .= "onblur=\"if(!this.value) this.value = '$name_value';\" onfocus=\"if(this.value == '$name_value') this.value=''\" ";
|
533 |
$output .= "/>";
|
10 |
|
11 |
public function __construct()
|
12 |
{
|
13 |
+
$defaults = array(
|
14 |
+
'form' => array('load_form_css' => 0, 'submit_button' => 'Sign up', 'name_label' => 'Name:', 'email_label' => "Email:", 'email_default_value' => 'Your emailaddress..', 'name_required' => 0, 'name_default_value' => 'Your name..', 'wpautop' => 0, 'text_after_signup' => 'Thanks for signing up to our newsletter. Please check your inbox to confirm your email address.', 'redirect_to' => ''),
|
15 |
+
'mailinglist' => array('provider' => '', 'use_api' => 0, 'subscribe_with_name' => 0, 'email_id' => '', 'name_id' => '', 'form_action' => ''),
|
16 |
+
'checkbox' => array('text' => 'Sign me up for the newsletter', 'redirect_to' => '', 'precheck' => 0, 'cookie_hide' => 0, 'css_reset' => 0, 'add_to_registration_form' => 0, 'add_to_comment_form' => 1, 'add_to_buddypress_form' => 0, 'add_to_multisite_form' => 0)
|
17 |
+
);
|
18 |
+
|
19 |
+
$this->options['form'] = array_merge($defaults['form'], (array) get_option('nsu_form'));
|
20 |
+
$this->options['mailinglist'] = array_merge($defaults['mailinglist'], (array) get_option('nsu_mailinglist'));
|
21 |
+
$this->options['checkbox'] = array_merge($defaults['checkbox'], (array) get_option('nsu_checkbox'));
|
22 |
+
$opts = $this->options;
|
23 |
+
|
24 |
+
// widget hooks
|
25 |
+
add_action('widgets_init', array($this, 'register_widget'));
|
26 |
+
add_action('init', array($this, 'check_for_form_submit'));
|
27 |
+
|
28 |
+
// register the shortcode which can be used to output sign-up form
|
29 |
+
add_shortcode('newsletter-sign-up-form', array($this,'form_shortcode'));
|
30 |
+
add_shortcode('nsu-form', array($this,'form_shortcode'));
|
31 |
+
|
32 |
+
// Should we load the stylesheet?
|
33 |
+
if($opts['checkbox']['css_reset'] == 1 || $opts['form']['load_form_css'] == 1) {
|
34 |
+
add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
|
35 |
+
}
|
36 |
+
|
37 |
+
// Add to comment form? If so, add necessary actions. Try to add automatically.
|
38 |
+
if($opts['checkbox']['add_to_comment_form'] == 1) {
|
39 |
+
add_action('thesis_hook_after_comment_box', array($this, 'output_checkbox'), 20);
|
40 |
+
add_action('comment_form', array($this, 'output_checkbox'), 20);
|
41 |
+
add_action('comment_approved_', array($this, 'grab_email_from_comment'), 10, 1);
|
42 |
+
add_action('comment_post', array($this, 'grab_email_from_comment'), 50, 2);
|
43 |
+
}
|
44 |
+
|
45 |
+
// If add_to_reg_form is ticked, add corresponding actions
|
46 |
+
if($opts['checkbox']['add_to_registration_form'] == 1) {
|
47 |
+
add_action('register_form',array($this, 'output_checkbox'), 20);
|
48 |
+
add_action('register_post',array($this, 'grab_email_from_wp_signup'), 50);
|
49 |
+
}
|
50 |
+
|
51 |
+
// If add_to_bp_form is ticked, add BuddyPress actions
|
52 |
+
if($opts['checkbox']['add_to_buddypress_form'] == 1) {
|
53 |
+
add_action('bp_before_registration_submit_buttons', array($this, 'output_checkbox'), 20);
|
54 |
+
add_action('bp_complete_signup', array($this, 'grab_email_from_wp_signup'), 20);
|
55 |
+
}
|
56 |
+
|
57 |
+
// If running a MultiSite, add to registration form and add actions.
|
58 |
+
if($opts['checkbox']['add_to_multisite_form'] == 1) {
|
59 |
+
add_action('signup_extra_fields', array($this, 'output_checkbox'), 20);
|
60 |
+
add_action('signup_blogform', array($this, 'add_hidden_checkbox'), 20);
|
61 |
+
add_filter('add_signup_meta', array($this, 'add_checkbox_to_usermeta'));
|
62 |
+
add_action('wpmu_activate_blog', array($this, 'grab_email_from_ms_blog_signup'), 20, 5);
|
63 |
+
add_action('wpmu_activate_user', array($this, 'grab_email_from_ms_user_signup'), 20, 3);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getOptions()
|
68 |
+
{
|
69 |
+
return $this->options;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
/**
|
73 |
+
* Registers the Newsletter Sign-Up Widget
|
74 |
* @return type
|
75 |
*/
|
76 |
+
public function register_widget()
|
77 |
{
|
78 |
return register_widget('NewsletterSignUpWidget');
|
79 |
}
|
90 |
|
91 |
public function enqueue_styles()
|
92 |
{
|
93 |
+
$opts = $this->getOptions();
|
94 |
+
|
95 |
// Build stylesheet url --------------
|
96 |
$stylesheet_opts = '?';
|
97 |
|
98 |
// Load CSS to reset the checkbox' position?
|
99 |
+
if($opts['checkbox']['css_reset'] == 1) {
|
100 |
$stylesheet_opts .= 'checkbox_reset=1&';
|
101 |
}
|
102 |
|
103 |
// Load CSS to reset label and input fields for the sign-up form?
|
104 |
+
if($opts['form']['load_form_css'] == 1) {
|
105 |
$stylesheet_opts .= 'form_css=1&';
|
106 |
}
|
107 |
|
108 |
+
wp_enqueue_style('ns_checkbox_style', plugins_url("/frontend/css/newsletter-sign-up.php{$stylesheet_opts}", dirname(__FILE__)));
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
/**
|
113 |
* Check if ANY Newsletter Sign-Up form has been submitted.
|
114 |
*/
|
115 |
+
public function check_for_form_submit()
|
116 |
{
|
117 |
$opts = $this->options['form'];
|
118 |
$errors = array();
|
122 |
$email = (isset($_POST['nsu_email'])) ? $_POST['nsu_email'] : '';
|
123 |
$name = (isset($_POST['nsu_name'])) ? $_POST['nsu_name'] : '';
|
124 |
|
125 |
+
if($this->options['mailinglist']['subscribe_with_name'] == 1 && $opts['name_required'] == 1 && empty($name)) {
|
126 |
$errors['name-field'] = 'Please fill in the name field.';
|
127 |
}
|
128 |
|
135 |
$this->validation_errors = $errors;
|
136 |
|
137 |
if(count($this->validation_errors) == 0) {
|
138 |
+
$this->send_post_data($email, $name, 'form');
|
139 |
}
|
140 |
|
141 |
}
|
152 |
$opts = $this->options['checkbox'];
|
153 |
|
154 |
// If using option to hide checkbox for subscribers and cookie is set, set instance variable showed_checkbox to true so checkbox won't show.
|
155 |
+
if($opts['cookie_hide'] == 1 && isset($_COOKIE['ns_subscriber'])) $this->showed_checkbox = TRUE;
|
156 |
|
157 |
// User could have rendered the checkbox by manually adding 'the hook 'ns_comment_checkbox()' to their comment form
|
158 |
// If so, abandon function.
|
160 |
|
161 |
?>
|
162 |
<p id="ns-checkbox">
|
163 |
+
<input value="1" id="nsu_checkbox" type="checkbox" name="newsletter-signup-do" <?php if($opts['precheck'] == 1) echo 'checked="checked" '; ?>/>
|
164 |
<label for="nsu_checkbox">
|
165 |
+
<?php echo $opts['text']; ?>
|
166 |
</label>
|
167 |
</p>
|
168 |
<?php
|
195 |
*/
|
196 |
function send_post_data($email, $name = '', $type = 'checkbox')
|
197 |
{
|
198 |
+
$opts = $this->options['mailinglist'];
|
199 |
+
|
200 |
// when not using api and no form action has been given, abandon.
|
201 |
if(empty($opts['use_api']) && empty($opts['form_action'])) return;
|
202 |
|
203 |
$post_data = array();
|
204 |
|
205 |
/* Are we using API? */
|
206 |
+
if($opts['use_api'] == 1) {
|
207 |
|
208 |
switch($opts['provider']) {
|
209 |
|
245 |
if(isset($opts['subscribe_with_name']) && $opts['subscribe_with_name'] == 1) {
|
246 |
// Try to provide values for First and Lastname fields
|
247 |
// These can be overridden, of just ignored by mailchimp.
|
248 |
+
$strpos = strpos($name, ' ');
|
249 |
+
|
250 |
+
$request['merge_vars']['FNAME'] = $name;
|
251 |
+
|
252 |
+
if($strpos) {
|
253 |
+
$request['merge_vars']['FNAME'] = substr($name, 0, $strpos);
|
254 |
+
$request['merge_vars']['LNAME'] = substr($name, $strpos);
|
255 |
+
} else {
|
256 |
+
$request['merge_vars']['FNAME'] = $name;
|
257 |
+
$request['merge_vars']['LNAME'] = '...';
|
258 |
+
}
|
259 |
+
|
260 |
$request['merge_vars'][$opts['name_id']] = $name;
|
261 |
}
|
262 |
// Add any set additional data to merge_vars array
|
283 |
);
|
284 |
|
285 |
// Subscribe with name? Add to $post_data array.
|
286 |
+
if($opts['subscribe_with_name'] == 1) $post_data[$opts['name_id']] = $name;
|
287 |
|
288 |
// Add list specific data
|
289 |
switch($opts['provider']) {
|
318 |
}
|
319 |
|
320 |
// store a cookie, if preferred by site owner
|
321 |
+
if($opts['cookie_hide'] == 1) @setcookie('ns_subscriber',TRUE,time() + 9999999);
|
322 |
|
323 |
// Check if we should redirect to a given page
|
324 |
+
if($type == 'form' && strlen($this->options['form']['redirect_to']) > 6) {
|
325 |
wp_redirect( $this->options['form']['redirect_to']);
|
326 |
exit;
|
327 |
+
} elseif($type == 'checkbox' && strlen($this->options['checkbox']['redirect_to']) > 6) {
|
328 |
wp_redirect( $this->options['checkbox']['redirect_to']);
|
329 |
exit;
|
330 |
}
|
331 |
+
|
332 |
+
return true;
|
333 |
}
|
334 |
|
335 |
|
381 |
* @param string $password : the password, we don't actually use this
|
382 |
* @param array $meta : the meta values that belong to this user, holds the value of our 'newsletter-sign-up' checkbox.
|
383 |
*/
|
384 |
+
public function grab_email_from_ms_user_signup($user_id, $password = NULL,$meta = NULL){
|
385 |
if(!isset($meta['newsletter-signup-do']) || $meta['newsletter-signup-do'] != 1) return;
|
386 |
$user_info = get_userdata($user_id);
|
387 |
|
400 |
* @param $b No idea, seriously.
|
401 |
* @param array $meta The meta values that belong to this user, holds the value of our 'newsletter-sign-up' checkbox.
|
402 |
*/
|
403 |
+
public function grab_email_from_ms_blog_signup($blog_id, $user_id, $a, $b ,$meta){
|
404 |
|
405 |
if(!isset($meta['newsletter-signup-do']) || $meta['newsletter-signup-do'] != 1) return;
|
406 |
$user_info = get_userdata($user_id);
|
408 |
$email = $user_info->user_email;
|
409 |
$name = $user_info->first_name;
|
410 |
|
411 |
+
$this->send_post_data($email, $name);
|
412 |
}
|
413 |
|
414 |
/**
|
440 |
* @param int $cid : the ID of the comment
|
441 |
* @param object $comment : the comment object, optionally
|
442 |
*/
|
443 |
+
public function grab_email_from_comment($cid,$comment = NULL)
|
444 |
{
|
445 |
if($_POST['newsletter-signup-do'] != 1) return;
|
446 |
|
465 |
* @param string $content Not used
|
466 |
* @return string Form HTML-code
|
467 |
*/
|
468 |
+
public function form_shortcode($atts = null,$content = null)
|
469 |
{
|
470 |
return $this->output_form(false);
|
471 |
}
|
478 |
public function output_form($echo = true)
|
479 |
{
|
480 |
$errors = $this->validation_errors;
|
481 |
+
$opts = $this->getOptions();
|
482 |
$additional_fields = '';
|
483 |
$output = '';
|
484 |
|
486 |
$formno = $this->no_of_forms;
|
487 |
|
488 |
/* Set up form variables for API usage or normal form */
|
489 |
+
if($opts['mailinglist']['use_api'] == 1) {
|
490 |
|
491 |
/* Using API, send form request to ANY page */
|
492 |
+
$form_action = get_site_url();
|
493 |
$email_id = 'nsu_email';
|
494 |
$name_id = 'nsu_name';
|
495 |
|
499 |
$form_action = $opts['mailinglist']['form_action'];
|
500 |
$email_id = $opts['mailinglist']['email_id'];
|
501 |
|
502 |
+
if(!empty($opts['mailinglist']['name_id'])) {
|
503 |
$name_id = $opts['mailinglist']['name_id'];
|
504 |
}
|
505 |
|
517 |
$additional_fields .= "</div>";
|
518 |
endif;
|
519 |
|
520 |
+
$email_label = $opts['form']['email_label'];
|
521 |
+
$name_label = $opts['form']['name_label'];
|
|
|
|
|
|
|
522 |
|
523 |
+
$email_value = $opts['form']['email_default_value'];
|
524 |
+
$name_value = $opts['form']['name_default_value'];
|
525 |
+
$submit_button = $opts['form']['submit_button'];
|
526 |
|
527 |
+
$text_after_signup = $opts['form']['text_after_signup'];
|
528 |
+
$text_after_signup = ($opts['form']['wpautop'] == 1) ? wpautop(wptexturize($text_after_signup)) : $text_after_signup;
|
529 |
|
530 |
|
531 |
|
532 |
if(!isset($_POST['nsu_submit']) || count($errors) > 0) { //form has not been submitted yet
|
533 |
|
534 |
$output .= "<form class=\"nsu-form\" id=\"nsu-form-$formno\" action=\"$form_action\" method=\"post\">";
|
535 |
+
if($opts['mailinglist']['subscribe_with_name'] == 1) {
|
536 |
$output .= "<p><label for=\"nsu-name-$formno\">$name_label</label><input class=\"nsu-field\" id=\"nsu-name-$formno\" type=\"text\" name=\"$name_id\" value=\"$name_value\" ";
|
537 |
if($name_value) $output .= "onblur=\"if(!this.value) this.value = '$name_value';\" onfocus=\"if(this.value == '$name_value') this.value=''\" ";
|
538 |
$output .= "/>";
|
frontend/css/newsletter-sign-up.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
if (isset($_GET['checkbox_reset']) && $_GET['checkbox_reset'] == 1) { ?>
|
4 |
p#ns-checkbox{ clear:both; display:block; }
|
5 |
-
p#ns-checkbox input{ margin:0 5px 0 0; display:inline-block; width:13px; height:13px; }
|
6 |
-
p#ns-checkbox label{ display:inline-block; }
|
7 |
<?php }
|
8 |
if (isset($_GET['form_css']) && $_GET['form_css'] == 1) { ?>
|
9 |
.nsu-form { margin:10px 0; }
|
2 |
|
3 |
if (isset($_GET['checkbox_reset']) && $_GET['checkbox_reset'] == 1) { ?>
|
4 |
p#ns-checkbox{ clear:both; display:block; }
|
5 |
+
p#ns-checkbox input{ margin:0 5px 0 0; display:inline-block !important; width:13px; height:13px; }
|
6 |
+
p#ns-checkbox label{ display:inline-block !important; }
|
7 |
<?php }
|
8 |
if (isset($_GET['form_css']) && $_GET['form_css'] == 1) { ?>
|
9 |
.nsu-form { margin:10px 0; }
|
newsletter-sign-up.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Newsletter Sign-Up
|
4 |
Plugin URI: http://DannyvanKooten.com/wordpress-plugins/newsletter-sign-up/
|
5 |
Description: Adds various ways for your visitors to sign-up to your mailinglist (checkbox, widget, form)
|
6 |
-
Version: 1.
|
7 |
Author: Danny van Kooten
|
8 |
Author URI: http://DannyvanKooten.com
|
9 |
License: GPL2
|
@@ -32,7 +32,7 @@ $NewsletterSignUp = NewsletterSignUp::getInstance();
|
|
32 |
|
33 |
if(is_admin()) {
|
34 |
require('backend/NewsletterSignUpAdmin.php');
|
35 |
-
$NewsletterSignUpAdmin = new NewsletterSignUpAdmin();
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -43,15 +43,6 @@ function nsu_checkbox() {
|
|
43 |
$NewsletterSignUp->output_checkbox();
|
44 |
}
|
45 |
|
46 |
-
/**
|
47 |
-
* Deprecated
|
48 |
-
* Just an alias for nsu_checkbox(), for backwards compatibility.
|
49 |
-
*/
|
50 |
-
function ns_comment_checkbox()
|
51 |
-
{
|
52 |
-
nsu_checkbox();
|
53 |
-
}
|
54 |
-
|
55 |
/**
|
56 |
* Outputs a sign-up form, for usage in your theme files.
|
57 |
*/
|
3 |
Plugin Name: Newsletter Sign-Up
|
4 |
Plugin URI: http://DannyvanKooten.com/wordpress-plugins/newsletter-sign-up/
|
5 |
Description: Adds various ways for your visitors to sign-up to your mailinglist (checkbox, widget, form)
|
6 |
+
Version: 1.8.1
|
7 |
Author: Danny van Kooten
|
8 |
Author URI: http://DannyvanKooten.com
|
9 |
License: GPL2
|
32 |
|
33 |
if(is_admin()) {
|
34 |
require('backend/NewsletterSignUpAdmin.php');
|
35 |
+
$NewsletterSignUpAdmin = new NewsletterSignUpAdmin($NewsletterSignUp);
|
36 |
}
|
37 |
|
38 |
/**
|
43 |
$NewsletterSignUp->output_checkbox();
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
* Outputs a sign-up form, for usage in your theme files.
|
48 |
*/
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: DvanKooten
|
3 |
Donate link: http://dannyvankooten.com/donate/
|
4 |
Tags: newsletter,sign-up,mailchimp,aweber,newsletter signup,checkbox,ymlp,email,phplist,icontact,mailinglist,checkbox,form widget,widget,newsletter widget,subscribe widget,form shortcode,mailchimp api
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 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 |
|
@@ -71,7 +71,7 @@ superb e-mail address gatherer. This plugin respects double opt-in rules, it's a
|
|
71 |
|
72 |
= What is the shortcode to embed a sign-up form in my posts? =
|
73 |
|
74 |
-
Its `[
|
75 |
|
76 |
= Why does the checkbox not show up? =
|
77 |
|
@@ -109,6 +109,18 @@ For more questions and answers go have a look at my website regarding [Newslette
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
= 1.7.9 =
|
113 |
* Improved CSS Reset for comment checkbox
|
114 |
|
2 |
Contributors: DvanKooten
|
3 |
Donate link: http://dannyvankooten.com/donate/
|
4 |
Tags: newsletter,sign-up,mailchimp,aweber,newsletter signup,checkbox,ymlp,email,phplist,icontact,mailinglist,checkbox,form widget,widget,newsletter widget,subscribe widget,form shortcode,mailchimp api
|
5 |
+
Requires at least: 3.1
|
6 |
+
Tested up to: 3.6
|
7 |
+
Stable tag: 1.8.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 |
|
71 |
|
72 |
= What is the shortcode to embed a sign-up form in my posts? =
|
73 |
|
74 |
+
Its `[nsu-form]`.
|
75 |
|
76 |
= Why does the checkbox not show up? =
|
77 |
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 1.8.1 =
|
113 |
+
* Improved: automatic guessing of first and last names.
|
114 |
+
* Removed backwards compatibility for v1.6 and below
|
115 |
+
* Removed unnecessary code, options, etc..
|
116 |
+
* Improved: Code clean-up
|
117 |
+
* Changed links to show your appreciation for this plugin.
|
118 |
+
|
119 |
+
= 1.8 =
|
120 |
+
* Fixed W3C error because of empty "action" attribute on form tag.
|
121 |
+
* Added notice for MailChimp users to switch to my newer plugin, [MailChimp for WordPress](http://dannyvankooten.com/wordpress-plugins/mailchimp-for-wordpress/).
|
122 |
+
* Further improved the CSS reset for the comment form checkbox
|
123 |
+
|
124 |
= 1.7.9 =
|
125 |
* Improved CSS Reset for comment checkbox
|
126 |
|