<?php
///----Blog widgets---
//Popular Post
class Ximsa_Popular_Post extends WP_Widget
{
    /** constructor */
    public function __construct()
    {
        parent::__construct( /* Base ID */'Ximsa_Popular_Post', /* Name */esc_html__('Ximsa Popular Post', 'ximsa'), array( 'description' => esc_html__('Show the Popular Post', 'ximsa')));
    }


    /** @see WP_Widget::widget */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);

        echo wp_kses_post($before_widget); ?>

		<!-- Post Widget -->
        <div class="post-widget">
            <!-- Sidebar Title -->
            <?php echo wp_kses_post($before_title.$title.$after_title); ?>
            <div class="widget-content">
                <?php $query_string = array('showposts'=>$instance['number']);
					if ($instance['cat']) {
						$query_string['tax_query'] = array(array('taxonomy' => 'category','field' => 'id','terms' => (array)$instance['cat']));
					}
					$this->posts($query_string); 
				?>
            </div>
        </div>
        
        <?php echo wp_kses_post($after_widget);
    }


    /** @see WP_Widget::update */
    public function update($new_instance, $old_instance)
    {
        $instance = $old_instance;

        $instance['title'] = strip_tags($new_instance['title']);
        $instance['number'] = $new_instance['number'];
        $instance['cat'] = $new_instance['cat'];

        return $instance;
    }

    /** @see WP_Widget::form */
    public function form($instance)
    {
        $title = ($instance) ? esc_attr($instance['title']) : esc_html__('Popular Post', 'ximsa');
        $number = ($instance) ? esc_attr($instance['number']) : 3;
        $cat = ($instance) ? esc_attr($instance['cat']) : ''; ?>

        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'ximsa'); ?></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 esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('No. of Posts:', 'ximsa'); ?></label>
            <input class="widefat" 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 esc_attr($number); ?>" />
        </p>
		<p>
            <label for="<?php echo esc_attr($this->get_field_id('categories')); ?>"><?php esc_html_e('Category', 'ximsa'); ?></label>
            <?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'ximsa'), 'taxonomy' => 'category', 'selected'=>$cat, 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
        </p>

        <?php
    }

    public function posts($query_string)
    {
        $query = new WP_Query($query_string);
        if ($query->have_posts()):?>

            <!-- Title -->
            <?php
                global $post;
				while ($query->have_posts()): $query->the_post();
				$post_thumbnail_id = get_post_thumbnail_id($post->ID);
				$post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id); 
			?>
            <div class="post">
                <div class="thumb" style="background-image:url(<?php echo esc_url($post_thumbnail_url); ?>);"><a href="<?php echo esc_url(get_the_permalink(get_the_id())); ?>"></a></div>
                <h6><a href="<?php echo esc_url(get_the_permalink(get_the_id())); ?>"><?php the_title(); ?></a></h6>
                <div class="post-date"><?php esc_html_e('By', 'ximsa'); ?> <?php the_author(); ?></div>
            </div>
            <?php endwhile; ?>

        <?php endif;
        wp_reset_postdata();
    }
}


///----Service Sidebar widgets---
//Quick Contact
class Ximsa_Quick_Contact extends WP_Widget
{
	
	/** constructor */
	function __construct()
	{
		parent::__construct( /* Base ID */'Ximsa_Quick_Contact', /* Name */esc_html__('Ximsa Quick Contact','ximsa'), array( 'description' => esc_html__('Show the Quick Contact', 'ximsa' )) );
	}

