Creating a Simple Wordpress Widget
Here’s a Wordpress widget base class which reduces the amount of code needed to create a simple widget with fields. Allows overriding a method adding more complex fields. This code should be placed in your theme’s function.php file. You can then subclass Field_Widget whenever you like by following the example given.
Thanks to http://frobert.com/en/2010/12/10/wordpress-widget-tutorial/ for sharing tips on how to use WP_Widget.