Index: wp-includes/default-widgets.php
===================================================================
--- wp-includes/default-widgets.php	(revision 33102)
+++ wp-includes/default-widgets.php	(working copy)
@@ -14,8 +14,8 @@
 class WP_Widget_Pages extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A list of your site&#8217;s Pages.') );
-		parent::__construct('pages', __('Pages'), $widget_ops);
+		$widget_ops = array( 'classname' => 'widget_pages', 'description' => __( 'A list of your site&#8217;s Pages.' ) );
+		parent::__construct( 'pages', __( 'Pages' ), $widget_ops );
 	}
 
 	/**
@@ -33,13 +33,13 @@
 		 * @param array  $instance An array of the widget's settings.
 		 * @param mixed  $id_base  The widget ID.
 		 */
-		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base );
-
-		$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
+		$title   = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base );
+		$sortby  = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
 		$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
 
-		if ( $sortby == 'menu_order' )
+		if ( 'menu_order' == $sortby ) {
 			$sortby = 'menu_order, post_title';
+		}
 
 		/**
 		 * Filter the arguments for the Pages widget.
@@ -54,7 +54,7 @@
 			'title_li'    => '',
 			'echo'        => 0,
 			'sort_column' => $sortby,
-			'exclude'     => $exclude
+			'exclude'     => $exclude,
 		) ) );
 
 		if ( ! empty( $out ) ) {
@@ -78,7 +78,7 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['title'] = strip_tags( $new_instance['title'] );
 		if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) {
 			$instance['sortby'] = $new_instance['sortby'];
 		} else {
@@ -95,21 +95,21 @@
 	 */
 	public function form( $instance ) {
 		//Defaults
-		$instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
-		$title = esc_attr( $instance['title'] );
-		$exclude = esc_attr( $instance['exclude'] );
+		$instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '' ) );
+		$title = isset( $instance['title'] ) ? $instance['title'] : '';
+		$exclude = isset( $instance['exclude'] ) ? $instance['exclude'] : '';
 	?>
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <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; ?>" /></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo  esc_attr( $title ); ?>" /></p>
 		<p>
-			<label for="<?php echo $this->get_field_id('sortby'); ?>"><?php _e( 'Sort by:' ); ?></label>
-			<select name="<?php echo $this->get_field_name('sortby'); ?>" id="<?php echo $this->get_field_id('sortby'); ?>" class="widefat">
-				<option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option>
-				<option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option>
+			<label for="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>"><?php esc_html_e( 'Sort by:' ); ?></label>
+			<select name="<?php echo esc_attr( $this->get_field_name( 'sortby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>" class="widefat">
+				<option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e( 'Page title' ); ?></option>
+				<option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e( 'Page order' ); ?></option>
 				<option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
 			</select>
 		</p>
 		<p>
-			<label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo $exclude; ?>" name="<?php echo $this->get_field_name('exclude'); ?>" id="<?php echo $this->get_field_id('exclude'); ?>" class="widefat" />
+			<label for="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo esc_attr( $exclude ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'exclude' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>" class="widefat" />
 			<br />
 			<small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
 		</p>
@@ -126,8 +126,10 @@
 class WP_Widget_Links extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('description' => __( "Your blogroll" ) );
-		parent::__construct('links', __('Links'), $widget_ops);
+		$widget_ops = array(
+			'description' => __( 'Your blogroll' )
+		);
+		parent::__construct( 'links',__( 'Links' ), $widget_ops );
 	}
 
 	/**
@@ -136,13 +138,13 @@
 	 */
 	public function widget( $args, $instance ) {
 		$show_description = isset($instance['description']) ? $instance['description'] : false;
-		$show_name = isset($instance['name']) ? $instance['name'] : false;
-		$show_rating = isset($instance['rating']) ? $instance['rating'] : false;
-		$show_images = isset($instance['images']) ? $instance['images'] : true;
-		$category = isset($instance['category']) ? $instance['category'] : false;
-		$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
-		$order = $orderby == 'rating' ? 'DESC' : 'ASC';
-		$limit = isset( $instance['limit'] ) ? $instance['limit'] : -1;
+		$show_name        = isset($instance['name']) ? $instance['name'] : false;
+		$show_rating      = isset($instance['rating']) ? $instance['rating'] : false;
+		$show_images      = isset($instance['images']) ? $instance['images'] : true;
+		$category         = isset($instance['category']) ? $instance['category'] : false;
+		$orderby          = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
+		$order            = $orderby == 'rating' ? 'DESC' : 'ASC';
+		$limit            = isset( $instance['limit'] ) ? $instance['limit'] : -1;
 
 		$before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] );
 
@@ -175,13 +177,15 @@
 		$new_instance = (array) $new_instance;
 		$instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0 );
 		foreach ( $instance as $field => $val ) {
-			if ( isset($new_instance[$field]) )
-				$instance[$field] = 1;
+			if ( isset( $new_instance[ $field ] ) ) {
+				$instance[ $field ] = 1;
+			}
 		}
 
 		$instance['orderby'] = 'name';
-		if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
+		if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) ) {
 			$instance['orderby'] = $new_instance['orderby'];
+		}
 
 		$instance['category'] = intval( $new_instance['category'] );
 		$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;
@@ -197,13 +201,15 @@
 		//Defaults
 		$instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false, 'orderby' => 'name', 'limit' => -1 ) );
 		$link_cats = get_terms( 'link_category' );
-		if ( ! $limit = intval( $instance['limit'] ) )
+		if ( ! $limit = intval( $instance['limit'] ) ) {
 			$limit = -1;
+		}
+
 ?>
 		<p>