	/** @see WP_Widget::widget */
	function widget($args, $instance)
	{
		extract( $args );
		
		echo wp_kses_post($before_widget);?>
      		
			
            <!-- Contact Widget -->
            <div class="contact-widget">
                <div class="widget-content" style="background-image: url(<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/background/pattern-25.png)">
                    <?php if($instance['widget_title']){ ?>
                    <div class="title">
                        <?php echo wp_kses_post($instance['widget_title']); ?>
                    </div>
                    <?php } ?>
                    
					<?php if($instance['w_button_link']){ ?>
                    <a href="<?php echo esc_url($instance['w_button_link']); ?>" class="theme-btn contact-btn"><?php echo wp_kses_post($instance['w_button_title']); ?></a>
                    <?php } ?>
                    <?php if($instance['w_phone_no']){ ?>
                    <div class="phone">
                        <span class="icon flaticon-call-1"></span>
                        <?php esc_html_e('Cal :', 'ximsa'); ?><a href="tel:<?php echo esc_attr($instance['w_phone_no']); ?>"><?php echo wp_kses_post($instance['w_phone_no']); ?></a>
                    </div>
                    <?php } ?>
                </div>
            </div>
              
        <?php
		
		echo wp_kses_post($after_widget);
	}
	
	
	/** @see WP_Widget::update */
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;
		
		$instance['widget_title'] = $new_instance['widget_title'];
		$instance['w_button_title'] = $new_instance['w_button_title'];
		$instance['w_button_link'] = $new_instance['w_button_link'];
		$instance['w_phone_no'] = $new_instance['w_phone_no'];
		
		
		
		return $instance;
	}

	/** @see WP_Widget::form */
	function form($instance)
	{
		
		$widget_title = ($instance) ? esc_attr($instance['widget_title']) : '';
		$w_button_title = ($instance) ? esc_attr($instance['w_button_title']) : '';
		$w_button_link = ($instance) ? esc_attr($instance['w_button_link']) : '';
		$w_phone_no = ($instance) ? esc_attr($instance['w_phone_no']) : '';
		?>
        
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('widget_title')); ?>"><?php esc_html_e('Title:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_title')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_title')); ?>" ><?php echo wp_kses_post($widget_title); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_button_title')); ?>"><?php esc_html_e('Button Title:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('Contact Us', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('w_button_title')); ?>" name="<?php echo esc_attr($this->get_field_name('w_button_title')); ?>" type="text" value="<?php echo esc_attr($w_button_title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_button_link')); ?>"><?php esc_html_e('Button Link:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('#', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('w_button_link')); ?>" name="<?php echo esc_attr($this->get_field_name('w_button_link')); ?>" type="text" value="<?php echo esc_attr($w_button_link); ?>" />
        </p> 
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_phone_no')); ?>"><?php esc_html_e('Phone Number:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('+1-800-555-44-678', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('w_phone_no')); ?>" name="<?php echo esc_attr($this->get_field_name('w_phone_no')); ?>" type="text" value="<?php echo esc_attr($w_phone_no); ?>" />
        </p>
            
                
		<?php 
	}
	
}

//Download Brochure
class Ximsa_Download_Brochure extends WP_Widget
{
	
	/** constructor */
	function __construct()
	{
		parent::__construct( /* Base ID */'Ximsa_Download_Brochure', /* Name */esc_html__('Ximsa Download Brochure','ximsa'), array( 'description' => esc_html__('Show the Download Brochure', 'ximsa' )) );
	}

	/** @see WP_Widget::widget */
	function widget($args, $instance)
	{
		extract( $args );
		
		echo wp_kses_post($before_widget);?>
      		
		<!-- Broucher Widget -->
        <div class="broucher-widget">
            <div class="widget-content">
                <ul class="broucher-list">
                    <?php if($instance['pdf_file_title'] || $instance['pdf_file_link'] ){ ?>
                    <li><a href="<?php echo esc_url($instance['pdf_file_link']); ?>"><span class="icon flaticon-pdf"></span><?php echo wp_kses_post($instance['pdf_file_title']); ?></a></li>
                    <?php } ?>
                    <?php if($instance['doc_file_title'] || $instance['doc_file_link'] ){ ?>
                    <li><a href="<?php echo esc_url($instance['doc_file_link']); ?>"><span class="icon flaticon-edit"></span><?php echo wp_kses_post($instance['doc_file_title']); ?></a></li>
                    <?php } ?>
                </ul>
            </div>
        </div>
                    
        <?php
		
		echo wp_kses_post($after_widget);
	}
	
	
	/** @see WP_Widget::update */
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;
		
