'; 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_ldblogbox_control() { // Get our options and see if we're handling a form submission. $options = get_option('widget_ldblogbox'); if ( !is_array($options) ) $options = array('title'=>'','list'=>'on','char'=>'','background'=>'','target'=>''); if ( $_POST['ldblogbox-submit'] ) { // Sanitize and format use input appropriately. $options['title'] = strip_tags(stripslashes($_POST['ldblogbox-title'])); $options['list'] = strip_tags(stripslashes($_POST['ldblogbox-list'])); $options['char'] = strip_tags(stripslashes($_POST['ldblogbox-char'])); $options['background'] = strip_tags(stripslashes($_POST['ldblogbox-background'])); $options['target'] = strip_tags(stripslashes($_POST['ldblogbox-target'])); update_option('widget_ldblogbox', $options); } // Format options to be valid HTML attributes. $title = htmlspecialchars($options['title'], ENT_QUOTES); $list = htmlspecialchars($options['list'], ENT_QUOTES); $char = htmlspecialchars($options['char'], ENT_QUOTES); $background = htmlspecialchars($options['background'], ENT_QUOTES); $target = htmlspecialchars($options['target'], ENT_QUOTES); // Form segment. This will be embedded into the existing form. echo '


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



Advanced options
(See instructions)
'; echo '

'; echo '

'; 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('LibDemBlogs box', 'widget_ldblogbox'); // Register optional widget control form. Because of this // the widget will have a button that reveals a 300x350 pixel form. register_widget_control('LibDemBlogs box', 'widget_ldblogbox_control', 300, 350); } // Run code later in case this loads prior to any required plugins. add_action('plugins_loaded', 'widget_ldblogbox_init'); ?>