<?php
 



 


///////////////////////////////
///////////////////////////////
/////////////////////////////// BREADCRUMB WIDGET
///////////////////////////////
///////////////////////////////
 
class BreadcrumbWidget extends WP_Widget
	{
	function BreadcrumbWidget()
		{
		$widget_ops = array('classname' => 'BreadcrumbWidget', 'description' => 'Displays the Breadcrumbs' );
		$this->WP_Widget('BreadcrumbWidget', 'Widget :: Breadcrumbs', $widget_ops);
		} 
	function form($instance)
		{
		$instance = wp_parse_args( (array) $instance, array( 'title' => ''  ) );
		$title = $instance['title'];
		?>
		<p><label for="<?php echo $this->get_field_id('title'); ?>">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>
		<?php
		}
	function update($new_instance, $old_instance)
		{
		$instance = $old_instance;
		$instance['title'] = $new_instance['title'];
		return $instance;
		}
 
  	function widget($args, $instance)
		{
		extract($args, EXTR_SKIP);
 		echo $before_widget;
		$title = $instance['title'];
		if (  $title)  
			echo $before_title . $title . $after_title;
		echo do_shortcode("[breadcrumbs]");
		echo $after_widget;
		}
	}
	add_action( 'widgets_init', create_function('', 'return register_widget("BreadcrumbWidget");') );

 




///////////////////////////////
///////////////////////////////
/////////////////////////////// SOCIAL WIDGET
///////////////////////////////
///////////////////////////////
 
class SocialWidget extends WP_Widget
	{
	function SocialWidget()
		{
		$widget_ops = array('classname' => 'LoginWidget', 'description' => 'Displays a Your Social Media Icons. Please create it under "Options" -> "Navigation Section" ' );
		$this->WP_Widget('SocialWidget', 'Widget :: Social Icons', $widget_ops);
		} 
	function form($instance)
		{
		$instance = wp_parse_args( (array) $instance, array( 'title' => ''  ) );
		$title = $instance['title'];
		?>
		<p><label for="<?php echo $this->get_field_id('title'); ?>">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>
		<?php
		}
	function update($new_instance, $old_instance)
		{
		$instance = $old_instance;
		$instance['title'] = $new_instance['title'];
		return $instance;
		}
 
  	function widget($args, $instance)
		{
		extract($args, EXTR_SKIP);
 		echo $before_widget;
		$title = $instance['title'];
		if ( $title) 
			echo $before_title . $title . $after_title;
		echo do_shortcode("[social-icons]");
		echo $after_widget;
		}
	}
	add_action( 'widgets_init', create_function('', 'return register_widget("SocialWidget");') );





 

 




///////////////////////////////
///////////////////////////////
/////////////////////////////// POPULAR POSTS WIDGET
///////////////////////////////
///////////////////////////////
 
class PopPostWidget extends WP_Widget
	{
	function PopPostWidget()
		{
		$widget_ops = array('classname' => 'PopPostWidget', 'description' => 'Displays the popular posts with thumbnail' );
		$this->WP_Widget('PopPostWidget', 'Widget :: Popular Posts', $widget_ops);
		} 
	function form($instance)
		{
		$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'number'=>'5','text'=>'','image'=>'','headline'=>'', 'readmore'=>'' ) );
		$title = $instance['title'];
		$number = $instance['number'];
		$text = $instance['text'];
		$image = $instance['image'];
		$headline = $instance['headline'];
		$readmore = $instance['readmore'];
		?>
		<p><label for="<?php echo $this->get_field_id('title'); ?>">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 $this->get_field_id('number'); ?>">Numbers of Posts: <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo esc_attr($number); ?>" /></label></p>
		<p><label for="<?php echo $this->get_field_id('text'); ?>">Excerpt Letters: <input class="widefat" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>" type="text" value="<?php echo esc_attr($text); ?>" /></label></p>
		<p><label for="<?php echo $this->get_field_id('headline'); ?>"><input id="<?php echo $this->get_field_id('headline'); ?>" name="<?php echo $this->get_field_name('headline'); ?>" type="checkbox" <?php if($headline) { echo " checked "; } ?>" /> Show Headline?</label></p>
		<p><label for="<?php echo $this->get_field_id('image'); ?>"><input id="<?php echo $this->get_field_id('image'); ?>" name="<?php echo $this->get_field_name('image'); ?>" type="checkbox" <?php if($image) { echo " checked "; } ?>" /> Show Image?</label></p>
		<p><label for="<?php echo $this->get_field_id('readmore'); ?>"><input id="<?php echo $this->get_field_id('readmore'); ?>" name="<?php echo $this->get_field_name('readmore'); ?>" type="checkbox" <?php if($readmore) { echo " checked "; } ?>" /> Show Readmore Button?</label></p>
		<?php
		}
	function update($new_instance, $old_instance)
		{
		$instance = $old_instance;
		$instance['title'] = $new_instance['title'];
		$instance['number'] = $new_instance['number'];
		$instance['text'] = $new_instance['text'];
		$instance['image'] = $new_instance['image'];
		$instance['headline'] = $new_instance['headline'];
		$instance['readmore'] = $new_instance['readmore'];
		return $instance;
		}
   	function widget($args, $instance)
		{
		extract($args, EXTR_SKIP);
 		echo $before_widget;
		$title = $instance['title'];
		$number = $instance['number'];
		$text=$instance['text'];
		$image=$instance['image'];	
		$headline=$instance['headline'];
		$readmore=$instance['readmore'];	
		if($headline) 
			{
			$headline="true";
			}	
			else
				{
				$headline="false";
				}
		if($image)
			{
			$image="true";
			}
			else
				{
				$image="false";
				}
		if($readmore)
			{
			$readmore="true";
			}
			else
				{
				$readmore="false";
				}
		if (!empty($title))
		echo $before_title . $title . $after_title;;
			echo do_shortcode('[popular_post before="" after="" number="'.$number.'" column="1"  headline="'.$headline.'" text="'.$text.'" readmore="'.$readmore.'" image="'.$image.'" ]');
		echo $after_widget;
		}
	}
	add_action( 'widgets_init', create_function('', 'return register_widget("PopPostWidget");') );

 
?>