		$instance['pdf_file_title'] = $new_instance['pdf_file_title'];
		$instance['pdf_file_link'] = $new_instance['pdf_file_link'];
		$instance['doc_file_title'] = $new_instance['doc_file_title'];
		$instance['doc_file_link'] = $new_instance['doc_file_link'];
		
		
		return $instance;
	}

	/** @see WP_Widget::form */
	function form($instance)
	{
		$pdf_file_title = ($instance) ? esc_attr($instance['pdf_file_title']) : 'Download pdf';
		$pdf_file_link = ($instance) ? esc_attr($instance['pdf_file_link']) : '#';
		$doc_file_title = ($instance) ? esc_attr($instance['doc_file_title']) : 'Download doc';
		$doc_file_link = ($instance) ? esc_attr($instance['doc_file_link']) : '#';
		?>
        
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('pdf_file_title')); ?>"><?php esc_html_e('Enter PDF File Title:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('Download pdf', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('pdf_file_title')); ?>" name="<?php echo esc_attr($this->get_field_name('pdf_file_title')); ?>" type="text" value="<?php echo esc_attr($pdf_file_title); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('pdf_file_link')); ?>"><?php esc_html_e('Enter PDF Link:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('#', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('pdf_file_link')); ?>" name="<?php echo esc_attr($this->get_field_name('pdf_file_link')); ?>" type="text" value="<?php echo esc_attr($pdf_file_link); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('doc_file_title')); ?>"><?php esc_html_e('Enter DOC File Title:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('Download doc', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('doc_file_title')); ?>" name="<?php echo esc_attr($this->get_field_name('doc_file_title')); ?>" type="text" value="<?php echo esc_attr($doc_file_title); ?>" />
        </p> 
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('doc_file_link')); ?>"><?php esc_html_e('DOC File Link:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('#', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('doc_file_link')); ?>" name="<?php echo esc_attr($this->get_field_name('doc_file_link')); ?>" type="text" value="<?php echo esc_attr($doc_file_link); ?>" />
        </p>
               
                
		<?php 
	}
	
}



///----footer widgets---
//About Company
class Ximsa_About_Company extends WP_Widget
{
	
	/** constructor */
	function __construct()
	{
		parent::__construct( /* Base ID */'Ximsa_About_Company', /* Name */esc_html__('Ximsa About Company','ximsa'), array( 'description' => esc_html__('Show the About Company', 'ximsa' )) );
	}

	/** @see WP_Widget::widget */
	function widget($args, $instance)
	{
		extract( $args );
		
		echo wp_kses_post($before_widget);?>
      		<div class="left-column">
                <div class="inner-column">
                    <div class="upper-box">
                        <div class="box-inner">
                            <?php if($instance['widget_logo_img']){ ?>
                            <div class="logo">
                                <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url($instance['widget_logo_img']); ?>" alt="<?php esc_attr_e('Awesome Image', 'ximsa'); ?>" /></a>
                            </div>
                            <?php } ?>
                            <div class="text"><?php echo wp_kses_post($instance['content']); ?></div>
                        </div>
                    </div>
                    <?php if($instance['widget_menu_html']){ ?>
                    <div class="lower-box">
                        <div class="row clearfix">
                            <?php echo wp_kses_post($instance['widget_menu_html']); ?>
                        </div>
                    </div>
                    <?php } ?>
                </div>
            </div>            
        <?php
		
		echo wp_kses_post($after_widget);
	}
	
	
	/** @see WP_Widget::update */
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;

		$instance['widget_logo_img'] = $new_instance['widget_logo_img'];
		$instance['content'] = $new_instance['content'];
		$instance['widget_menu_html'] = $new_instance['widget_menu_html'];
		