-		<label for="<?php echo $this->get_field_id('category'); ?>"><?php _e( 'Select Link Category:' ); ?></label>
-		<select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>">
-		<option value=""><?php _ex('All Links', 'links widget'); ?></option>
+		<label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php _e( 'Select Link Category:' ); ?></label>
+		<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>">
+		<option value=""><?php _ex( 'All Links', 'links widget' ); ?></option>
 		<?php
 		foreach ( $link_cats as $link_cat ) {
 			echo '<option value="' . intval( $link_cat->term_id ) . '"'
@@ -212,8 +218,8 @@
 		}
 		?>
 		</select>
-		<label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e( 'Sort by:' ); ?></label>
-		<select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
+		<label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php _e( 'Sort by:' ); ?></label>
+		<select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat">
 			<option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php _e( 'Link title' ); ?></option>
 			<option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php _e( 'Link rating' ); ?></option>
 			<option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php _e( 'Link ID' ); ?></option>
@@ -221,18 +227,18 @@
 		</select>
 		</p>
 		<p>
-		<input class="checkbox" type="checkbox" <?php checked($instance['images'], true) ?> id="<?php echo $this->get_field_id('images'); ?>" name="<?php echo $this->get_field_name('images'); ?>" />
-		<label for="<?php echo $this->get_field_id('images'); ?>"><?php _e('Show Link Image'); ?></label><br />
-		<input class="checkbox" type="checkbox" <?php checked($instance['name'], true) ?> id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" />
-		<label for="<?php echo $this->get_field_id('name'); ?>"><?php _e('Show Link Name'); ?></label><br />
-		<input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>" />
-		<label for="<?php echo $this->get_field_id('description'); ?>"><?php _e('Show Link Description'); ?></label><br />
-		<input class="checkbox" type="checkbox" <?php checked($instance['rating'], true) ?> id="<?php echo $this->get_field_id('rating'); ?>" name="<?php echo $this->get_field_name('rating'); ?>" />
-		<label for="<?php echo $this->get_field_id('rating'); ?>"><?php _e('Show Link Rating'); ?></label>
+		<input class="checkbox" type="checkbox" <?php checked( $instance['images'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'images' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'images' ) ); ?>" />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'images' ) ); ?>"><?php _e( 'Show Link Image' ); ?></label><br />
+		<input class="checkbox" type="checkbox" <?php checked( $instance['name'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'name' ) ); ?>" />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>"><?php _e( 'Show Link Name' ); ?></label><br />
+		<input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"><?php _e( 'Show Link Description' ); ?></label><br />
+		<input class="checkbox" type="checkbox" <?php checked( $instance['rating'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'rating' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'rating' ) ); ?>" />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'rating' ) ); ?>"><?php _e( 'Show Link Rating' ); ?></label>
 		</p>
 		<p>
-		<label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e( 'Number of links to show:' ); ?></label>
-		<input id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of links to show:' ); ?></label>
+		<input id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" />
 		</p>
 <?php
 	}
@@ -246,7 +252,7 @@
 class WP_Widget_Search extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") );
+		$widget_ops = array( 'classname' => 'widget_search', 'description' => _( 'A search form for your site.' ) );
 		parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops );
 	}
 
@@ -273,10 +279,10 @@
 	 * @param array $instance
 	 */
 	public function form( $instance ) {
-		$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
 		$title = $instance['title'];
 ?>
-		<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 esc_attr($title); ?>" /></label></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
 <?php
 	}
 
@@ -287,8 +293,8 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
-		$instance['title'] = strip_tags($new_instance['title']);
+		$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
+		$instance['title'] = strip_tags( $new_instance['title'] );
 		return $instance;
 	}
 
@@ -302,8 +308,8 @@
 class WP_Widget_Archives extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site&#8217;s Posts.') );
-		parent::__construct('archives', __('Archives'), $widget_ops);
+		$widget_ops = array( 'classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site&#8217;s Posts.' ) );
+		parent::__construct( 'archives', __( 'Archives' ), $widget_ops );
 	}
 
 	/**
@@ -340,7 +346,7 @@
 			$dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
 				'type'            => 'monthly',
 				'format'          => 'option',
-				'show_post_count' => $c
+				'show_post_count' => $c,
 			) );
 
 			switch ( $dropdown_args['type'] ) {
@@ -382,7 +388,7 @@
 		 */
 		wp_get_archives( apply_filters( 'widget_archives_args', array(
 			'type'            => 'monthly',
-			'show_post_count' => $c
+			'show_post_count' => $c,
 		) ) );
 ?>
 		</ul>
@@ -399,8 +405,8 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
-		$instance['title'] = strip_tags($new_instance['title']);
+		$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );
+		$instance['title'] = strip_tags( $new_instance['title'] );
 		$instance['count'] = $new_instance['count'] ? 1 : 0;
 		$instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
 
@@ -411,16 +417,16 @@
 	 * @param array $instance
 	 */
 	public function form( $instance ) {
-		$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
-		$title = strip_tags($instance['title']);
-		$count = $instance['count'] ? 'checked="checked"' : '';
-		$dropdown = $instance['dropdown'] ? 'checked="checked"' : '';
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '' ) );
+		$title    = strip_tags( $instance['title'] );
+		$count    = $instance['count']    ? true : false;
+		$dropdown = $instance['dropdown'] ? true : false;
 ?>
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
 		<p>
-			<input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>" /> <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e('Display as dropdown'); ?></label>
+			<input class="checkbox" type="checkbox" <?php checked( true , $dropdown ); ?> id="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'dropdown' ) ); ?>" /> <label for="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>"><?php _e( 'Display as dropdown' ); ?></label>
 			<br/>
-			<input class="checkbox" type="checkbox" <?php echo $count; ?> id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Show post counts'); ?></label>
+			<input class="checkbox" type="checkbox" <?php checked( true , $count ); ?> id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>" /> <label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php _e( 'Show post counts' ); ?></label>
 		</p>
 <?php
 	}
@@ -436,8 +442,8 @@
 class WP_Widget_Meta extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, &amp; WordPress.org links.") );
