Index: bbp-widgets.php
===================================================================
--- bbp-widgets.php	(revision 2709)
+++ bbp-widgets.php	(working copy)
@@ -38,7 +38,7 @@
 
 		if ( bbp_has_forums( $default ) ) :
 			echo "<ul>";
-			while ( bbp_forums ( ) ) : bbp_the_forum();
+			while ( bbp_forums() ) : bbp_the_forum();
 ?>
 
 				<li><a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?></a></li>
@@ -101,9 +101,9 @@
 		echo $before_widget;
 		echo $before_title . $title . $after_title;
 
-		if ( ($pop_check < $max_shown) && bbp_has_topics( $default ) ) :
+		if ( $pop_check < $max_shown && bbp_has_topics( $default ) ) :
 			echo "<ul>";
-			while ( bbp_topics ( ) ) : bbp_the_topic();
+			while ( bbp_topics() ) : bbp_the_topic();
 ?>
 				<li><a class="bbp-forum-title" href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?></a><?php if ( $show_date == 'on' )
 					_e( ', ' . bbp_get_topic_last_active() . ' ago' ); ?></li>
@@ -112,7 +112,7 @@
 			echo "</ul>";
 		endif;
 
-		if ( ($pop_check >= $max_shown) && bbp_has_topics( $default ) ) :
+		if ( $pop_check >= $max_shown && bbp_has_topics( $default ) ) :
 			echo "<ul>";
 			while ( bbp_topics ( ) ) : bbp_the_topic();
 				$topics[bbp_get_topic_id()] = bbp_get_topic_reply_count();
@@ -144,10 +144,10 @@
 	}
 
 	function form( $instance ) {
-		$title     = esc_attr( $instance['title'] );
-		$max_shown = esc_attr( $instance['max_shown'] );
-		$show_date = esc_attr( $instance['show_date'] );
-		$pop_check = esc_attr( $instance['pop_check'] );
+		$title     = !empty( $instance['title'] )     ? esc_attr( $instance['title'] )     : '';
+		$max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : '';
+		$show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
+		$pop_check = !empty( $instance['pop_check'] ) ? esc_attr( $instance['pop_check'] ) : '';
 ?>
 		<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( 'max_shown' ); ?>"><?php _e( 'Maximum topics to show:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo $max_shown; ?>" /></label></p>
@@ -191,7 +191,7 @@
 		if ( bbp_has_replies( $default ) ) :
 			echo "<ul>";
 
-			while ( bbp_replies ( ) ) : bbp_the_reply();
+			while ( bbp_replies() ) : bbp_the_reply();
 ?>
 				<li>
 					<a class="bbp-forum-title" href="<?php bbp_reply_permalink(); ?>" title="<?php bbp_reply_title(); ?>"><?php bbp_reply_title(); ?></a>
@@ -229,8 +229,8 @@
 
 }
 
-add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Forums_Widget");' ) );
-add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Topics_Widget");' ) );
+add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Forums_Widget");'  ) );
+add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Topics_Widget");'  ) );
 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Replies_Widget");' ) );
 
 ?>