		return $instance;
	}

	/** @see WP_Widget::form */
	function form($instance)
	{
		$widget_logo_img = ($instance) ? esc_attr($instance['widget_logo_img']) : 'http://themexriver.com/wp/ximsa/wp-content/uploads/2022/02/logo.png';
		$content = ($instance) ? esc_attr($instance['content']) : '';
		$widget_menu_html = ($instance) ? esc_attr($instance['widget_menu_html']) : '';
		?>
        
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('widget_logo_img')); ?>"><?php esc_html_e('Enter Logo Image:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('Image Url', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_logo_img')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_logo_img')); ?>" type="text" value="<?php echo esc_attr($widget_logo_img); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('content')); ?>"><?php esc_html_e('Content:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('content')); ?>" name="<?php echo esc_attr($this->get_field_name('content')); ?>" ><?php echo wp_kses_post($content); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('widget_menu_html')); ?>"><?php esc_html_e('Enter Menu Raw Html:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_menu_html')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_menu_html')); ?>" ><?php echo wp_kses_post($widget_menu_html); ?></textarea>
        </p>             
                
		<?php 
	}
	
}

//Contact Info
class Ximsa_Contact_Info extends WP_Widget
{
	
	/** constructor */
	function __construct()
	{
		parent::__construct( /* Base ID */'Ximsa_Contact_Info', /* Name */esc_html__('Ximsa Contact Info','ximsa'), array( 'description' => esc_html__('Show the Contact Info', 'ximsa' )) );
	}

	/** @see WP_Widget::widget */
	function widget($args, $instance)
	{
		extract( $args );
		$title = apply_filters( 'widget_title', $instance['title'] );
		
		echo wp_kses_post($before_widget);?>
      		
			<!--Start single footer widget-->
         	<div class="right-column">
                <div class="inner-column">
                    <?php echo wp_kses_post($before_title.$title.$after_title); ?>
                    
                    <?php if($instance['w_address'] || $instance['w_phone_no'] || $instance['w_email_address']){ ?>
                    <ul class="list-style-one">
                        <?php if($instance['w_email_address']){ ?><li><span class="icon flaticon-email"></span> <?php echo wp_kses_post($instance['w_email_address']); ?></li><?php } ?>
                        <?php if($instance['w_phone_no']){ ?><li><span class="icon flaticon-telephone"></span> <?php echo wp_kses_post($instance['w_phone_no']); ?></li><?php } ?>
                        <?php if($instance['w_address']){ ?><li><span class="icon flaticon-map"></span><?php echo wp_kses_post($instance['w_address']); ?></li><?php } ?>
                    </ul>
                    <?php } ?>
                    
                    <?php if( $instance['show'] ): ?>
                    <?php echo wp_kses_post(ximsa_get_social_icons2()); ?>
                    <?php endif; ?>
                </div>
             </div>                     
        <?php
		
		echo wp_kses_post($after_widget);
	}
	
	
	/** @see WP_Widget::update */
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;
		
		$instance['title'] = strip_tags($new_instance['title']);
		$instance['w_email_address'] = strip_tags($new_instance['w_email_address']);
		$instance['w_phone_no'] = $new_instance['w_phone_no'];
		$instance['w_address'] = $new_instance['w_address'];
		$instance['show'] = $new_instance['show'];
		