-		parent::__construct('meta', __('Meta'), $widget_ops);
+		$widget_ops = array( 'classname' => 'widget_meta', 'description' => __( 'Login, RSS, &amp; WordPress.org links.' ) );
+		parent::__construct( 'meta', __( 'Meta' ), $widget_ops );
 	}
 
 	/**
@@ -456,8 +462,8 @@
 			<ul>
 			<?php wp_register(); ?>
 			<li><?php wp_loginout(); ?></li>
-			<li><a href="<?php bloginfo('rss2_url'); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
-			<li><a href="<?php bloginfo('comments_rss2_url'); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
+			<li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php echo _e( 'Entries <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li>
+			<li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li>
 <?php
 			/**
 			 * Filter the "Powered by WordPress" text in the Meta widget.
@@ -486,7 +492,7 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['title'] = strip_tags( $new_instance['title'] );
 
 		return $instance;
 	}
@@ -496,9 +502,9 @@
 	 */
 	public function form( $instance ) {
 		$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
-		$title = strip_tags($instance['title']);
+		$title = strip_tags( $instance['title'] );
 ?>
-			<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+			<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
 <?php
 	}
 }
@@ -511,8 +517,8 @@
 class WP_Widget_Calendar extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site&#8217;s Posts.') );
-		parent::__construct('calendar', __('Calendar'), $widget_ops);
+		$widget_ops = array( 'classname' => 'widget_calendar', 'description' => __( 'A calendar of your site&#8217;s Posts.' ) );
+		parent::__construct( 'calendar', __( 'Calendar' ), $widget_ops );
 	}
 
 	/**
@@ -540,7 +546,7 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['title'] = strip_tags( $new_instance['title'] );
 
 		return $instance;
 	}
@@ -550,10 +556,10 @@
 	 */
 	public function form( $instance ) {
 		$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
-		$title = strip_tags($instance['title']);
+		$title = strip_tags( $instance['title'] );
 ?>
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
-		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
+		<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
 <?php
 	}
 }
@@ -566,9 +572,15 @@
 class WP_Widget_Text extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.'));
-		$control_ops = array('width' => 400, 'height' => 350);
-		parent::__construct('text', __('Text'), $widget_ops, $control_ops);
+		$widget_ops = array(
+			'classname' => 'widget_text',
+			'description' => __( 'Arbitrary text or HTML.' )
+		);
+		$control_ops = array(
+			'width' => 400,
+			'height' => 350,
+		);
+		parent::__construct( 'text', __( 'Text' ), $widget_ops, $control_ops );
 	}
 
 	/**
@@ -592,7 +604,7 @@
 		if ( ! empty( $title ) ) {
 			echo $args['before_title'] . $title . $args['after_title'];
 		} ?>
-			<div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
+			<div class="textwidget"><?php echo ! empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
 		<?php
 		echo $args['after_widget'];
 	}
@@ -604,11 +616,12 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$instance['title'] = strip_tags($new_instance['title']);
-		if ( current_user_can('unfiltered_html') )
-			$instance['text'] =  $new_instance['text'];
-		else
-			$instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed
+		$instance['title'] = strip_tags( $new_instance['title'] );
+		if ( current_user_can( 'unfiltered_html' ) ) {
+			$instance['text'] = $new_instance['text'];
+		} else {
+			$instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text'] ) ) ); // wp_filter_post_kses() expects slashed
+		}
 		$instance['filter'] = ! empty( $new_instance['filter'] );
 		return $instance;
 	}
@@ -618,16 +631,16 @@
 	 */
 	public function form( $instance ) {
 		$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
-		$title = strip_tags($instance['title']);
-		$text = esc_textarea($instance['text']);
+		$title = strip_tags( $instance['title'] );
+		$text = isset( $instance['text'] ) ? $instance['text'] : '';
 ?>
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
-		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
+		<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
 
-		<p><label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
-		<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php _e( 'Content:' ); ?></label>
+		<textarea class="widefat" rows="16" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"><?php echo esc_textarea( $text ); ?></textarea></p>
 
-		<p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>
+		<p><input id="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'filter' ) ); ?>" type="checkbox" <?php checked( isset( $instance['filter'] ) ? $instance['filter'] : 0 ); ?> />&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>"><?php _e( 'Automatically add paragraphs' ); ?></label></p>
 <?php
 	}
 }
@@ -640,8 +653,11 @@
 class WP_Widget_Categories extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
-		parent::__construct('categories', __('Categories'), $widget_ops);
+		$widget_ops = array(
+			'classname' => 'widget_categories',
+			'description' => __( 'A list or dropdown of categories.' )
+		);
+		parent::__construct( 'categories', __( 'Categories' ), $widget_ops );
 	}
 
 	/**
@@ -668,7 +684,7 @@
 		$cat_args = array(
 			'orderby'      => 'name',
 			'show_count'   => $c,
-			'hierarchical' => $h
+			'hierarchical' => $h,
 		);
 
 		if ( $d ) {
@@ -695,10 +711,10 @@
 <script type='text/javascript'>
 /* <![CDATA[ */
 (function() {
-	var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
+	var dropdown = document.getElementById( "<?php echo wp_json_encode( $dropdown_id ); ?>" );
 	function onCatChange() {
 		if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {
-			location.href = "<?php echo home_url(); ?>/?cat=" + dropdown.options[ dropdown.selectedIndex ].value;
+			location.href = "<?php echo esc_url( home_url() ); ?>/?cat=" + dropdown.options[ dropdown.selectedIndex ].value;
 		}
 	}
 	dropdown.onchange = onCatChange;
@@ -736,10 +752,10 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$instance['title'] = strip_tags($new_instance['title']);
-		$instance['count'] = !empty($new_instance['count']) ? 1 : 0;
-		$instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0;
-		$instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;
+		$instance['title'] = strip_tags( $new_instance['title'] );
+		$instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0;
+		$instance['hierarchical'] = ! empty( $new_instance['hierarchical'] ) ? 1 : 0;
+		$instance['dropdown'] = ! empty($new_instance['dropdown'] ) ? 1 : 0;
 
 		return $instance;
 	}
@@ -749,23 +765,22 @@
 	 */
 	public function form( $instance ) {
 		//Defaults
-		$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
-		$title = esc_attr( $instance['title'] );
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
 		$count = isset($instance['count']) ? (bool) $instance['count'] :false;
 		$hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
 		$dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
 ?>
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
-		<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; ?>" /></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
+		<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ) ?>" /></p>
 
-		<p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> />
-		<label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
+		<p><input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'dropdown' ) ); ?>"<?php checked( $dropdown ); ?> />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
 
