• Hi, wonderful plugin, but a small chance might make it much better. This is only a suggestion. The <p></p> tags you use in generating the widget are bit unnecessary and they make the widget look bloated.

    There is much better way, I have modified your code a bit if you like you can add it in the next update 🙂 I have modified from line 44.

    if($uri) {
                $uri = str_replace('http://feeds.feedburner.com/','',$uri);
                if (!empty($title)) {
                    $html .= $before_title . $title . $after_title;
                }
                $html .= '<form id="feedburner_sbef" action="http://feedburner.google.com/fb/a/mailverify" method="post" onsubmit="window.open(\'http://feedburner.google.com/fb/a/mailverify?uri=' . $uri . '\', \'popupwindow\', \'scrollbars=yes,width=550,height=520\');return true" target="popupwindow">';
                if($above_email) {
                    $html .= '<label>' . $above_email . '</label>';
                }
                $html .= '<input type="text" name="email"/>';
                $html .= '<input type="hidden" value="' . $uri . '" name="uri"/>';
                $html .= '<input type="hidden" name="loc" value="en_US"/>';
                if($below_email) {
                    $html .= '<label>' . $below_email . '</label>';
                }
                $html .= '<input type="submit" value="' . $subscribe_btn . '" />';
                if($show_link) {
                    $html .= '<label>Delivered by <a href="http://feedburner.google.com" target="_blank">FeedBurner</a><label>';
                }
                $html .= '</form>';

    You can ask the user to add the following css to their main theme css.

    #feedburner_sbef {
    border:opx solid #ccc;
    padding:0px;
    text-align:center;
    }
    #feedburner_sbef text{
    width:140px;
    display: block;
    }
    #feedburner_sbef label{
    display:block;
    }

    Cheers
    Joel

    If you like to view a preview you can Visit my site

    http://wordpress.org/extend/plugins/feedburner-email-widget/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey Joel

    Thanks a lot for the suggestion, the new code is already in toe svn repo. I’ll test a bit with it and push the update tomorrow when I’m done testing.

    Cheers

    Cees-Jan

    Thread Starter dotnetwizard

    (@dotnetwizard)

    ok cool :), and you are welcome. Keep up the good work 🙂

    Cheers
    Joel

    Thread Starter dotnetwizard

    (@dotnetwizard)

    Hey Jan, I hope you noticed this, there is a small syntax error in the PHP code that I posted.

    Towards the last line,

    $html .= '<label>Delivered by <a href="http://feedburner.google.com" target="_blank">FeedBurner</a><label>';

    Should be corrected as,

    $html .= '<label>Delivered by <a href="http://feedburner.google.com" target="_blank">FeedBurner</a></label>';

    My bad, I kinda missed the closing tag slash, the difference does not show up in Firefox, but it shows clearly in other browsers 😀
    Sorry for the inconvenience.

    Regards
    Joel

    Thread Starter dotnetwizard

    (@dotnetwizard)

    Hi Jan,

    I did a little modification, code-cleanup and added a few features to your plugin. Now it’s much more user friendly. Here is the code for widget-feedburner-email.php file. You can roll this out as your next update.

    I have fully tested it with WordPress 2.9.2

    I would be happy to support this plugin and work on it with u if you can add me as a co-author in the plugin info. But if you don’t want to, Its ok 🙂

    View Screenshot

    <?php
    /*
    Plugin Name: Feedburner Email Widget
    Version: 1.0.4
    Plugin URI: http://wyrihaximus.net/projects/wordpress/feedburner-email-widget/
    Description: Allows you to add a Feedburner Email Subscription widget to one of your sidebars.
    Author: WyriHaximus & Joel
    Author URI: http://wyrihaximus.net/
    */
    class FeedburnerEmailWidget extends WP_Widget {
        function FeedburnerEmailWidget() {
            $widget_ops = array('classname' => 'FeedburnerEmailWidget', 'description' => 'Allows you to add a Feedburner Email Subscription widget to one of your sidebars.' );
            $this->WP_Widget('FeedburnerEmailWidget', 'Feedburner Email Widget', $widget_ops);
        }
        function form($instance) {
            $title = esc_attr($instance['title']);
            $uri = esc_attr($instance['uri']);
            $above_email = esc_attr($instance['above_email']);
            $below_email = esc_attr($instance['below_email']);
            $subscribe_btn = esc_attr($instance['subscribe_btn']);
            $show_link = esc_attr($instance['show_link']);
    		$form_id = esc_attr($instance['form_id']);
    		$css_style_code = esc_attr($instance['css_style_code']);
            ?>
                <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
                <p><label for="<?php echo $this->get_field_id('uri'); ?>"><?php _e('Feedburner feed URL:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('uri'); ?>" name="<?php echo $this->get_field_name('uri'); ?>" type="text" value="<?php echo $uri; ?>" /></label></p>
                <p><label for="<?php echo $this->get_field_id('above_email'); ?>"><?php _e('Above input text:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('above_email'); ?>" name="<?php echo $this->get_field_name('above_email'); ?>" type="text" value="<?php echo $above_email; ?>" /></label></p>
                <p><label for="<?php echo $this->get_field_id('below_email'); ?>"><?php _e('Below input text:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('below_email'); ?>" name="<?php echo $this->get_field_name('below_email'); ?>" type="text" value="<?php echo $below_email; ?>" /></label></p>
                <p><label for="<?php echo $this->get_field_id('subscribe_btn'); ?>"><?php _e('Submit button caption:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('subscribe_btn'); ?>" name="<?php echo $this->get_field_name('subscribe_btn'); ?>" type="text" value="<?php echo $subscribe_btn; ?>" /></label></p>
    			<p><label for="<?php echo $this->get_field_id('form_id'); ?>"><?php _e('Form CSS ID:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('form_id'); ?>" name="<?php echo $this->get_field_name('form_id'); ?>" type="text" value="<?php echo $form_id; ?>" /></label></p>
    			<p><label for="<?php echo $this->get_field_id('css_style_code'); ?>"><?php _e('CSS Styling:'); ?> <textarea style="height:250px;" class="widefat" id="<?php echo $this->get_field_id('css_style_code'); ?>" name="<?php echo $this->get_field_name('css_style_code'); ?>"><?php echo $css_style_code; ?></textarea></label></p>
    			<p><label for="<?php echo $this->get_field_id('show_link'); ?>"><?php _e('Show feedburner link:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('show_link'); ?>" name="<?php echo $this->get_field_name('show_link'); ?>" type="checkbox"<?php echo (($show_link) ? ' checked' : ''); ?> /></label></p>
            <?php
        }
    
        function update($new_instance, $old_instance) {
            return $new_instance;
        }
        function widget($args, $instance) {
            extract($args, EXTR_SKIP);
            $html = $before_widget;
            $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
            $uri = empty($instance['uri']) ? false : $instance['uri'];
            $above_email = empty($instance['above_email']) ? false : $instance['above_email'];
            $below_email = empty($instance['below_email']) ? false : $instance['below_email'];
            $subscribe_btn = empty($instance['subscribe_btn']) ? 'Subscribe' : $instance['subscribe_btn'];
            $show_link = $instance['show_link'] ? true : false;
    		$form_id = empty($instance['form_id']) ? 'feedburner_sbef' : $instance['form_id'];
    		$css_style_code = empty($instance['css_style_code']) ? false : $instance['css_style_code'];
            if($uri) {
                $uri = str_replace('http://feeds.feedburner.com/','',$uri);
                if (!empty($title)) {
                    $html .= $before_title . trim($title) . $after_title;
                }
    			/*Get Style*/
    			if($css_style_code)
    			{
    				$html .='<style type="text/css">' . trim($css_style_code) . '</style>';
    			}
    			/*Open Form*/
                $html .= '<form id="' . trim($form_id) . '" action="http://feedburner.google.com/fb/a/mailverify" method="post" onsubmit="window.open(\'http://feedburner.google.com/fb/a/mailverify?uri=' . $uri . '\', \'popupwindow\', \'scrollbars=yes,width=550,height=520\');return true" target="popupwindow">';
                if($above_email) {
                    $html .= '<label>' . trim($above_email) . '</label>';
                }
                $html .= '<input type="text" name="email"/>';
                $html .= '<input type="hidden" value="' . $uri . '" name="uri"/>';
                $html .= '<input type="hidden" name="loc" value="en_US"/>';
                if($below_email) {
                    $html .= '<label>' . trim($below_email) . '</label>';
                }
                $html .= '<input type="submit" value="' . trim($subscribe_btn) . '" />';
                if($show_link) {
                    $html .= '<label>Delivered by <a href="http://feedburner.google.com" target="_blank">FeedBurner</a></label>';
                }
                $html .= '</form>';
            }
            $html .= $after_widget;
            echo($html);
        }
    }
    add_action('widgets_init', create_function('', 'return register_widget(\'FeedburnerEmailWidget\');'));

    Hey Joel,

    Could you email me on webmaster@wyrihaximus.net with your IM/IRC/Otherway to contact you details :).

    After dinner I’ll update everything and put out 1.0.5 with your changes :).

    Cees-Jan

    1.0.5 is out with a tiny bit of tweaking. Added a link to the styling fields to my wiki: http://wiki.wyrihaximus.net/wiki/Wordpress_Feedburner_Email_Widget_Styling The article needs some work on but the basics are there :).

    Cees-Jan

    Thread Starter dotnetwizard

    (@dotnetwizard)

    1.0.5 is out with a tiny bit of tweaking. Added a link to the styling fields to my wiki: http://wiki.wyrihaximus.net/wiki/Wordpress_Feedburner_Email_Widget_Styling The article needs some work on but the basics are there :).

    Cees-Jan

    Fantastic, the new update works perfectly… good job.
    Good idea to have a styling help wiki 🙂 Pls do update the screenshots on your plugin page.

    Regards
    Joel

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Feedburner Email Widget] Nice Plugin, A Small Update’ is closed to new replies.