		return $instance;
	}

	/** @see WP_Widget::form */
	function form($instance)
	{
		
		$title = ($instance) ? esc_attr($instance['title']) : '';
		$w_email_address = ($instance) ? esc_attr($instance['w_email_address']) : '';
		$w_phone_no = ($instance) ? esc_attr($instance['w_phone_no']) : '';
		$w_address = ($instance) ? esc_attr($instance['w_address']) : '';
		$show = ($instance) ? esc_attr($instance['show']) : '';
		?>
        
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Enter Title:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" ><?php echo wp_kses_post($title); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_email_address')); ?>"><?php esc_html_e('Enter Email Address:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('info@example.com', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('w_email_address')); ?>" name="<?php echo esc_attr($this->get_field_name('w_email_address')); ?>" type="text" value="<?php echo esc_attr($w_email_address); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_phone_no')); ?>"><?php esc_html_e('Phone Number:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('+1-800-555-44-678', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('w_phone_no')); ?>" name="<?php echo esc_attr($this->get_field_name('w_phone_no')); ?>" type="text" value="<?php echo esc_attr($w_phone_no); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_address')); ?>"><?php esc_html_e('Address:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('w_address')); ?>" name="<?php echo esc_attr($this->get_field_name('w_address')); ?>" ><?php echo wp_kses_post($w_address); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('show')); ?>"><?php esc_html_e('Show Social Icons:', 'ximsa'); ?></label>
			<?php $selected = ( $show ) ? ' checked="checked"' : ''; ?>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('show')); ?>"<?php echo esc_attr($selected); ?> name="<?php echo esc_attr($this->get_field_name('show')); ?>" type="checkbox" value="true" />
        </p>
              
		<?php 
	}
	
}


///----footer Two widgets---
//About Company V2
class Ximsa_About_Company_V2 extends WP_Widget
{
	
	/** constructor */
	function __construct()
	{
		parent::__construct( /* Base ID */'Ximsa_About_Company_V2', /* Name */esc_html__('Ximsa About Company V2','ximsa'), array( 'description' => esc_html__('Show the About Company V2', 'ximsa' )) );
	}

	/** @see WP_Widget::widget */
	function widget($args, $instance)
	{
		extract( $args );
		
		echo wp_kses_post($before_widget);?>
      		
            <!-- Footer Column -->
            <div class="logo-widget">
                <?php if($instance['widget_logo_img_v2']){ ?>
                <div class="logo">
                    <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url($instance['widget_logo_img_v2']); ?>" alt="<?php esc_attr_e('Awesome Image', 'ximsa'); ?>" /></a>
                </div>
                <?php } ?>
                <div class="text"><?php echo wp_kses_post($instance['content_v2']); ?></div>
                
                <!-- Social Box -->
               <?php if( $instance['show_v2'] ): ?>
				<?php echo wp_kses_post(ximsa_get_social_icons2()); ?>
                <?php endif; ?>
                
            </div>
                        
        <?php
		
		echo wp_kses_post($after_widget);
	}
	
	
	/** @see WP_Widget::update */
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;

		$instance['widget_logo_img_v2'] = $new_instance['widget_logo_img_v2'];
		$instance['content_v2'] = $new_instance['content_v2'];
		$instance['show_v2'] = $new_instance['show_v2'];
		
		return $instance;
	}

	/** @see WP_Widget::form */
	function form($instance)
	{
		$widget_logo_img_v2 = ($instance) ? esc_attr($instance['widget_logo_img_v2']) : 'http://themexriver.com/wp/ximsa/wp-content/uploads/2022/02/logo.png';
		$content_v2 = ($instance) ? esc_attr($instance['content_v2']) : '';
		$show_v2 = ($instance) ? esc_attr($instance['show_v2']) : '';
		?>
        
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('widget_logo_img_v2')); ?>"><?php esc_html_e('Enter Logo Image:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('Image Url', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_logo_img_v2')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_logo_img_v2')); ?>" type="text" value="<?php echo esc_attr($widget_logo_img_v2); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('content_v2')); ?>"><?php esc_html_e('Content:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('content_v2')); ?>" name="<?php echo esc_attr($this->get_field_name('content_v2')); ?>" ><?php echo wp_kses_post($content_v2); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('show_v2')); ?>"><?php esc_html_e('Show Social Icons:', 'ximsa'); ?></label>
			<?php $selected = ( $show_v2 ) ? ' checked="checked"' : ''; ?>
            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('show_v2')); ?>"<?php echo esc_attr($selected); ?> name="<?php echo esc_attr($this->get_field_name('show_v2')); ?>" type="checkbox" value="true" />
        </p>             
                
		<?php 
	}
	
}