-		<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />
-		<label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />
+		<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'count' ) ); ?>"<?php checked( $count ); ?> />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'count' ) ); ?>"><?php _e( 'Show post counts' ); ?></label><br />
 
-		<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
-		<label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
+		<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'hierarchical' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hierarchical' ) ); ?>"<?php checked( $hierarchical ); ?> />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'hierarchical' ) ); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
 <?php
 	}
 
@@ -779,13 +794,16 @@
 class WP_Widget_Recent_Posts extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site&#8217;s most recent Posts.") );
-		parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
+		$widget_ops = array(
+			'classname' => 'widget_recent_entries',
+			'description' => __( 'Your site&#8217;s most recent Posts.' )
+		);
+		parent::__construct( 'recent-posts', __( 'Recent Posts' ), $widget_ops );
 		$this->alt_option_name = 'widget_recent_entries';
 
-		add_action( 'save_post', array($this, 'flush_widget_cache') );
-		add_action( 'deleted_post', array($this, 'flush_widget_cache') );
-		add_action( 'switch_theme', array($this, 'flush_widget_cache') );
+		add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
+		add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
+		add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
 	}
 
 	/**
@@ -819,8 +837,9 @@
 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
 
 		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
-		if ( ! $number )
+		if ( ! $number ) {
 			$number = 5;
+		}
 		$show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
 
 		/**
@@ -836,15 +855,16 @@
 			'posts_per_page'      => $number,
 			'no_found_rows'       => true,
 			'post_status'         => 'publish',
-			'ignore_sticky_posts' => true
+			'ignore_sticky_posts' => true,
 		) ) );
 
-		if ($r->have_posts()) :
+		if ( $r->have_posts() ) :
 ?>
 		<?php echo $args['before_widget']; ?>
-		<?php if ( $title ) {
+		<?php
+		if ( $title ) {
 			echo $args['before_title'] . $title . $args['after_title'];
-		} ?>
+		}?>
 		<ul>
 		<?php while ( $r->have_posts() ) : $r->the_post(); ?>
 			<li>
@@ -877,14 +897,15 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['title'] = strip_tags( $new_instance['title'] );
 		$instance['number'] = (int) $new_instance['number'];
 		$instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
 		$this->flush_widget_cache();
 
 		$alloptions = wp_cache_get( 'alloptions', 'options' );
-		if ( isset($alloptions['widget_recent_entries']) )
-			delete_option('widget_recent_entries');
+		if ( isset( $alloptions['widget_recent_entries'] ) ) {
+			delete_option( 'widget_recent_entries' );
+		}
 
 		return $instance;
 	}
@@ -893,7 +914,7 @@
 	 * @access public
 	 */
 	public function flush_widget_cache() {
-		wp_cache_delete('widget_recent_posts', 'widget');
+		wp_cache_delete( 'widget_recent_posts', 'widget' );
 	}
 
 	/**
@@ -900,18 +921,18 @@
 	 * @param array $instance
 	 */
 	public function form( $instance ) {
-		$title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
-		$number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
-		$show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false;
+		$title     = isset( $instance['title'] )     ? $instance['title']: '';
+		$number    = isset( $instance['number'] )    ? $instance['number'] : 5;
+		$show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
 ?>
-		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
-		<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; ?>" /></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
+		<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
 
-		<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
-		<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
+		<p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
+		<input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo absint( $number ); ?>" size="3" /></p>
 
-		<p><input class="checkbox" type="checkbox" <?php checked( $show_date ); ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" />
-		<label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display post date?' ); ?></label></p>
+		<p><input class="checkbox" type="checkbox" <?php checked( (bool) $show_date ); ?> id="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_date' ) ); ?>" />
+		<label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>"><?php _e( 'Display post date?' ); ?></label></p>
 <?php
 	}
 }
@@ -924,16 +945,20 @@
 class WP_Widget_Recent_Comments extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'Your site&#8217;s most recent comments.' ) );
-		parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
+		$widget_ops = array(
+			'classname' => 'widget_recent_comments',
+			'description' => _( 'Your site&#8217;s most recent comments.' )
+		);
+		parent::__construct( 'recent-comments', __( 'Recent Comments' ), $widget_ops );
 		$this->alt_option_name = 'widget_recent_comments';
 
-		if ( is_active_widget(false, false, $this->id_base) )
-			add_action( 'wp_head', array($this, 'recent_comments_style') );
+		if ( is_active_widget( false, false, $this->id_base ) ) {
+			add_action( 'wp_head', array( $this, 'recent_comments_style' ) );
+		}
 
-		add_action( 'comment_post', array($this, 'flush_widget_cache') );
-		add_action( 'edit_comment', array($this, 'flush_widget_cache') );
-		add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
+		add_action( 'comment_post', array( $this, 'flush_widget_cache' ) );
+		add_action( 'edit_comment', array( $this, 'flush_widget_cache' ) );
+		add_action( 'transition_comment_status', array( $this, 'flush_widget_cache' ) );
 	}
 
 	/**
@@ -949,8 +974,9 @@
 		 * @param string $id_base The widget ID.
 		 */
 		if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
-			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
+			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) {
 			return;
+		}
 		?>
 	<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
 <?php
