WP Subscribe - Version 1.1.3

Version Description

  • Added option to enable name field
  • Added MyThemeShop tab in "Add Plugins" page
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Subscribe
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.3

Files changed (4) hide show
  1. css/wp-subscribe.css +2 -1
  2. mail-icon.svg +0 -1
  3. readme.txt +9 -3
  4. wp-subscribe.php +68 -10
css/wp-subscribe.css CHANGED
@@ -10,7 +10,8 @@ Author URI: http://mythemeshop.com
10
  #wp-subscribe p { color: #FFFFFF; margin: 0; text-align: center; }
11
  #wp-subscribe p.text { margin: 15px 0; opacity: 0.8; }
12
  #wp-subscribe input { border: none; width: 100%; text-align: center; box-sizing: border-box; padding: 10px 0; margin: 0; box-shadow: none; border-radius: 0; height: 45px; }
13
- #wp-subscribe input.email-field { color: #FFFFFF; background: #d56144; }
 
14
  #wp-subscribe input::-webkit-input-placeholder { color: inherit; opacity: 0.8; }
15
  #wp-subscribe input:-moz-input-placeholder { color: inherit; opacity: 0.8; }
16
  #wp-subscribe input::-moz-input-placeholder { color: inherit; opacity: 0.8; }
10
  #wp-subscribe p { color: #FFFFFF; margin: 0; text-align: center; }
11
  #wp-subscribe p.text { margin: 15px 0; opacity: 0.8; }
12
  #wp-subscribe input { border: none; width: 100%; text-align: center; box-sizing: border-box; padding: 10px 0; margin: 0; box-shadow: none; border-radius: 0; height: 45px; }
13
+ #wp-subscribe .email-field { margin-top: 10px }
14
+ #wp-subscribe input.email-field, #wp-subscribe input.name-field { color: #FFFFFF; background: #d56144; }
15
  #wp-subscribe input::-webkit-input-placeholder { color: inherit; opacity: 0.8; }
16
  #wp-subscribe input:-moz-input-placeholder { color: inherit; opacity: 0.8; }
17
  #wp-subscribe input::-moz-input-placeholder { color: inherit; opacity: 0.8; }
mail-icon.svg DELETED
@@ -1 +0,0 @@
1
- <?xml version="1.0" ?><svg height="120px" version="1.1" viewBox="0 0 32 32" width="120px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1"><g fill="#929292" id="icon-2-mail-envelope-open"><path d="M20.6381516,20 L18.4205694,21.9827889 L18.5199469,21.9822704 L18.5199469,21.9822704 L18.5,22.000001 L15.1214931,22.000001 L16.8181902,21.9911489 L16.8181902,21.9911489 L14.551004,21.9803099 L12.3066528,20 L20.6381516,20 L20.6381516,20 Z M21.7565673,19 L25,16.0999756 L25,8.00862577 C25,7.45157714 24.5452911,7 24.0000398,7 L8.9999602,7 C8.44769743,7 8,7.44373571 8,8.00207596 L8,16.2000122 L11.1733195,19 L21.7565673,19 L21.7565673,19 Z M13.0909091,6 L16.5,3 L19.9090909,6 L24.0025781,6 C25.1090746,6 26,6.89525812 26,7.99961498 L26,11.36 L29,14 L29,28.0059397 C29,29.1054862 28.10296,30 26.9964051,30 L6.00359486,30 C4.88976324,30 4,29.1072288 4,28.0059397 L4,14 L7,11.36 L7,7.99961498 C7,6.88743329 7.89427625,6 8.99742191,6 L13.0909091,6 L13.0909091,6 L13.0909091,6 Z M18.4278349,6 L16.5,4.30000019 L14.5721651,6 L18.4278349,6 L18.4278349,6 L18.4278349,6 Z M26,12.6772727 L27.5,14 L26,15.3333335 L26,12.6772727 L26,12.6772727 L26,12.6772727 Z M7,15.3333335 L5.5,14 L7,12.6772728 L7,15.3333335 L7,15.3333335 L7,15.3333335 Z M13.5,23 L6.5,29 L26.5,29 L19.5,23 L13.5,23 L13.5,23 Z M27.68514,28.7251701 L20,22.0170898 L28,15 L28,21.5000199 L28,28.0000398 C28,28.2831537 27.8789949,28.5418569 27.68514,28.7251701 L27.68514,28.7251701 L27.68514,28.7251701 Z M5.31486,28.7251701 L13,22.0170898 L5,15 L5,21.5000199 L5,28.0000398 C5,28.2831537 5.12100514,28.5418569 5.31486,28.7251701 L5.31486,28.7251701 L5.31486,28.7251701 Z M10,10 L10,11 L23,11 L23,10 L10,10 L10,10 Z M10,13 L10,14 L23,14 L23,13 L10,13 L10,13 Z M10,16 L10,17 L23,17 L23,16 L10,16 L10,16 Z" id="mail-envelope-open"/></g></g></svg>
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mythemeshop
3
  Creator's website link: http://mythemeshop.com/plugins/wp-subscribe/