//Contact Info V2
class Ximsa_Contact_Info_V2 extends WP_Widget
{
	
	/** constructor */
	function __construct()
	{
		parent::__construct( /* Base ID */'Ximsa_Contact_Info_V2', /* Name */esc_html__('Ximsa Contact Info V2','ximsa'), array( 'description' => esc_html__('Show the Contact Info V2', 'ximsa' )) );
	}

	/** @see WP_Widget::widget */
	function widget($args, $instance)
	{
		extract( $args );
		$title = apply_filters( 'widget_title', $instance['title'] );
		
		echo wp_kses_post($before_widget);?>
      		
			<!--Start single footer widget-->
         	<div class="info-widget">
                <?php echo wp_kses_post($before_title.$title.$after_title); ?>
                <?php if($instance['w_address_v2'] || $instance['w_phone_no_v2'] || $instance['w_email_address_v2'] || $instance['w_working_hours_v2']){ ?>
                <ul class="list-style-one style-two">
                    <?php if($instance['w_email_address_v2']){ ?><li><span class="icon flaticon-email"></span> <?php echo wp_kses_post($instance['w_email_address_v2']); ?></li><?php } ?>
					<?php if($instance['w_phone_no_v2']){ ?><li><span class="icon flaticon-telephone"></span> <?php echo wp_kses_post($instance['w_phone_no_v2']); ?></li><?php } ?>
                    <?php if($instance['w_address_v2']){ ?><li><span class="icon flaticon-map"></span><?php echo wp_kses_post($instance['w_address_v2']); ?></li><?php } ?>
                    <?php if($instance['w_working_hours_v2']){ ?><li><span class="icon flaticon-clock"></span><?php echo wp_kses_post($instance['w_working_hours_v2']); ?></li><?php } ?>
                </ul>
                <?php } ?>
            </div>
                                
        <?php
		
		echo wp_kses_post($after_widget);
	}
	
	
	/** @see WP_Widget::update */
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;
		
		$instance['title'] = strip_tags($new_instance['title']);
		$instance['w_email_address_v2'] = strip_tags($new_instance['w_email_address_v2']);
		$instance['w_phone_no_v2'] = $new_instance['w_phone_no_v2'];
		$instance['w_address_v2'] = $new_instance['w_address_v2'];
		$instance['w_working_hours_v2'] = $new_instance['w_working_hours_v2'];
		
		return $instance;
	}

	/** @see WP_Widget::form */
	function form($instance)
	{
		
		$title = ($instance) ? esc_attr($instance['title']) : '';
		$w_email_address_v2 = ($instance) ? esc_attr($instance['w_email_address_v2']) : '';
		$w_phone_no_v2 = ($instance) ? esc_attr($instance['w_phone_no_v2']) : '';
		$w_address_v2 = ($instance) ? esc_attr($instance['w_address_v2']) : '';
		$w_working_hours_v2 = ($instance) ? esc_attr($instance['w_working_hours_v2']) : '';
		?>
        
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Enter Title:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" ><?php echo wp_kses_post($title); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_email_address_v2')); ?>"><?php esc_html_e('Enter Email Address:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('info@example.com', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('w_email_address_v2')); ?>" name="<?php echo esc_attr($this->get_field_name('w_email_address_v2')); ?>" type="text" value="<?php echo esc_attr($w_email_address_v2); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_phone_no_v2')); ?>"><?php esc_html_e('Phone Number:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('+1-800-555-44-678', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('w_phone_no_v2')); ?>" name="<?php echo esc_attr($this->get_field_name('w_phone_no_v2')); ?>" type="text" value="<?php echo esc_attr($w_phone_no_v2); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_address_v2')); ?>"><?php esc_html_e('Address:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('w_address_v2')); ?>" name="<?php echo esc_attr($this->get_field_name('w_address_v2')); ?>" ><?php echo wp_kses_post($w_address_v2); ?></textarea>
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_working_hours_v2')); ?>"><?php esc_html_e('Enter Working Hours:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('w_working_hours_v2')); ?>" name="<?php echo esc_attr($this->get_field_name('w_working_hours_v2')); ?>" ><?php echo wp_kses_post($w_working_hours_v2); ?></textarea>
        </p>
              
		<?php 
	}
	
}


