<?php
	global $flc;
	$social = $flc->get_option('social');
	$attrib = $flc->get_option('attrib');
	$bg_color = $flc->get_option('bg_color');
	$link_color = $flc->get_option('link_color');
	$section_color = $flc->get_option('section_color');
	
	$sections = $flc->db->get_all( $flc->plugin_tables['sections'] );
	$website = get_site_url();
	$share_mesage = get_bloginfo ( 'description' );
?>
<div style="margin:20px;border-top:1px solid #e5e5e5;background:<?php echo $bg_color; ?>!important">
<?php
	if($social){
?>
	<div style="margin:10px 250px!important;padding:0!important;background:#FFF;">
<iframe src="//www.facebook.com/plugins/like.php?href=<?php echo $website; ?>&amp;width=100&amp;height=21&amp;colorscheme=light&amp;layout=button_count&amp;action=like&amp;show_faces=false&amp;send=false&amp;appId=225776157591556" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe><a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $website; ?>" data-text="<?php echo $share_mesage; ?>" data-via="<?php echo $twitter_name; ?>">Tweet</a><g:plusone size="medium"></g:plusone><script type="IN/Share" data-url="<?php echo $website; ?>" data-counter="right"></script></div>
<?php
	}
	if(strlen($attrib)){
?>
	<p style="text-align:center;color:#777"><?php echo $attrib; ?></p>
<?php
	}
	if(count($sections)){
		foreach($sections as $section ){
?>
	<p style="text-transform:capitalize;font-weight:bold;font-size:14px;text-align:center;color:<?php echo $section_color; ?>"><?php echo $section['title']; ?></p>
<?php
			$links = $flc->db->get( 
					$flc->plugin_tables['links'],
					array( 'section_id' => $section['id'] )
			);
			if(count($links)){
?>
	<p style="text-align:center;color:#777">
<?php
				foreach($links as $link ){
					if($link['do_follow'])
						$do_follow = 'dofollow';
					else
						$do_follow = 'nofollow';

					if($link['do_index'])
						$do_index = 'doindex';
					else
						$do_index = 'noindex';

					echo sprintf(
						'<a style="color:%s;width:120px;overflow:hidden;display:inline-block;margin:5px 10px;" href="%s" target="%s" rel="%s %s">%s</a>',
						$link_color,
						$link['url'],
						$link['target'],
						$do_follow,
						$do_index,
						$link['anchor']
					);
				}
?>
	</p>
<?php
			}
		}
	}
?>	
</div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script><script src="//platform.linkedin.com/in.js" type="text/javascript"></script><script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
