Version Description
- Fixed Title field saving issue in newly added widget
- Fixed compatibility with other plugins using Mailchimp API
Download this release
Release Info
Developer | MyThemeShop |
Plugin | WP Subscribe |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.0.1
- readme.txt +5 -1
- wp-subscribe.php +89 -78
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.0
|
7 |
-
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -72,5 +72,9 @@ Please disable all plugins and check if plugin is working properly. Then you can
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
75 |
= 1.0 =
|
76 |
* Official plugin release.
|
4 |
Tags: subscribe, subscription, subscription box, newsletter, subscribe widget, mailchimp, aweber, feedburner,
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 1.0.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 1.0.1 =
|
76 |
+
* Fixed Title field saving issue in newly added widget
|
77 |
+
* Fixed compatibility with other plugins using Mailchimp API
|
78 |
+
|
79 |
= 1.0 =
|
80 |
* Official plugin release.
|
wp-subscribe.php
CHANGED
@@ -4,18 +4,19 @@ 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.0
|
8 |
Author URI: http://mythemeshop.com/
|
9 |
*/
|
10 |
|
11 |
-
|
|
|
12 |
|
13 |
// Add function to widgets_init that'll load our widget.
|
14 |
add_action( 'widgets_init', 'wp_subscribe_register_widget' );
|
15 |
|
16 |
// Register widget.
|
17 |
function wp_subscribe_register_widget() {
|
18 |
-
|
19 |
}
|
20 |
|
21 |
// Widget class.
|
@@ -23,68 +24,68 @@ class wp_subscribe extends WP_Widget {
|
|
23 |
|
24 |
|
25 |
/*-----------------------------------------------------------------------------------*/
|
26 |
-
/*
|
27 |
/*-----------------------------------------------------------------------------------*/
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
add_action('admin_enqueue_scripts', array(&$this, 'register_admin_scripts'));
|
33 |
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
/*-----------------------------------------------------------------------------------*/
|
45 |
-
/*
|
46 |
/*-----------------------------------------------------------------------------------*/
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
}
|
53 |
-
|
54 |
if ($hook != 'widgets.php')
|
55 |
return;
|
56 |
wp_register_script('wp-subscribe-admin', plugins_url('js/wp-subscribe-admin.js', __FILE__), array('jquery'));
|
57 |
wp_enqueue_script('wp-subscribe-admin');
|
58 |
-
|
59 |
-
|
60 |
}
|
61 |
|
62 |
|
63 |
/*-----------------------------------------------------------------------------------*/
|
64 |
-
/*
|
65 |
/*-----------------------------------------------------------------------------------*/
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
$defaults = $this->get_defaults();
|
70 |
$instance = wp_parse_args( (array) $instance, $defaults );
|
71 |
wp_enqueue_style( 'wp-subscribe' );
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
<p class="text"><?php echo $instance['text'];?></p>
|
82 |
|
83 |
<?php if ($instance['service'] == 'feedburner') { ?>
|
84 |
|
85 |
<form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $instance['feedburner_id']; ?>', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" _lpchecked="1">
|
86 |
-
|
87 |
-
|
88 |
<input class="submit" name="submit" type="submit" value="<?php echo $instance['button_text']; ?>">
|
89 |
</form>
|
90 |
|
@@ -132,71 +133,67 @@ class wp_subscribe extends WP_Widget {
|
|
132 |
<p class="footer-text"><?php echo $instance['footer_text'];?></p>
|
133 |
|
134 |
</div><!--subscribe_widget-->
|
135 |
-
|
136 |
-
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
|
143 |
/*-----------------------------------------------------------------------------------*/
|
144 |
-
/*
|
145 |
/*-----------------------------------------------------------------------------------*/
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
/* Strip tags to remove HTML (important for text inputs). */
|
151 |
-
//$instance['service'] = $new_instance['service'];
|
152 |
-
$instance = array_merge($instance, $new_instance);
|
153 |
|
154 |
-
|
155 |
-
if (strpos($instance['feedburner_id'], 'http') === 0)
|
156 |
-
$instance['feedburner_id'] = substr( $instance['feedburner_id'], strrpos( $instance['feedburner_id'], '/' )+1 );
|
157 |
|
158 |
-
|
|
|
|
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
|
164 |
/*-----------------------------------------------------------------------------------*/
|
165 |
-
/*
|
166 |
/*-----------------------------------------------------------------------------------*/
|
167 |
-
|
168 |
-
|
169 |
$defaults = $this->get_defaults();
|
170 |
-
|
171 |
-
|
172 |
<div class="wp_subscribe_options_form">
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
|
178 |
<div class="wp_subscribe_account_details">
|
179 |
<div class="wp_subscribe_account_details_feedburner" style="display: none;">
|
180 |
-
|
181 |
</div><!-- .wp_subscribe_account_details_mailchimp -->
|
182 |
|
183 |
<div class="wp_subscribe_account_details_mailchimp" style="display: none;">
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
</div><!-- .wp_subscribe_account_details_mailchimp -->
|
189 |
|
190 |
<div class="wp_subscribe_account_details_aweber" style="display: none;">
|
191 |
-
|
192 |
-
|
193 |
</div><!-- .wp_subscribe_account_details_aweber -->
|
194 |
</div><!-- .wp_subscribe_account_details -->
|
195 |
|
196 |
<h4 class="wp_subscribe_labels_header"><a class="wp-subscribe-toggle" href="#" rel="wp_subscribe_labels"><?php _e('Labels', 'wp-subscribe'); ?></a></h4>
|
197 |
<div class="wp_subscribe_labels" style="display: none;">
|
198 |
<?php
|
199 |
-
$this->
|
200 |
$this->output_text_field('text', __('Text', 'wp-subscribe'), $instance['text']);
|
201 |
$this->output_text_field('email_placeholder', __('Email Placeholder', 'wp-subscribe'), $instance['email_placeholder']);
|
202 |
$this->output_text_field('button_text', __('Button Text', 'wp-subscribe'), $instance['button_text']);
|
@@ -209,11 +206,11 @@ class wp_subscribe extends WP_Widget {
|
|
209 |
|
210 |
</div><!-- .wp_subscribe_options_form -->
|
211 |
|
212 |
-
|
213 |
-
|
214 |
|
215 |
|
216 |
-
|
217 |
?>
|
218 |
|
219 |
<p class="wp-subscribe-<?php echo $setting_name; ?>-field">
|
@@ -225,7 +222,21 @@ class wp_subscribe extends WP_Widget {
|
|
225 |
id="<?php echo $this->get_field_id($setting_name) ?>"
|
226 |
name="<?php echo $this->get_field_name($setting_name) ?>"
|
227 |
type="text"
|
228 |
-
value="<?php echo $setting_value ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
</p>
|
230 |
|
231 |
<?php
|
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.0.1
|
8 |
Author URI: http://mythemeshop.com/
|
9 |
*/
|
10 |
|
11 |
+
if (!class_exists('Mailchimp'))
|
12 |
+
require_once dirname(__FILE__) . '/Mailchimp.php';
|
13 |
|
14 |
// Add function to widgets_init that'll load our widget.
|
15 |
add_action( 'widgets_init', 'wp_subscribe_register_widget' );
|
16 |
|
17 |
// Register widget.
|
18 |
function wp_subscribe_register_widget() {
|
19 |
+
register_widget( 'wp_subscribe' );
|
20 |
}
|
21 |
|
22 |
// Widget class.
|
24 |
|
25 |
|
26 |
/*-----------------------------------------------------------------------------------*/
|
27 |
+
/* Widget Setup
|
28 |
/*-----------------------------------------------------------------------------------*/
|
29 |
+
|
30 |
+
function wp_subscribe() {
|
31 |
+
|
32 |
+
add_action('wp_enqueue_scripts', array(&$this, 'register_scripts'));
|
33 |
add_action('admin_enqueue_scripts', array(&$this, 'register_admin_scripts'));
|
34 |
|
35 |
+
/* Widget settings. */
|
36 |
+
$widget_ops = array( 'classname' => 'wp_subscribe', 'description' => __('Displays Subscription Form, Supports - FeedBurner, MailChimp & AWeber.', 'wp-subscribe') );
|
37 |
|
38 |
+
/* Widget control settings. */
|
39 |
+
$control_ops = array( 'id_base' => 'wp_subscribe' );
|
40 |
|
41 |
+
/* Create the widget. */
|
42 |
+
$this->WP_Widget( 'wp_subscribe', __('WP Subscribe Widget', 'wp-subscribe'), $widget_ops, $control_ops );
|
43 |
+
}
|
44 |
|
45 |
/*-----------------------------------------------------------------------------------*/
|
46 |
+
/* Enqueue assets
|
47 |
/*-----------------------------------------------------------------------------------*/
|
48 |
+
function register_scripts() {
|
49 |
+
// JS
|
50 |
+
// wp_register_script('wp-subscribe', plugins_url('js/wp-subscribe.js', __FILE__), array('jquery'));
|
51 |
+
// CSS
|
52 |
+
wp_register_style('wp-subscribe', plugins_url('css/wp-subscribe.css', __FILE__));
|
53 |
}
|
54 |
+
function register_admin_scripts($hook) {
|
55 |
if ($hook != 'widgets.php')
|
56 |
return;
|
57 |
wp_register_script('wp-subscribe-admin', plugins_url('js/wp-subscribe-admin.js', __FILE__), array('jquery'));
|
58 |
wp_enqueue_script('wp-subscribe-admin');
|
59 |
+
wp_register_style('wp-subscribe-admin', plugins_url('css/wp-subscribe-admin.css', __FILE__));
|
60 |
+
wp_enqueue_style('wp-subscribe-admin');
|
61 |
}
|
62 |
|
63 |
|
64 |
/*-----------------------------------------------------------------------------------*/
|
65 |
+
/* Display Widget
|
66 |
/*-----------------------------------------------------------------------------------*/
|
67 |
+
|
68 |
+
function widget( $args, $instance ) {
|
69 |
+
extract( $args );
|
70 |
$defaults = $this->get_defaults();
|
71 |
$instance = wp_parse_args( (array) $instance, $defaults );
|
72 |
wp_enqueue_style( 'wp-subscribe' );
|
73 |
|
74 |
+
/* Before widget (defined by themes). */
|
75 |
+
echo $before_widget;
|
76 |
+
|
77 |
+
/* Display Widget */
|
78 |
+
?>
|
79 |
+
|
80 |
+
<div class="wp-subscribe" id="wp-subscribe">
|
81 |
+
<h4 class="title"><?php echo $instance['title'];?></h4>
|
82 |
<p class="text"><?php echo $instance['text'];?></p>
|
83 |
|
84 |
<?php if ($instance['service'] == 'feedburner') { ?>
|
85 |
|
86 |
<form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $instance['feedburner_id']; ?>', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" _lpchecked="1">
|
87 |
+
<input class="email-field" type="text" value="" placeholder="<?php echo $instance['email_placeholder']; ?>" name="email">
|
88 |
+
<input type="hidden" value="<?php echo $instance['feedburner_id']; ?>" name="uri"><input type="hidden" name="loc" value="en_US">
|
89 |
<input class="submit" name="submit" type="submit" value="<?php echo $instance['button_text']; ?>">
|
90 |
</form>
|
91 |
|
133 |
<p class="footer-text"><?php echo $instance['footer_text'];?></p>
|
134 |
|
135 |
</div><!--subscribe_widget-->
|
136 |
+
|
137 |
+
<?php
|
138 |
|
139 |
+
/* After widget (defined by themes). */
|
140 |
+
echo $after_widget;
|
141 |
+
}
|
142 |
|
143 |
|
144 |
/*-----------------------------------------------------------------------------------*/
|
145 |
+
/* Update Widget
|
146 |
/*-----------------------------------------------------------------------------------*/
|
147 |
+
|
148 |
+
function update( $new_instance, $old_instance ) {
|
149 |
+
$instance = $old_instance;
|
|
|
|
|
|
|
|
|
150 |
|
151 |
+
$instance = array_merge($instance, $new_instance);
|
|
|
|
|
152 |
|
153 |
+
// Feedburner ID -- make sure the user didn't insert full url
|
154 |
+
if (strpos($instance['feedburner_id'], 'http') === 0)
|
155 |
+
$instance['feedburner_id'] = substr( $instance['feedburner_id'], strrpos( $instance['feedburner_id'], '/' )+1 );
|
156 |
|
157 |
+
return $instance;
|
158 |
+
}
|
159 |
+
|
160 |
|
161 |
/*-----------------------------------------------------------------------------------*/
|
162 |
+
/* Widget Settings
|
163 |
/*-----------------------------------------------------------------------------------*/
|
164 |
+
|
165 |
+
function form( $instance ) {
|
166 |
$defaults = $this->get_defaults();
|
167 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
168 |
+
?>
|
169 |
<div class="wp_subscribe_options_form">
|
170 |
|
171 |
+
<?php $this->output_select_field('service', __('Service:', 'wp-subscribe'), array('feedburner' => 'FeedBurner', 'mailchimp' => 'MailChimp', 'aweber' => 'AWeber'), $instance['service']); ?>
|
172 |
+
|
173 |
+
<div class="clear"></div>
|
174 |
|
175 |
<div class="wp_subscribe_account_details">
|
176 |
<div class="wp_subscribe_account_details_feedburner" style="display: none;">
|
177 |
+
<?php $this->output_text_field('feedburner_id', __('Feedburner ID', 'wp-subscribe'), $instance['feedburner_id']); ?>
|
178 |
</div><!-- .wp_subscribe_account_details_mailchimp -->
|
179 |
|
180 |
<div class="wp_subscribe_account_details_mailchimp" style="display: none;">
|
181 |
+
<?php $this->output_text_field('mailchimp_api_key', __('Mailchimp API key', 'wp-subscribe'), $instance['mailchimp_api_key']); ?>
|
182 |
+
<a href="http://kb.mailchimp.com/accounts/management/about-api-keys#Finding-or-generating-your-API-key" target="_blank"><?php _e('Find your API key', 'wp-subscribe'); ?></a>
|
183 |
+
<?php $this->output_text_field('mailchimp_list_id', __('Mailchimp List ID', 'wp-subscribe'), $instance['mailchimp_list_id']); ?>
|
184 |
+
<a href="http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id" target="_blank"><?php _e('Find your list ID', 'wp-subscribe'); ?></a>
|
185 |
</div><!-- .wp_subscribe_account_details_mailchimp -->
|
186 |
|
187 |
<div class="wp_subscribe_account_details_aweber" style="display: none;">
|
188 |
+
<?php $this->output_text_field('aweber_list_id', __('AWeber List ID', 'wp-subscribe'), $instance['aweber_list_id']); ?>
|
189 |
+
<a href="https://help.aweber.com/entries/61177326-What-Is-The-Unique-List-ID-" target="_blank"><?php _e('Find your list ID', 'wp-subscribe'); ?></a>
|
190 |
</div><!-- .wp_subscribe_account_details_aweber -->
|
191 |
</div><!-- .wp_subscribe_account_details -->
|
192 |
|
193 |
<h4 class="wp_subscribe_labels_header"><a class="wp-subscribe-toggle" href="#" rel="wp_subscribe_labels"><?php _e('Labels', 'wp-subscribe'); ?></a></h4>
|
194 |
<div class="wp_subscribe_labels" style="display: none;">
|
195 |
<?php
|
196 |
+
$this->output_textarea_field('title', __('Title', 'wp-subscribe'), $instance['title']);
|
197 |
$this->output_text_field('text', __('Text', 'wp-subscribe'), $instance['text']);
|
198 |
$this->output_text_field('email_placeholder', __('Email Placeholder', 'wp-subscribe'), $instance['email_placeholder']);
|
199 |
$this->output_text_field('button_text', __('Button Text', 'wp-subscribe'), $instance['button_text']);
|
206 |
|
207 |
</div><!-- .wp_subscribe_options_form -->
|
208 |
|
209 |
+
<?php
|
210 |
+
}
|
211 |
|
212 |
|
213 |
+
public function output_text_field($setting_name, $setting_label, $setting_value) {
|
214 |
?>
|
215 |
|
216 |
<p class="wp-subscribe-<?php echo $setting_name; ?>-field">
|
222 |
id="<?php echo $this->get_field_id($setting_name) ?>"
|
223 |
name="<?php echo $this->get_field_name($setting_name) ?>"
|
224 |
type="text"
|
225 |
+
value="<?php echo esc_attr($setting_value) ?>" />
|
226 |
+
</p>
|
227 |
+
|
228 |
+
<?php
|
229 |
+
}
|
230 |
+
|
231 |
+
public function output_textarea_field($setting_name, $setting_label, $setting_value) {
|
232 |
+
?>
|
233 |
+
|
234 |
+
<p class="wp-subscribe-<?php echo $setting_name; ?>-field">
|
235 |
+
<label for="<?php echo $this->get_field_id($setting_name) ?>">
|
236 |
+
<?php echo $setting_label ?>
|
237 |
+
</label>
|
238 |
+
|
239 |
+
<textarea class="widefat" id="<?php echo $this->get_field_id($setting_name) ?>" name="<?php echo $this->get_field_name($setting_name) ?>"><?php echo esc_attr($setting_value); ?></textarea>
|
240 |
</p>
|
241 |
|
242 |
<?php
|