Genesis eNews Extended - Version 0.1.2

Version Description

  • Modifies class name to work with more StudioPress themes.
Download this release

Release Info

Developer kraftbj
Plugin Icon wp plugin Genesis eNews Extended
Version 0.1.2
Comparing to
See all releases

Code changes from version 0.1.1 to 0.1.2

Files changed (2) hide show
  1. plugin.php +167 -167
  2. readme.txt +62 -42
plugin.php CHANGED
@@ -1,168 +1,168 @@
1
- <?php
2
- /**
3
- * Plugin Name: Genesis eNews Extended
4
- * Plugin URI: http://www.brandonkraft.com/contrib/plugins/genesis-enews-extended/
5
- * Description: Replaces the Genesis eNews Widget to allow easier use of additional mailing services.
6
- * Version: 0.1.1
7
- * Author: Brandon Kraft
8
- * Author URI: http://www.brandonkraft.com
9
- *
10
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
11
- * General Public License version 2, as published by the Free Software Foundation. You may NOT assume
12
- * that you can use any other version of the GPL.
13
- *
14
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
15
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
- *
17
- * @package BJGK_Genesis_enews_extended
18
- * @version 0.1.1
19
- * @author Brandon Kraft <bk@kraft.im>
20
- * @copyright Copyright (c) 2012, Brandon Kraft
21
- * @link http://www.brandonkraft.com
22
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23
- */
24
-
25
- class BJGK_Genesis_eNews_Extended extends WP_Widget {
26
-
27
- /**
28
- * Holds widget settings defaults, populated in constructor.
29
- *
30
- * @var array
31
- */
32
- protected $defaults;
33
-
34
- /**
35
- * Constructor. Set the default widget options and create widget.
36
- */
37
- function __construct() {
38
-
39
- $this->defaults = array(
40
- 'title' => '',
41
- 'text' => '',
42
- 'hidden_fields' => '',
43
- 'input_text' => '',
44
- 'button_text' => '',
45
- 'action' => '',
46
- );
47
-
48
- $widget_ops = array(
49
- 'classname' => 'enews-extended-widget',
50
- 'description' => __( 'Displays subscribe form', 'genesis' ),
51
- );
52
-
53
- $this->WP_Widget( 'enews-ext', __( 'Genesis - eNews Extended', 'genesis' ), $widget_ops );
54
-
55
- }
56
-
57
- /**
58
- * Echo the widget content.
59
- *
60
- * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
61
- * @param array $instance The settings for the particular instance of the widget
62
- */
63
- function widget( $args, $instance ) {
64
-
65
- extract( $args );
66
-
67
- /** Merge with defaults */
68
- $instance = wp_parse_args( (array) $instance, $this->defaults );
69
-
70
- echo $before_widget . '<div class="enews">';
71
-
72
- if ( ! empty( $instance['title'] ) )
73
- echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
74
-
75
- echo wpautop( $instance['text'] ); // We run KSES on update
76
-
77
- if ( ! empty( $instance['action'] ) ) : ?>
78
- <form id="subscribe" action="<?php echo esc_js( $instance['action'] ); ?>" method="post" target="_blank">
79
- <input type="text" value="<?php echo esc_attr( $instance['input_text'] ); ?>" id="subbox" onfocus="if ( this.value == '<?php echo esc_js( $instance['input_text'] ); ?>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['input_text'] ); ?>'; }" name="<?php echo esc_js( $instance['email-field'] ); ?>" />
80
- <?php echo $instance['hidden_fields']; ?>
81
- <input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" />
82
- </form>
83
- <?php endif;
84
-
85
- echo '</div>' . $after_widget;
86
-
87
- }
88
-
89
- /**
90
- * Update a particular instance.
91
- *
92
- * This function should check that $new_instance is set correctly.
93
- * The newly calculated value of $instance should be returned.
94
- * If "false" is returned, the instance won't be saved/updated.
95
- *
96
- * @param array $new_instance New settings for this instance as input by the user via form()
97
- * @param array $old_instance Old settings for this instance
98
- * @return array Settings to save or bool false to cancel saving
99
- */
100
- function update( $new_instance, $old_instance ) {
101
-
102
- $new_instance['title'] = strip_tags( $new_instance['title'] );
103
- $new_instance['text'] = wp_kses( $new_instance['text'], genesis_formatting_allowedtags() );
104
- /** $new_instance['hidden_fields'] = strip_tags( $new_instance['hidden_fields'], "input" ); */
105
- return $new_instance;
106
-
107
- }
108
-
109
- /**
110
- * Echo the settings update form.
111
- *
112
- * @param array $instance Current settings
113
- */
114
- function form( $instance ) {
115
-
116
- /** Merge with defaults */
117
- $instance = wp_parse_args( (array) $instance, $this->defaults );
118
-
119
- ?>
120
- <p>
121
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'genesis' ); ?>:</label><br />
122
- <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" />
123
- </p>
124
-
125
- <p>
126
- <label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Text To Show', 'genesis' ); ?>:</label><br />
127
- <textarea id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" class="widefat" rows="6" cols="4"><?php echo htmlspecialchars( $instance['text'] ); ?></textarea>
128
- </p>
129
-
130
- <p>
131
- <label for="<?php echo $this->get_field_id( 'action' ); ?>"><?php _e( 'Form Action', 'genesis' ); ?>:</label>
132
- <input type="text" id="<?php echo $this->get_field_id( 'action' ); ?>" name="<?php echo $this->get_field_name( 'action' ); ?>" value="<?php echo esc_attr( $instance['action'] ); ?>" class="widefat" />
133
- </p>
134
-
135
- <p>
136
- <label for="<?php echo $this->get_field_id( 'email-field' ); ?>"><?php _e( 'E-Mail Field', 'genesis' ); ?>:</label>
137
- <input type="text" id="<?php echo $this->get_field_id( 'email-field' ); ?>" name="<?php echo $this->get_field_name( 'email-field' ); ?>" value="<?php echo esc_attr( $instance['email-field'] ); ?>" class="widefat" />
138
- </p>
139
-
140
- <p>
141
- <label for="<?php echo $this->get_field_id( 'hidden_fields' ); ?>"><?php _e( 'Hidden Fields', 'genesis' ); ?>:</label>
142
- <textarea id="<?php echo $this->get_field_id( 'hidden_fields' ); ?>" name="<?php echo $this->get_field_name( 'hidden_fields' ); ?>" class="widefat"><?php echo esc_attr( $instance['hidden_fields'] ); ?></textarea>
143
- <br><small>Not all services use hidden fields.</small>
144
- </p>
145
-
146
- <p>
147
- <?php $input_text = empty( $instance['input_text'] ) ? __( 'Enter your email address...', 'genesis' ) : $instance['input_text']; ?>
148
- <label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php _e( 'Input Text', 'genesis' ); ?>:</label>
149
- <input type="text" id="<?php echo $this->get_field_id( 'input_text' ); ?>" name="<?php echo $this->get_field_name( 'input_text' ); ?>" value="<?php echo esc_attr( $input_text ); ?>" class="widefat" />
150
- </p>
151
-
152
- <p>
153
- <?php $button_text = empty( $instance['button_text'] ) ? __( 'Go', 'genesis' ) : $instance['button_text']; ?>
154
- <label for="<?php echo $this->get_field_id( 'button_text' ); ?>"><?php _e( 'Button Text', 'genesis' ); ?>:</label>
155
- <input type="text" id="<?php echo $this->get_field_id( 'button_text' ); ?>" name="<?php echo $this->get_field_name( 'button_text' ); ?>" value="<?php echo esc_attr( $button_text ); ?>" class="widefat" />
156
- </p>
157
-
158
- <?php
159
- }
160
-
161
- }
162
- add_action( 'widgets_init', 'bjgk_genesis_enews_load_widgets' );
163
-
164
- function bjgk_genesis_enews_load_widgets() {
165
-
166
- register_widget( 'BJGK_Genesis_eNews_Extended' );
167
-
168
  }