///----footer Three widgets---
//About Company V3
class Ximsa_About_Company_V3 extends WP_Widget
{
	
	/** constructor */
	function __construct()
	{
		parent::__construct( /* Base ID */'Ximsa_About_Company_V3', /* Name */esc_html__('Ximsa About Company V3','ximsa'), array( 'description' => esc_html__('Show the About Company V3', 'ximsa' )) );
	}

	/** @see WP_Widget::widget */
	function widget($args, $instance)
	{
		extract( $args );
		
		echo wp_kses_post($before_widget);?>
      		
            <div class="logo-widget">
                <?php if($instance['widget_logo_img_v3']){ ?>
                <div class="logo">
                    <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url($instance['widget_logo_img_v3']); ?>" alt="<?php esc_attr_e('Awesome Image', 'ximsa'); ?>" /></a>
                </div>
                <?php } ?>
                <div class="text"><?php echo wp_kses_post($instance['content_v3']); ?></div>
                
				<?php if( $instance['w_mailchimp_form_url'] ): ?>
                <!-- Subscribe Form -->
                <div class="subscribe-form">
                    <?php echo do_shortcode($instance['w_mailchimp_form_url']); ?>
                </div>
			    <?php endif; ?>
            </div>
                        
        <?php
		
		echo wp_kses_post($after_widget);
	}
	
	
	/** @see WP_Widget::update */
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;

		$instance['widget_logo_img_v3'] = $new_instance['widget_logo_img_v3'];
		$instance['content_v3'] = $new_instance['content_v3'];
		$instance['w_mailchimp_form_url'] = $new_instance['w_mailchimp_form_url'];
		
		return $instance;
	}

	/** @see WP_Widget::form */
	function form($instance)
	{
		$widget_logo_img_v3 = ($instance) ? esc_attr($instance['widget_logo_img_v3']) : 'http://themexriver.com/wp/ximsa/wp-content/uploads/2022/03/logo-5.png';
		$content_v3 = ($instance) ? esc_attr($instance['content_v3']) : '';
		$w_mailchimp_form_url = ($instance) ? esc_attr($instance['w_mailchimp_form_url']) : '';
		?>
        
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('widget_logo_img_v3')); ?>"><?php esc_html_e('Enter Logo Image:', 'ximsa'); ?></label>
            <input placeholder="<?php esc_attr_e('Image Url', 'ximsa');?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_logo_img_v3')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_logo_img_v3')); ?>" type="text" value="<?php echo esc_attr($widget_logo_img_v3); ?>" />
        </p>
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('content_v3')); ?>"><?php esc_html_e('Content:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('content_v3')); ?>" name="<?php echo esc_attr($this->get_field_name('content_v3')); ?>" ><?php echo wp_kses_post($content_v3); ?></textarea>
        </p>            
        <p>
            <label for="<?php echo esc_attr($this->get_field_id('w_mailchimp_form_url')); ?>"><?php esc_html_e('MailChimp Form Url:', 'ximsa'); ?></label>
            <textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('w_mailchimp_form_url')); ?>" name="<?php echo esc_attr($this->get_field_name('w_mailchimp_form_url')); ?>" ><?php echo wp_kses_post($w_mailchimp_form_url); ?></textarea>
        </p> 
               
		<?php 
	}
	
}