Feature/widget conditions extra hooks (second time lucky)

See previous Pull Request: https://github.com/Automattic/jetpack/pull/167 (I got too far your repo with my delay, and a new branch/PR was the quickest cleanest way to catch up)

Copy paste of #167 follows:

These hooks would allow us to add in more type conditions to Widget Visibility, save them, and process them on the front end.

Here's the addition of a "type" control:

![140203-185953](https://f.cloud.github.com/assets/233434/2068106/697c9580-8d05-11e3-9158-38eedd96514c.png)

![140203-190032](https://f.cloud.github.com/assets/233434/2068115/841b7064-8d05-11e3-8a9f-911de98389b1.png)

Here's the code to add it:

```php
/**
 * 
 * 
 * @package 
 **/
class Widget_Visibility_Types {

	/**
	 * Singleton stuff.
	 * 
	 * @access @static
	 * 
	 * @return Widget_Visibility_Types object
	 */
	static public function init() {
		static $instance = false;

		if ( ! $instance )
			$instance = new Widget_Visibility_Types;

		return $instance;

	}

	/**
	 * Class constructor
	 *
	 * @return null
	 */
	public function __construct() {
		add_action( 'widget_conditions_before_admin_form', array( $this, 'action_widget_conditions_before_admin_form' ), 10, 3 );
		add_filter( 'widget_conditions_condition_result', array( $this, 'filter_widget_conditions_condition_result' ), 10, 2 );
		add_filter( 'widget_conditions_update', array( $this, 'filter_widget_conditions_update' ), 10, 4 );
	}

	// HOOKS
	// =====

	/**
	 * Hooks the Widget Conditions action widget_conditions_before_admin_form
	 * Adds the additional type condition UI.
	 *
	 * @action widget_conditions_before_admin_form
	 * 
	 * @param array $instance
	 * @param $return not used
	 * @param $widget not used
	 *
	 * @return void
	 * @author Simon Wheatley
	 **/
	public function action_widget_conditions_before_admin_form( $instance, $return, $widget ) {
		$type = '';
		if ( isset( $instance['conditions']['type'] ) )
			$type = $instance['conditions']['type'];

		?>
		<div class="condition">
			<div class="alignleft">
				<select class="conditions-rule-type" name="conditions[type]">
					<option value="" <?php selected( "", $type ); ?>><?php echo esc_html_x( 'on any type (i.e. everywhere)', 'Used as the default option in a dropdown list', 'jetpack' ); ?></option>
					<option value="is_front_page" <?php selected( "is_front_page", $type ); ?>><?php esc_html_e( 'on the front page only', 'jetpack' ); ?></option>
					<option value="is_home" <?php selected( "is_home", $type ); ?>><?php esc_html_e( 'on the news page only', 'jetpack' ); ?></option>
					<option value="is_archive" <?php selected( "is_archive", $type ); ?>><?php esc_html_e( 'on an archive page only', 'jetpack' ); ?></option>
					<option value="is_singular" <?php selected( "is_singular", $type ); ?>><?php esc_html_e( 'on single posts (or pages, etc) only', 'jetpack' ); ?></option>
				</select>
			</div>
			<span class="condition-conjunction"><?php echo esc_html_x( 'and', 'Shown between widget visibility conditions.', 'jetpack' ); ?></span>
			<br class="clear" />
		</div><!-- .condition -->
		<?php
	}

	/**
	 * Hooks the Widget Conditions filter widget_conditions_update
	 * Save the type condition on the widget instance
	 *
	 * @filter widget_conditions_update
	 * 
	 * @param array $conditions The current widget conditions, to be returned
	 * @param array $instance The current widget settings instance
	 * @param array $new_instance The new widget settings as was
	 * @param array $old_instance The old widget settings as were
	 *
	 * @return void
	 * @author Simon Wheatley
	 **/
	public function filter_widget_conditions_update( $conditions, $instance, $new_instance, $old_instance ) {
		
		$conditions['type'] = '';
		
		if ( isset( $_POST['conditions']['type'] ) ) {
			$conditions['type'] = $_POST['conditions']['type'];
			$conditions[ 'active' ] = true;
		}

		return $conditions;
	}

	/**
	 * Hooks the Widget Conditions filter widget_conditions_before_admin_form
	 * Checks the additional `type` condition allows widget display.
	 *
	 * @filter widget_conditions_condition_result
	 * 
	 * @param bool $condition_result Whether to show the widget
	 * @param array $instance The widget settings for this instance
	 *
	 * @return void
	 * @author Simon Wheatley
	 **/
	public function filter_widget_conditions_condition_result( $condition_result, $instance ) {
		
		if ( $instance['conditions']['type'] ) {
			switch ( $instance['conditions']['type'] ) {
				case 'is_front_page':
					$condition_result = is_front_page();
				break;
				case 'is_singular':
					$condition_result = is_singular();
				break;
				case 'is_home':
					$condition_result = is_home();
				break;
				case 'is_archive':
					$condition_result = is_archive();
				break;
			}
		}

		return $condition_result;
	}

}


// Initiate the singleton
Widget_Visibility_Types::init();
```