4
  Tags: subscribe, subscription, subscription box, newsletter, subscribe widget, mailchimp, aweber, feedburner,
5
  Requires at least: 3.0.1
6
- Tested up to: 4.5
7
- Stable tag: 1.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -31,7 +31,6 @@ See the WP Subscribe Plugin in action on our demo page: <a href="http://demo.myt
31
  * Super lightweight.
32
  * Compatible with caching and SEO plugins.
33
  * Eye-catching design.
34
- * Choose between 3 unique styles of thumbnails: small, big or no thumbnails.
35
  * Position it anywhere where a widget is configured in your theme.
36
 
37
  = Support =
@@ -83,6 +82,13 @@ Please disable all plugins and check if plugin is working properly. Then you can
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
 
 
86
  = 1.1.0 =
87
  * Replaced Feedburner HTTP link with HTTPS
88
 
3
  Creator's website link: http://mythemeshop.com/plugins/wp-subscribe/
4
  Tags: subscribe, subscription, subscription box, newsletter, subscribe widget, mailchimp, aweber, feedburner,
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.7
7
+ Stable tag: 1.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
31
  * Super lightweight.
32
  * Compatible with caching and SEO plugins.
33
  * Eye-catching design.
 
34
  * Position it anywhere where a widget is configured in your theme.
35
 
36
  = Support =
82
 
83
  == Changelog ==
84
 
85
+ = 1.1.3 =
86
+ * Added option to enable name field
87
+ * Added MyThemeShop tab in "Add Plugins" page
88
+
89
+ = 1.1.2 =
90
+ * Removed nonce from frontend
91
+
92
  = 1.1.0 =
93
  * Replaced Feedburner HTTP link with HTTPS
94
 
wp-subscribe.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Subscribe
4
  Plugin URI: http://mythemeshop.com/plugins/wp-subscribe/
5
  Description: WP Subscribe is a simple but powerful subscription plugin which supports MailChimp, Aweber and Feedburner.
6
  Author: MyThemeShop
7
- Version: 1.1.1
8
  Author URI: http://mythemeshop.com/
9
  */
10
 