@@ -960,7 +986,7 @@
 	 * @access public
 	 */
 	public function flush_widget_cache() {
-		wp_cache_delete('widget_recent_comments', 'widget');
+		wp_cache_delete( 'widget_recent_comments', 'widget' );
 	}
 
 	/**
@@ -975,14 +1001,15 @@
 
 		$cache = array();
 		if ( ! $this->is_preview() ) {
-			$cache = wp_cache_get('widget_recent_comments', 'widget');
+			$cache = wp_cache_get( 'widget_recent_comments', 'widget' );
 		}
 		if ( ! is_array( $cache ) ) {
 			$cache = array();
 		}
 
-		if ( ! isset( $args['widget_id'] ) )
+		if ( ! isset( $args['widget_id'] ) ) {
 			$args['widget_id'] = $this->id;
+		}
 
 		if ( isset( $cache[ $args['widget_id'] ] ) ) {
 			echo $cache[ $args['widget_id'] ];
@@ -997,9 +1024,11 @@
 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
 
 		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
-		if ( ! $number )
+		if ( ! $number ) {
 			$number = 5;
+		}
 
+
 		/**
 		 * Filter the arguments for the Recent Comments widget.
 		 *
@@ -1012,7 +1041,7 @@
 		$comments = get_comments( apply_filters( 'widget_comments_args', array(
 			'number'      => $number,
 			'status'      => 'approve',
-			'post_status' => 'publish'
+			'post_status' => 'publish',
 		) ) );
 
 		$output .= $args['before_widget'];
@@ -1026,7 +1055,7 @@
 			$post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
 			_prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );
 
-			foreach ( (array) $comments as $comment) {
+			foreach ( (array) $comments as $comment ) {
 				$output .= '<li class="recentcomments">';
 				/* translators: comments widget: 1: comment author, 2: post link */
 				$output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
@@ -1054,13 +1083,14 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
-		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['title'] = strip_tags( $new_instance['title'] );
 		$instance['number'] = absint( $new_instance['number'] );
 		$this->flush_widget_cache();
 
 		$alloptions = wp_cache_get( 'alloptions', 'options' );
-		if ( isset($alloptions['widget_recent_comments']) )
-			delete_option('widget_recent_comments');
+		if ( isset( $alloptions['widget_recent_comments'] ) ) {
+			delete_option( 'widget_recent_comments' );
+		}
 
 		return $instance;
 	}
@@ -1089,9 +1119,9 @@
 class WP_Widget_RSS extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array( 'description' => __('Entries from any RSS or Atom feed.') );
+		$widget_ops = array( 'description' => __( 'Entries from any RSS or Atom feed.' ) );
 		$control_ops = array( 'width' => 400, 'height' => 200 );
-		parent::__construct( 'rss', __('RSS'), $widget_ops, $control_ops );
+		parent::__construct( 'rss', __( 'RSS' ), $widget_ops, $control_ops );
 	}
 
 	/**
@@ -1099,44 +1129,52 @@
 	 * @param array $instance
 	 */
 	public function widget( $args, $instance ) {
-		if ( isset($instance['error']) && $instance['error'] )
+		if ( isset($instance['error']) && $instance['error'] ) {
 			return;
+		}
 
 		$url = ! empty( $instance['url'] ) ? $instance['url'] : '';
-		while ( stristr($url, 'http') != $url )
-			$url = substr($url, 1);
+		while ( stristr( $url, 'http' ) != $url ) {
+			$url = substr( $url, 1 );
+		}
 
-		if ( empty($url) )
+		if ( empty($url) ) {
 			return;
+		}
 
 		// self-url destruction sequence
-		if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) )
+		if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) ) {
 			return;
+		}
 
-		$rss = fetch_feed($url);
+		$rss = fetch_feed( $url );
 		$title = $instance['title'];
 		$desc = '';
 		$link = '';
 
