'; echo ''; echo $after_widget; } // This is the function that outputs the form to let the users edit // the widget's title. It's an optional feature that users cry for. function widget_librarything_control() { // Get our options and see if we're handling a form submission. $options = get_option('widget_librarything'); if ( !is_array($options) ) $options = array('title'=>'Some of my Books', 'lt_user'=>'', 'number_of_books'=>5, 'url_params'=>''); if ( $_POST['librarything-submit'] ) { // Remember to sanitize and format use input appropriately. $options['title'] = strip_tags(stripslashes($_POST['librarything-title'])); $options['lt_user'] = strip_tags(stripslashes($_POST['librarything-lt_user'])); $options['number_of_books'] = strip_tags(stripslashes($_POST['librarything-number_of_books'])); $options['url_params'] = strip_tags(stripslashes($_POST['librarything-url_params'])); update_option('widget_librarything', $options); } // Be sure you format your options to be valid HTML attributes. $title = htmlspecialchars($options['title'], ENT_QUOTES); $lt_user = htmlspecialchars($options['lt_user'], ENT_QUOTES); $number_of_books = htmlspecialchars($options['number_of_books'], ENT_QUOTES); $url_params = htmlspecialchars($options['url_params'], ENT_QUOTES); // Here is our little form segment. Notice that we don't need a // complete form. This will be embedded into the existing form. echo '
'; echo ''; echo ''; echo '