@@ -78,11 +78,16 @@ class wp_subscribe extends WP_Widget {
78
 
79
  /* Before widget (defined by themes). */
80
  echo $before_widget;
81
-
 
 
 
 
 
82
  /* Display Widget */
83
  ?>
84
 
85
- <div class="wp-subscribe" id="wp-subscribe">
86
  <h4 class="title"><?php echo $instance['title'];?></h4>
87
  <p class="text"><?php echo $instance['text'];?></p>
88
 
@@ -98,10 +103,12 @@ class wp_subscribe extends WP_Widget {
98
 
99
  <?php if (empty($_POST['mailchimp_email']) || (!empty($_POST['widget_id']) && $_POST['widget_id'] != $this->id)) { ?>
100
  <form action="<?php echo esc_url(add_query_arg('mailchimp_signup', '1')); ?>" method="post">
 
 
 
101
  <input class="email-field" type="text" value="" placeholder="<?php echo $instance['email_placeholder']; ?>" name="mailchimp_email">
102
  <input class="submit" name="submit" type="submit" value="<?php echo $instance['button_text']; ?>">
103
  <input type="hidden" name="widget_id" value="<?php echo $this->id ?>" />
104
- <?php wp_nonce_field('wp-subscribe-mailchimp'); ?>
105
  </form>
106
  <?php } else {
107
  // process signup through API
@@ -123,6 +130,9 @@ class wp_subscribe extends WP_Widget {
123
  <input type="hidden" name="redirect" value="<?php echo esc_url(add_query_arg('aweber_signedup', '1')); ?>" />
124
  <input type="hidden" name="meta_redirect_onlist" value="<?php echo esc_url(add_query_arg('aweber_signedup', '-1')); ?>" /> -->
125
  </div>
 
 
 
126
  <input class="email-field" type="text" value="" placeholder="<?php echo esc_attr($instance['email_placeholder']); ?>" name="email">
127
  <input class="submit" name="submit" type="submit" value="<?php echo esc_attr($instance['button_text']); ?>">
128
  </form>
@@ -200,11 +210,18 @@ class wp_subscribe extends WP_Widget {
200
  </div><!-- .wp_subscribe_account_details_aweber -->
201
  </div><!-- .wp_subscribe_account_details -->
202
 
 
 
 
 
 
 
203
  <h4 class="wp_subscribe_labels_header"><a class="wp-subscribe-toggle" href="#" rel="wp_subscribe_labels"><?php _e('Labels', 'wp-subscribe'); ?></a></h4>
204
  <div class="wp_subscribe_labels" style="display: none;">
205
  <?php
206
  $this->output_textarea_field('title', __('Title', 'wp-subscribe'), $instance['title']);
207
  $this->output_text_field('text', __('Text', 'wp-subscribe'), $instance['text']);
 
208
  $this->output_text_field('email_placeholder', __('Email Placeholder', 'wp-subscribe'), $instance['email_placeholder']);
209
  $this->output_text_field('button_text', __('Button Text', 'wp-subscribe'), $instance['button_text']);
210
  $this->output_text_field('success_message', __('Success Message', 'wp-subscribe'), $instance['success_message']);
@@ -285,10 +302,11 @@ class wp_subscribe extends WP_Widget {
285
  'mailchimp_list_id' => '',
286
  'mailchimp_double_optin' => 0,
287
  'aweber_list_id' => '',
288
-
289
  'title' => __('Get more stuff like this<br/> <span>in your inbox</span>', 'wp-subscribe'),
290
  'text' => __('Subscribe to our mailing list and get interesting stuff and updates to your email inbox.', 'wp-subscribe'),
291
  'email_placeholder' => __('Enter your email here', 'wp-subscribe'),
 
292
  'button_text' => __('Sign Up Now', 'wp-subscribe'),
293
  'success_message' => __('Thank you for subscribing.', 'wp-subscribe'),
294
  'error_message' => __('Something went wrong.', 'wp-subscribe'),
@@ -321,7 +339,7 @@ class wp_subscribe extends WP_Widget {
321
  );
322
 
323
  $email = isset($_POST['mailchimp_email']) ? trim($_POST['mailchimp_email']) : '';
324
- $nonce = isset($_POST['_wpnonce']) ? trim($_POST['_wpnonce']) : '';
325
 
326
  $mc_api_key = null;
327
  $mc_list_id = null;
@@ -338,12 +356,21 @@ class wp_subscribe extends WP_Widget {
338
  if ($email &&
339
  $widget_settings &&
340
  $mc_api_key != null &&
341
- $mc_list_id != null &&
342
- wp_verify_nonce($nonce, 'wp-subscribe-mailchimp')) {
343
 
344
  try {
345
  $list = new Mailchimp_Lists(new Mailchimp($mc_api_key));
346
- $resp = $list->subscribe($mc_list_id, array('email' => $email), null, 'html', (bool) $double_optin, true);
 
 
 
 
 
 
 
 
 
 
347
 
348
  if ($resp) {
349
  $ret['success'] = true;
@@ -392,4 +419,35 @@ function subscribe_admin_notice_ignore() {
392
  if ( isset($_GET['subscribe_admin_notice_ignore']) && '0' == $_GET['subscribe_admin_notice_ignore'] ) {
393
  add_user_meta($user_id, 'subscribe_ignore_notice', 'true', true);
394
  }
395
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  Plugin URI: http://mythemeshop.com/plugins/wp-subscribe/
5
  Description: WP Subscribe is a simple but powerful subscription plugin which supports MailChimp, Aweber and Feedburner.
6
  Author: MyThemeShop
7
+ Version: 1.1.3
8
  Author URI: http://mythemeshop.com/
9
  */
10
 
78
 
79
  /* Before widget (defined by themes). */
80
  echo $before_widget;
81
+
82
+ $include_name = isset( $instance['include_name_field'] ) ? $instance['include_name_field'] : '';
83
+ $name_placeh = isset( $instance['name_placeholder'] ) ? $instance['name_placeholder'] : '';
84
+
85
+ $name_class = ' no-name-field';
86
+ if (!empty($include_name)) $name_class = ' has-name-field';
87
  /* Display Widget */
88
  ?>
89
 
90
+ <div class="wp-subscribe<?php echo $name_class; ?>" id="wp-subscribe">
91
  <h4 class="title"><?php echo $instance['title'];?></h4>
92
  <p class="text"><?php echo $instance['text'];?></p>
93
 
103
 
104
  <?php if (empty($_POST['mailchimp_email']) || (!empty($_POST['widget_id']) && $_POST['widget_id'] != $this->id)) { ?>
105
  <form action="<?php echo esc_url(add_query_arg('mailchimp_signup', '1')); ?>" method="post">
106
+ <?php if (!empty($include_name)) { ?>
107
+ <input class="name-field" type="text" value="" placeholder="<?php echo $name_placeh; ?>" name="mailchimp_name">
108
+ <?php } ?>
109
  <input class="email-field" type="text" value="" placeholder="<?php echo $instance['email_placeholder']; ?>" name="mailchimp_email">
110
  <input class="submit" name="submit" type="submit" value="<?php echo $instance['button_text']; ?>">
111
  <input type="hidden" name="widget_id" value="<?php echo $this->id ?>" />
 
112
  </form>
113
  <?php } else {
114
  // process signup through API
130
  <input type="hidden" name="redirect" value="<?php echo esc_url(add_query_arg('aweber_signedup', '1')); ?>" />
131
  <input type="hidden" name="meta_redirect_onlist" value="<?php echo esc_url(add_query_arg('aweber_signedup', '-1')); ?>" /> -->
132
  </div>
133
+ <?php if (!empty($include_name)) { ?>
134
+ <input class="name-field" type="text" value="" placeholder="<?php echo $name_placeh; ?>" name="name">
135
+ <?php } ?>
136
  <input class="email-field" type="text" value="" placeholder="<?php echo esc_attr($instance['email_placeholder']); ?>" name="email">
137
  <input class="submit" name="submit" type="submit" value="<?php echo esc_attr($instance['button_text']); ?>">
138
  </form>
210
  </div><!-- .wp_subscribe_account_details_aweber -->
211
  </div><!-- .wp_subscribe_account_details -->
212
 
213
+ <p class="wp_subscribe_include_name"><label for="<?php echo $this->get_field_id('include_name_field'); ?>">
214
+ <input type="hidden" name="<?php echo $this->get_field_name('include_name_field'); ?>" value="0">
215
+ <input id="<?php echo $this->get_field_id('include_name_field'); ?>" type="checkbox" class="include-name-field" name="<?php echo $this->get_field_name('include_name_field'); ?>" value="1" <?php checked($instance['include_name_field']); ?>>
216
+ <?php _e( 'Include <strong>Name</strong> field', 'wp-subscribe' ); ?>
217
+ </label></p>
218
+
219
  <h4 class="wp_subscribe_labels_header"><a class="wp-subscribe-toggle" href="#" rel="wp_subscribe_labels"><?php _e('Labels', 'wp-subscribe'); ?></a></h4>
220
  <div class="wp_subscribe_labels" style="display: none;">
221
  <?php
222
  $this->output_textarea_field('title', __('Title', 'wp-subscribe'), $instance['title']);
223
  $this->output_text_field('text', __('Text', 'wp-subscribe'), $instance['text']);
224
+ $this->output_text_field('name_placeholder', __('Name Placeholder', 'wp-subscribe'), $instance['name_placeholder']);
225
  $this->output_text_field('email_placeholder', __('Email Placeholder', 'wp-subscribe'), $instance['email_placeholder']);
226
  $this->output_text_field('button_text', __('Button Text', 'wp-subscribe'), $instance['button_text']);
227
  $this->output_text_field('success_message', __('Success Message', 'wp-subscribe'), $instance['success_message']);
302
  'mailchimp_list_id' => '',
303
  'mailchimp_double_optin' => 0,
304
  'aweber_list_id' => '',
305
+ 'include_name_field' => false,
306
  'title' => __('Get more stuff like this<br/> <span>in your inbox</span>', 'wp-subscribe'),
307
  'text' => __('Subscribe to our mailing list and get interesting stuff and updates to your email inbox.', 'wp-subscribe'),
308
  'email_placeholder' => __('Enter your email here', 'wp-subscribe'),
309
+ 'name_placeholder' => __('Enter your name here', 'wp-subscribe'),
310
  'button_text' => __('Sign Up Now', 'wp-subscribe'),
311
  'success_message' => __('Thank you for subscribing.', 'wp-subscribe'),
312
  'error_message' => __('Something went wrong.', 'wp-subscribe'),
339
  );
340
 
341
  $email = isset($_POST['mailchimp_email']) ? trim($_POST['mailchimp_email']) : '';
342
+ $name = isset($_POST['mailchimp_name']) ? trim($_POST['mailchimp_name']) : '';
343
 
344
  $mc_api_key = null;
345
  $mc_list_id = null;
356
  if ($email &&
357
  $widget_settings &&
358
  $mc_api_key != null &&
359
+ $mc_list_id != null ) {
 
360
 
361
  try {
362
  $list = new Mailchimp_Lists(new Mailchimp($mc_api_key));
363
+ $merge_vars = null;
364
+ if ($name) {
365
+ $fname = $name;
366
+ $lname = '';
367
+ if ($space_pos = strpos($name, ' ')) {
368
+ $fname = substr($name, 0, $space_pos);
369
+ $lname = substr($name, $space_pos);
370
+ }
371
+ $merge_vars = array('FNAME' => $fname, 'LNAME' => $lname);
372
+ }
373
+ $resp = $list->subscribe($mc_list_id, array('email' => $email), $merge_vars, 'html', (bool) $double_optin, true);
374
 
375
  if ($resp) {
376
  $ret['success'] = true;
419
  if ( isset($_GET['subscribe_admin_notice_ignore']) && '0' == $_GET['subscribe_admin_notice_ignore'] ) {
420
  add_user_meta($user_id, 'subscribe_ignore_notice', 'true', true);
421
  }
422
+ }
423
+
424
+ // Add MyThemeShop tab to "Add Plugins" Page
425
+ add_action( 'after_setup_theme', 'subscribe_install_plugins_mts_tab', 20 );
426
+ function subscribe_install_plugins_mts_tab() {
427
+ if ( !has_filter( 'install_plugins_tabs', 'mts_install_plugins_tab' ) ) {
428
+ // Add MyThemeShop tab to "Add Plugins" Page
429
+ add_filter( 'install_plugins_tabs', 'subscribe_mts_install_plugins_tab' );
430
+ // Set args for MyThemeShop tab in "Add Plugins" Page
431
+ add_filter( 'install_plugins_table_api_args_mts_addons', 'subscribe_mts_addons_args' );
432
+ // List plugins in "Add Plugins" Page under "MyThemeShop" tab
433
+ add_action( 'install_plugins_mts_addons', 'display_plugins_table' );
434
+ }
435
+ }
436
+ function subscribe_mts_install_plugins_tab( $tabs ) {
437
+ $tabs['mts_addons'] = 'MyThemeShop';
438
+ return $tabs;
439
+ }
440
+ function subscribe_mts_addons_args( $args ) {
441
+ $args = array(
442
+ 'page' => 1,
443
+ 'per_page' => 30,
444
+ 'fields' => array(
445
+ 'last_updated' => true,
446
+ 'icons' => true,
447
+ 'active_installs' => true
448
+ ),
449
+ 'author' => 'MyThemeShop'
450
+ );
451
+
452
+ return $args;
453
+ }