'.$jointext.''; echo $after_widget; } // This is the function that outputs the form to let the users edit // the widget's title and other options. function widget_ldjoin_control() { // Get our options and see if we're handling a form submission. $options = get_option('widget_ldjoin'); if ( !is_array($options) ) $options = array('title'=>'','ref'=>'','jointext'=>'Join the Liberal Democrats'); if ( $_POST['ldjoin-submit'] ) { // Sanitize and format use input appropriately. $options['title'] = strip_tags(stripslashes($_POST['ldjoin-title'])); $options['ref'] = strip_tags(stripslashes($_POST['ldjoin-ref'])); $options['jointext'] = strip_tags(stripslashes($_POST['ldjoin-jointext'])); update_option('widget_ldjoin', $options); } // Format options to be valid HTML attributes. $title = htmlspecialchars($options['title'], ENT_QUOTES); $ref = htmlspecialchars($options['ref'], ENT_QUOTES); $jointext = htmlspecialchars($options['jointext'], ENT_QUOTES); // Form segment. This will be embedded into the existing form. echo '


Leave this blank if you do not want a header.
'; echo '


'; echo '


'; echo ''; } // Register the widget so it appears with the other available // widgets and can be dragged and dropped into any active sidebars. register_sidebar_widget('Lib Dem joining link', 'widget_ldjoin'); // Register optional widget control form. Because of this // the widget will have a button that reveals a 300x350 pixel form. register_widget_control('Lib Dem joining link', 'widget_ldjoin_control', 300, 350); } // Run code later in case this loads prior to any required plugins. add_action('plugins_loaded', 'widget_ldjoin_init'); ?>