1
+ <?php
2
+ /**
3
+ * Plugin Name: Genesis eNews Extended
4
+ * Plugin URI: http://www.brandonkraft.com/contrib/plugins/genesis-enews-extended/
5
+ * Description: Replaces the Genesis eNews Widget to allow easier use of additional mailing services.
6
+ * Version: 0.1.2
7
+ * Author: Brandon Kraft
8
+ * Author URI: http://www.brandonkraft.com
9
+ *
10
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
11
+ * General Public License version 2, as published by the Free Software Foundation. You may NOT assume
12
+ * that you can use any other version of the GPL.
13
+ *
14
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
15
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
+ *
17
+ * @package BJGK_Genesis_enews_extended
18
+ * @version 0.1.2
19
+ * @author Brandon Kraft <bk@kraft.im>
20
+ * @copyright Copyright (c) 2012, Brandon Kraft
21
+ * @link http://www.brandonkraft.com
22
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23
+ */
24
+
25
+ class BJGK_Genesis_eNews_Extended extends WP_Widget {
26
+
27
+ /**
28
+ * Holds widget settings defaults, populated in constructor.
29
+ *
30
+ * @var array
31
+ */
32
+ protected $defaults;
33
+
34
+ /**
35
+ * Constructor. Set the default widget options and create widget.
36
+ */
37
+ function __construct() {
38
+
39
+ $this->defaults = array(
40
+ 'title' => '',
41
+ 'text' => '',
42
+ 'hidden_fields' => '',
43
+ 'input_text' => '',
44
+ 'button_text' => '',
45
+ 'action' => '',
46
+ );
47
+
48
+ $widget_ops = array(
49
+ 'classname' => 'enews-widget',
50
+ 'description' => __( 'Displays subscribe form', 'genesis' ),
51
+ );
52
+
53
+ $this->WP_Widget( 'enews-ext', __( 'Genesis - eNews Extended', 'genesis' ), $widget_ops );
54
+
55
+ }
56
+
57
+ /**
58
+ * Echo the widget content.
59
+ *
60
+ * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
61
+ * @param array $instance The settings for the particular instance of the widget
62
+ */
63
+ function widget( $args, $instance ) {
64
+
65
+ extract( $args );
66
+
67
+ /** Merge with defaults */
68
+ $instance = wp_parse_args( (array) $instance, $this->defaults );
69
+
70
+ echo $before_widget . '<div class="enews">';
71
+
72
+ if ( ! empty( $instance['title'] ) )
73
+ echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
74
+
75
+ echo wpautop( $instance['text'] ); // We run KSES on update
76
+
77
+ if ( ! empty( $instance['action'] ) ) : ?>
78
+ <form id="subscribe" action="<?php echo esc_js( $instance['action'] ); ?>" method="post" target="_blank">
79
+ <input type="text" value="<?php echo esc_attr( $instance['input_text'] ); ?>" id="subbox" onfocus="if ( this.value == '<?php echo esc_js( $instance['input_text'] ); ?>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['input_text'] ); ?>'; }" name="<?php echo esc_js( $instance['email-field'] ); ?>" />
80
+ <?php echo $instance['hidden_fields']; ?>
81
+ <input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" />
82
+ </form>
83
+ <?php endif;
84
+
85
+ echo '</div>' . $after_widget;
86
+
87
+ }
88
+
89
+ /**
90
+ * Update a particular instance.
91
+ *
92
+ * This function should check that $new_instance is set correctly.
93
+ * The newly calculated value of $instance should be returned.
94
+ * If "false" is returned, the instance won't be saved/updated.
95
+ *
96
+ * @param array $new_instance New settings for this instance as input by the user via form()
97
+ * @param array $old_instance Old settings for this instance
98
+ * @return array Settings to save or bool false to cancel saving
99
+ */
100
+ function update( $new_instance, $old_instance ) {
101
+
102
+ $new_instance['title'] = strip_tags( $new_instance['title'] );
103
+ $new_instance['text'] = wp_kses( $new_instance['text'], genesis_formatting_allowedtags() );
104
+ /** $new_instance['hidden_fields'] = strip_tags( $new_instance['hidden_fields'], "input" ); */
105
+ return $new_instance;
106
+
107
+ }
108
+
109
+ /**
110
+ * Echo the settings update form.
111
+ *
112
+ * @param array $instance Current settings
113
+ */
114
+ function form( $instance ) {
115
+
116
+ /** Merge with defaults */
117
+ $instance = wp_parse_args( (array) $instance, $this->defaults );
118
+
119
+ ?>
120
+ <p>
121
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'genesis' ); ?>:</label><br />
122
+ <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" />
123
+ </p>
124
+
125
+ <p>
126
+ <label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Text To Show', 'genesis' ); ?>:</label><br />
127
+ <textarea id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" class="widefat" rows="6" cols="4"><?php echo htmlspecialchars( $instance['text'] ); ?></textarea>
128
+ </p>
129
+
130
+ <p>
131
+ <label for="<?php echo $this->get_field_id( 'action' ); ?>"><?php _e( 'Form Action', 'genesis' ); ?>:</label>
132
+ <input type="text" id="<?php echo $this->get_field_id( 'action' ); ?>" name="<?php echo $this->get_field_name( 'action' ); ?>" value="<?php echo esc_attr( $instance['action'] ); ?>" class="widefat" />
133
+ </p>
134
+
135
+ <p>
136
+ <label for="<?php echo $this->get_field_id( 'email-field' ); ?>"><?php _e( 'E-Mail Field', 'genesis' ); ?>:</label>
137
+ <input type="text" id="<?php echo $this->get_field_id( 'email-field' ); ?>" name="<?php echo $this->get_field_name( 'email-field' ); ?>" value="<?php echo esc_attr( $instance['email-field'] ); ?>" class="widefat" />
138
+ </p>
139
+
140
+ <p>
141
+ <label for="<?php echo $this->get_field_id( 'hidden_fields' ); ?>"><?php _e( 'Hidden Fields', 'genesis' ); ?>:</label>
142
+ <textarea id="<?php echo $this->get_field_id( 'hidden_fields' ); ?>" name="<?php echo $this->get_field_name( 'hidden_fields' ); ?>" class="widefat"><?php echo esc_attr( $instance['hidden_fields'] ); ?></textarea>
143
+ <br><small>Not all services use hidden fields.</small>
144
+ </p>
145
+
146
+ <p>
147
+ <?php $input_text = empty( $instance['input_text'] ) ? __( 'Enter your email address...', 'genesis' ) : $instance['input_text']; ?>
148
+ <label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php _e( 'Input Text', 'genesis' ); ?>:</label>
149
+ <input type="text" id="<?php echo $this->get_field_id( 'input_text' ); ?>" name="<?php echo $this->get_field_name( 'input_text' ); ?>" value="<?php echo esc_attr( $input_text ); ?>" class="widefat" />
150
+ </p>
151
+
152
+ <p>
153
+ <?php $button_text = empty( $instance['button_text'] ) ? __( 'Go', 'genesis' ) : $instance['button_text']; ?>
154
+ <label for="<?php echo $this->get_field_id( 'button_text' ); ?>"><?php _e( 'Button Text', 'genesis' ); ?>:</label>
155
+ <input type="text" id="<?php echo $this->get_field_id( 'button_text' ); ?>" name="<?php echo $this->get_field_name( 'button_text' ); ?>" value="<?php echo esc_attr( $button_text ); ?>" class="widefat" />
156
+ </p>
157
+
158
+ <?php
159
+ }
160
+
161
+ }
162
+ add_action( 'widgets_init', 'bjgk_genesis_enews_load_widgets' );
163
+
164
+ function bjgk_genesis_enews_load_widgets() {
165
+
166
+ register_widget( 'BJGK_Genesis_eNews_Extended' );
167
+
168
  }
