<?php
/**
 * Created by PhpStorm.
 * User: phuongth
 * Date: 3/26/15
 * Time: 5:24 PM
 */
class G5plus_Social_Profile extends  G5Plus_Widget {
    public function __construct() {
        $this->widget_cssclass    = 'widget-social-profile';
        $this->widget_description = __( "Social profile widget", 'g5plus-wolverine' );
        $this->widget_id          = 'g5plus-social-profile';
        $this->widget_name        = __( 'G5Plus: Social Profile', 'g5plus-wolverine' );
        $this->settings           = array(
            'label' => array(
		        'type' => 'text',
		        'std' => '',
		        'label' => __('Label','g5plus-wolverine')
            ),
	        'type'  => array(
                'type'    => 'select',
                'std'     => '',
                'label'   => __( 'Type', 'g5plus-wolverine' ),
                'options' => array(
                    'social-icon-no-border' => __( 'No Border', 'g5plus-wolverine' ),
                    'social-icon-bordered'  => __( 'Bordered', 'g5plus-wolverine' ),
	                'social-icon-text'  => __( 'Text Only', 'g5plus-wolverine' )
                )
            ),
            'icons' => array(
                'type'  => 'multi-select',
                'label'   => __( 'Select social profiles', 'g5plus-wolverine' ),
                'std'   => '',
	            'options' => array(
		            'twitter'  => __( 'Twitter', 'g5plus-wolverine' ),
		            'facebook'  => __( 'Facebook', 'g5plus-wolverine' ),
		            'dribbble'  => __( 'Dribbble', 'g5plus-wolverine' ),
		            'vimeo'  => __( 'Vimeo', 'g5plus-wolverine' ),
		            'tumblr'  => __( 'Tumblr', 'g5plus-wolverine' ),
		            'skype'  => __( 'Skype', 'g5plus-wolverine' ),
		            'linkedin'  => __( 'LinkedIn', 'g5plus-wolverine' ),
		            'googleplus'  => __( 'Google+', 'g5plus-wolverine' ),
		            'flickr'  => __( 'Flickr', 'g5plus-wolverine' ),
		            'youtube'  => __( 'YouTube', 'g5plus-wolverine' ),
		            'pinterest' => __( 'Pinterest', 'g5plus-wolverine' ),
		            'foursquare'  => __( 'Foursquare', 'g5plus-wolverine' ),
		            'instagram' => __( 'Instagram', 'g5plus-wolverine' ),
		            'github'  => __( 'GitHub', 'g5plus-wolverine' ),
		            'xing' => __( 'Xing', 'g5plus-wolverine' ),
		            'behance'  => __( 'Behance', 'g5plus-wolverine' ),
		            'deviantart'  => __( 'Deviantart', 'g5plus-wolverine' ),
		            'soundcloud'  => __( 'SoundCloud', 'g5plus-wolverine' ),
		            'yelp'  => __( 'Yelp', 'g5plus-wolverine' ),
		            'rss'  => __( 'RSS Feed', 'g5plus-wolverine' ),
		            'email'  => __( 'Email address', 'g5plus-wolverine' ),
	            )
            )
        );
        parent::__construct();
    }

    function widget( $args, $instance ) {
        extract( $args, EXTR_SKIP );
	    $label = empty( $instance['label'] ) ? '' : apply_filters( 'widget_label', $instance['label'] );
        $type         = empty( $instance['type'] ) ? '' : apply_filters( 'widget_type', $instance['type'] );
        $icons        = empty( $instance['icons'] ) ? '' : apply_filters( 'widget_icons', $instance['icons'] );
        $widget_id    = $args['widget_id'];
	    $social_icons = g5plus_get_social_icon($icons,'widget-social-profile ' . $type );
	    echo wp_kses_post( $before_widget );
	    ?>
	    <?php if (!empty($label)) : ?>
		    <span><?php echo wp_kses_post($label); ?></span>
		 <?php endif; ?>
		    <?php echo wp_kses_post( $social_icons ); ?>
	    <?php
	    echo wp_kses_post( $after_widget );
    }
}
if (!function_exists('g5plus_register_social_profile')) {
    function g5plus_register_social_profile() {
        register_widget('G5plus_Social_Profile');
    }
    add_action('widgets_init', 'g5plus_register_social_profile', 1);
}