1 | <?php
|
---|
2 | function widget_bfa_subscribe($args) {
|
---|
3 | extract($args);
|
---|
4 | $options = get_option('widget_bfa_subscribe');
|
---|
5 | $title = apply_filters('widget_title', $options['title']);
|
---|
6 | $email_text = apply_filters('widget_text', $options['email-text']);
|
---|
7 | $field_text = apply_filters('widget_title', $options['field-text']);
|
---|
8 | $submit_text = apply_filters('widget_title', $options['submit-text']);
|
---|
9 | $posts_text = apply_filters('widget_text', $options['posts-text']);
|
---|
10 | $comments_text = apply_filters('widget_text', $options['comments-text']);
|
---|
11 | $id = apply_filters('widget_title', $options['id']);
|
---|
12 | $google_or_feedburner = apply_filters('widget_title', $options['google-or-feedburner']);
|
---|
13 | echo $before_widget;
|
---|
14 | if ( !empty($title) ) { echo $before_title . $title . $after_title; }
|
---|
15 | // feedburner or google:
|
---|
16 | if ( $google_or_feedburner == "feedburner" ) {
|
---|
17 | $action_url = "www.feedburner.com/fb/a/emailverify";
|
---|
18 | $window_url = "www.feedburner.com/fb/a/emailverifySubmit?feedId=";
|
---|
19 | $hidden_value_url = "http://feeds.feedburner.com/~e?ffid=";
|
---|
20 | $hidden_uri = "url";
|
---|
21 | $hidden_input = '<input type="hidden" value="' . get_bloginfo('name') . '" name="title"/>';
|
---|
22 | } else {
|
---|
23 | $action_url = "feedburner.google.com/fb/a/mailverify";
|
---|
24 | $window_url = "feedburner.google.com/fb/a/mailverify?uri=";
|
---|
25 | $hidden_value_url = "";
|
---|
26 | $hidden_uri = "uri";
|
---|
27 | $hidden_input = "";
|
---|
28 | }
|
---|
29 | // replace URL placeholders:
|
---|
30 | $email_text = str_replace("%email-url", "http://" . $window_url . $id . "&loc=" . get_locale(), $email_text);
|
---|
31 | $posts_text = str_replace("%posts-url", get_bloginfo('rss2_url'), $posts_text);
|
---|
32 | $comments_text = str_replace("%comments-url", get_bloginfo('comments_rss2_url'), $comments_text);
|
---|
33 | ?>
|
---|
34 | <form class="feedburner-email-form"
|
---|
35 | action="http://<?php echo $action_url; ?>" method="post" target="popupwindow"
|
---|
36 | onsubmit="window.open('http://<?php echo $window_url . $id; ?>',
|
---|
37 | 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
|
---|
38 | <table class="subscribe" cellpadding="0" cellspacing="0" border="0"><tr>
|
---|
39 | <td class="email-text" colspan="2"><p>
|
---|
40 | <a href="http://<?php echo $window_url . $id; ?>&loc=<?php echo get_locale() .
|
---|
41 | ($bfa_ata_nofollow == "Yes" ? ' rel="nofollow"' : ''); ?>">
|
---|
42 | <img src="<?php echo get_bloginfo('template_directory'); ?>/images/feedburner-email.gif" style="float:left; margin: 0 7px 3px 0" alt="" /></a><?php echo $email_text; ?></p>
|
---|
43 | </td></tr><tr><td class="email-field"><input type="text" name="email" class="text inputblur" value="<?php echo $field_text; ?>"
|
---|
44 | onfocus="this.value='';" />
|
---|
45 | <input type="hidden" value="<?php echo $hidden_value_url . $id; ?>" name="<?php echo $hidden_uri; ?>"/>
|
---|
46 | <?php echo $hidden_input ?>
|
---|
47 | <input type="hidden" name="loc" value="<?php echo get_locale(); ?>"/>
|
---|
48 | </td><td class="email-button">
|
---|
49 | <input type="submit" class="button" value="<?php echo $submit_text; ?>" />
|
---|
50 | </td></tr>
|
---|
51 | <tr>
|
---|
52 | <td class="post-text" colspan="2"><p>
|
---|
53 | <a href="<?php echo get_bloginfo('rss2_url'); ?>"<?php if ($bfa_ata_nofollow == "Yes") { ?> rel="nofollow"<?php } ?>>
|
---|
54 | <img src="<?php echo get_bloginfo('template_directory'); ?>/images/post-feed.gif" style="float:left; margin: 0 7px 3px 0" alt="" /></a><?php echo $posts_text; ?></p>
|
---|
55 | </td>
|
---|
56 | </tr>
|
---|
57 | <tr>
|
---|
58 | <td class="comment-text" colspan="2"><p>
|
---|
59 | <a href="<?php echo get_bloginfo('comments_rss2_url'); ?>"<?php if ($bfa_ata_nofollow == "Yes") { ?> rel="nofollow"<?php } ?>>
|
---|
60 | <img src="<?php echo get_bloginfo('template_directory'); ?>/images/comment-feed.gif" style="float:left; margin: 0 7px 3px 0" alt="" /></a><?php echo $comments_text; ?></p>
|
---|
61 | </td>
|
---|
62 | </tr>
|
---|
63 | </table>
|
---|
64 | </form>
|
---|
65 | <?php
|
---|
66 | echo $after_widget;
|
---|
67 | }
|
---|
68 | function widget_bfa_subscribe_control() {
|
---|
69 | $options = $newoptions = get_option('widget_bfa_subscribe');
|
---|
70 | if ( $_POST["subscribe-submit"] ) {
|
---|
71 | $newoptions['title'] = strip_tags(stripslashes($_POST["subscribe-title"]));
|
---|
72 |
|
---|
73 | $newoptions['field-text'] = strip_tags(stripslashes($_POST["feedburner-email-field-text"]));
|
---|
74 | $newoptions['submit-text'] = strip_tags(stripslashes($_POST["feedburner-email-submit-text"]));
|
---|
75 |
|
---|
76 | if ( current_user_can('unfiltered_html') ) {
|
---|
77 | $newoptions['email-text'] = stripslashes($_POST["subscribe-email-text"]);
|
---|
78 | $newoptions['posts-text'] = stripslashes($_POST["subscribe-posts-text"]);
|
---|
79 | $newoptions['comments-text'] = stripslashes($_POST["subscribe-comments-text"]);
|
---|
80 | } else {
|
---|
81 | $newoptions['email-text'] = stripslashes(wp_filter_post_kses($_POST["subscribe-email-text"]));
|
---|
82 | $newoptions['posts-text'] = stripslashes(wp_filter_post_kses($_POST["subscribe-posts-text"]));
|
---|
83 | $newoptions['comments-text'] = stripslashes(wp_filter_post_kses($_POST["subscribe-comments-text"]));
|
---|
84 | }
|
---|
85 |
|
---|
86 | $newoptions['id'] = strip_tags(stripslashes($_POST["feedburner-email-id"]));
|
---|
87 | $newoptions['google-or-feedburner'] = strip_tags(stripslashes($_POST["google-or-feedburner"]));
|
---|
88 | }
|
---|
89 | if ( $options != $newoptions ) {
|
---|
90 | $options = $newoptions;
|
---|
91 | update_option('widget_bfa_subscribe', $options);
|
---|
92 | }
|
---|
93 | $title = attribute_escape($options['title']);
|
---|
94 | $email_text = format_to_edit($options['email-text']);
|
---|
95 | $field_text = attribute_escape($options['field-text']);
|
---|
96 | $submit_text = attribute_escape($options['submit-text']);
|
---|
97 | $posts_text = format_to_edit($options['posts-text']);
|
---|
98 | $comments_text = format_to_edit($options['comments-text']);
|
---|
99 | $id = attribute_escape($options['id']);
|
---|
100 | $google_or_feedburner = attribute_escape($options['google-or-feedburner']);
|
---|
101 | if ( $google_or_feedburner == "" ) { $google_or_feedburner = "google"; }
|
---|
102 | ?>
|
---|
103 | You may have to <span style="font-weight: bold; color: #c00">save this widget once</span> first (Click "Done" and "Save Changes") before you can edit the text fields below...<br /><br />
|
---|
104 | <p><label for="subscribe-title">Optional: Title:
|
---|
105 | <input class="widefat" id="subscribe-title" name="subscribe-title" type="text" value="<?php echo $title; ?>" /></label></p>
|
---|
106 |
|
---|
107 | <p><label for="subscribe-email-text">
|
---|
108 | Text for Email section. <?php if ( current_user_can('unfiltered_html')) echo' (HTML allowed. Email subscribe URL = %email-url)'; ?>
|
---|
109 | <textarea class="widefat" style="width: 98%" rows="3" cols="20" id="subscribe-email-text" name="subscribe-email-text">
|
---|
110 | <?php echo $email_text; ?></textarea></label></p>
|
---|
111 |
|
---|
112 | <p style="float: left; width: 69%; display: block">
|
---|
113 | <label for="feedburner-email-field-text">Optional: Text inside Email input field:
|
---|
114 | <input class="widefat" id="feedburner-email-field-text" name="feedburner-email-field-text" type="text" value="<?php echo $field_text; ?>" /></label></p>
|
---|
115 |
|
---|
116 | <p style="float: right; width: 29%; display: block">
|
---|
117 | <label for="feedburner-email-submit-text">Text for Email submit button:
|
---|
118 | <input class="widefat" id="feedburner-email-submit-text" name="feedburner-email-submit-text" type="text" value="<?php echo $submit_text; ?>" /></label></p>
|
---|
119 | <div style="clear: both"></div>
|
---|
120 |
|
---|
121 | <p><label for="subscribe-posts-text">
|
---|
122 | Text for Posts RSS section <?php if ( current_user_can('unfiltered_html')) echo ' (HTML allowed. Posts feed URL = %posts-url)'; ?>
|
---|
123 | <textarea class="widefat" style="width: 98%" rows="3" cols="20" id="subscribe-posts-text" name="subscribe-posts-text">
|
---|
124 | <?php echo $posts_text; ?></textarea></label></p>
|
---|
125 |
|
---|
126 | <p><label for="subscribe-comments-text">
|
---|
127 | Text for Comments RSS section <?php if ( current_user_can('unfiltered_html')) echo ' (HTML allowed. Comments feed URL = %comments-url)'; ?>
|
---|
128 | <textarea class="widefat" style="width: 98%" rows="3" cols="20" id="subscribe-comments-text" name="subscribe-comments-text">
|
---|
129 | <?php echo $comments_text; ?></textarea></label></p>
|
---|
130 |
|
---|
131 | <p><label for="feedburner-email-id">
|
---|
132 | Feedburner Email ID:
|
---|
133 | <input class="widefat" id="feedburner-email-id" name="feedburner-email-id" type="text" value="<?php echo $id; ?>" /></label></p>
|
---|
134 |
|
---|
135 | <p><strong>How to find the feed ID for this site at Feedburner:</strong><br />
|
---|
136 | Login to your Feedburner account, click "My Feeds" -> Title of the feed in question -> Publicize -> Email Subscriptions -> Check out the two textareas.
|
---|
137 | In the bigger one of the two textareas your ID appears as: <br />1) If you have an <strong>old feedburner.com</strong> account:
|
---|
138 | www.feedburner.com/fb/a/emailverifySubmit?feedId=<strong>1234567</strong>&loc=en_US<br />2) if you have a <strong>new feedburner.google.com</strong> account:
|
---|
139 | feedburner.google.com/fb/a/mailverify?uri=<strong>bytesforall/lzoG</strong>&loc=en_US<br />The bold part is the ID that you need to put here.</p>
|
---|
140 |
|
---|
141 | <p>Is this a feedburner.google.com account or an old feedburner.com account?
|
---|
142 | <p><input id="google-or-feedburner" name="google-or-feedburner" type="radio" value="google" <?php
|
---|
143 | if($google_or_feedburner == "google"){echo " CHECKED";}?> /> New feedburner.google.com account</p>
|
---|
144 | <p><input id="google-or-feedburner" name="google-or-feedburner" type="radio" value="feedburner" <?php
|
---|
145 | if($google_or_feedburner == "feedburner"){echo " CHECKED";}?> /> Old feedburner.com account</p>
|
---|
146 |
|
---|
147 | <input type="hidden" id="subscribe-submit" name="subscribe-submit" value="1" />
|
---|
148 |
|
---|
149 | <?php
|
---|
150 | }
|
---|
151 | // register feedburner email widget
|
---|
152 | $widget_ops = array('classname' => 'widget_bfa_subscribe', 'description' => 'Subscribe widget for RSS and Email' );
|
---|
153 | $control_ops = array('width' => 600, 'height' => 500);
|
---|
154 | wp_register_sidebar_widget('bfa_subscribe', 'BFA Subscribe', 'widget_bfa_subscribe', $widget_ops);
|
---|
155 | wp_register_widget_control('bfa_subscribe', 'BFA Subscribe', 'widget_bfa_subscribe_control', $control_ops);
|
---|
156 | ?> |
---|