readme.txt CHANGED
@@ -1,42 +1,62 @@
1
- === Genesis eNews Extended ===
2
- Contributors: kraftbj
3
- Tags: genesis
4
- Requires at least: 3.0
5
- Tested up to: 3.4-beta1
6
- Stable tag: 0.1.1
7
-
8
- Creates a new widget to replace the Genesis eNews Widget to allow easier use of non-Feedburner mailing lists.
9
-
10
- == Description ==
11
-
12
- Creates a new widget to replace the Genesis eNews Widget to allow easier use of non-Feedburner mailing lists. The widget allows the site administrator to set the form action, e-mail form field and hidden fields to mimic the subscribe form of other mailing list services.
13
-
14
- == Installation ==
15
-
16
- 1. Upload contents of the directory to /wp-content/plugins/ (or use the automatic installer)
17
- 1. Activate the plugin through the 'Plugins' menu in WordPress
18
- 1. In Appearance->Widgerts, add Genesis eNews Extended widget to any sidebar.
19
- 1. Using the mailing list contact form code provided by your vendor, add the form action URL, the form field ID for the e-mail field and any hidden fields (not all services use them) into the widget options.
20
- 1. Verify it works!
21
-
22
- == Frequently Asked Questions ==
23
-
24
- = What services work with this plugin? =
25
-
26
- I've only tested this with MailChimp, but should work with most mailing list services. If you have tested this with other services, please [contact me](http://brandonkraft.com/contact/)
27
-
28
- == Changelog ==
29
-
30
- = 0.1 =
31
- * Inital release.
32
-
33
- = 0.1.1 =
34
- * Adds "Hidden Fields" widget setting to make widget compatible with more mailing services.
35
-
36
- == Upgrade Notice ==
37
-
38
- = 0.1 =
39
- Initial stable release. Please update from alpha now.
40
-
41
- = 0.1.1 =
42
- * Adds "Hidden Fields" widget setting to make widget compatible with more mailing services. Upgrade if you want to use AWeber or other services that require one or more hidden fields.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Genesis eNews Extended ===
2
+ Contributors: kraftbj
3
+ Tags: genesis
4
+ Requires at least: 3.0
5
+ Tested up to: 3.4.2
6
+ Stable tag: 0.1.2
7
+
8
+ Creates a new widget to replace the Genesis eNews Widget to allow easier use of non-Feedburner mailing lists.
9
+
10
+ == Description ==
11
+
12
+ Creates a new widget to replace the Genesis eNews Widget to allow easier use of non-Feedburner mailing lists. The widget allows the site administrator to set the form action, e-mail form field and hidden fields to mimic the subscribe form of other mailing list services.
13
+
14
+ == Installation ==
15
+
16
+ 1. Upload contents of the directory to /wp-content/plugins/ (or use the automatic installer)
17
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
18
+ 1. In Appearance->Widgerts, add Genesis eNews Extended widget to any sidebar.
19
+ 1. Using the mailing list contact form code provided by your vendor, add the form action URL, the form field ID for the e-mail field and any hidden fields (not all services use them) into the widget options.
20
+ 1. Verify it works!
21
+
22
+ Note: If you are using the first and last name fields, you will need to edit your styles.css. The fields use the ID subbox1 and subbox2 as some themes provide e-mail icons in the form field (which wouldn't make sense in every box).
23
+
24
+ == Frequently Asked Questions ==
25
+
26
+ = What services work with this plugin? =
27
+
28
+ MailChimp, Aweber and Constant Contact are confirmed to work, but it should work with almost all services. If you have tested this with other services, please [contact me](http://brandonkraft.com/contact/)
29
+
30
+ = I need help! Where I can get it? =
31
+
32
+ "Official" tutorials will be maintained on the [plugin's website](http://www.brandonkraft.com/contrib/plugins/genesis-enews-extended/).
33
+
34
+ Questions can be asked at the [WordPress.org Support Forum](http://wordpress.org/support/plugin/genesis-enews-extended) for this plugin.
35
+
36
+ == Changelog ==
37
+
38
+ = 0.1 =
39
+ * Inital release.
40
+
41
+ = 0.1.1 =
42
+ * Adds "Hidden Fields" widget setting to make widget compatible with more mailing services.
43
+
44
+ = 0.1.2 =
45
+ * Modifies class name to work with more StudioPress themes.
46
+
47
+ = 0.2 =
48
+ * Adds first/last name fields (CSS ID subbox1 and subbox2)
49
+
50
+ == Upgrade Notice ==
51
+
52
+ = 0.1 =
53
+ Initial stable release. Please update from alpha now.
54
+
55
+ = 0.1.1 =
56
+ * Adds "Hidden Fields" widget setting to make widget compatible with more mailing services. Upgrade if you want to use AWeber or other services that require one or more hidden fields.
57
+
58
+ = 0.1.2 =
59
+ * Expands widget's usefulness to more StudioPress themes (Balance, etc).
60
+
61
+ = 0.2 =
62
+ * Adds first and last name fields.