Genesis eNews Extended - Version 0.1

Version Description

  • Inital release.

=

Download this release

Release Info

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

Version 0.1

Files changed (2) hide show
  1. plugin.php +161 -0
  2. readme.txt +36 -0
plugin.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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
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
+ 'id' => '',
43
+ 'input_text' => '',
44
+ 'button_text' => '',
45
+ );
46
+
47
+ $widget_ops = array(
48
+ 'classname' => 'enews-extended-widget',
49
+ 'description' => __( 'Displays subscribe form', 'genesis' ),
50
+ );
51
+
52
+ $this->WP_Widget( 'enews-ext', __( 'Genesis - eNews Extended', 'genesis' ), $widget_ops );
53
+
54
+ }
55
+
56
+ /**
57
+ * Echo the widget content.
58
+ *
59
+ * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
60
+ * @param array $instance The settings for the particular instance of the widget
61
+ */
62
+ function widget( $args, $instance ) {
63
+
64
+ extract( $args );
65
+
66
+ /** Merge with defaults */
67
+ $instance = wp_parse_args( (array) $instance, $this->defaults );
68
+
69
+ echo $before_widget . '<div class="enews">';
70
+
71
+ if ( ! empty( $instance['title'] ) )
72
+ echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
73
+
74
+ echo wpautop( $instance['text'] ); // We run KSES on update
75
+
76
+ if ( ! empty( $instance['action'] ) ) : ?>
77
+ <form id="subscribe" action="<?php echo esc_js( $instance['action'] ); ?>" method="post" target="_blank">
78
+ <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'] ); ?>" />
79
+ <input type="hidden" name="uri" value="<?php echo esc_attr( $instance['id'] ); ?>" />
80
+ <input type="hidden" name="loc" value="<?php echo esc_attr( get_locale() ); ?>" />
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
+ return $new_instance;
105
+
106
+ }
107
+
108
+ /**
109
+ * Echo the settings update form.
110
+ *
111
+ * @param array $instance Current settings
112
+ */
113
+ function form( $instance ) {
114
+
115
+ /** Merge with defaults */
116
+ $instance = wp_parse_args( (array) $instance, $this->defaults );
117
+
118
+ ?>
119
+ <p>
120
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'genesis' ); ?>:</label><br />
121
+ <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" />
122
+ </p>
123
+
124
+ <p>
125
+ <label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Text To Show', 'genesis' ); ?>:</label><br />
126
+ <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>
127
+ </p>
128
+
129
+ <p>
130
+ <label for="<?php echo $this->get_field_id( 'action' ); ?>"><?php _e( 'Form Action', 'genesis' ); ?>:</label>
131
+ <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" />
132
+ </p>
133
+
134
+ <p>
135
+ <label for="<?php echo $this->get_field_id( 'email-field' ); ?>"><?php _e( 'E-Mail Field', 'genesis' ); ?>:</label>
136
+ <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" />
137
+ </p>
138
+
139
+ <p>
140
+ <?php $input_text = empty( $instance['input_text'] ) ? __( 'Enter your email address...', 'genesis' ) : $instance['input_text']; ?>
141
+ <label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php _e( 'Input Text', 'genesis' ); ?>:</label>
142
+ <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" />
143
+ </p>
144
+
145
+ <p>
146
+ <?php $button_text = empty( $instance['button_text'] ) ? __( 'Go', 'genesis' ) : $instance['button_text']; ?>
147
+ <label for="<?php echo $this->get_field_id( 'button_text' ); ?>"><?php _e( 'Button Text', 'genesis' ); ?>:</label>
148
+ <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" />
149
+ </p>
150
+
151
+ <?php
152
+ }
153
+
154
+ }
155
+ add_action( 'widgets_init', 'bjgk_genesis_enews_load_widgets' );
156
+
157
+ function bjgk_genesis_enews_load_widgets() {
158
+
159
+ register_widget( 'BJGK_Genesis_eNews_Extended' );
160
+
161
+ }
readme.txt ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Genesis eNews Extended ===
2
+ Contributors: kraftbj
3
+ Tags: genesis
4
+ Requires at least: 3.0
5
+ Tested up to: 3.3
6
+ Stable tag: 0.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.
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 and the form field name for the e-mail field 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. 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
+ == Upgrade Notice ==
34
+
35
+ = 0.1 =
36
+ Initial stable release. Please update from alpha now.