<?php
add_action('widgets_init','reedwan_adds620x90_load_widgets');


function reedwan_adds620x90_load_widgets(){
		register_widget("Reedwan_Adds620x90_Widget");
}

class Reedwan_Adds620x90_Widget extends WP_widget{
	
	function Reedwan_Adds620x90_Widget(){
		$widget_ops = array('classname' => 'reedwan_adds620x90_widget', 'description' => 'Adds for magazine-widget');

		$control_ops = array('id_base' => 'reedwan_adds620x90_widget');

		$this->WP_Widget('reedwan_adds620x90_widget', 'Backstreet : Adds 620x90', $widget_ops, $control_ops);
		
	}
	
	function widget($args,$instance){
		extract($args);
		
		$link = $instance['link'];
		$image = $instance['image'];
		?>
		<?php
			if($image) {	
			?>				
			<div class="adds620x90"><a href="<?php echo $link; ?>"><img src="<?php echo $image; ?>" alt="" width="620" height="90" class="fadeover"/></a></div>
		<?php
		}
		
	}
	
	function update($new_instance, $old_instance){
		$instance = $old_instance;
		
		$instance['link'] = $new_instance['link'];
		$instance['image'] = $new_instance['image'];
		
		return $instance;
	}
	
	function form($instance){
		?>
		
		<p>
			<label for="<?php echo $this->get_field_id('link'); ?>">Link Url:</label>
			<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('link'); ?>" name="<?php echo $this->get_field_name('link'); ?>" value="<?php echo $instance['link']; ?>" />
		</p>
		
		<p>
			<label for="<?php echo $this->get_field_id('image'); ?>">Image Url:</label>
			<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('image'); ?>" name="<?php echo $this->get_field_name('image'); ?>" value="<?php echo $instance['image']; ?>" />
		</p>
		<?php

	}
}
?>