<?php 
/*****************************************************************************************************************************************************
******************************************************************************************************************************************************
 
																	Register Widget Socail
 
*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
add_action( 'widgets_init', 'reza_register_widget_social' );
 function reza_register_widget_social() {
    register_widget( 'reza_widget_social' );
}
class reza_widget_social extends WP_Widget {
	function __construct() {
		parent::__construct(
			'reza_widget_social', // Base ID
			  __('rabonews','reza').' - '.esc_html__('Social Icon', 'reza') );
	}	
		public  function option(){
		$option=array();
  		$option=array();
     	$option[]=array(
				'name' =>__('Title' , 'reza' ),
 				'id' => 'title',
 				'type' => 'text'
		);
		 
		$option[]= array( 
			
		
			"name"			=> esc_html__('Space Between Item','reza'),
			"id"			=> "between",
			"group"			=>  esc_html__('Layout','reza'),
			"type"			=> "select",
 			"options"		=>  reza_array_options('between',true),						

		); 	 	
		
		$option[]= array( 
			"name"			=> __('Icon Style','reza'),
			"id"			=> "icon_style",
			"group"			=>  esc_html__('Social Icon','reza'),
			"type"			=> "select",
			"options"		=> array(
				"style-1" => esc_html__('Style 1: only icon','reza'),
				"style-2" => esc_html__('Style 2: Boxed Icon','reza'),
				"style-3" => esc_html__('Style 3: Boxed Original Color','reza'),
			),						
		); 	
		
		return $option;
    }
  /********** Update the widget info from the admin panel *******/
 	public function update( $new_instance, $old_instance ) {
		$instance = $old_instance;
 
  		return	reza_widget_options_save( $new_instance, $old_instance,$this->option() );
 	}
 
	/********** Display the widget update form *******/
 	public function form( $instance ) { 
		$defaults = array( 'title'=>__('Social' , 'reza' ),'icon_style'=>'style-3');
		$instance = wp_parse_args( (array) $instance, $defaults );
 
		reza_widget_options($instance,$this->id_base,$this->number,$this->option());
  
 	}	
    /**********  The widget For Display *******/
	function widget( $args, $instance ) {
		global $smof_data;
		
		extract( $args );
	
 		$args['key'] = 'widget_social';
 
 
	$between_class= !empty($instance['between']) ?'rd-gap-'.$instance['between']:'rd-gap-5px';
	$icon_size= !empty($instance['icon_size']) ?$instance['icon_size']:'';
	$style = !empty($instance['icon_style']) ?$instance['icon_style']:'style-1';		
		
	$classes = array(
  		'rd-el-widget_social',
    		 $between_class,
    	);?>
        
		<aside class="<?php echo esc_attr(join( ' ', $classes ));?> ">
			
			<?php reza_post_title_tabs($instance);?>
 			
            <div class="rd-gap-warp ">
			<div class="rd-item-list  rd-social-icon-<?php echo esc_attr($style);?>">
 				<?php reza_social_content($style,$smof_data,'social_');?>
   	     	</div>
			</div>
		</aside>  
	<?php
 	}
}
