<?php 

add_action('widgets_init','fb_likebox_widget');

function fb_likebox_widget() {
	register_widget('fb_likebox_widget');
	
	}

class fb_likebox_widget extends WP_Widget {
	function fb_likebox_widget() {
			
		$widget_ops = array('classname' => 'Like-box','description' => 'مربع جانبى لعرض صندوق الإعجاب فى فيسبوك');

		
		$this->WP_Widget('Like-box','الوان الويب - صندوق إعجاب فيسبوك',$widget_ops);

		}
		
	function widget( $args, $instance ) {
		extract( $args );
		/* User-selected settings. */
		$title = apply_filters('widget_title', $instance['title'] );
		$page = $instance['page'];


		echo $before_widget;

		
		if ( $title )
			echo $before_title . $title . $after_title;
?>

<div class="like_box_footer">
  <iframe src="//www.facebook.com/plugins/likebox.php?href=<?php echo $page ; ?>&amp;width=240&amp;colorscheme=light&amp;show_faces=true&amp;border_color=%23acb7d1&amp;stream=false&amp;header=false&amp;height=258" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:240px; height:258px;" allowTransparency="true"></iframe>
</div>
<!--like_box_footer-->

<?php 

		echo $after_widget;
	}
	
	function update( $new_instance, $old_instance ) {
		$instance = $old_instance;


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

		return $instance;
	}
	
function form( $instance ) {


		$defaults = array(
			'title' => 'فيسبوك',
			'page' => 'http://www.facebook.com/Lioit', 
 			);
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
  <label for="<?php echo $this->get_field_id( 'title' ); ?>">
    <?php _e('العنوان : ', 'salahelimam') ?>
  </label>
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
</p>
<p>
  <label for="<?php echo $this->get_field_id( 'page' ); ?>">رابط صفحتك:</label>
  <input id="<?php echo $this->get_field_id( 'page' ); ?>" name="<?php echo $this->get_field_name( 'page' ); ?>" value="<?php echo $instance['page']; ?>"  class="widefat" />
</p>
<?php 
}
	} //end class
