<?php 

add_action('widgets_init','salahelimam_social');

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

class salahelimam_social extends WP_Widget {
	function salahelimam_social() {
			
		$widget_ops = array('classname' => 'social','description' => 'مربع جانبى يعرض حسابات الشبكات الإجتماعية');
/*		$control_ops = array( 'twitter name' => 'salahelimam', 'count' => 3, 'avatar_size' => '32' );
*/		
		$this->WP_Widget('social','برامجي - الشبكات الإجتماعية',$widget_ops);

		}
		
	function widget( $args, $instance ) {
		extract( $args );
		/* User-selected settings. */
		$title = apply_filters('widget_title', $instance['title'] );
		/* Before widget (defined by themes). */
		echo $before_widget;

		/* Title of widget (before and after defined by themes). */
		if ( $title )
			echo $before_title . $title . $after_title;
?>

		<div class="socialSide">
        	<div class="socialNetworks">
        	<ul class="social">
                <li class="gplus"><a href="<?php  if (of_get_option('gplus_url')!= 'false') { echo of_get_option('gplus_url'); } else { echo "#"; } ?>">Google Plus</a></li>
                <li class="facebook"><a href="<?php if (of_get_option('facebook_url')!= 'false') { echo of_get_option('facebook_url'); } else { echo "#";} ?>">facebook</a></li>
                <li class="twitter"><a href="<?php if (of_get_option('twitter_url')!= 'false') { echo of_get_option('twitter_url');} else { echo "#";} ?>">twitter</a></li>
                <li class="rss"><a href="<?php echo  bloginfo( 'rss2_url' ); ?>">rss</a></li>
                <li class="flickr"><a href="<?php if (of_get_option('flickr_url')!= 'false') { echo of_get_option('flickr_url'); } else { echo "#";} ?>">Flickr</a></li>
            </ul> <!-- End Social -->
            </div> <!-- End socialNetworks -->
	      
		</div>


<?php 
		/* After widget (defined by themes). */
		echo $after_widget;
	}
	
	function update( $new_instance, $old_instance ) {
		$instance = $old_instance;

		/* Strip tags (if needed) and update the widget settings. */
		$instance['title'] = strip_tags( $new_instance['title'] );
		

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

		/* Set up some default widget settings. */
		$defaults = array( 'title' => 'تابعني هناك', 
			'feed_url' => 'salahelimam'
 			);
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
	
    	<p>
		<label for="<?php echo $this->get_field_id( 'title' ); ?>">العنوان:</label>
		<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>"  class="widefat" />
		</p>

       
		


   <?php 
}
	} //end class