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


function Reedwan_socialnetworks(){
		register_widget("Reedwan_socialnetworks");
}


class Reedwan_socialnetworks extends WP_widget{
	
	function Reedwan_socialnetworks(){
		$options = array(
				"classname" => "socialnetworks",
				"description" => "Social networks links for sidebar and footer widget"
		);
		$this->WP_widget("socialnetworks","Backstreet : Social networks",$options);
	}
	
	function widget($args,$d){
		extract($args);
		echo $before_widget;
		echo $before_title;
		echo $d['title'];
		echo $after_title;
		echo '<ul class="social-widget">';
		if($d['title_facebook']) {
        echo '<li class="tooltip facebook"><a href="http://www.facebook.com/'.$d['ID_facebook'].'"></a><div class="post-tooltip">'.$d['title_facebook'].'</div></li>';
        }
		if($d['title_twitter']) {
        echo '<li class="tooltip twitter"><a href="http://www.twitter.com/'.$d['ID_twitter'].'"></a><div class="post-tooltip">'.$d['title_twitter'].'</div></li>';
        }
		if($d['title_vimeo']) {
        echo '<li class="tooltip vimeo"><a href="http://www.vimeo.com/'.$d['ID_vimeo'].'"></a><div class="post-tooltip">'.$d['title_vimeo'].'</div></li>';
        }
		if($d['title_friendfeed']) {
        echo '<li class="tooltip friendfeed"><a href="http://www.friendfeed.com/'.$d['ID_friendfeed'].'"></a><div class="post-tooltip">'.$d['title_friendfeed'].'</div></li>';
        }
		if($d['title_linkedin']) {
        echo '<li class="tooltip linkedin"><a href="http://www.linkedin.com/'.$d['ID_linkedin'].'"></a><div class="post-tooltip">'.$d['title_linkedin'].'</div></li>';
        }
		if($d['title_deviantart']) {
        echo '<li class="tooltip deviantart"><a href="http://www.deviantart.com/'.$d['ID_deviantart'].'"></a><div class="post-tooltip">'.$d['title_deviantart'].'</div></li>';
        }
		if($d['title_youtube']) {
        echo '<li class="tooltip youtube"><a href="http://www.youtube.com/'.$d['ID_youtube'].'"></a><div class="post-tooltip">'.$d['title_youtube'].'</div></li>';
        }
		if($d['title_flickr']) {
        echo '<li class="tooltip flickr"><a href="http://www.flickr.com/'.$d['ID_flickr'].'"></a><div class="post-tooltip">'.$d['title_flickr'].'</div></li>';
        }
        echo '</ul>';
		echo $after_widget;
	}
	
	function update($new,$old){
		return $new;
	}
	
	function form($d){
		?>
        <p>
        	<label for="<?php echo $this->get_field_id('title'); ?>">Title :</label>
            <input name="<?php echo $this->get_field_name('title'); ?>" id="<?php echo $this->get_field_id('title') ; ?>" type="text" value="<?php echo $d['title']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('title_facebook'); ?>">Facebook text :</label>
            <input name="<?php echo $this->get_field_name('title_facebook'); ?>" id="<?php echo $this->get_field_id('title_facebook') ; ?>" type="text" value="<?php echo $d['title_facebook']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_facebook'); ?>">Facebook ID :</label>
            <input name="<?php echo $this->get_field_name('ID_facebook'); ?>" id="<?php echo $this->get_field_id('ID_facebook') ; ?>" type="text" value="<?php echo $d['ID_facebook']; ?>" />
        </p>
        
        <p>
        	<label for="<?php echo $this->get_field_id('title_twitter'); ?>">Twitter text :</label>
            <input name="<?php echo $this->get_field_name('title_twitter'); ?>" id="<?php echo $this->get_field_id('title_twitter') ; ?>" type="text" value="<?php echo $d['title_twitter']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_twitter'); ?>">Twitter ID :</label>
            <input name="<?php echo $this->get_field_name('ID_twitter'); ?>" id="<?php echo $this->get_field_id('ID_twitter') ; ?>" type="text" value="<?php echo $d['ID_twitter']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('title_vimeo'); ?>">Vimeo text :</label>
            <input name="<?php echo $this->get_field_name('title_vimeo'); ?>" id="<?php echo $this->get_field_id('title_vimeo') ; ?>" type="text" value="<?php echo $d['title_vimeo']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_vimeo'); ?>">Vimeo ID :</label>
            <input name="<?php echo $this->get_field_name('ID_vimeo'); ?>" id="<?php echo $this->get_field_id('ID_vimeo') ; ?>" type="text" value="<?php echo $d['ID_vimeo']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('title_friendfeed'); ?>">Friendfeed text :</label>
            <input name="<?php echo $this->get_field_name('title_friendfeed'); ?>" id="<?php echo $this->get_field_id('title_friendfeed') ; ?>" type="text" value="<?php echo $d['title_friendfeed']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_friendfeed'); ?>">Friendfeed ID :</label>
            <input name="<?php echo $this->get_field_name('ID_friendfeed'); ?>" id="<?php echo $this->get_field_id('ID_friendfeed') ; ?>" type="text" value="<?php echo $d['ID_friendfeed']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('title_youtube'); ?>">Youtube text :</label>
            <input name="<?php echo $this->get_field_name('title_youtube'); ?>" id="<?php echo $this->get_field_id('title_youtube') ; ?>" type="text" value="<?php echo $d['title_youtube']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_youtube'); ?>">Youtube ID :</label>
            <input name="<?php echo $this->get_field_name('ID_youtube'); ?>" id="<?php echo $this->get_field_id('ID_youtube') ; ?>" type="text" value="<?php echo $d['ID_youtube']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('title_flickr'); ?>">Flickr text :</label>
            <input name="<?php echo $this->get_field_name('title_flickr'); ?>" id="<?php echo $this->get_field_id('title_flickr') ; ?>" type="text" value="<?php echo $d['title_flickr']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_flickr'); ?>">Flickr ID :</label>
            <input name="<?php echo $this->get_field_name('ID_flickr'); ?>" id="<?php echo $this->get_field_id('ID_flickr') ; ?>" type="text" value="<?php echo $d['ID_flickr']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('title_linkedin'); ?>">Linkedin text :</label>
            <input name="<?php echo $this->get_field_name('title_linkedin'); ?>" id="<?php echo $this->get_field_id('title_linkedin') ; ?>" type="text" value="<?php echo $d['title_linkedin']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_linkedin'); ?>">Linkedin ID :</label>
            <input name="<?php echo $this->get_field_name('ID_linkedin'); ?>" id="<?php echo $this->get_field_id('ID_linkedin') ; ?>" type="text" value="<?php echo $d['ID_linkedin']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('title_deviantart'); ?>">Deviantart text :</label>
            <input name="<?php echo $this->get_field_name('title_deviantart'); ?>" id="<?php echo $this->get_field_id('title_deviantart') ; ?>" type="text" value="<?php echo $d['title_deviantart']; ?>" />
        </p>
        <p>
        	<label for="<?php echo $this->get_field_id('ID_deviantart'); ?>">Deviantart ID :</label>
            <input name="<?php echo $this->get_field_name('ID_deviantart'); ?>" id="<?php echo $this->get_field_id('ID_deviantart') ; ?>" type="text" value="<?php echo $d['ID_deviantart']; ?>" />
        </p>
        <?php
	}
}
?>