-		if ( ! is_wp_error($rss) ) {
-			$desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
-			if ( empty($title) )
-				$title = esc_html(strip_tags($rss->get_title()));
-			$link = esc_url(strip_tags($rss->get_permalink()));
-			while ( stristr($link, 'http') != $link )
-				$link = substr($link, 1);
+		if ( ! is_wp_error( $rss ) ) {
+			$desc = esc_attr( strip_tags( @html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
+			if ( empty( $title ) ) {
+				$title = esc_html( strip_tags( $rss->get_title() ) );
+			}
+			$link = esc_url( strip_tags( $rss->get_permalink() ) );
+			while ( stristr( $link, 'http' ) != $link ) {
+				$link = substr( $link, 1 );
+			}
 		}
 
-		if ( empty($title) )
-			$title = empty($desc) ? __('Unknown Feed') : $desc;
+		if ( empty( $title ) ) {
+			$title = empty( $desc ) ? __( 'Unknown Feed' ) : $desc;
+		}
 
 		/** This filter is documented in wp-includes/default-widgets.php */
 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
 
-		$url = esc_url(strip_tags($url));
-		$icon = includes_url('images/rss.png');
-		if ( $title )
-			$title = "<a class='rsswidget' href='$url'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link'>$title</a>";
+		$url = esc_url( strip_tags( $url ) );
+		$icon = includes_url( 'images/rss.png' );
+		if ( $title ) {
+			$title = '<a class="rsswidget" href="' . esc_url( $url ). '"><img style="border:0" width="14" height="14" src="' . esc_url( $icon ) .'" alt="RSS" /></a> <a class="rsswidget" href="' . esc_url( $link ) .'">' . $title.'</a>';
+		}
 
 		echo $args['before_widget'];
 		if ( $title ) {
@@ -1145,8 +1183,9 @@
 		wp_widget_rss_output( $rss, $instance );
 		echo $args['after_widget'];
 
-		if ( ! is_wp_error($rss) )
+		if ( ! is_wp_error( $rss ) ) {
 			$rss->__destruct();
+		}
 		unset($rss);
 	}
 
@@ -1156,7 +1195,7 @@
 	 * @return array
 	 */
 	public function update( $new_instance, $old_instance ) {
-		$testurl = ( isset( $new_instance['url'] ) && ( !isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
+		$testurl = ( isset( $new_instance['url'] ) && ( ! isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
 		return wp_widget_rss_process( $new_instance, $testurl );
 	}
 
@@ -1165,7 +1204,15 @@
 	 */
 	public function form( $instance ) {
 		if ( empty( $instance ) ) {
-			$instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 );
+			$instance = array(
+				'title'         => '',
+				'url'           => '',
+				'items'         => 10,
+				'error'         => false,
+				'show_summary'  => 0,
+				'show_author'   => 0,
+				'show_date'     => 0,
+			);
 		}
 		$instance['number'] = $this->number;
 
@@ -1183,31 +1230,40 @@
  */
 function wp_widget_rss_output( $rss, $args = array() ) {
 	if ( is_string( $rss ) ) {
-		$rss = fetch_feed($rss);
-	} elseif ( is_array($rss) && isset($rss['url']) ) {
+		$rss = fetch_feed( $rss );
+	} elseif ( is_array( $rss ) && isset( $rss['url'] ) ) {
 		$args = $rss;
-		$rss = fetch_feed($rss['url']);
-	} elseif ( !is_object($rss) ) {
+		$rss = fetch_feed( $rss['url'] );
+	} elseif ( ! is_object( $rss ) ) {
 		return;
 	}
 
-	if ( is_wp_error($rss) ) {
-		if ( is_admin() || current_user_can('manage_options') )
-			echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
+	if ( is_wp_error( $rss ) ) {
+		if ( is_admin() || current_user_can( 'manage_options' ) ) {
+			echo '<p><strong>' . sprintf( __( 'RSS Error: %s' ), $rss->get_error_message() ) . '</strong></p>';
+		}
+
 		return;
 	}
 
-	$default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0 );
+	$default_args = array(
+		'show_author'   => 0,
+		'show_date'     => 0,
+		'show_summary'  => 0,
+		'items'         => 0,
+	);
 	$args = wp_parse_args( $args, $default_args );
 
 	$items = (int) $args['items'];
-	if ( $items < 1 || 20 < $items )
+	if ( $items < 1 || 20 < $items ) {
 		$items = 10;
+	}
+
 	$show_summary  = (int) $args['show_summary'];
 	$show_author   = (int) $args['show_author'];
 	$show_date     = (int) $args['show_date'];
 
-	if ( !$rss->get_item_quantity() ) {
+	if ( ! $rss->get_item_quantity() ) {
 		echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
 		$rss->__destruct();
 		unset($rss);
@@ -1254,7 +1310,7 @@
 		$author = '';
 		if ( $show_author ) {
 			$author = $item->get_author();
-			if ( is_object($author) ) {
+			if ( is_object( $author ) ) {
 				$author = $author->get_name();
 				$author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
 			}
@@ -1261,11 +1317,11 @@
 		}
 
 		if ( $link == '' ) {
-			echo "<li>$title{$date}{$summary}{$author}</li>";
+			echo '<li>' . $title . $date . $summary . $author . '</li>';
 		} elseif ( $show_summary ) {
-			echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$summary}{$author}</li>";
+			echo '<li><a class="rsswidget" href="' . esc_url( $link ) .'">' . $title .'</a>' . $date . $summary . $author . '</li>';
 		} else {
-			echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$author}</li>";
+			echo '<li><a class="rsswidget" href="'.  esc_url( $link ) .'">' . $title . '</a>' . $date . $author . '</li>';
 		}
 	}
 	echo '</ul>';
@@ -1308,14 +1364,14 @@
 
 	if ( $inputs['url'] ) :
 ?>
-	<p><label for="rss-url-<?php echo $args['number']; ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label>
-	<input class="widefat" id="rss-url-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][url]" type="text" value="<?php echo $args['url']; ?>" /></p>
+	<p><label for="rss-url-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label>
+	<input class="widefat" id="rss-url-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][url]" type="text" value="<?php echo esc_attr( $args['url'] ); ?>" /></p>
 <?php endif; if ( $inputs['title'] ) : ?>
-	<p><label for="rss-title-<?php echo $args['number']; ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label>
-	<input class="widefat" id="rss-title-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][title]" type="text" value="<?php echo $args['title']; ?>" /></p>
+	<p><label for="rss-title-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label>
+	<input class="widefat" id="rss-title-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][title]" type="text" value="<?php echo esc_attr( $args['title'] ); ?>" /></p>
 <?php endif; if ( $inputs['items'] ) : ?>
-	<p><label for="rss-items-<?php echo $args['number']; ?>"><?php _e( 'How many items would you like to display?' ); ?></label>
-	<select id="rss-items-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][items]">
+	<p><label for="rss-items-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'How many items would you like to display?' ); ?></label>
+	<select id="rss-items-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][items]">
 <?php
 		for ( $i = 1; $i <= 20; ++$i ) {
 			echo "<option value='$i' " . selected( $args['items'], $i, false ) . ">$i</option>";
@@ -1323,21 +1379,21 @@
 ?>
 	</select></p>
 <?php endif; if ( $inputs['show_summary'] ) : ?>
-	<p><input id="rss-show-summary-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_summary]" type="checkbox" value="1" <?php checked( $args['show_summary'] ); ?> />
-	<label for="rss-show-summary-<?php echo $args['number']; ?>"><?php _e( 'Display item content?' ); ?></label></p>
+	<p><input id="rss-show-summary-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][show_summary]" type="checkbox" value="1" <?php checked( $args['show_summary'] ); ?> />
+	<label for="rss-show-summary-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Display item content?' ); ?></label></p>
 <?php endif; if ( $inputs['show_author'] ) : ?>
-	<p><input id="rss-show-author-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_author]" type="checkbox" value="1" <?php checked( $args['show_author'] ); ?> />
-	<label for="rss-show-author-<?php echo $args['number']; ?>"><?php _e( 'Display item author if available?' ); ?></label></p>
+	<p><input id="rss-show-author-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][show_author]" type="checkbox" value="1" <?php checked( $args['show_author'] ); ?> />
+	<label for="rss-show-author-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Display item author if available?' ); ?></label></p>
 <?php endif; if ( $inputs['show_date'] ) : ?>
-	<p><input id="rss-show-date-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_date]" type="checkbox" value="1" <?php checked( $args['show_date'] ); ?>/>
-	<label for="rss-show-date-<?php echo $args['number']; ?>"><?php _e( 'Display item date?' ); ?></label></p>
+	<p><input id="rss-show-date-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][show_date]" type="checkbox" value="1" <?php checked( $args['show_date'] ); ?>/>
+	<label for="rss-show-date-<?php echo esc_attr( $args['number'] ); ?>"><?php _e( 'Display item date?' ); ?></label></p>
 <?php
 	endif;
-	foreach ( array_keys($default_inputs) as $input ) :
-		if ( 'hidden' === $inputs[$input] ) :
+	foreach ( array_keys( $default_inputs ) as $input ) :
+		if ( 'hidden' === $inputs[ $input ] ) :
 			$id = str_replace( '_', '-', $input );
 ?>
-	<input type="hidden" id="rss-<?php echo $id; ?>-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][<?php echo $input; ?>]" value="<?php echo $args[ $input ]; ?>" />
+	<input type="hidden" id="rss-<?php echo esc_attr( $id ); ?>-<?php echo esc_attr( $args['number'] ); ?>" name="widget-rss[<?php echo esc_attr( $args['number'] ); ?>][<?php echo esc_attr( $input ); ?>]" value="<?php echo esc_attr( $args[ $input ] ); ?>" />
 <?php
 		endif;
 	endforeach;
@@ -1361,8 +1417,10 @@
  */
 function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
 	$items = (int) $widget_rss['items'];
-	if ( $items < 1 || 20 < $items )
+	if ( $items < 1 || 20 < $items ) {
 		$items = 10;
+	}
+
 	$url           = esc_url_raw( strip_tags( $widget_rss['url'] ) );
 	$title         = isset( $widget_rss['title'] ) ? trim( strip_tags( $widget_rss['title'] ) ) : '';
 	$show_summary  = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
@@ -1370,15 +1428,16 @@
 	$show_date     = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0;
 
 	if ( $check_feed ) {
-		$rss = fetch_feed($url);
+		$rss = fetch_feed( $url );
 		$error = false;
 		$link = '';
-		if ( is_wp_error($rss) ) {
+		if ( is_wp_error( $rss ) ) {
 			$error = $rss->get_error_message();
 		} else {
-			$link = esc_url(strip_tags($rss->get_permalink()));
-			while ( stristr($link, 'http') != $link )
-				$link = substr($link, 1);
+			$link = esc_url( strip_tags( $rss->get_permalink() ) );
+			while ( stristr( $link, 'http' ) != $link ) {
+				$link = substr( $link, 1 );
+			}
 
 			$rss->__destruct();
 			unset($rss);
@@ -1396,8 +1455,8 @@
 class WP_Widget_Tag_Cloud extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array( 'description' => __( "A cloud of your most used tags.") );
-		parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
+		$widget_ops = array( 'description' => __( 'A cloud of your most used tags.' ) );
+		parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops );
 	}
 
 	/**
@@ -1405,14 +1464,14 @@
 	 * @param array $instance
 	 */
 	public function widget( $args, $instance ) {
-		$current_taxonomy = $this->_get_current_taxonomy($instance);
-		if ( !empty($instance['title']) ) {
+		$current_taxonomy = $this->_get_current_taxonomy( $instance );
+		if ( ! empty( $instance['title'] ) ) {
 			$title = $instance['title'];
 		} else {
 			if ( 'post_tag' == $current_taxonomy ) {
-				$title = __('Tags');
+				$title = __( 'Tags' );
 			} else {
-				$tax = get_taxonomy($current_taxonomy);
+				$tax = get_taxonomy( $current_taxonomy );
 				$title = $tax->labels->name;
 			}
 		}
@@ -1437,7 +1496,7 @@
 		 * @param array $current_taxonomy The taxonomy to use in the tag cloud. Default 'tags'.
 		 */
 		wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(
-			'taxonomy' => $current_taxonomy
+			'taxonomy' => $current_taxonomy,
 		) ) );
 
 		echo "</div>\n";
@@ -1451,8 +1510,8 @@
 	 */
 	public function update( $new_instance, $old_instance ) {
 		$instance = array();
-		$instance['title'] = strip_tags(stripslashes($new_instance['title']));
-		$instance['taxonomy'] = stripslashes($new_instance['taxonomy']);
+		$instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
+		$instance['taxonomy'] = stripslashes( $new_instance['taxonomy'] );
 		return $instance;
 	}
 
@@ -1460,18 +1519,20 @@
 	 * @param array $instance
 	 */
 	public function form( $instance ) {
-		$current_taxonomy = $this->_get_current_taxonomy($instance);
+		$current_taxonomy = $this->_get_current_taxonomy( $instance );
+		$title = ( isset ( $instance['title'] ) ) ? $instance['title'] : '';
 ?>
-	<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
-	<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" /></p>
-	<p><label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:') ?></label>
-	<select class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>">
+	<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ) ?></label>
+	<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $title );?>" /></p>
+	<p><label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"><?php _e( 'Taxonomy:' ) ?></label>
+	<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>">
 	<?php foreach ( get_taxonomies() as $taxonomy ) :
-				$tax = get_taxonomy($taxonomy);
-				if ( !$tax->show_tagcloud || empty($tax->labels->name) )
+				$tax = get_taxonomy( $taxonomy );
+				if ( ! $tax->show_tagcloud || empty( $tax->labels->name ) ) {
 					continue;
+				}
 	?>
-		<option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option>
+		<option value="<?php echo esc_attr( $taxonomy ) ?>" <?php selected( $taxonomy, $current_taxonomy ) ?>><?php echo esc_html( $tax->labels->name ); ?></option>
 	<?php endforeach; ?>
 	</select></p><?php
 	}
@@ -1481,8 +1542,9 @@
 	 * @return string
 	 */
 	public function _get_current_taxonomy($instance) {
-		if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
+		if ( ! empty( $instance['taxonomy'] ) && taxonomy_exists( $instance['taxonomy'] ) ) {
 			return $instance['taxonomy'];
+		}
 
 		return 'post_tag';
 	}
@@ -1493,11 +1555,11 @@
  *
  * @since 3.0.0
  */
- class WP_Nav_Menu_Widget extends WP_Widget {
+class WP_Nav_Menu_Widget extends WP_Widget {
 
 	public function __construct() {
-		$widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
-		parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
+		$widget_ops = array( 'description' => __( 'Add a custom menu to your sidebar.' ) );
+		parent::__construct( 'nav_menu', __( 'Custom Menu' ), $widget_ops );
 	}
 
 	/**
@@ -1508,20 +1570,24 @@
 		// Get menu
 		$nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
 
-		if ( !$nav_menu )
+		if ( ! $nav_menu ) {
 			return;
+		}
 
+
 		/** This filter is documented in wp-includes/default-widgets.php */
 		$instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
 
 		echo $args['before_widget'];
 
-		if ( !empty($instance['title']) )
+		if ( ! empty( $instance['title'] ) ) {
 			echo $args['before_title'] . $instance['title'] . $args['after_title'];
+		}
 
+
 		$nav_menu_args = array(
 			'fallback_cb' => '',
-			'menu'        => $nav_menu
+			'menu'        => $nav_menu,
 		);
 
 		/**
@@ -1551,7 +1617,7 @@
 	public function update( $new_instance, $old_instance ) {
 		$instance = array();
 		if ( ! empty( $new_instance['title'] ) ) {
-			$instance['title'] = strip_tags( stripslashes($new_instance['title']) );
+			$instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
 		}
 		if ( ! empty( $new_instance['nav_menu'] ) ) {
 			$instance['nav_menu'] = (int) $new_instance['nav_menu'];
@@ -1563,7 +1629,7 @@
 	 * @param array $instance
 	 */
 	public function form( $instance ) {
-		$title = isset( $instance['title'] ) ? $instance['title'] : '';
+		$title    = isset( $instance['title'] ) ? $instance['title'] : '';
 		$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
 
 		// Get menus
@@ -1570,25 +1636,25 @@
 		$menus = wp_get_nav_menus();
 
 		// If no menus exists, direct the user to go and create some.
-		if ( !$menus ) {
-			echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';
+		if ( ! $menus ) {
+			echo '<p>'. sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_url( admin_url( 'nav-menus.php' ) ) ) .'</p>';
 			return;
 		}
 		?>
 		<p>
-			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
+			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ) ?></label>
+			<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $title ); ?>" />
 		</p>
 		<p>
-			<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
-			<select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
+			<label for="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>"><?php _e( 'Select Menu:' ); ?></label>
+			<select id="<?php echo esc_attr( $this->get_field_id( 'nav_menu' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'nav_menu' ) ); ?>">
 				<option value="0"><?php _e( '&mdash; Select &mdash;' ) ?></option>
 		<?php
-			foreach ( $menus as $menu ) {
-				echo '<option value="' . $menu->term_id . '"'
-					. selected( $nav_menu, $menu->term_id, false )
-					. '>'. esc_html( $menu->name ) . '</option>';
-			}
+		foreach ( $menus as $menu ) {
+			echo '<option value="' . $menu->term_id . '"'
+				. selected( $nav_menu, $menu->term_id, false )
+				. '>'. esc_html( $menu->name ) . '</option>';
+		}
 		?>
 			</select>
 		</p>
@@ -1605,36 +1671,39 @@
  * @since 2.2.0
  */
 function wp_widgets_init() {
-	if ( !is_blog_installed() )
+	if ( ! is_blog_installed() ) {
 		return;
+	}
 
-	register_widget('WP_Widget_Pages');
+	register_widget( 'WP_Widget_Pages' );
 
-	register_widget('WP_Widget_Calendar');
+	register_widget( 'WP_Widget_Calendar' );
 
-	register_widget('WP_Widget_Archives');
+	register_widget( 'WP_Widget_Archives' );
 
-	if ( get_option( 'link_manager_enabled' ) )
-		register_widget('WP_Widget_Links');
+	if ( get_option( 'link_manager_enabled' ) ) {
+		register_widget( 'WP_Widget_Links' );
+	}
 
-	register_widget('WP_Widget_Meta');
 
-	register_widget('WP_Widget_Search');
+	register_widget( 'WP_Widget_Meta' );
 
-	register_widget('WP_Widget_Text');
+	register_widget( 'WP_Widget_Search' );
 
-	register_widget('WP_Widget_Categories');
+	register_widget( 'WP_Widget_Text' );
 
-	register_widget('WP_Widget_Recent_Posts');
+	register_widget( 'WP_Widget_Categories' );
 
-	register_widget('WP_Widget_Recent_Comments');
+	register_widget( 'WP_Widget_Recent_Posts' );
 
-	register_widget('WP_Widget_RSS');
+	register_widget( 'WP_Widget_Recent_Comments' );
 
-	register_widget('WP_Widget_Tag_Cloud');
+	register_widget( 'WP_Widget_RSS' );
 
-	register_widget('WP_Nav_Menu_Widget');
+	register_widget( 'WP_Widget_Tag_Cloud' );
 
+	register_widget( 'WP_Nav_Menu_Widget' );
+
 	/**
 	 * Fires after all default WordPress widgets have been registered.
 	 *
